chemfp.openbabel_types module

class chemfp.openbabel_types.OpenBabelBaseFingerprintType(fingerprint_kwargs)

Bases: chemfp.types.FingerprintType

from_inchi(content: str, *, options: Optional[str, None] = None, delimiter: Optional[Literal[to_eol, space, tab, comma, whitespace, native, , ], None] = None, errors: str = 'strict')

Generate a fingerprint from an InChI string and id

This is equivalent to calling:

mol = fptype.toolkit.from_inchi(content, ..., errors=errors)
fp = fptype.from_mol(mol) if (mol is not None) else None
Parameters:
  • options (string or None) – options string passed to Open Babel
  • 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, *, options: Optional[str, None] = None, errors: str = 'strict')

Generate a fingerprint from an InChI string

This is equivalent to calling:

mol = fptype.toolkit.from_inchistring(content, ..., errors=errors)
fp = fptype.from_mol(mol) if (mol is not None) else None
Parameters:
  • options (string or None) – options string passed to Open Babel
  • errors (one of "strict", "ignore", or "log") – specify how to handle errors
Returns:

a fingerprint byte string

from_sdf(content: str, *, implementation: Literal[None, openbabel, chemfp] = 'openbabel', perceive_stereo: bool = False, perceive_0d_stereo: bool = False, options: Optional[str, None] = None, errors: str = 'strict')

Generate a fingerprint from an SDF record

This is equivalent to calling:

mol = fptype.toolkit.from_sdf(content, ..., errors=errors)
fp = fptype.from_mol(mol) if (mol is not None) else None
Parameters:
  • implementation (None or 'openbabel' to use Open Babel, else 'chemfp' (default: "openbabel")) – SDF record tokenizer implementation
  • perceive_stereo (Boolean (default: False)) – not implemented
  • perceive_0d_stereo (Boolean (default: False)) – not implemented
  • options (string or None) – options string passed to Open Babel
  • errors (one of "strict", "ignore", or "log") – specify how to handle errors
Returns:

a fingerprint byte string

from_smi(content: str, *, options: Optional[str, None] = None, delimiter: Optional[Literal[to_eol, space, tab, comma, whitespace, native, , ], None] = None, has_header: bool = False, errors: str = 'strict')

Generate a fingerprint from a SMILES string and id

This is equivalent to calling:

mol = fptype.toolkit.from_smi(content, ..., errors=errors)
fp = fptype.from_mol(mol) if (mol is not None) else None
Parameters:
  • options (string or None) – options string passed to Open Babel
  • 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
  • has_header (Boolean (default: False)) – If true, treat the first line of the SMILES file as a header
  • errors (one of "strict", "ignore", or "log") – specify how to handle errors
Returns:

a fingerprint byte string

from_smiles(content: str, *, options: Optional[str, None] = None, errors: str = 'strict')

Generate a fingerprint from a SMILES string

This is equivalent to calling:

mol = fptype.toolkit.from_smistring(content, ..., errors=errors)
fp = fptype.from_mol(mol) if (mol is not None) else None
Parameters:
  • options (string or None) – options string passed to Open Babel
  • errors (one of "strict", "ignore", or "log") – specify how to handle errors
Returns:

a fingerprint byte string

from_smistring(content: str, *, options: Optional[str, None] = None, errors: str = 'strict')

Generate a fingerprint from a SMILES string

This is equivalent to calling:

mol = fptype.toolkit.from_smistring(content, ..., errors=errors)
fp = fptype.from_mol(mol) if (mol is not None) else None
Parameters:
  • options (string or None) – options string passed to Open Babel
  • errors (one of "strict", "ignore", or "log") – specify how to handle errors
Returns:

a fingerprint byte string

software = ...

a description of the Open Babel and chemfp software packages used

toolkit = <module 'chemfp.openbabel_toolkit>'

a reference to the openbabel_toolkit module

class chemfp.openbabel_types.OpenBabelFP2FingerprintType_v1(fingerprint_kwargs)

Bases: chemfp.types.NoFingerprintParametersMixin, chemfp.openbabel_types.OpenBabelBaseFingerprintType

OpenBabel FP2 fingerprint based on path enumeration

See https://openbabel.org/wiki/FP2

This is a Daylight-like path enumeration fingerprint with 1021 bits.

The OpenBabel-FP2/1 FingerprintType has no parameters.

make_fingerprinter()

Make a ‘fingerprinter’; a callable which takes a molecule and returns a fingerprint

Returns:a function object which takes a molecule and return a fingerprint
name = 'OpenBabel-FP2/1'
num_bits = 1021
class chemfp.openbabel_types.OpenBabelFP3FingerprintType_v1(fingerprint_kwargs)

Bases: chemfp.types.NoFingerprintParametersMixin, chemfp.openbabel_types.OpenBabelBaseFingerprintType

OpenBabel FP3 fingerprint

See https://openbabel.org/wiki/FP3

55 bit fingerprints based on a set of SMARTS patterns defining functional groups.

The OpenBabel-FP3/1 FingerprintType has no parameters.

make_fingerprinter()

Make a ‘fingerprinter’; a callable which takes a molecule and returns a fingerprint

Returns:a function object which takes a molecule and return a fingerprint
name = 'OpenBabel-FP3/1'
num_bits = 55
class chemfp.openbabel_types.OpenBabelFP4FingerprintType_v1(fingerprint_kwargs)

Bases: chemfp.types.NoFingerprintParametersMixin, chemfp.openbabel_types.OpenBabelBaseFingerprintType

OpenBabel FP4 fingerprint

https://openbabel.org/wiki/FP4

307 bit fingerprints based on a set of SMARTS patterns defining functional groups.

The OpenBabel-FP4/1 FingerprintType has no parameters.

make_fingerprinter()

Make a ‘fingerprinter’; a callable which takes a molecule and returns a fingerprint

Returns:a function object which takes a molecule and return a fingerprint
name = 'OpenBabel-FP4/1'
num_bits = 307
class chemfp.openbabel_types.OpenBabelBaseMACCSFingerprintType(fingerprint_kwargs)

Bases: chemfp.types.NoFingerprintParametersMixin, chemfp.openbabel_types.OpenBabelBaseFingerprintType

make_fingerprinter()

Make a ‘fingerprinter’; a callable which takes a molecule and returns a fingerprint

Returns:a function object which takes a molecule and return a fingerprint
num_bits = 166
class chemfp.openbabel_types.OpenBabelMACCSFingerprintType_v2(fingerprint_kwargs)

Bases: chemfp.openbabel_types.OpenBabelBaseMACCSFingerprintType

Open Babel’s implementation of the 166 MACCS keys

See https://openbabel.org/wiki/Tutorial:Fingerprints and https://github.com/openbabel/openbabel/blob/master/data/MACCS.txt .

Note: Open Babel added support for key 44 on 20 October 2014. This should have been version 3. However, I didn’t notice until 1 May 2017 that there was no chemfp test for it. Since everyone has been using it as v2, and very few people used the older version, I won’t change the version number.

The OpenBabel-MACCS/2 FingerprintType has no parameters.

name = 'OpenBabel-MACCS/2'
class chemfp.openbabel_types.OpenBabelECFPBaseFingerprintType(fingerprint_kwargs)

Bases: chemfp.openbabel_types.OpenBabelBaseFingerprintType

class chemfp.openbabel_types.OpenBabelECFP0FingerprintType_v1(fingerprint_kwargs)

Bases: chemfp.openbabel_types.OpenBabelECFPBaseFingerprintType

Open Babel’s implementation of the ECFP0 fingerprint

This is a circular fingerprint of diameter 0.

The OpenBabel-ECFP0/1 FingerprintType parameter is:

  • nBits - the number of bits in the fingerprint (default: 4096 and
    must be a power of 2)
is_available = False
name = 'OpenBabel-ECFP0/1'
class chemfp.openbabel_types.OpenBabelECFP2FingerprintType_v1(fingerprint_kwargs)

Bases: chemfp.openbabel_types.OpenBabelECFPBaseFingerprintType

Open Babel’s implementation of the ECFP2 fingerprint

This is a circular fingerprint of diameter 2.

The OpenBabel-ECFP2/1 FingerprintType parameter is:

  • nBits - the number of bits in the fingerprint (default: 4096 and
    must be a power of 2)
name = 'OpenBabel-ECFP2/1'
class chemfp.openbabel_types.OpenBabelECFP4FingerprintType_v1(fingerprint_kwargs)

Bases: chemfp.openbabel_types.OpenBabelECFPBaseFingerprintType

Open Babel’s implementation of the ECFP4 fingerprint

This is a circular fingerprint of diameter 4.

The OpenBabel-ECFP4/1 FingerprintType parameter is:

  • nBits - the number of bits in the fingerprint (default: 4096 and
    must be a power of 2)
name = 'OpenBabel-ECFP4/1'
class chemfp.openbabel_types.OpenBabelECFP6FingerprintType_v1(fingerprint_kwargs)

Bases: chemfp.openbabel_types.OpenBabelECFPBaseFingerprintType

Open Babel’s implementation of the ECFP6 fingerprint

This is a circular fingerprint of diameter 6.

The OpenBabel-ECFP6/1 FingerprintType parameter is:

  • nBits - the number of bits in the fingerprint (default: 4096 and
    must be a power of 2)
name = 'OpenBabel-ECFP6/1'
class chemfp.openbabel_types.OpenBabelECFP8FingerprintType_v1(fingerprint_kwargs)

Bases: chemfp.openbabel_types.OpenBabelECFPBaseFingerprintType

Open Babel’s implementation of the ECFP8 fingerprint

This is a circular fingerprint of diameter 8.

The OpenBabel-ECFP8/1 FingerprintType parameter is:

  • nBits - the number of bits in the fingerprint (default: 4096 and
    must be a power of 2)
is_available = False
name = 'OpenBabel-ECFP8/1'
class chemfp.openbabel_types.OpenBabelECFP10FingerprintType_v1(fingerprint_kwargs)

Bases: chemfp.openbabel_types.OpenBabelECFPBaseFingerprintType

Open Babel’s implementation of the ECFP10 fingerprint

This is a circular fingerprint of diameter 10.

The OpenBabel-ECFP10/1 FingerprintType parameter is:

  • nBits - the number of bits in the fingerprint (default: 4096 and
    must be a power of 2)
is_available = False
name = 'OpenBabel-ECFP10/1'