Helper functions¶
Helper functions — prolif.utils
¶
-
prolif.utils.
get_residues_near_ligand
(lig, prot, cutoff=6.0)[source]¶ Detects residues close to a reference ligand
- Parameters
lig (prolif.molecule.Molecule) – Select residues that are near this ligand
prot (prolif.molecule.Molecule) – Protein containing the residues
cutoff (float) – If any interatomic distance between the ligand reference points and a residue is below or equal to this cutoff, the residue will be selected
- Returns
residues – A list of unique
ResidueId
that are close to the ligand- Return type
-
prolif.utils.
to_bitvectors
(df)[source]¶ Converts an interaction DataFrame to a list of RDKit ExplicitBitVector
- Parameters
df (pandas.DataFrame) – A DataFrame where each column corresponds to an interaction between two residues
- Returns
bv – A list of
ExplicitBitVect
for each frame- Return type
Example
>>> from rdkit.DataStructs import TanimotoSimilarity >>> bv = prolif.to_bitvectors(df) >>> TanimotoSimilarity(bv[0], bv[1]) 0.42
-
prolif.utils.
to_dataframe
(ifp, interactions, index_col='Frame', dtype=None, drop_empty=True)[source]¶ Converts IFPs to a pandas DataFrame
- Parameters
ifp (list) – A list of dict in the format {key: bitvector} where “bitvector” is a numpy.ndarray obtained by running the
bitvector()
method of aFingerprint
, and “key” is a tuple of ligand and protein ResidueId. Each dictionnary must also contain an entry that will be used as an index, typically a frame number.interactions (list) – A list of interactions, in the same order as the bitvector.
index_col (str) – The dictionnary key that will be used as an index in the DataFrame
dtype (object or None) – Cast the input of each bit in the bitvector to this type. If None, keep the data as is.
drop_empty (bool) – Drop columns with only empty values
- Returns
df – A 3-levels DataFrame where each ligand residue, protein residue, and interaction type are in separate columns
- Return type
Example
>>> df = prolif.to_dataframe(results, fp.interactions.keys(), dtype=int) >>> print(df) ligand LIG1.G protein ILE59 ILE55 TYR93 interaction Hydrophobic HBAcceptor Hydrophobic Hydrophobic PiStacking Frame 0 0 1 0 0 0 ...