Hi RDKitters,
I am trying to calculate reaction fingerprints and store it in database.
The transformation fingerprint created using the routine below is a
IntSparseIntVect and I would like to convert it to a BitString of a
particular length. How do we do that .
def create_transformation_FP(rxn, fp_size, fp_type):
rkfp = None
rfp = None
pfp = None
for react in range(rxn.GetNumReactantTemplates()):
mol = rxn.GetReactantTemplate(react)
mol.UpdatePropertyCache(strict=False)
Chem.GetSSSR(mol)
try:
if fp_type == 'AP':
fp = AllChem.GetAtomPairFingerprint(mol=mol, maxLength=fp_size)
elif fp_type == 'Morgan':
fp = AllChem.GetMorganFingerprint(mol=mol, radius=fp_size)
elif fp_type == 'Topological':
fp = AllChem.GetTopologicalTorsionFingerprint(mol=mol)
else:
print "Unsupported fingerprint type"
except:
print "Cannot build reactant fingerprint"
if rfp is None:
rfp = fp
else:
rfp += fp
for product in range(rxn.GetNumProductTemplates()):
mol = rxn.GetProductTemplate(product)
mol.UpdatePropertyCache(strict=False)
Chem.GetSSSR(mol)
try:
if fp_type == 'AP':
fp = AllChem.GetAtomPairFingerprint(mol=mol, maxLength=fp_size)
elif fp_type == 'Morgan':
fp = AllChem.GetMorganFingerprint(mol=mol, radius=fp_size)
elif fp_type == 'Topological':
fp = AllChem.GetTopologicalTorsionFingerprint(mol=mol)
else:
print "Unsupported fingerprint type"
except:
print "Cannot build product fingerprint"
if pfp is None:
pfp = fp
else:
pfp += fp
if pfp is not None and rfp is not None:
rkfp = pfp - rfp
return rkfp
Thanks.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss