Pharmacophore API


This documents the various classes of the pharmacophore module, available to CSD-Discovery and CSD-Enterprise users. - 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.


class ccdc.pharmacophore.Pharmacophore[source]

Namespace for the Pharmacophore functionality.

class AnnotationFilter(key, value)[source]
property key

The annotation filter key.

property value

The annotation filter value.

class AnyCentroidPointGenerator(identifier)[source]

Generates a point at the centroid of atoms.

class DummyPointGenerator(identifier)[source]

Generates no points.

class ExcludedVolume(sphere, smarts='[*]')[source]

An excluded volume feature. This expresses a region to exclude if atoms are in this region.

  • sphere – the sphere to exclude

  • smarts – an optional SMARTS pattern that means you can exclude hits that have a specific substructure

within the sphere

property filter_smarts

The SMARTS pattern that controls when an atom excludes in a given volume by substructure matching.

class Feature(feature_definition, *spheres)[source]

A feature in a Query.


Add a sphere to the feature definition.


sphereccdc.descriptors.GeometricDescriptors.Sphere instance

property colour

The colour of the spheres.

property component_label

The component label

property description

Description of the feature definition.

property identifier

The identifier of the feature definition.

property 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.


instances or None. If None, the default set of feature definitions in read in by ccdc.pharmacophore.Pharmacophore.read_feature_definitions() will be used.

class DatabaseInfo(file_name, n_entries, colour)
property colour

Alias for field number 2

property file_name

Alias for field number 0

property n_entries

Alias for field number 1

class Entry(_entry=None)[source]

An entry in a FeatureDatabase.

property annotations

The dictionary of annotations for the entry.


Clear all annotations from the entry.

property identifier

The identifier of the entry.


Add a feature definition to the database.

Note: this feature definition will not be indexed in the database, so will run rather more slowly if required in a search. To add the corresponding index, the database will need to be recreated with the feature present.

annotate(pattern, **kw)[source]

Add or replace an annotation in the database.


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.

property annotation_keys

The annotations available in this database.


Remove all annotations from the database.

property databases

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

Each database is presented as a tuple of file_name, nunmber of entries, and colour.


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


identifier – identifier of the entry.


a ccdc.pharmacophore.Pharmacophore.FeatureDatabase.Entry instance.


RuntimeError if the identifier is not present.

property 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.


feature_database_path – pharmacophore feature database file path.


ccdc.Pharmacophore.FeatureDatabase instance.

property identifiers

All identifiers from the database.

property schema_version

The database schema version.


Write a pharmacophore feature database to the specified path.


file_name – pharmacophore feature database file path.

class FeatureDefinition(_feature_def=None)[source]

A feature definition in a feature database.

property colour

The colour associated with this feature.

property component_label

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


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.

  • point_generator – a string giving one of the point_generator_names associated with this definition.

  • atoms – an iterable of ccdc.molecule.Atom instances.


a ccdc.pharmacophore.Pharmacophore.Feature instance.


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.

  • 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.

property identifier

The identifier of the feature.

property point_generator_names

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


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]

Generates a point at the centroid of atoms which are not planar.

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]

Generates a point at the centre of a planar ring.

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.


The points generated by this generator.


RuntimeError if the sequence of points is inappropriate for the generator.

property 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)
property distance_range

Alias for field number 2

property feature_point1

Alias for field number 0

property feature_point2

Alias for field number 1

property which

Alias for field number 3

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

Add a distance constraint between features.

  • 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 a feature to the pharmacophore.

property bounding_sphere

A minimum volume sphere containing all feature points.

property features

The features of the pharmacophore.

static from_file(file_name)[source]

Read a pharmacophore query from a file.

property intra_only

Whether all features should be intramolecular.

property maximum_feature_distance

The maximum distance between features.

property packing

Whether to use crystal packing for query structure.


Write a pharmacophore query to a file.

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

A SMARTS definition with associated point generation schemes.

property SMARTS

The SMARTS string.

property allow_overlaps

Whether fully overlapping structures are permitted to be a hit.

property apply_rule

How to apply the SMARTS definition.

property permutational_equivalence

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

property point_generators

The generators for feature points.


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.

property complete_proteins

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

property complete_small_molecules

Whether or not to return the complete small molecule hit.

property max_hit_rmsd

The maximum RMSD of hit structures to be returned.

property max_hit_structures

The number of hits to retain.

property max_hits_per_structure

The number of hits per structure to be returned.

property n_threads

The number of threads to use in the search.

property skip_proteins

Whether or not to skip protein structures.

property three_cubed_packing

Whether or not to use 3-cubed packing.

property 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.

property annotations

The annotations of the hit.

property cluster_number

The pharmacophore hit cluster number


The values of the distance constraints of the query.


The points in the hit associated with the given feature.

property identifier

The hit identifier

property molecule

The pharmacophore overlay molecule

property overlay_rmsd

The root-mean-square deviation of the pharmacophore overlay

property overlay_transformation

The transformation matrix of the pharmacophore overlay

property points

The matched points of the hit.

property protein

The hit’s protein, if any.

property 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.