1.1.1.2. molpher.algorithms package

The algorithms package contains implementations of complete exploration algorithms. Each algorithm is implemented within its own subpackage. All subpackages contain a run module that contains the run() function which can be used to set up and initiate a search (or multiple searches).

1.1.1.2.2. Submodules

1.1.1.2.3. molpher.algorithms.functions module

General utility functions for the algorithms.

molpher.algorithms.functions.find_path(tree, end_mol=None)[source]

Backtracks the tree starting from end_mol and returns a list of SMILES strings representing the path from the root of the tree to end_mol.

Parameters:
  • tree (instance of ExplorationTree) – a tree to backtrack through
  • end_mol (str) – SMILES of the last molecule in the requested path (target molecule by default)
Returns:

list of SMILES of molecules on the path

Return type:

list of str

molpher.algorithms.functions.timeit(func)[source]

Executes func and returns its runtime.

Parameters:func (any callable) – function to time
Returns:runtime of func
Return type:float

1.1.1.2.4. molpher.algorithms.operations module

Custom operations and callbacks shared between algorithms.

class molpher.algorithms.operations.FindClosest[source]

Bases: object

Callback that will search for a molecule closest to the target and saves it as a copy to the self.closest

closest = None

MolpherMol instance (copy of the closest molecule) after the callback was executed, initialized to None

1.1.1.2.5. molpher.algorithms.settings module

class molpher.algorithms.settings.Settings(source, target, storage_dir, max_threads=None, max_iters=100, tree_params=None, verbose=False, filters=63)[source]

Bases: object

Holds basic settings and parameters shared among the exploration algorithms.

max_iters = None

maximum number of iterations to spend on a search

max_threads = None

maximum number of threads to use in computations (uses all available CPUs by default)

source = None

SMILES string of the source molecule

storage_dir = None

path to a directory where results will be stored

target = None

SMILES string of the target molecule

tree_params = None

parameters of the exploration tree; either a dictionary like in params or an instance of ExplorationData

verbose = None

some algorithms can support verbose output

1.1.1.2.6. Module contents