def compute_properties(args): if args.oformat == 'sdf': outfile = pybel.Outputfile(args.oformat, args.output, overwrite=True) else: outfile = open(args.output, 'w') if args.header: mol = next(pybel.readfile(args.iformat, args.input)) metadata = cheminfolib.get_properties_ext(mol) outfile.write( '%s\n' % '\t'.join([cheminfolib.ColumnNames[key] for key in metadata])) for mol in pybel.readfile(args.iformat, args.input): if mol.OBMol.NumHvyAtoms() > 5: metadata = cheminfolib.get_properties_ext(mol) if args.oformat == 'sdf': [ mol.data.update( {cheminfolib.ColumnNames[key]: metadata[key]}) for key in metadata ] outfile.write(mol) else: outfile.write( '%s\n' % ('\t'.join([str(metadata[key]) for key in metadata]))) outfile.close()
def __init__(self, molecule): prop = cheminfolib.get_properties_ext(molecule) self.mol = molecule.write("mol") self.set_bits = len(molecule.calcfp().bits) """ maccs = ['0']*166 for i in molecule.calcfp('MACCS').bits: maccs[i-1] = '1' self.maccs = ''.join(maccs) fp3 = ['0']*1024 for i in molecule.calcfp('FP3').bits: fp3[i-1] = '1' self.fp3 = ''.join(fp3) fp4 = ['0']*1024 for i in molecule.calcfp('FP4').bits: fp4[i-1] = '1' self.fp4 = ''.join(fp4) """ self.inchi = prop["inchi"] self.inchi_key_first = prop["inchi_key"][:14] self.inchi_key_last = prop["inchi_key"][15:] self.can_smiles = prop["can"] self.spectrophore = prop["spectrophore"] self.molwt = prop["molwt"] self.logp = prop["logp"] self.mr = prop["mr"] self.hbd = prop["donors"] self.hba = prop["acceptors"] self.psa = prop["psa"] self.rotbonds = prop["rotbonds"] self.rings = prop["rings"] self.atoms = prop["atoms"]
def compute_properties(args): if args.oformat == 'sdf': outfile = pybel.Outputfile(args.oformat, args.output, overwrite=True) else: outfile = open(args.output, 'w') if args.header: mol = pybel.readfile(args.iformat, args.input).next() metadata = cheminfolib.get_properties_ext(mol) outfile.write( '%s\n' % '\t'.join( [ cheminfolib.ColumnNames[key] for key in metadata ] ) ) for mol in pybel.readfile(args.iformat, args.input): if mol.OBMol.NumHvyAtoms() > 5: metadata = cheminfolib.get_properties_ext(mol) if args.oformat == 'sdf': [ mol.data.update( { cheminfolib.ColumnNames[key] : metadata[key] } ) for key in metadata ] outfile.write(mol) else: outfile.write( '%s\n' % ('\t'.join( [ str(metadata[key]) for key in metadata ] ) ) ) outfile.close()