Pharmacophore API

Introduction

This documents the various classes of the pharmacophore module, available to CSD-Discovery and CSD-Enterprise users.

pharmacophore.py - access to pharmacophore searches.

This allows pharmacophore models to be read and written, and using these to run searches. Access to the hits is also provided.

API

class ccdc.pharmacophore.Pharmacophore[source]

Namespace for the Pharmacophore functionality.

class AnnotationFilter(key, value)[source]
key

The annotation filter key.

value

The annotation filter value.

class AnyCentroidPointGenerator(identifier)[source]
class DummyPointGenerator(identifier)[source]

Generates no points.

class ExcludedVolume(sphere)[source]
class Feature(feature_definition, *spheres)[source]

A feature in a Query.

add_sphere(sphere)[source]

Add a sphere to the feature definition.

Parameters:sphereccdc.descriptors.GeometricDescriptors.Sphere instance
colour

The colour of the spheres.

component_label

The component label

description

Description of the feature definition.

identifier

The identifier of the feature definition.

spheres

The spheres defined by this feature definition.

class FeatureDatabase(file_name, _feature_db=None)[source]

A database of pharmacophore features.

class Creator(settings=None)[source]

The creator for feature databases.

class Settings(feature_definition_directory=None, n_threads=None)[source]

Settings for feature database creation.

class StructureDatabase(db_info, use_crystal_symmetry=True, sqlmol2_database_path=None, structure_filters=None, structure_database_path=None)[source]

A database of structures from which a feature database may be created.

static default_csd_filters()[source]

Suggested filters for CSD structures to include in pharmacophore feature database.

create(structure_databases, feature_defs=None)[source]

Create the feature database.

Parameters:
class DatabaseInfo(file_name, n_entries, colour)
colour

Alias for field number 2

file_name

Alias for field number 0

n_entries

Alias for field number 1

class Entry(_entry=None)[source]

An entry in a FeatureDatabase.

annotations

The dictionary of annotations for the entry.

clear_annotations()[source]

Clear all annotations from the entry.

identifier

The identifier of the entry.

add_feature_definition(feature_definition)[source]

Add a feature definition to the database.

NB: this feature definition will not be indexed, so will run rather more slowly if required in a search. If you want this feature to be indexed, then the database will need to be recreated with the feature present.

annotate(pattern, **kw)[source]

Add or replace an annotation in the database.

Parameters:pattern – a glob-style pattern which will be used to match against identifiers.

All entries in the database with a matching identifier will be annotated with the key, value pairs of the kw argument.

annotation_keys

The annotations available in this database.

clear_annotations()[source]

Remove all annotations from the database.

databases

The structure databases used in the construction of this feature database.

Each database is presented as a tuple, file_name, nentries, colour.

entry(identifier)[source]

The ccdc.pharmacophore.Pharmacophore.FeatureDatabase.Entry corresponding to the identifier.

Returns:a ccdc.pharmacophore.Pharmacophore.FeatureDatabase.Entry instance.
Raises:RuntimeError if the identifier is not present.
feature_definitions

The feature definitions present in the database.

static from_file(feature_database_path)[source]

Read a pharmacophore feature database from the specified path.

Parameters:feature_database_path – pharmacophore feature database file path.
Returns:ccdc.Pharmacophore.FeatureDatabase instance.
identifiers

All identifiers from the database.

schema_version

The database schema version.

write(file_name)[source]

Write a pharmacophore feature database to the specified path.

Parameters:file_name – pharmacophore feature database file path.
class FeatureDefinition(_feature_def=None)[source]

A feature definition in a feature database.

colour

The colour associated with this feature.

component_label

Which component (protein, small_molecule or any) the feature def applies to.

copy()[source]

Copies the Feature so it can be edited freely.

features_from_atoms(point_generator, *atoms)[source]

Create features from this feature definition and an atom of the appropriate type.

Parameters:
  • point_generator – a string giving one of the point_generator_names associated with this definition.
  • *atoms – an iterable of ccdc.molecule.Atom instances.
Returns:

a ccdc.pharmacophore.Pharmacophore.Feature instance.

Raises:

RuntimeError – if the atom is not suitable for the feature definition.

static from_SMARTS_definitions(identifier, smarts, point_generators)[source]

Create a feature from SMARTS definitions.

Parameters:
  • identifier – string
  • smarts – iterable of ccdc.pharmacophore.Pharmacophore.SMARTS_definition instances.
  • point_generators – iterable of ccdc.pharmacophore.Pharmaophore.PointGenerator instances.
static from_file(file_name)[source]

Reads a structural feature definition from a file.

identifier

The identifier of the feature.

point_generator_names

The names of the point generator schemes associated with this feature definition.

write(file_name)[source]

Writes the feature definition.

class LinearPointGenerator(identifier, distance=2.8, neighbour_is_base_feature=False)[source]

Generates a point displaced from the relevant atom.

class NonPlanarCentroidPointGenerator(identifier, atom_planarity_threshold=0.0)[source]
class NormalPointGenerator(identifier, distance=2.8)[source]

Generates a point from the normal to the plane of atoms.

class PlanarCentroidPointGenerator(identifier, atom_planarity_threshold=0.0)[source]
class PlanarNormalPointGenerator(identifier, distance=2.8, planar_ring_tolerance=0.0)[source]

Generates a point from the normal to the plane of a planar ring.

class PointGenerator(_pg=None)[source]

A mechanism for generating spheres from a SMARTS match.

feature_points(atoms)[source]

The points generated by this generator.

Raises:RuntimeError if the sequence of points is inappropriate for the generator.
parameters

The optional parameters of the point generator.

class PointPointGenerator(identifier)[source]

Generates a single point at the position of the relevant atom.

class Query(features=None, _motif_pharmacophore=None)[source]

A pharmacophore query.

class DistanceConstraint(feature_point1, feature_point2, distance_range, which)
distance_range

Alias for field number 2

feature_point1

Alias for field number 0

feature_point2

Alias for field number 1

which

Alias for field number 3

add_distance_constraint(feature1, feature2, distance_range, which)[source]

Add a distance constraint between features.

Parameters:
  • feature1 – a feature in the model, the tuple contains an id and a point.
  • feature2 – a feature in the model, the tuple contains an id and a point.
  • distance_range – a pair of numbers specifying the desired range.
  • which – ‘intramolecular’, ‘intermolecular’ or ‘any’.
add_feature(feature)[source]

Add a feature to the pharmacophore.

bounding_sphere

A minimum volums sphere containing all the feature points.

features

The features of the pharmacophore.

static from_file(file_name)[source]

Read a pharmacophore query from a file.

intra_only

Whether all features should be intramolecular.

maximum_feature_distance

The maximum distance between features.

packing

Whether to use crystal packing for query structure.

write(pharmacophore_path)[source]

Write a pharmacophore query to a file.

class SMARTSDefinition(smarts, point_generators, _sd=None, **kw)[source]

A SMARTS definition with associated point generation schemes.

SMARTS

The SMARTS string.

allow_overlaps

Whether fully overlapping structures are permitted to be a hit.

apply_rule

How to apply the SMARTS definition.

permutational_equivalence

Whether permutionally equivalent structures are deemed to be a single match.

point_generators

The generators for feature points.

search(crystal)[source]

Search a crystal for instances of the SMARTS pattern.

class Search(settings=None)[source]

A pharmacophore search

class Settings(max_hits_per_structure=5, max_hit_structures=100000)[source]

Settings for a pharmacophore search.

complete_proteins

Whether or not to return the complete protein of a hit.

complete_small_molecules

Whether or not to return the complete small molecule hit.

max_hit_rmsd

The maximum RMSD of hit structures to be returned.

max_hit_structures

The number of hits to retain.

max_hits_per_structure

The number of hits per structure to be returned.

n_threads

The number of threads to use in the search.

skip_proteins

Whether or not to skip protein structures.

three_cubed_packing

Whether or not to use 3 cubed packing.

feature_database

The CSD-CrossMiner feature database.

search(model, database=None, verbose=False, stop_after=9223372036854775807)[source]

Perform a pharmacophore search.

class SearchHit(model, _motif_pharmacophore_hit=None)[source]

Pharmacophore search hit.

annotations

The annotations of the hit.

cluster_number

The pharmacophore hit cluster number

constraint_values()[source]

The values of the distance constraints of the query.

feature_points(feature)[source]

The points in the hit associated with the given feature.

identifier

The hit identifier

molecule

The pharmacophore overlay molecule

overlay_rmsd

The root-mean-square deviation of the pharmacophore overlay

overlay_transformation

The transformation matrix of the pharmacophore overlay

points

The matched points of the hit.

protein

The hit’s protein, if any.

small_molecule

The hit’s small molecule.

class TetrahedralPointGenerator(identifier, distance=2.8)[source]

Generates two points with a tetrahedral geometry.

class TrigonalPointGenerator(identifier, distance=2.8)[source]

Generates two points with a trigonal geometry.

static default_feature_database()[source]

The CSD provided CrossMiner feature database.

static default_feature_database_location()[source]

The path to the default CrossMiner database.

static read_feature_definitions(directory=None)[source]

Read all the feature definitions found in any subdirectory of the provided argument.

By default this will read the feature definitions supplied by the CSD.