view @ 0:88f229c63734 draft

planemo upload for repository commit 01da22e4184a5a6f6a3dd4631a7b9c31d1b6d502
author bgruening
date Sat, 20 May 2017 08:38:05 -0400
children d3b48303045b
line wrap: on
line source

#!/usr/bin/env python
    Input: molecular input file.
    Output: Molecule file with removed ions and fragments.
    Copyright 2012, Bjoern Gruening and Xavier Lucas
import sys, os
import argparse
import openbabel
import 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_ions(args):
    outfile = pybel.Outputfile(args.iformat, args.output, overwrite=True)
    for mol in pybel.readfile(args.iformat, args.input):
        if mol.OBMol.NumHvyAtoms() > 5:
            # Check if new small fragments have been created and remove them
            if mol.OBMol.NumHvyAtoms() > 5:

def __main__():
        Remove any counterion and delete any fragment but the largest one for each molecule.
    args = parse_command_line()

if __name__ == "__main__" :