kripodb.pharmacophores¶
-
kripodb.pharmacophores.
FEATURE_TYPES
= [{'color': 'ff33cc', 'element': 'He', 'key': 'LIPO', 'label': 'Hydrophobe'}, {'color': 'ff9933', 'element': 'P', 'key': 'POSC', 'label': 'Positive charge'}, {'color': '376092', 'element': 'Ne', 'key': 'NEGC', 'label': 'Negative charge'}, {'color': 'bfbfbf', 'element': 'As', 'key': 'HACC', 'label': 'H-bond acceptor'}, {'color': '00ff00', 'element': 'O', 'key': 'HDON', 'label': 'H-bond donor'}, {'color': '00ffff', 'element': 'Rn', 'key': 'AROM', 'label': 'Aromatic'}]¶ Types of pharmacophore feature types. List of dictionaries with the following keys –
- key, short identifier of type
- label, human readable label
- color, hex rrggbb color
- element, Element used in kripo pharmacophore sdfile for this type
-
class
kripodb.pharmacophores.
PharmacophorePointsTable
(h5file, expectedrows=0)[source]¶ Wrapper around pytables table to store pharmacohpore points
Parameters: - h5file (tables.File) – Pytables hdf5 file object which contains the pharmacophores table
- expectedrows (int) – Expected number of pharmacophores. Required when hdf5 file is created, helps optimize compression
Pharmacophore points of a fragment can be retrieved using:
points = table['frag_id1']
points is a list of points, each point is a tuple with following columns feature type key, x, y and z coordinate. The feature type key is defined in FEATURE_TYPES.
Number of pharmacophore points can be requested using:
nr_points = len(table)
To check whether fragment identifier is contained use:
'frag_id1' in table
-
class
kripodb.pharmacophores.
PharmacophoresDb
(filename, mode='r', expectedrows=0, **kwargs)[source]¶ Database for pharmacophores of fragments aka sub-pockets.
Parameters: - filename (str) – File name of hdf5 file to write or read pharmacophores to/from
- mode (str) – Can be ‘r’ for reading or ‘w’ for writing or ‘a’ for appending
- expectedrows (int) – Expected number of pharmacophores. Required when hdf5 file is created, helps optimize compression
- **kwargs – Passed to tables.open_file
Pharmacophore points of a fragment can be retrieved using:
points = db['frag_id1']
points is a list of points, each point is a tuple with following columns feature type key, x, y and z coordinate. The feature type key is defined in FEATURE_TYPES.
-
h5file
¶ tables.File – Object representing an open hdf5 file
-
points
¶ PharmacophorePointsTable – HDF5 table that contains pharmacophore points
-
add_dir
(startdir)[source]¶ Find *_pphore.sd.gz *_pphores.txt file pairs recursively in start directory and add them.
Parameters: startdir (str) – Path to a start directory
-
append
(other)[source]¶ Append pharmacophores in other db to self
Parameters: other (PharmacophoresDb) – The other pharmacophores database
-
close
()[source]¶ Closes the hdf5file
Instead of calling close() explicitly, use context manager:
with PharmacophoresDb('data/pharmacophores.h5') as db: points = db['frag_id1']
-
kripodb.pharmacophores.
as_phar
(frag_id, points)[source]¶ Return pharmacophore in *.phar format.
See align-it for format description.
Parameters: Returns: Pharmacophore is *.phar format
Return type:
-
kripodb.pharmacophores.
read_fragtxtfile
(fragtxtfile)[source]¶ Read a fragment text file
Parameters: fragtxtfile – Filename of fragment text file Returns: Dictionary where key is fragment identifier and value is a list of pharmacophore point indexes. Return type: dict
-
kripodb.pharmacophores.
read_fragtxtfile_as_file
(fileobject)[source]¶ Read a fragment text file object which contains the pharmacophore point indexes for each fragment identifier.
File format is a fragment on each line, the line is space separated with fragment_identifier followed by the pharmacophore point indexes.
Parameters: fileobject (file) – File object to read Returns: Dictionary where key is fragment identifier and value is a list of pharmacophore point indexes. Return type: dict