1.1.1.2.1.1. molpher.algorithms.antidecoys package¶
1.1.1.2.1.1.1. Submodules¶
1.1.1.2.1.1.2. molpher.algorithms.antidecoys.custom_opers module¶
Custom operations and callbacks used in
AntidecoysPathFinder
.
-
class
molpher.algorithms.antidecoys.custom_opers.
AntiFpSortCallback
(antifp_scores)[source]¶ Bases:
molpher.swig_wrappers.core.SortMorphsCallback
Parameters: antifp_scores ( dict
) – SMILES to anti-fingerprint similarity map (for each molecule incandidates
)This callback is used to sort
candidates
with regard to their similarity to the anti-fingerprint. Molecules less similar to the anti-fingerprint are ranked higher than more similar ones.-
antifp_scores
= None¶ SMILES to anti-fingerprint score map (for each molecule in
candidates
)
-
maximum_common_bits_perc
= None¶ maximum percentage of bits that one
candidate morph
has in common with the anti-fingerprint
-
minimum_common_bits_perc
= None¶ minimum percentage of bits that one
candidate morph
has in common with the anti-fingerprint
-
-
class
molpher.algorithms.antidecoys.custom_opers.
AntidecoysFilter
(scores, common_bits_thrs, minimum_accept)[source]¶ Bases:
molpher.core.operations.TreeOperation.TreeOperation
Parameters: - scores – a
dict
mapping a SMILES string of a molecule incandidates
to the corresponding score value - common_bits_thrs – maximum percentage of bits in common with the anti-fingerprint allowed in the
- minimum_accept – always accept at least this many top scoring molecules
A filtering
tree operation
which filters the morphs incandidates
based oncommon_bits_thrs
. All morphs with anti-fingerprint score bigger thancommon_bits_thrs
are rejected. However, at leastminimum_accept
best morphs survives.-
common_bits_thrs
= None¶ maximum percentage of bits in common with the anti-fingerprint allowed in the
-
minimum_accept
= None¶ always accept at least this many top scoring molecules
-
scores
= None¶ a
dict
mapping a SMILES string of a molecule incandidates
to the corresponding score value
- scores – a
-
class
molpher.algorithms.antidecoys.custom_opers.
GatherAntiFPScores
(out, anti_fp, settings)[source]¶ Bases:
molpher.core.operations.TreeOperation.TreeOperation
Parameters: - out – a dictionary to save the results to
- anti_fp – the anti-fingerprint
- settings –
AntidecoysSettings
A
tree operation
which computes the anti-fingerprint scores using the given settings and anti-fingerprint. For every molecule incandidates
the similarity to the anti-fingerprint is computed and saved as a score into the supplied dictionary.See also
-
antitfp
= None¶ the anti-fingerprint
-
out
= None¶ output dictionary
-
settings
= None¶
1.1.1.2.1.1.3. molpher.algorithms.antidecoys.pathfinder module¶
-
class
molpher.algorithms.antidecoys.pathfinder.
AntidecoysPathFinder
(settings, antifingerprint=None)[source]¶ Bases:
object
Parameters: - settings (
AntidecoysSettings
) – exploration settings and parameters - antifingerprint (
rdkit.cDataStructs.SparseBitVector
) – the anti-fingerprint to use (optional)
Implements a modified version of the bidirectional algorithm. The algorithm tries to avoid some already sampled areas of chemical space by using an ‘anti-fingerprint’, a 2D pharmacophore fingerprint that describes previously explored pharmacophore features and their geometric relationships.
The RDKit implementation of pharmacophore fingerprints is used. Therefore, it is necessary to have RDKit installed to use this class and this module.
If no
antifingerprint
is specified, the search defaults to an ordinarybidirectional
algorithm.-
__dict__
= mappingproxy({'__module__': 'molpher.algorithms.antidecoys.pathfinder', '__doc__': "\n :param settings: exploration settings and parameters\n :type settings: `AntidecoysSettings`\n :param antifingerprint: the anti-fingerprint to use (optional)\n :type antifingerprint: :class:`rdkit.cDataStructs.SparseBitVector`\n\n Implements a modified version of the bidirectional algorithm. The algorithm tries to avoid\n some already sampled areas of chemical space by using an 'anti-fingerprint',\n a 2D pharmacophore fingerprint that describes previously explored pharmacophore features and their geometric relationships.\n\n The `RDKit <http://www.rdkit.org/docs/RDKit_Book.html#representation-of-pharmacophore-fingerprints>`_\n implementation of pharmacophore fingerprints is used. Therefore, it is necessary to have RDKit installed\n to use this class and this module.\n\n If no :samp:`antifingerprint` is specified, the search defaults to an ordinary :mod:`~molpher.algorithms.bidirectional` algorithm.\n\n ", '__init__': <function AntidecoysPathFinder.__init__>, '__call__': <function AntidecoysPathFinder.__call__>, '__dict__': <attribute '__dict__' of 'AntidecoysPathFinder' objects>, '__weakref__': <attribute '__weakref__' of 'AntidecoysPathFinder' objects>})¶
-
__init__
(settings, antifingerprint=None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
__module__
= 'molpher.algorithms.antidecoys.pathfinder'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
antifingerprint
= None¶ the anti-fingerprint
-
connecting_molecule
= None¶ SMILES string of a molecule that connects the two trees
-
settings
= None¶ AntidecoysSettings
object used to initialize this instance
-
source
= None¶ SMILES of the source
-
source_target
= None¶ tree searching from source to target
-
source_target_min
= None¶ FindClosest
holding the current minimum in the ‘source to target’ tree
-
target
= None¶ SMILES of the target
-
target_source
= None¶ tree searching from target to source
-
target_source_min
= None¶ FindClosest
holding the current minimum in the ‘target to source’ tree
-
verbose
= None¶ use verbose output
- settings (
1.1.1.2.1.1.4. molpher.algorithms.antidecoys.run module¶
-
molpher.algorithms.antidecoys.run.
run
(settings, paths_count)[source]¶ Parameters: - settings – instance of
AntidecoysSettings
specifying search parameters - paths_count – number of paths to generate
Returns: a
list
of lists of SMILES strings (each path is represented by a list of SMILES strings)- settings – instance of
1.1.1.2.1.1.5. molpher.algorithms.antidecoys.settings module¶
-
class
molpher.algorithms.antidecoys.settings.
AntidecoysSettings
(source, target, storage_dir='/home/sichom/projects/molpher-lib/doc/antidecoys_data', max_threads=None, tree_params=None, max_iters=100, verbose=False, fg_bins=((0, 2), (2, 5), (5, 8)), fg_min_points=2, fg_max_points=3, min_accepted=1000, common_bits_max_thrs=0.75, common_bits_mean_thrs=0.5, antidecoys_min_iters=10, antidecoys_max_iters=50, distance_thrs=0.2)[source]¶ Bases:
molpher.algorithms.settings.Settings
A specialized class that holds the settings for the anti-decoys algorithm.
-
antidecoys_max_iters
= None¶ maximum number of iterations that will use the antidecoys filter
-
antidecoys_min_iters
= None¶ minimum number of iterations that will use the antidecoys filter
-
common_bits_max_thrs
= None¶ maximum percentage of shared bits between a structure and the anti-fingerprint that the filter will accept on every iteration
-
common_bits_mean_thrs
= None¶ if for the structures that survived the filter the mean common bits percentage falls below this value, antidecoys will be turned off
-
distance_thrs
= None¶ turn antidecoys filter off when the distance between two closest molecules from each tree gets below this value
-
fg_max_points
= None¶ max number of features encoded in the pharmacophore fingerprint (as described here)
-
fg_min_points
= None¶ min number of features encoded in the pharmacophore fingerprint (as described here)
-
min_accepted
= None¶ minimum number of morphs the antidecoys filter will accept on every iteration
-
1.1.1.2.1.1.6. molpher.algorithms.antidecoys.utils module¶
-
molpher.algorithms.antidecoys.utils.
compute_anti_fp
(mols_smiles, sig_fac, antifp_old=None)[source]¶ Computes an anti-fingerprint from the given molecules.
It is possible to specify an existing anti-fingerprint for an update. In this case, the returned fingerprint will be the result of doing a bitwise
or
between the old fingerprint and the one generated from the supplied structures.Parameters: - mols_smiles – SMILES of the molecules to generate the anti-fingerprint from
- sig_fac – RDKit’s signature factory used in the 2D pharmacophore fingerprint computation
- antifp_old – an old anti-fingerprint to update
Returns: new or updated anti-fingerprint
-
molpher.algorithms.antidecoys.utils.
compute_antifp_scores
(mols, anti_fp, settings)[source]¶ Computes (in parallel) the anti-fingerprint scores for the given molecules.
Parameters: - mols – molecules as a list of SMILES strings
- anti_fp – the anti-fingerprint
- settings –
AntidecoysSettings
Returns: a
dict
mapping SMILES of the given molecules to the anti-fingerprint scores
-
molpher.algorithms.antidecoys.utils.
update_target
(tree, target)[source]¶ Change the tree’s target molecule.
Parameters: - tree (
ExplorationTree
) – anexploration tree
- target (
str
) – SMILES string of the new target
- tree (