Repository navigation
08 Fingerprint Calculations
Levente Nagy edited this page Sep 22, 2026
·
1 revision
Chemaxon has a number of functions that you can use to generate fingerprints.
from chemaxon.io import import_mol
from chemaxon.fingerprints import cfp, ecfp
mol = import_mol('CCO')
cfp = cfp(mol)
ecfp = ecfp(mol, 4, 1024)These functions return chemaxon.fingerprints.Fingerprint objects. You can get the fingerprints
in bytes or in binary string format.
ecfp.to_bytes()b'\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
ecfp.to_binary_string()['0000000000000000000000000000000000000001000000000000000000000000',
'0000000000000000000000000000000000000000000000000000000000000000',
'0000000000000000000000000000000000000000000000000000000000000000',
'0000000000000000000000000000000000001000000000000000000000000000',
'0000000000000000000000000000000000000000000000000000000000000000',
'0000000000000000000000000000000000000000000000000000000000000000',
'0000000000000000000000000000001000000000000000000000000000000000',
'0000000000000000000000000000000000000000000000000000000000000000',
'0000000000000000000000000000000000000000000000000000000000000000',
'0000000000000000000000000000000000000000000000000000000000000000',
'0000000000000000000000000000000000000000000000000000000000000000',
'0000000000000000010000000000000000000000000000000000000000000000',
'0000000000000000000000000000000000000000000000000000000000000000',
'0000000000000001000000000000000000000000000000000000000000000000',
'0000000000000000000001000000000000000000000000000000000000000000',
'0000000000000000000000000000000000000000000000000000000000000000']
You can also calculate pharmacophore f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0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0])
This method returns a FloatVectorFingerprint, which contains a list of float values.
You can also calculate Tanimoto Dissimilarity for the fingerprints:
from chemaxon.fingerprints import tanimoto, ecfp, pharmacophore_fp, float_vector_tanimoto
mol = import_mol('aspirin')
mol2 = import_mol('aspirin')
ecfp1 = ecfp(mol, 4, 1024)
ecfp2 = ecfp(mol2, 4, 1024)
result1 = tanimoto(ecfp1, ecfp2)
print(result1)
mol = import_mol('aspirin')
mol2 = import_mol('coffein')
pf1 = pharmacophore_fp(mol)
pf2 = pharmacophore_fp(mol2)
result2 = float_vector_tanimoto(pf1, pf2)
print(result2)1.0
0.375
Reaction fingerprints can also be claucluated using the reaction_fp function.
from chemaxon.fingerprints import reaction_fp
reaction_str = '[#7:1][H:2].[#6:4][S:3]([#7,#9,#17,#35,#53:7])(=[O:5])=[O:6]>>[#6:4][S:3]([#7:1])(=[O:6])=[O:5]'
reaction_mol = import_mol(reaction_str)
result_reaction = reaction_fp(reaction_mol)
result_reactionFingerprint(bits=[274877906944, 281474976710656, 13510798882111488, 1152921504607371264, 35184372088832, 32, 2, 0, 18014673387388928, 281474976710656, 13510798882111488, 1152921504607371264, 36063981391052800, 33, 2199023255554, 137438953472, 268435457, 0, 144115188075855872, 16, 144255925564743680, 0, 2450098934778437632, 4194320, 144255925564743680, 0, 1688849860296704, 134217984, 2450098934778437632, 4194320, 1688849860296704, 2199157473664, 0])