chemaxon.fingerprints

In this package you can find functions for fingerprint calculations.

GitHub examples: https://github.com/ChemAxon/python-examples/blob/main/jupyter/08_fingerprint_calculations.ipynb

@typecheck(Molecule, int, int, int, bool)
def cfp( mol: chemaxon.Molecule, bond_count: int = 7, bits_per_pattern: int = 3, length: int = 1024, consider_rings: bool = True) -> Fingerprint:

Chemical Fingerprint calculation.

The chemical hashed fingerprint of a molecule is bitstring (a sequence of 0 and 1 digits) that contains information on the structure.

Link: https://docs.chemaxon.com/display/docs/fingerprints_chemical-hashed-fingerprint.html

Parameters
  • mol: chemaxon.Molecule - Input molecule
  • bond_count: int - The maximum length of consecutive bonds in the linear paths that are considered during the fragmentation of the molecule
  • bits_per_pattern: int - The number of bits used to code each pattern in the hashed binary vector representation
  • length: int - Default length (bit count) for CFP - folded binary fingerprint representation
  • consider_rings: bool - If True, the presence of rings is considered during the fragmentation of the molecule
Returns

Fingerprint - The generated CFP fingerprint

@typecheck(Molecule, int, int)
def ecfp( mol: chemaxon.Molecule, diameter: int = 4, length: int = 1024) -> Fingerprint:

Extended Connectivity Fingerprint calculation.

Extended-Connectivity Fingerprints (ECFPs) are circular topological fingerprints designed for molecular characterization, similarity searching, and structure-activity modeling. They are among the most popular similarity search tools in drug discovery, and they are effectively used in a wide variety of applications.

Link: https://docs.chemaxon.com/display/docs/fingerprints_extended-connectivity-fingerprint-ecfp.html

Parameters
  • mol: chemaxon.Molecule - Input molecule
  • diameter: int - It specifies the diameter of the circular neighborhood considered for each atom
  • length: int - Sets the length of the ECFP fingerprint
Returns

Fingerprint - The generated ECFP fingerprint

@dataclass(frozen=True)
class Fingerprint:

Generic fingerprint representation This class is the result class of fingerprint generation algorithms.

Fingerprint(bits: list[int] = None)
bits: list[int] = None

Fingerprint - every bit of every int (64 bit) in the list represents a fingerprint bit

def to_bytes(self) -> bytes:
Returns

bytes The byte representation of the fingerprint

def to_binary_string(self) -> list[str]:
Returns

list[str] The binary string representation of the fingerprint

def darkness(self):
Returns

int The count of 1 bit in the fingerprint

@dataclass(frozen=True)
class FloatVectorFingerprint:

Generic float vector fingerprint representation This class is the result class of fingerprint generation algorithms.

FloatVectorFingerprint(bits: list[float] = None)
bits: list[float] = None

Fingerprint object - fingerprint array

@typecheck(Molecule)
def pharmacophore_fp( mol: chemaxon.Molecule) -> FloatVectorFingerprint:

Pharmacophore fingerprint calculation.

Pharmacophore fingerprints attempt to model binding related structural or chemical properties of chemical compounds with the use of simple statistics of chemical features. In the case of pharmacophore fingerprints generated these features are always assigned to individual atoms of the molecule thus these fingerprints are atom based pharmacophore fingerprints.

Link: https://docs.chemaxon.com/display/docs/fingerprints_pharmacophore-fingerprint.html

Parameters
Returns

FloatVectorFingerprint - The generated pharmacophore fingerprint

@typecheck(Molecule, int, int, int)
def reaction_fp( mol: chemaxon.Molecule, length: int = 2048, bond_count: int = 6, bits_set: int = 2) -> Fingerprint:

Reaction fingerprint calculation.

Reaction fingerprints are designed to capture the structural features of chemical reactions.

Link: https://docs.chemaxon.com/display/docs/fingerprints_reaction-fingerprint.html

Parameters
  • mol: chemaxon.Molecule - Input reaction molecule
  • length: int - Length of the generated fingerprint. Must be a power of 2. Default value is 2048.
  • bond_count: int - Maximum bond count to be considered for the fingerprint. Default value is 6.
  • bits_set: int - Number of bits to set for each feature. Default value is 2.
Returns

Fingerprint - The generated reaction fingerprint

@typecheck(Fingerprint, Fingerprint)
def tanimoto( fp1: Fingerprint, fp2: Fingerprint) -> float:

Calculates the Tanimoto similarity coefficient of the two Fingerprint.

Parameters
Returns

float - The calculated Tanimoto coefficient (value between 0 and 1, where 1 means identical fingerprints)

@typecheck(FloatVectorFingerprint, FloatVectorFingerprint)
def float_vector_tanimoto( fp1: FloatVectorFingerprint, fp2: FloatVectorFingerprint) -> float:

Calculates the Tanimoto similarity coefficient of the two Fingerprint.

Parameters
Returns

float - The calculated Tanimoto coefficient (value between 0 and 1, where 1 means identical fingerprints)