chemfp.rdkit_count_types module
This module should not be imported directly.
It contains implementation details for generating count fingerprints
using RDKit. See the chemfp.rdkit_types module for the
equivalent for RDKit 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.rdkit_count_types.RDKitAtomPairCountFingerprintType_v3(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
RDKitCountGeneratorMixin,RDKitBaseCountFingerprintTypeRDKit atom pair count fingerprints, version 3
This RDKit-AtomPairCount/3 fingerprint type works with the generator-based API described at:
The RDKit-AtomPairCount/3
FingerprintTypeparameters are:minDistance - minimum bond distance for two atoms to be considered a pair (default: 1 bond)
maxDistance - maximum bond distance for two atoms to be considered a pair (default: 30)
includeChirality - if 1, chirality will be used in the atom invariants (default: 0)
- use2D - if 1, use a 2D distance matrix, if 0 use the 3D matrix from the first
set of conformers, or return an empty fingerprint if no conformers (default: 1)
- base_name = 'RDKit-AtomPairCount'
the base_name, like “MACCS”
- int_version = 3
- name = 'RDKit-AtomPairCount/3'
the full fingerprint name as “{base_name}/{version}” (like “MACCS/2”)
- version = '3'
the version, like “2”
- class chemfp.rdkit_count_types.RDKitAvalonCountFingerprintType_v1(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
RDKitCountGeneratorMixin,RDKitBaseCountFingerprintTypeAvalon count fingerprints
The Avalon Cheminformatics toolkit is available from https://sourceforge.net/projects/avalontoolkit/ . It is not part of the core RDKit distribution. Instead, RDKit has a compile-time option to download and include it as part of the build process.
The Avalon fingerprint are described in the supplemental information for “QSAR - How Good Is It in Practice? Comparison of Descriptor Sets on an Unbiased Cross Section of Corporate Data Sets”, Peter Gedeck, Bernhard Rohde, and Christian Bartels, J. Chem. Inf. Model., 2006, 46 (5), pp 1924-1936, DOI: 10.1021/ci050413p. The supplemental information is available from https://pubs.acs.org/doi/suppl/10.1021/ci050413p
It uses a set of feature classes which “have been fine-tuned to provide good screen-out for the set of substructure queries encounted at Novartis while limiting redundancy.” The classes are ATOM_COUNT, ATOM_SYMBOL_PATH, AUGMENTED_ATOM, AUGMENTED_BOND, HCOUNT_PAIR, HCOUNT_PATH, RING_PATH, BOND_PATH, HCOUNT_CLASS_PATH, ATOM_CLASS_PATH, RING_PATTERN, RING_SIZE_COUNTS, DEGREE_PATHS, CLASS_SPIDERS, FEATURE_PAIRS and ALL_PATTERNS.
- base_name = 'RDKit-AvalonCount'
the base_name, like “MACCS”
- int_version = 1
- name = 'RDKit-AvalonCount/1'
the full fingerprint name as “{base_name}/{version}” (like “MACCS/2”)
- version = '1'
the version, like “2”
- class chemfp.rdkit_count_types.RDKitBaseCountFingerprintType(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
CountFingerprintType- from_inchi(content: str | bytes, *, sanitize: bool = True, removeHs: bool = True, logLevel: int | None = None, treatWarningAsError: bool = False, delimiter: Literal['to-eol', 'space', 'tab', 'comma', 'whitespace', 'native', ' ', '\t'] | None = None, 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:
sanitize (Boolean (default: True)) – If true, sanitize the molecule after parsing
removeHs (Boolean (default: True)) – If true, remove simple hydrogens from the molecular graph
logLevel (an integer, or None to disable logging completely (default: None)) – the log level for the InChI API
treatWarningAsError (Boolean (default: False)) – treat any InChI warnings as an error
delimiter (One of None, 'to-eol', 'space', 'tab', 'comma', 'whitespace', 'native', or the space or tab characters (default: None)) – The separator between the SMILES and the id
errors (one of "strict", "ignore", or "log") – specify how to handle errors
- Returns:
a fingerprint byte string
- from_inchistring(content: str | bytes, *, sanitize: bool = True, removeHs: bool = True, logLevel: int | None = None, treatWarningAsError: bool = False, 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:
sanitize (Boolean (default: True)) – If true, sanitize the molecule after parsing
removeHs (Boolean (default: True)) – If true, remove simple hydrogens from the molecular graph
logLevel (an integer, or None to disable logging completely (default: None)) – the log level for the InChI API
treatWarningAsError (Boolean (default: False)) – treat any InChI warnings as an error
errors (one of "strict", "ignore", or "log") – specify how to handle errors
- Returns:
a fingerprint byte string
- from_molfile(content: str | bytes, *, sanitize: bool = True, removeHs: bool = True, strictParsing: 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:
sanitize (Boolean (default: True)) – If true, sanitize the molecule after parsing
removeHs (Boolean (default: True)) – If true, remove simple hydrogens from the molecular graph
strictParsing (Boolean (default: True)) – If true, require stricter adherence to the SDF specification
errors (one of "strict", "ignore", or "log") – specify how to handle errors
- Returns:
a fingerprint byte string
- from_sdf(content: str | bytes, *, sanitize: bool = True, removeHs: bool = True, strictParsing: bool = True, includeTags: 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:
sanitize (Boolean (default: True)) – If true, sanitize the molecule after parsing
removeHs (Boolean (default: True)) – If true, remove simple hydrogens from the molecular graph
strictParsing (Boolean (default: True)) – If true, require stricter adherence to the SDF specification
includeTags (Boolean (default: True)) – if true, extract the struture data tag fields
errors (one of "strict", "ignore", or "log") – specify how to handle errors
- Returns:
a fingerprint byte string
- from_smi(content: str | bytes, *, sanitize: bool = True, cxsmiles: bool = True, delimiter: Literal['to-eol', 'space', 'tab', 'comma', 'whitespace', 'native', ' ', '\t'] | None = None, 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:
sanitize (Boolean (default: True)) – If true, sanitize the molecule after parsing
cxsmiles (Boolean (default: True)) – If true, look for ChemAxon CXSMILES extensions after the SMILES string
delimiter (One of None, 'to-eol', 'space', 'tab', 'comma', 'whitespace', 'native', or the space or tab characters (default: None)) – The separator between the SMILES and the id
errors (one of "strict", "ignore", or "log") – specify how to handle errors
- Returns:
a fingerprint byte string
- from_smiles(content: str | bytes, *, sanitize: bool = True, cxsmiles: 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:
sanitize (Boolean (default: True)) – If true, sanitize the molecule after parsing
cxsmiles (Boolean (default: True)) – If true, look for ChemAxon CXSMILES extensions after the SMILES string
errors (one of "strict", "ignore", or "log") – specify how to handle errors
- Returns:
a fingerprint byte string
- from_smistring(content: str | bytes, *, sanitize: bool = True, cxsmiles: 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:
sanitize (Boolean (default: True)) – If true, sanitize the molecule after parsing
cxsmiles (Boolean (default: True)) – If true, look for ChemAxon CXSMILES extensions after the SMILES string
errors (one of "strict", "ignore", or "log") – specify how to handle errors
- Returns:
a fingerprint byte string
- software = ...
a description of the software package(s) used
- toolkit = <module 'chemfp.rdkit_toolkit>'
a reference to the underlying toolkit wrapper
- class chemfp.rdkit_count_types.RDKitCountFingerprintType_v3(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
RDKitCountGeneratorMixin,RDKitBaseCountFingerprintType- base_name = 'RDKit-CountFingerprint'
the base_name, like “MACCS”
- int_version = 3
- name = 'RDKit-CountFingerprint/3'
the full fingerprint name as “{base_name}/{version}” (like “MACCS/2”)
- num_bits = 18446744073709551615
The number of bits in the fingerprint
- version = '3'
the version, like “2”
- class chemfp.rdkit_count_types.RDKitCountGeneratorMixin(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
object- fingerprint_kwargs: Dict[str, Any]
- make_fingerprinter()
Return a fingerprinter function specialized to the current parameters
The returned function takes an RDKit molecule and returns a count fingerprint, matching the signature:
def compute_fingerprint(mol: rdkit.Mol ) -> :class:`.CountFingerprint:` pass
- property num_bits: int
- class chemfp.rdkit_count_types.RDKitGobbi2DCountFingerprintType_v1(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
RDKitBaseCountFingerprintType- base_name = 'RDKit-Gobbi2DCount'
the base_name, like “MACCS”
- int_version = 1
- make_fingerprinter()
Return a fingerprinter function specialized to the Gobbi2D parameters
The returned function takes an RDKit molecule and returns a Gobbi2D count fingerprint, matching the signature:
def compute_fingerprint(mol: rdkit.Mol ) -> :class:`.CountFingerprint:` pass
- name = 'RDKit-Gobbi2DCount/1'
the full fingerprint name as “{base_name}/{version}” (like “MACCS/2”)
- property num_bits
- version = '1'
the version, like “2”
- class chemfp.rdkit_count_types.RDKitMorganCountFingerprintType_v2(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
RDKitCountGeneratorMixin,RDKitBaseCountFingerprintTypeRDKit Morgan (ECFP-like) count fingerprints, version 2
The RDKit-MorganCount/2 fingerprint type works with the generator-based API described at:
The RDKit-MorganCount/2
FingerprintTypeparameters are:radius - radius for the Morgan algorithm (default: 3) (was 2 in v1!)
useFeatures - use chemical-feature invariants (default: 0)
countSimulation - simulate count fingerprints by setting more bits for higher counts (default: 0)
countBounds - list of minimum counts needed to set the corresponding bit during count simulation (default: None)
includeChirality - include chirality information in the bond invariants (default: 0)
useBondTypes - (default: 1)
includeRingMembership - if 1, include ring membership in the atom invariants (default: 1)
includeRedundantEnvironments - if 1, include redundant environments in the fingerprint (default: 0)
fromAtoms - list of atom indices to use as centers (default: None)
- base_name = 'RDKit-MorganCount'
the base_name, like “MACCS”
- int_version = 2
- name = 'RDKit-MorganCount/2'
the full fingerprint name as “{base_name}/{version}” (like “MACCS/2”)
- num_bits = 18446744073709551615
The number of bits in the fingerprint
- version = '2'
the version, like “2”
- class chemfp.rdkit_count_types.RDKitTorsionCountFingerprintType_v4(fingerprint_kwargs: Dict[str, Any] | None = None)
Bases:
RDKitCountGeneratorMixin,RDKitBaseCountFingerprintTypeRDKit torsion fingerprints, version 4
This RDKitTorsionCountFingerprintType/4 fingerprint type works the the generator-based API described at:
The underlying algorithm is described in: R. Nilakantan, N. Bauman, J. S. Dixon, R. Venkataraghavan; “Topological Torsion: A New Molecular Descriptor for SAR Applications. Comparison with Other Descriptors” JCICS 27, 82-85 (1987).
The RDKit-TorsionCount/4
FingerprintTypeparameters are:torsionAtomCount - the number of atoms to include in the ‘torsions’ (default: 4)
includeChirality - if 1, include chirality in the atom invariants (default: 0)
onlyShortestPaths - if 1, only include the shortest paths between the start and end atoms, not all paths (default: 0)
- base_name = 'RDKit-TorsionCount'
the base_name, like “MACCS”
- int_version = 4
- name = 'RDKit-TorsionCount/4'
the full fingerprint name as “{base_name}/{version}” (like “MACCS/2”)
- version = '4'
the version, like “2”