view @ 14:d7f0ca1f2669 draft default tip

"planemo upload for repository commit 327c29cc43f56d7067ab9fa51323ea31951db98b"
author bgruening
date Tue, 10 Nov 2020 20:31:26 +0000
parents e94b2920d4e4
line wrap: on
line source

#!/usr/bin/env python
    Input: molecular input file.
    Output: Molecule file with removed ions and fragments.
    Copyright 2013, Bjoern Gruening and Xavier Lucas
import argparse

from openbabel import openbabel, pybel

def parse_command_line():
    parser = argparse.ArgumentParser()
    parser.add_argument('--iformat', default='sdf', help='input file format')
    parser.add_argument('-i', '--input', required=True, help='input file name')
    parser.add_argument('-o', '--output', required=True, help='output file name')
    return parser.parse_args()

def remove_protonation(args):
    outfile = pybel.Outputfile(args.iformat, args.output, overwrite=True)
    for mol in pybel.readfile(args.iformat, args.input):
        [atom.OBAtom.SetFormalCharge(0) for atom in mol.atoms]
        if 'inchi' in
            del['inchi']  # remove inchi cache so modified mol is saved

def __main__():
        Remove any protonation state from each atom in each molecule.
    args = parse_command_line()

if __name__ == "__main__":