Pharmacophore class

Class

Pharmacophore

Main class

Initialization and setup

Pharmacophore.__init__

Initializes Pharmacophore instance

Pharmacophore.update

Changes parameters of the pharmacophore instance.

Create pharmacophore

Pharmacophore.load_from_mol

Creates pharmacophore from RDKit Mol.

Pharmacophore.load_from_smarts

Creates pharmacophore from RDKit Mol and features encoded by custom SMARTS.

Pharmacophore.load_from_feature_factory

Creates pharmacophore from RDKit Mol and features encoded by custom RDKit feature factory.

Pharmacophore.load_from_atom_ids

Creates pharmacophore from RDKit Mol and atom ids subsets associated with particular features

Pharmacophore properties and methods

Pharmacophore.get_bin_step

Returns current binning step value

Pharmacophore.get_descriptors

Returns count-based descriptor string of a pharmacophore.

Pharmacophore.get_feature_coords

Returns coordinates of features.

Pharmacophore.get_features_count

Returns number of each feature type

Pharmacophore.get_fp

Returns a bitstring fingerprint of a pharmacophore encoded by subsets of features

Pharmacophore.get_fp2

Returns a bitstring fingerprint of a pharmacophore encoded by subsets of features obtained with different setups

Pharmacophore.get_graph

Returns a copy of a pharmacophore graph

Pharmacophore.get_mirror_pharmacophore

Returns a new mirrored Pharmacophore instance.

Pharmacophore.get_mol

Returns RDKit Mol object of a pharmacophore where features are replaced with atoms

Pharmacophore.get_signature_md5

Returns pharmacophore hash.

Pharmacophore.iterate_pharm

Iterates over subsets of features to get their hashes.

Pharmacophore.iterate_pharm1

Iterates over subsets of features created by addition of a single feature to the input list of features.

Pharmacophore match

Pharmacophore.fit_model

Matches the supplied pharmacophore model.

Load/save file

Pharmacophore.load_from_pma

Reads pharmacophore from a pma-file.

Pharmacophore.load_from_xyz

Reads pharmacophore from xyz-file.

Pharmacophore.load_ls_model

Reads pharmacophore from LigandScout pml-file

Pharmacophore.save_ls_model

Saves pharmacophore to LigandScout pml-file.

Pharmacophore.save_to_pma

Saves pharmacophore in json format.

class pmapper.pharmacophore.Pharmacophore(bin_step=1, cached=False)

Main class

__init__(bin_step=1, cached=False)

Initializes Pharmacophore instance

Parameters
  • bin_step (float) – binning step

  • cached (bool) – whether or not to cache intermediate computation results. This substantially increases speed of repeated computation of a hash or fingerprints.

fit_model(model, n_omitted=0, essential_features=None, tol=0, get_transform_matrix=False)

Matches the supplied pharmacophore model.

Parameters
  • model (Pharmacophore) – a pharmacophore model which is used for matching (it should be a subgraph of the current pharmacophore graph).

  • n_omitted (int) – a number of simultaneously omitted features in a model pharmacophore

  • essential_features (list) – a list of ids of features which will not be omitted in a model pharmacophore.

  • tol (float) – tolerance

  • get_transform_matrix (bool) – if set, the function will return a transformation matrix as an additional output to align the pharmacopore to a model

Returns

tuple of feature ids of a model matching the pharmacophore or a 2-tuple where the first item is tuple of feature ids of a model matching the pharmacophore and the seond item is a transformation matrix. If no matching None will be returned.

get_bin_step()

Returns current binning step value

Returns

value of a binning step of a pharmacophore

Return type

float

get_descriptors(tol=0)

Returns count-based descriptor string of a pharmacophore.

Parameters

tol (float) – tolerance

Returns

dictionary where keys are hashes of feature quadruplets and values are counts of identical quadruples

Return type

dict

get_feature_coords(ids=None)

Returns coordinates of features.

Parameters

ids (iterable (int)) – iterable with feature ids to be used

Returns

list of 2-tuples where each tuple consists of a label and a 3-tuple with coordinates

get_features_count()

Returns number of each feature type

Returns

Counter (dict-like) object with feature labels and their feature count of a pharmacophore

get_fp(min_features=3, max_features=3, tol=0, nbits=2048, activate_bits=1)

Returns a bitstring fingerprint of a pharmacophore encoded by subsets of features

Parameters
  • min_features (int) – minimum number of features in a subset

  • max_features (int) – maximum number of features in a subset

  • tol (float) – tolerance

  • nbits (int) – length of a bit string

  • activate_bits (int) – number of activated bits per feature subset

Returns

set of numbers of activated bits (bitstring)

Return type

set

get_fp2(min_features=3, max_features=3, tol=(0, ), nbits=(2048, ), activate_bits=(1, ))

Returns a bitstring fingerprint of a pharmacophore encoded by subsets of features obtained with different setups

Parameters
  • min_features (int) – minimum number of features in a subset

  • max_features (int) – maximum number of features in a subset

  • tol (iterable (float)) – iterable with tolerance values

  • nbits (iterable (int)) – iterable with lengths of a bit string

  • activate_bits (iterable (int)) – iterable with numbers of activated bits per feature subset

Returns

dictionary where key is a tuple of (nbits, activate_bits, tol) and value is a set of numbers of activated bits (bitstring)

Return type

dict

get_graph()

Returns a copy of a pharmacophore graph

Returns

a copy of a NetworkX graph object of a pharmacophore

get_mirror_pharmacophore()

Returns a new mirrored Pharmacophore instance.

Returns

a new instance of a Pharmacophore class with all features mirrored in yz-plane.

get_mol(ids=None)

Returns RDKit Mol object of a pharmacophore where features are replaced with atoms

Parameters

ids (iterable (int)) – iterable with feature ids to be used

Returns

RDKit RWMol

get_signature_md5(ids=None, tol=0)

Returns pharmacophore hash.

Parameters
  • ids (iterable (int)) – iterable with feature ids to be used to compute pharmacophore hash

  • tol (float) – tolerance value to ignore small deviation of quadruplets of features from planarity. Minimal angle between an edge and a plane formed by other three features. Quadruplets having at least one angle less than tolerance value are assigned 0 chirality.

Returns

md5 hash of a pharmacophore

Return type

str

iterate_pharm(min_features=1, max_features=None, tol=0, return_feature_ids=True)

Iterates over subsets of features to get their hashes.

Parameters
  • min_features (int) – minimum number of features in a subset

  • max_features (int) – maximum number of features in a subset

  • tol (float) – tolerance

  • return_feature_ids (bool) – whether or not return feature ids

Returns

generator over hashes of feature subsets or over 2-tuples with a hash and a tuple with feature ids.

iterate_pharm1(fix_ids, tol=0, return_feature_ids=True)

Iterates over subsets of features created by addition of a single feature to the input list of features.

Parameters
  • fix_ids (iterable (int)) – iterable with feature ids which will be used as a constant part of enumerated feature subsets

  • tol (float) – tolerance

  • return_feature_ids (bool) – whether or not return feature ids

Returns

generator over hashes of feature subsets or over 2-tuples with a hash and a tuple with feature ids.

load_from_atom_ids(mol, atom_features_ids, confId=-1)

Creates pharmacophore from RDKit Mol and atom ids subsets associated with particular features

Parameters
  • mol – RDKit Mol object

  • atom_features_ids – dictionary where keys are feature labels and values are lists of tuples with atom ids of individual features, e.g. {‘A’: [(12,), (14,)], ‘H’: [(11,12,13,14,15,16)], …}

  • confId – id of a conformer in a molecule

Returns

nothing

load_from_feature_factory(mol, factory)

Creates pharmacophore from RDKit Mol and features encoded by custom RDKit feature factory.

Parameters
  • mol – RDKit Mol object

  • factory – object of MolChemicalFeatureFactory class

Returns

nothing

load_from_file(fname)

Reads pharmacophore from file. File format will be recognized by extension.

Parameters

fname – file name

Returns

nothing

load_from_mol(mol)

Creates pharmacophore from RDKit Mol. Uses default definition of feature SMARTS.

Parameters

mol – RDKit Mol object

Returns

nothing

load_from_pma(fname)

Reads pharmacophore from a pma-file.

Parameters

fname – pma-file name

Returns

nothing

load_from_smarts(mol, smarts)

Creates pharmacophore from RDKit Mol and features encoded by custom SMARTS.

Parameters
  • mol – RDKit Mol object

  • smarts – dictionary of SMARTS of features obtained with load_smarts function from pmapper.util module

Returns

nothing

load_from_xyz(fname)

Reads pharmacophore from xyz-file.

Parameters

fname – xyz-file name

Returns

nothing

load_ls_model(pml_fname)

Reads pharmacophore from LigandScout pml-file

Parameters

pml_fname – file name of a LigandScout pml-file

Returns

nothing

save_ls_model(fname, name='pmapper_pharmcophore')

Saves pharmacophore to LigandScout pml-file.

Parameters
  • fname – pml-file name

  • name – name of a pharmacophore which would be stored in a file and will be displayed in LigandScout

Returns

nothing

save_to_pma(fname, feature_ids=None)

Saves pharmacophore in json format. This is a native way to store pharmacophore objects in a readable format.

Parameters
  • fname – pma-file name

  • feature_ids – ids of features which should be stored. Default: None (all features).

Returns

nothing

update(bin_step=None, cached=None)

Changes parameters of the pharmacophore instance.

Parameters
  • bin_step (float) – binning step.

  • cached (bool) – whether or not to cache intermediate computation results. This substantially increases speed of repeated computation of a hash or fingerprints.