chemfp.cdk_count_types module
This module should not be imported directly.
It contains implementation details for generating count fingerprints
using CDK. See the chemfp.cdk_types module for the equivalent
for CDK binary fingerprint types.
This module is included in the documentation because parts of this module are returned to the user, and are part of the public API.
- class chemfp.cdk_count_types.CDKAtomPairs2DCountFingerprintType_v20(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
NoFingerprintParametersMixin,CDKBaseCountFingerprintTypeCDK’s count implementation of the atom pairs fingerprint from Yap Chun Wei’s PaDEL.
The CDK-AtomPairs2DCount/2.0
CountFingerprintTypetakes no parameters.This fingerprinter requires explicit hydrogens. When using chemfp to read a SMILES or SDF, set the “hydrogens” reader argument to “make-explicit” to convert any implicit hydrogens to explicit.
- base_name = 'CDK-AtomPairs2DCount'
the base_name, like “MACCS”
- int_version = 2000000
- make_fingerprinter()
Return a fingerprinter function specialized to the current parameters
The returned function takes a CDK molecule and returns a count fingerprint, matching the signature:
- def compute_fingerprint(mol: CDKMol) ->
CountFingerprint: pass
- def compute_fingerprint(mol: CDKMol) ->
- name = 'CDK-AtomPairs2DCount/2.0'
the full fingerprint name as “{base_name}/{version}” (like “MACCS/2”)
- num_bits = 780
The number of bits in the fingerprint
- version = '2.0'
the version, like “2”
- class chemfp.cdk_count_types.CDKBaseCountFingerprintType(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
CountFingerprintTypeThe base type for all CDK count fingerprint types
This defines shared properties like
toolkitandsoftware, and implements the molecule I/O helper methods.- from_inchi(content: str | bytes, *, delimiter: Literal['to-eol', 'space', 'tab', 'comma', 'whitespace', 'native', ' ', '\t'] | None = 'to-eol', prepare: bool = True, errors: str = 'strict')
Generate a fingerprint from an InChI string and its id
This is equivalent to calling:
mol = fptype.toolkit.parse_inchi(content, ..., errors=errors) fp = fptype.compute_fingerprint(mol) if (mol is not None) else None
- Parameters:
delimiter (One of None, 'to-eol', 'space', 'tab', 'comma', 'whitespace', 'native', or the space or tab characters (default: "to-eol")) – The separator between the SMILES and the id
prepare (Boolean (default: True)) – if true, perform ring and aromaticity perception during input
errors (one of "strict", "ignore", or "log") – specify how to handle errors
- Returns:
a fingerprint byte string
- from_inchistring(content: str | bytes, *, delimiter: Literal['to-eol', 'space', 'tab', 'comma', 'whitespace', 'native', ' ', '\t'] | None = 'to-eol', prepare: bool = True, errors: str = 'strict')
Generate a fingerprint from an InChI string
This is equivalent to calling:
mol = fptype.toolkit.parse_inchistring(content, ..., errors=errors) fp = fptype.compute_fingerprint(mol) if (mol is not None) else None
- Parameters:
delimiter (One of None, 'to-eol', 'space', 'tab', 'comma', 'whitespace', 'native', or the space or tab characters (default: "to-eol")) – The separator between the SMILES and the id
prepare (Boolean (default: True)) – if true, perform ring and aromaticity perception during input
errors (one of "strict", "ignore", or "log") – specify how to handle errors
- Returns:
a fingerprint byte string
- from_molfile(content: str | bytes, *, AddStereo0d: bool = True, AddStereoElements: bool = True, InterpretHydrogenIsotopes: bool = True, ForceReadAs3DCoordinates: bool = False, mode: Literal['RELAXED', 'STRICT'] = 'RELAXED', hydrogens: Literal['as-is', 'make-explicit', 'make-implicit', 'make-nonchiral-implicit'] = 'as-is', implementation: Literal['cdk', 'chemfp'] | None = 'cdk', prepare: bool = True, errors: str = 'strict')
Generate a fingerprint from an MDL molfile record
This is equivalent to calling:
mol = fptype.toolkit.parse_molfile(content, ..., errors=errors) fp = fptype.compute_fingerprint(mol) if (mol is not None) else None
- Parameters:
AddStereo0d (Boolean (default: True)) – if true, create stereo from parity value when no coordinates
AddStereoElements (Boolean (default: True)) – if true, detect and create IStereoElements
InterpretHydrogenIsotopes (Boolean (default: True)) – if true, interpret D and T as hydrogen isotopes
ForceReadAs3DCoordinates (Boolean (default: False)) – if true, always interpret coordinates as 3D
mode ('RELAXED' will attempt to recover, 'STRICT' will not) – strictness mode when parsing a record
hydrogens (One of 'as-is', 'make-explicit', 'make-implicit', or 'make-nonchiral-implicit' (default: "as-is")) – Specify how to handle implicit or explicit hydrogens
implementation (either 'cdk' or 'chemfp') – use CDK or chemfp to identify records
prepare (Boolean (default: True)) – if true, perform ring and aromaticity perception during input
errors (one of "strict", "ignore", or "log") – specify how to handle errors
- Returns:
a fingerprint byte string
- from_sdf(content: str | bytes, *, AddStereo0d: bool = True, AddStereoElements: bool = True, InterpretHydrogenIsotopes: bool = True, ForceReadAs3DCoordinates: bool = False, mode: Literal['RELAXED', 'STRICT'] = 'RELAXED', hydrogens: Literal['as-is', 'make-explicit', 'make-implicit', 'make-nonchiral-implicit'] = 'as-is', implementation: Literal['cdk', 'chemfp'] | None = 'cdk', prepare: bool = True, errors: str = 'strict')
Generate a fingerprint from an SDF record
This is equivalent to calling:
mol = fptype.toolkit.parse_sdf(content, ..., errors=errors) fp = fptype.compute_fingerprint(mol) if (mol is not None) else None
- Parameters:
AddStereo0d (Boolean (default: True)) – if true, create stereo from parity value when no coordinates
AddStereoElements (Boolean (default: True)) – if true, detect and create IStereoElements
InterpretHydrogenIsotopes (Boolean (default: True)) – if true, interpret D and T as hydrogen isotopes
ForceReadAs3DCoordinates (Boolean (default: False)) – if true, always interpret coordinates as 3D
mode ('RELAXED' will attempt to recover, 'STRICT' will not) – strictness mode when parsing a record
hydrogens (One of 'as-is', 'make-explicit', 'make-implicit', or 'make-nonchiral-implicit' (default: "as-is")) – Specify how to handle implicit or explicit hydrogens
implementation (either 'cdk' or 'chemfp') – use CDK or chemfp to identify records
prepare (Boolean (default: True)) – if true, perform ring and aromaticity perception during input
errors (one of "strict", "ignore", or "log") – specify how to handle errors
- Returns:
a fingerprint byte string
- from_smi(content: str | bytes, *, has_header: bool = False, delimiter: Literal['to-eol', 'space', 'tab', 'comma', 'whitespace', 'native', ' ', '\t'] | None = 'to-eol', implementation: Literal['cdk', 'chemfp'] | None = 'cdk', kekulise: bool = True, cxsmiles: bool = True, hydrogens: Literal['as-is', 'make-explicit', 'make-implicit', 'make-nonchiral-implicit'] = 'as-is', prepare: bool = True, errors: str = 'strict')
Generate a fingerprint from a SMILES string and its id
This is equivalent to calling:
mol = fptype.toolkit.parse_smi(content, ..., errors=errors) fp = fptype.compute_fingerprint(mol) if (mol is not None) else None
- Parameters:
has_header (Boolean (default: False)) – If true, treat the first line of the SMILES file as a header
delimiter (One of None, 'to-eol', 'space', 'tab', 'comma', 'whitespace', 'native', or the space or tab characters (default: "to-eol")) – The separator between the SMILES and the id
implementation (either 'cdk' or 'chemfp') – use CDK or chemfp to identify records
kekulise (Boolean (default: True)) – if true, ensure a valid Kekule intepretation exists
cxsmiles (Boolean (default: True)) – If true, look for ChemAxon CXSMILES extensions after the SMILES string (only works with ‘chemfp’ implementation)
hydrogens (One of 'as-is', 'make-explicit', 'make-implicit', or 'make-nonchiral-implicit' (default: "as-is")) – Specify how to handle implicit or explicit hydrogens
prepare (Boolean (default: True)) – if true, perform ring and aromaticity perception during input
errors (one of "strict", "ignore", or "log") – specify how to handle errors
- Returns:
a fingerprint byte string
- from_smiles(content: str | bytes, *, kekulise: bool = True, cxsmiles: bool = True, hydrogens: Literal['as-is', 'make-explicit', 'make-implicit', 'make-nonchiral-implicit'] = 'as-is', prepare: bool = True, errors: str = 'strict')
Generate a fingerprint from a SMILES string
This is equivalent to calling:
mol = fptype.toolkit.parse_smistring(content, ..., errors=errors) fp = fptype.compute_fingerprint(mol) if (mol is not None) else None
- Parameters:
kekulise (Boolean (default: True)) – if true, ensure a valid Kekule intepretation exists
cxsmiles (Boolean (default: True)) – If true, look for ChemAxon CXSMILES extensions after the SMILES string
hydrogens (One of 'as-is', 'make-explicit', 'make-implicit', or 'make-nonchiral-implicit' (default: "as-is")) – Specify how to handle implicit or explicit hydrogens
prepare (Boolean (default: True)) – if true, perform ring and aromaticity perception during input
errors (one of "strict", "ignore", or "log") – specify how to handle errors
- Returns:
a fingerprint byte string
- from_smistring(content: str | bytes, *, kekulise: bool = True, cxsmiles: bool = True, hydrogens: Literal['as-is', 'make-explicit', 'make-implicit', 'make-nonchiral-implicit'] = 'as-is', prepare: bool = True, errors: str = 'strict')
Generate a fingerprint from a SMILES string
This is equivalent to calling:
mol = fptype.toolkit.parse_smistring(content, ..., errors=errors) fp = fptype.compute_fingerprint(mol) if (mol is not None) else None
- Parameters:
kekulise (Boolean (default: True)) – if true, ensure a valid Kekule intepretation exists
cxsmiles (Boolean (default: True)) – If true, look for ChemAxon CXSMILES extensions after the SMILES string
hydrogens (One of 'as-is', 'make-explicit', 'make-implicit', or 'make-nonchiral-implicit' (default: "as-is")) – Specify how to handle implicit or explicit hydrogens
prepare (Boolean (default: True)) – if true, perform ring and aromaticity perception during input
errors (one of "strict", "ignore", or "log") – specify how to handle errors
- Returns:
a fingerprint byte string
- make_fingerprinter()
Return a fingerprinter function specialized to the current parameters
The returned function takes a CDK molecule and returns a count fingerprint, matching the signature:
- def compute_fingerprint(mol: CDKMol) ->
CountFingerprint: pass
- def compute_fingerprint(mol: CDKMol) ->
- num_bits = 4294967296
The number of bits in the fingerprint
- software = ...
a description of the software package(s) used
- toolkit = <module 'chemfp.cdk_toolkit>'
a reference to the underlying toolkit wrapper
- class chemfp.cdk_count_types.CDKDaylightCountFingerprintType_v210(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
CDKBaseCountFingerprintType- base_name = 'CDK-DaylightCount'
the base_name, like “MACCS”
- fingerprinter_can_fail = True
an internal flag indicating if the fingerprinter can raise an exception when processing a molecule
- int_version = 2010000
- name = 'CDK-DaylightCount/2.10'
the full fingerprint name as “{base_name}/{version}” (like “MACCS/2”)
- version = '2.10'
the version, like “2”
- class chemfp.cdk_count_types.CDKECFP0CountFingerprintType_v20(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
CDKCircularCountFingerprintTypeCDK’s count implementation of the ECFP0 fingerprint, version 2.0
The CDK-ECFP0/2.0
CountFingerprintTypeparameter is:perceiveStereochemistry - if True, re-perceive stereochemistry from 2D/3D coordinates
- base_name = 'CDK-ECFP0Count'
the base_name, like “MACCS”
- int_version = 2000000
- name = 'CDK-ECFP0Count/2.0'
the full fingerprint name as “{base_name}/{version}” (like “MACCS/2”)
- version = '2.0'
the version, like “2”
- class chemfp.cdk_count_types.CDKECFP2CountFingerprintType_v20(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
CDKCircularCountFingerprintTypeCDK’s count implementation of the ECFP2 fingerprint, version 2.0
The CDK-ECFP2Count/2.0
CountFingerprintTypeparameter is:perceiveStereochemistry - if True, re-perceive stereochemistry from 2D/3D coordinates
- base_name = 'CDK-ECFP2Count'
the base_name, like “MACCS”
- int_version = 2000000
- name = 'CDK-ECFP2Count/2.0'
the full fingerprint name as “{base_name}/{version}” (like “MACCS/2”)
- version = '2.0'
the version, like “2”
- class chemfp.cdk_count_types.CDKECFP4CountFingerprintType_v20(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
CDKCircularCountFingerprintTypeCDK’s count implementation of the ECFP4 fingerprint, version 2.0
The CDK-ECFP4/2.0
FingerprintTypeparameter is:perceiveStereochemistry - if True, re-perceive stereochemistry from 2D/3D coordinates
- base_name = 'CDK-ECFP4Count'
the base_name, like “MACCS”
- int_version = 2000000
- name = 'CDK-ECFP4Count/2.0'
the full fingerprint name as “{base_name}/{version}” (like “MACCS/2”)
- version = '2.0'
the version, like “2”
- class chemfp.cdk_count_types.CDKECFP6CountFingerprintType_v20(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
CDKCircularCountFingerprintTypeCDK’s count implementation of the ECFP6 fingerprint, version 2.0
The CDK-ECFP6Count/2.0
CountFingerprintTypeparameter is:perceiveStereochemistry - if True, re-perceive stereochemistry from 2D/3D coordinates
- base_name = 'CDK-ECFP6Count'
the base_name, like “MACCS”
- int_version = 2000000
- name = 'CDK-ECFP6Count/2.0'
the full fingerprint name as “{base_name}/{version}” (like “MACCS/2”)
- version = '2.0'
the version, like “2”
- class chemfp.cdk_count_types.CDKExtendedCountFingerprintType_v210(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
CDKBaseCountFingerprintTypeCDK’s Extended count fingerprint, version 2.10
This extends the DaylightCountFingerprinter with 25 additional bits describing ring features and isotopic masses.
The CDK-ExtendedCount/2.10
FingerprintCountTypeparameters are:searchDepth - maximum path length (default: 7)
pathLimit - maximum number of paths (default: 42000)
hashPseudoAtoms - include pseudo-atoms in the hash calculation (default: 0)
hashExplicitHydrogens - include explicit hydrogens in the hash calculation (default: 0)
The implementation changed in CDK 2.10 so the DaylightFingerprinter used internally sets hashExplicitHydrogens to 0. However, there no way to set that value to 1 until version 2.12.
- base_name = 'CDK-ExtendedCount'
the base_name, like “MACCS”
- fingerprinter_can_fail = True
an internal flag indicating if the fingerprinter can raise an exception when processing a molecule
- int_version = 2010000
- name = 'CDK-ExtendedCount/2.10'
the full fingerprint name as “{base_name}/{version}” (like “MACCS/2”)
- version = '2.10'
the version, like “2”
- class chemfp.cdk_count_types.CDKFCFP0CountFingerprintType_v20(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
CDKCircularCountFingerprintTypeCDK’s count implementation of the FCFP0 fingerprint, version 2.0
The CDK-FCFP0/2.0
FingerprintTypeparameter is:perceiveStereochemistry - if True, re-perceive stereochemistry from 2D/3D coordinates
- base_name = 'CDK-FCFP0Count'
the base_name, like “MACCS”
- int_version = 2000000
- name = 'CDK-FCFP0Count/2.0'
the full fingerprint name as “{base_name}/{version}” (like “MACCS/2”)
- version = '2.0'
the version, like “2”
- class chemfp.cdk_count_types.CDKFCFP2CountFingerprintType_v20(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
CDKCircularCountFingerprintTypeCDK’s count implementation of the FCFP2 fingerprint, version 2.0
The CDK-FCFP2Count/2.0
CountFingerprintTypeparameter is:perceiveStereochemistry - if True, re-perceive stereochemistry from 2D/3D coordinates
- base_name = 'CDK-FCFP2Count'
the base_name, like “MACCS”
- int_version = 2000000
- name = 'CDK-FCFP2Count/2.0'
the full fingerprint name as “{base_name}/{version}” (like “MACCS/2”)
- version = '2.0'
the version, like “2”
- class chemfp.cdk_count_types.CDKFCFP4CountFingerprintType_v20(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
CDKCircularCountFingerprintTypeCDK’s count implementation of the FCFP4 fingerprint, version 2.0
The CDK-FCFP4Count/2.0
FingerprintTypeparameter is:perceiveStereochemistry - if True, re-perceive stereochemistry from 2D/3D coordinates
- base_name = 'CDK-FCFP4Count'
the base_name, like “MACCS”
- int_version = 2000000
- name = 'CDK-FCFP4Count/2.0'
the full fingerprint name as “{base_name}/{version}” (like “MACCS/2”)
- version = '2.0'
the version, like “2”
- class chemfp.cdk_count_types.CDKFCFP6CountFingerprintType_v20(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
CDKCircularCountFingerprintTypeCDK’s count implementation of the FCFP6 fingerprint, version 2.0
The CDK-FCFP6Count/2.0
CountFingerprintTypeparameter is:perceiveStereochemistry - if True, re-perceive stereochemistry from 2D/3D coordinates
- base_name = 'CDK-FCFP6Count'
the base_name, like “MACCS”
- int_version = 2000000
- name = 'CDK-FCFP6Count/2.0'
the full fingerprint name as “{base_name}/{version}” (like “MACCS/2”)
- version = '2.0'
the version, like “2”
- class chemfp.cdk_count_types.CDKGraphOnlyCountFingerprintType_v210(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
CDKBaseCountFingerprintTypeCDK’s GraphOnly count fingerprint, version 2.10
This is a variant of the DaylightCountFingerprinter which does not take bond orders into account.
The CDK-GraphOnlyCount/2.10
CountFingerprintTypeparameters are:searchDepth - maximum path length (default: 7)
pathLimit - maximum number of paths (default: 42000)
hashPseudoAtoms - include pseudo-atoms in the hash calculation (default: 0)
hashExplicitHydrogens - include explicit hydrogens in the hash calculation (default: 0)
The hashExplicitHydrogens option was added in CDK 2.10. Earlier versions required explicit hydrogens and always included them.
- base_name = 'CDK-GraphOnlyCount'
the base_name, like “MACCS”
- fingerprinter_can_fail = True
an internal flag indicating if the fingerprinter can raise an exception when processing a molecule
- int_version = 2010000
- name = 'CDK-GraphOnlyCount/2.10'
the full fingerprint name as “{base_name}/{version}” (like “MACCS/2”)
- version = '2.10'
the version, like “2”
- class chemfp.cdk_count_types.CDKHybridizationCountFingerprintType_v210(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
CDKBaseCountFingerprintTypeCDK’s Hybridization count fingerprint, version 2.10
This is a variant of the DaylightCountFingerprinter which ignores aromaticity but instead takes into account SP2 hybridization.
The CDK-HybridizationCount/2.10
CountFingerprintTypeparameter is:searchDepth - maximum path length (default: 7)
pathLimit - maximum number of paths (default: 42000)
hashPseudoAtoms - include pseudo-atoms in the hash calculation (default: 0)
hashExplicitHydrogens - include explicit hydrogens in the hash calculation (default: 0)
The hashExplicitHydrogens option was added in CDK 2.10. Earlier versions required explicit hydrogens and always included them.
- base_name = 'CDK-HybridizationCount'
the base_name, like “MACCS”
- fingerprinter_can_fail = True
an internal flag indicating if the fingerprinter can raise an exception when processing a molecule
- int_version = 2010000
- name = 'CDK-HybridizationCount/2.10'
the full fingerprint name as “{base_name}/{version}” (like “MACCS/2”)
- version = '2.10'
the version, like “2”
- class chemfp.cdk_count_types.CDKKlekotaRothCountFingerprintType_v20(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
NoFingerprintParametersMixin,CDKBaseCountFingerprintTypeCDK’s count variant of the Klekota-Roth fingerprints
The CDK-KlekotaRothCount/2.0 fingerprints have no parameters.
- base_name = 'CDK-KlekotaRothCount'
the base_name, like “MACCS”
- int_version = 2000000
- make_fingerprinter()
Return a fingerprinter function specialized to the current parameters
The returned function takes a CDK molecule and returns a count fingerprint, matching the signature:
- def compute_fingerprint(mol: CDKMol) ->
CountFingerprint: pass
- def compute_fingerprint(mol: CDKMol) ->
- name = 'CDK-KlekotaRothCount/2.0'
the full fingerprint name as “{base_name}/{version}” (like “MACCS/2”)
- num_bits = 4860
The number of bits in the fingerprint
- version = '2.0'
the version, like “2”
- class chemfp.cdk_count_types.CDKSubstructureCountFingerprintType_v20(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
NoFingerprintParametersMixin,CDKBaseCountFingerprintTypeCDK’s Substructure key count fingerprints
The CDK-SubstructureCount/2.0 fingerprints have no parameters.
This fingerprinter requires fully implicit hydrogens. When using chemfp to read a SMILES or SDF, set the “hydrogens” reader argument to “make-implicit” to convert any implicit hydrogens to explicit.
- base_name = 'CDK-SubstructureCount'
the base_name, like “MACCS”
- int_version = 2000000
- make_fingerprinter()
Return a fingerprinter function specialized to the current parameters
The returned function takes a CDK molecule and returns a count fingerprint, matching the signature:
- def compute_fingerprint(mol: CDKMol) ->
CountFingerprint: pass
- def compute_fingerprint(mol: CDKMol) ->
- name = 'CDK-SubstructureCount/2.0'
the full fingerprint name as “{base_name}/{version}” (like “MACCS/2”)
- num_bits = 307
The number of bits in the fingerprint
- version = '2.0'
the version, like “2”