diff --git a/.buildinfo b/.buildinfo new file mode 100644 index 0000000..a78e4bc --- /dev/null +++ b/.buildinfo @@ -0,0 +1,4 @@ +# Sphinx build info version 1 +# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. +config: 608448081a16afd39c4f5c6390ec2392 +tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/_images/analysis-rel.png b/_images/analysis-rel.png new file mode 100644 index 0000000..b64e33f Binary files /dev/null and b/_images/analysis-rel.png differ diff --git a/_images/analysis-seq.png b/_images/analysis-seq.png new file mode 100644 index 0000000..cf09d24 Binary files /dev/null and b/_images/analysis-seq.png differ diff --git a/_images/gui_clustering.png b/_images/gui_clustering.png new file mode 100644 index 0000000..5caa3f6 Binary files /dev/null and b/_images/gui_clustering.png differ diff --git a/_images/gui_input.png b/_images/gui_input.png new file mode 100644 index 0000000..b55d783 Binary files /dev/null and b/_images/gui_input.png differ diff --git a/_images/gui_results.png b/_images/gui_results.png new file mode 100644 index 0000000..d8a7be7 Binary files /dev/null and b/_images/gui_results.png differ diff --git a/_images/line-desc.png b/_images/line-desc.png new file mode 100644 index 0000000..3527263 Binary files /dev/null and b/_images/line-desc.png differ diff --git a/_images/treesearch-rel.png b/_images/treesearch-rel.png new file mode 100644 index 0000000..07ccaa4 Binary files /dev/null and b/_images/treesearch-rel.png differ diff --git a/_images/treesearch-seq.png b/_images/treesearch-seq.png new file mode 100644 index 0000000..09da2b6 Binary files /dev/null and b/_images/treesearch-seq.png differ diff --git a/_sources/aizynthfinder.analysis.rst.txt b/_sources/aizynthfinder.analysis.rst.txt new file mode 100644 index 0000000..fc33748 --- /dev/null +++ b/_sources/aizynthfinder.analysis.rst.txt @@ -0,0 +1,37 @@ +aizynthfinder.analysis package +============================== + +Submodules +---------- + +aizynthfinder.analysis.routes module +------------------------------------ + +.. automodule:: aizynthfinder.analysis.routes + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.analysis.tree\_analysis module +-------------------------------------------- + +.. automodule:: aizynthfinder.analysis.tree_analysis + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.analysis.utils module +----------------------------------- + +.. automodule:: aizynthfinder.analysis.utils + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: aizynthfinder.analysis + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/aizynthfinder.chem.rst.txt b/_sources/aizynthfinder.chem.rst.txt new file mode 100644 index 0000000..3277741 --- /dev/null +++ b/_sources/aizynthfinder.chem.rst.txt @@ -0,0 +1,37 @@ +aizynthfinder.chem package +========================== + +Submodules +---------- + +aizynthfinder.chem.mol module +----------------------------- + +.. automodule:: aizynthfinder.chem.mol + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.chem.reaction module +---------------------------------- + +.. automodule:: aizynthfinder.chem.reaction + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.chem.serialization module +--------------------------------------- + +.. automodule:: aizynthfinder.chem.serialization + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: aizynthfinder.chem + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/aizynthfinder.context.policy.rst.txt b/_sources/aizynthfinder.context.policy.rst.txt new file mode 100644 index 0000000..e23dcf4 --- /dev/null +++ b/_sources/aizynthfinder.context.policy.rst.txt @@ -0,0 +1,45 @@ +aizynthfinder.context.policy package +==================================== + +Submodules +---------- + +aizynthfinder.context.policy.expansion\_strategies module +--------------------------------------------------------- + +.. automodule:: aizynthfinder.context.policy.expansion_strategies + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.context.policy.filter\_strategies module +------------------------------------------------------ + +.. automodule:: aizynthfinder.context.policy.filter_strategies + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.context.policy.policies module +-------------------------------------------- + +.. automodule:: aizynthfinder.context.policy.policies + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.context.policy.utils module +----------------------------------------- + +.. automodule:: aizynthfinder.context.policy.utils + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: aizynthfinder.context.policy + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/aizynthfinder.context.rst.txt b/_sources/aizynthfinder.context.rst.txt new file mode 100644 index 0000000..4f630ec --- /dev/null +++ b/_sources/aizynthfinder.context.rst.txt @@ -0,0 +1,39 @@ +aizynthfinder.context package +============================= + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + aizynthfinder.context.policy + aizynthfinder.context.scoring + aizynthfinder.context.stock + +Submodules +---------- + +aizynthfinder.context.collection module +--------------------------------------- + +.. automodule:: aizynthfinder.context.collection + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.context.config module +----------------------------------- + +.. automodule:: aizynthfinder.context.config + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: aizynthfinder.context + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/aizynthfinder.context.scoring.rst.txt b/_sources/aizynthfinder.context.scoring.rst.txt new file mode 100644 index 0000000..d00112e --- /dev/null +++ b/_sources/aizynthfinder.context.scoring.rst.txt @@ -0,0 +1,29 @@ +aizynthfinder.context.scoring package +===================================== + +Submodules +---------- + +aizynthfinder.context.scoring.collection module +----------------------------------------------- + +.. automodule:: aizynthfinder.context.scoring.collection + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.context.scoring.scorers module +-------------------------------------------- + +.. automodule:: aizynthfinder.context.scoring.scorers + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: aizynthfinder.context.scoring + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/aizynthfinder.context.stock.rst.txt b/_sources/aizynthfinder.context.stock.rst.txt new file mode 100644 index 0000000..e8c6b5b --- /dev/null +++ b/_sources/aizynthfinder.context.stock.rst.txt @@ -0,0 +1,29 @@ +aizynthfinder.context.stock package +=================================== + +Submodules +---------- + +aizynthfinder.context.stock.queries module +------------------------------------------ + +.. automodule:: aizynthfinder.context.stock.queries + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.context.stock.stock module +---------------------------------------- + +.. automodule:: aizynthfinder.context.stock.stock + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: aizynthfinder.context.stock + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/aizynthfinder.interfaces.gui.rst.txt b/_sources/aizynthfinder.interfaces.gui.rst.txt new file mode 100644 index 0000000..9bb3979 --- /dev/null +++ b/_sources/aizynthfinder.interfaces.gui.rst.txt @@ -0,0 +1,37 @@ +aizynthfinder.interfaces.gui package +==================================== + +Submodules +---------- + +aizynthfinder.interfaces.gui.clustering module +---------------------------------------------- + +.. automodule:: aizynthfinder.interfaces.gui.clustering + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.interfaces.gui.pareto\_fronts module +-------------------------------------------------- + +.. automodule:: aizynthfinder.interfaces.gui.pareto_fronts + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.interfaces.gui.utils module +----------------------------------------- + +.. automodule:: aizynthfinder.interfaces.gui.utils + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: aizynthfinder.interfaces.gui + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/aizynthfinder.interfaces.rst.txt b/_sources/aizynthfinder.interfaces.rst.txt new file mode 100644 index 0000000..6740cc4 --- /dev/null +++ b/_sources/aizynthfinder.interfaces.rst.txt @@ -0,0 +1,37 @@ +aizynthfinder.interfaces package +================================ + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + aizynthfinder.interfaces.gui + +Submodules +---------- + +aizynthfinder.interfaces.aizynthapp module +------------------------------------------ + +.. automodule:: aizynthfinder.interfaces.aizynthapp + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.interfaces.aizynthcli module +------------------------------------------ + +.. automodule:: aizynthfinder.interfaces.aizynthcli + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: aizynthfinder.interfaces + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/aizynthfinder.rst.txt b/_sources/aizynthfinder.rst.txt new file mode 100644 index 0000000..65a285b --- /dev/null +++ b/_sources/aizynthfinder.rst.txt @@ -0,0 +1,43 @@ +aizynthfinder package +===================== + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + aizynthfinder.analysis + aizynthfinder.chem + aizynthfinder.context + aizynthfinder.interfaces + aizynthfinder.search + aizynthfinder.tools + aizynthfinder.utils + +Submodules +---------- + +aizynthfinder.aizynthfinder module +---------------------------------- + +.. automodule:: aizynthfinder.aizynthfinder + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.reactiontree module +--------------------------------- + +.. automodule:: aizynthfinder.reactiontree + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: aizynthfinder + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/aizynthfinder.search.breadth_first.rst.txt b/_sources/aizynthfinder.search.breadth_first.rst.txt new file mode 100644 index 0000000..d52a937 --- /dev/null +++ b/_sources/aizynthfinder.search.breadth_first.rst.txt @@ -0,0 +1,29 @@ +aizynthfinder.search.breadth\_first package +=========================================== + +Submodules +---------- + +aizynthfinder.search.breadth\_first.nodes module +------------------------------------------------ + +.. automodule:: aizynthfinder.search.breadth_first.nodes + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.search.breadth\_first.search\_tree module +------------------------------------------------------- + +.. automodule:: aizynthfinder.search.breadth_first.search_tree + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: aizynthfinder.search.breadth_first + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/aizynthfinder.search.dfpn.rst.txt b/_sources/aizynthfinder.search.dfpn.rst.txt new file mode 100644 index 0000000..cbc32db --- /dev/null +++ b/_sources/aizynthfinder.search.dfpn.rst.txt @@ -0,0 +1,29 @@ +aizynthfinder.search.dfpn package +================================= + +Submodules +---------- + +aizynthfinder.search.dfpn.nodes module +-------------------------------------- + +.. automodule:: aizynthfinder.search.dfpn.nodes + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.search.dfpn.search\_tree module +--------------------------------------------- + +.. automodule:: aizynthfinder.search.dfpn.search_tree + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: aizynthfinder.search.dfpn + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/aizynthfinder.search.mcts.rst.txt b/_sources/aizynthfinder.search.mcts.rst.txt new file mode 100644 index 0000000..7a72eef --- /dev/null +++ b/_sources/aizynthfinder.search.mcts.rst.txt @@ -0,0 +1,45 @@ +aizynthfinder.search.mcts package +================================= + +Submodules +---------- + +aizynthfinder.search.mcts.node module +------------------------------------- + +.. automodule:: aizynthfinder.search.mcts.node + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.search.mcts.search module +--------------------------------------- + +.. automodule:: aizynthfinder.search.mcts.search + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.search.mcts.state module +-------------------------------------- + +.. automodule:: aizynthfinder.search.mcts.state + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.search.mcts.utils module +-------------------------------------- + +.. automodule:: aizynthfinder.search.mcts.utils + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: aizynthfinder.search.mcts + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/aizynthfinder.search.retrostar.rst.txt b/_sources/aizynthfinder.search.retrostar.rst.txt new file mode 100644 index 0000000..03af986 --- /dev/null +++ b/_sources/aizynthfinder.search.retrostar.rst.txt @@ -0,0 +1,37 @@ +aizynthfinder.search.retrostar package +====================================== + +Submodules +---------- + +aizynthfinder.search.retrostar.cost module +------------------------------------------ + +.. automodule:: aizynthfinder.search.retrostar.cost + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.search.retrostar.nodes module +------------------------------------------- + +.. automodule:: aizynthfinder.search.retrostar.nodes + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.search.retrostar.search\_tree module +-------------------------------------------------- + +.. automodule:: aizynthfinder.search.retrostar.search_tree + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: aizynthfinder.search.retrostar + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/aizynthfinder.search.rst.txt b/_sources/aizynthfinder.search.rst.txt new file mode 100644 index 0000000..ee2af14 --- /dev/null +++ b/_sources/aizynthfinder.search.rst.txt @@ -0,0 +1,32 @@ +aizynthfinder.search package +============================ + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + aizynthfinder.search.breadth_first + aizynthfinder.search.dfpn + aizynthfinder.search.mcts + aizynthfinder.search.retrostar + +Submodules +---------- + +aizynthfinder.search.andor\_trees module +---------------------------------------- + +.. automodule:: aizynthfinder.search.andor_trees + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: aizynthfinder.search + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/aizynthfinder.tools.rst.txt b/_sources/aizynthfinder.tools.rst.txt new file mode 100644 index 0000000..a756a92 --- /dev/null +++ b/_sources/aizynthfinder.tools.rst.txt @@ -0,0 +1,37 @@ +aizynthfinder.tools package +=========================== + +Submodules +---------- + +aizynthfinder.tools.cat\_output module +-------------------------------------- + +.. automodule:: aizynthfinder.tools.cat_output + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.tools.download\_public\_data module +------------------------------------------------- + +.. automodule:: aizynthfinder.tools.download_public_data + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.tools.make\_stock module +-------------------------------------- + +.. automodule:: aizynthfinder.tools.make_stock + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: aizynthfinder.tools + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/aizynthfinder.utils.rst.txt b/_sources/aizynthfinder.utils.rst.txt new file mode 100644 index 0000000..55c62a6 --- /dev/null +++ b/_sources/aizynthfinder.utils.rst.txt @@ -0,0 +1,109 @@ +aizynthfinder.utils package +=========================== + +Submodules +---------- + +aizynthfinder.utils.bonds module +-------------------------------- + +.. automodule:: aizynthfinder.utils.bonds + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.utils.exceptions module +------------------------------------- + +.. automodule:: aizynthfinder.utils.exceptions + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.utils.files module +-------------------------------- + +.. automodule:: aizynthfinder.utils.files + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.utils.image module +-------------------------------- + +.. automodule:: aizynthfinder.utils.image + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.utils.loading module +---------------------------------- + +.. automodule:: aizynthfinder.utils.loading + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.utils.logging module +---------------------------------- + +.. automodule:: aizynthfinder.utils.logging + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.utils.math module +------------------------------- + +.. automodule:: aizynthfinder.utils.math + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.utils.models module +--------------------------------- + +.. automodule:: aizynthfinder.utils.models + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.utils.mongo module +-------------------------------- + +.. automodule:: aizynthfinder.utils.mongo + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.utils.paths module +-------------------------------- + +.. automodule:: aizynthfinder.utils.paths + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.utils.sc\_score module +------------------------------------ + +.. automodule:: aizynthfinder.utils.sc_score + :members: + :undoc-members: + :show-inheritance: + +aizynthfinder.utils.type\_utils module +-------------------------------------- + +.. automodule:: aizynthfinder.utils.type_utils + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: aizynthfinder.utils + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/cli.rst.txt b/_sources/cli.rst.txt new file mode 100644 index 0000000..bf3f896 --- /dev/null +++ b/_sources/cli.rst.txt @@ -0,0 +1,106 @@ +Command-line interface +====================== + +This tools provide the possibility to perform tree search on a batch of molecules. + +In its simplest form, you type + +.. code-block:: bash + + aizynthcli --config config_local.yml --smiles smiles.txt + +where `config_local.yml` contains configurations such as paths to policy models and stocks (see :doc:`here `) +and `smiles.txt` is a simple text file with SMILES (one on each row). + + +To find out what other arguments are available use the ``-h`` flag. + +.. code-block:: bash + + aizynthcli -h + +That gives something like this: + +.. include:: cli_help.txt + + +By default: + + * `All` stocks are selected if no stock is specified + * `First` expansion policy is selected if not expansion policy is specified + * `All` filter policies are selected if it is not specified on the command-line + +Analysing output +---------------- + + +The results from the ``aizynthcli`` tool when supplying multiple SMILES is an JSON or HDF5 file that can be read as a pandas dataframe. +It will be called `output.json.gz` by default. + +A `checkpoint.json.gz` will also be generated if a checkpoint file path is provided as input when calling the ``aizynthcli`` tool. The +checkpoint data will contain the processed smiles with their corresponding results in each line of the file. + +.. code-block:: + + import pandas as pd + data = pd.read_json("output.json.gz", orient="table") + +it will contain statistics about the tree search and the top-ranked routes (as JSONs) for each target compound, see below. + +When a single SMILES is provided to the tool, the statistics will be written to the terminal, and the top-ranked routes to +a JSON file (`trees.json` by default). + + +This is an example of how to create images of the top-ranked routes for the first target compound + + +.. code-block:: + + import pandas as pd + from aizynthfinder.reactiontree import ReactionTree + + data = pd.read_json("output.json.gz", orient="table") + all_trees = data.trees.values # This contains a list of all the trees for all the compounds + trees_for_first_target = all_trees[0] + + for itree, tree in enumerate(trees_for_first_target): + imagefile = f"route{itree:03d}.png" + ReactionTree.from_dict(tree).to_image().save(imagefile) + +The images will be called `route000.png`, `route001.png` etc. + + +Specification of output +----------------------- + +The JSON or HDF5 file created when running the tool with a list of SMILES will have the following columns + +============================= =========== +Column Description +============================= =========== +target The target SMILES +search_time The total search time in seconds +first_solution_time The time elapsed until the first solution was found +first_solution_iteration The number of iterations completed until the first solution was found +number_of_nodes The number of nodes in the search tree +max_transforms The maximum number of transformations for all routes in the search tree +max_children The maximum number of children for a search node +number_of_routes The number of routes in the search tree +number_of_solved_routes The number of solved routes in search tree +top_score The score of the top-scored route (default to MCTS reward) +is_solved If the top-scored route is solved +number_of_steps The number of reactions in the top-scored route +number_of_precursors The number of starting materials +number_of_precursors_in_stock The number of starting materials in stock +precursors_in_stock Comma-separated list of SMILES of starting material in stock +precursors_not_in_stock Comma-separated list of SMILES of starting material not in stock +precursors_availability Semi-colon separated list of stock availability of the staring material +policy_used_counts Dictionary of the total number of times an expansion policy have been used +profiling Profiling information from the search tree, including expansion models call and reactant generation +stock_info Dictionary of the stock availability for each of the starting material in all extracted routes +top_scores Comma-separated list of the score of the extracted routes (default to MCTS reward) +trees A list of the extracted routes as dictionaries +============================= =========== + +If you running the tool with a single SMILES, all of this data will be printed to the screen, except +the ``stock_info`` and ``trees``. diff --git a/_sources/configuration.rst.txt b/_sources/configuration.rst.txt new file mode 100644 index 0000000..7df00c7 --- /dev/null +++ b/_sources/configuration.rst.txt @@ -0,0 +1,187 @@ + +Configuration file +=================== + +The configuration file that is to be provided to the interfaces +specify file paths to policy models and stocks, in addition to +detailed parameters of the tree search. + +Simple usage +------------ + +Let's say you have a + + * A trained Keras expansion model that is called `uspto_expansion.onnx` + * A library of unique templates called `uspto_templates.csv.gz` + * A stock file in HDF5 format, called `zinc_stock.hdf5` + +(this could have been created by the ``smiles2stock`` tool, see :doc:`here `) + +then to use them in the tree search, create a file called `config.yml` that has the following content + +.. code-block:: yaml + + expansion: + full: + - uspto_expansion.onnx + - uspto_templates.csv.gz + stock: + zinc: zinc_stock.hdf5 + + +Advanced usage +-------------- + +A more detailed configuration file is shown below + +.. code-block:: yaml + + search: + algorithm: mcts + algorithm_config: + C: 1.4 + default_prior: 0.5 + use_prior: True + prune_cycles_in_search: True + search_rewards: + - state score + max_transforms: 6 + iteration_limit: 100 + return_first: false + time_limit: 120 + exclude_target_from_stock: True + break_bonds: [[1, 2], [2, 3]] + freeze_bonds: [[3, 4]] + break_bonds_operator: or + expansion: + my_policy: + type: template-based + model: /path/to/keras/model/weights.hdf5 + template: /path/to/hdf5/templates.hdf5 + template_column: retro_template + cutoff_cumulative: 0.995 + cutoff_number: 50 + use_rdchiral: True + use_remote_models: False + my_full_policy: + - /path/to/keras/model/weights.hdf5 + - /path/to/hdf5/templates.hdf5 + filter: + uspto: + type: quick-filter + model: /path/to/keras/model/weights.hdf5 + exclude_from_policy: rc + filter_cutoff: 0.05 + use_remote_models: False + uspto_full: /path/to/keras/model/weights.hdf5 + stock: + buyables: + type: inchiset + path: /path/to/stock1.hdf5 + emolecules: /path/to/stock1.hdf5 + +The (expansion) policy models are specified using two files + * a checkpoint files from Keras in ONNX or hdf5 format, + * a HDF5 or a CSV file containing templates. + +A key like ``my_policy`` should be set and the configuration contains ``type``, ``model`` and ``template`` that must be provided. +If the other settings are not assigned, their default values are taken. +The policy ``my_full_policy`` exemplifies a short-cut to the template-based expansion model when no other settings need to be +provided, only the ``model`` and ``templates`` can be provided. The default settings will be taken in this case. + +The template file should be readable by ``pandas`` using the ``table`` key and the ``retro_template`` column. +A policy can then be selected using the provided key, like ``my_policy`` in the above example. + +The filter policy model is specified using a single checkpoint file. +Any key like ``uspto`` can be set. The settings contains ``type`` and ``model`` that must be provided. If the other +settings are not assigned, their default values are taken. +The filter ``uspto_full`` exemplifies a short-cut to the quick-filter model when no other settings need to be +provided, only the ``model`` can be provided. The default settings will be taken in this case. + + +The stock files can be + * HDF5 files with the ``table`` key an the ``inchi_key`` column. + * A CSV file with a ``inchi_key`` column + * A text file a single column + +In all cases, the column should contain pre-computed inchi keys of the molecules. +The stocks can be set using any key, like ``buyables`` or ``emolecules`` in the above example. +The ``type`` and ``path`` parameters can also be set along with other parameters. +If no other settings need to be provided, only the ``path`` can be provided, whereby it will be +treated as a +short-cut to the inchiset class.. + +The values in the ``search`` sections are optional, and if missing, default values are considered. These +values can also be taken from environment variables. An example of this can be seen as below: + +.. code-block:: yaml + + search: + iteration_limit: ${ITERATION_LIMIT} + algorithm_config: + C: ${C} + time_limit: ${TIME_LIMIT} + max_transforms: ${MAX_TRANSFORMS} + +These are the available ``search`` settings. The ``algorithm_config`` refers to MCTS settings: + +============================================ ============== =========== +Setting Default value Description +============================================ ============== =========== +algorithm mcts The search algorithm. Can be set to `package.module.ClassName` to use a custom search method. +algorithm_config: C 1.4 The C value used to balance exploitation and exploration in the upper confidence bound score of the nodes. +algorithm_config: default_prior 0.5 The prior that is used if policy-provided priors are not used. +algorithm_config: use_prior True If True, priors from the policy is used instead of the `default_prior`. +algorithm_config: prune_cycles_in_search True If True, prevents the MCTS from creating cycles by recreating previously seen molecules when it is expanded. +algorithm_config: search_rewards [state score] The scoring used for the MCTS search algorithm. +algorithm_config: search_rewards_weights [] The scoring weights used by the Combined Scorer for the MCTS search algorithm. +algorithm_config: immediate_instantiation [] list of expansion policies for which the MCTS algorithm immediately instantiate the children node upon expansion +algorithm_config: mcts_grouping - if is partial or full the MCTS algorithm will group expansions that produce the same state. If ``partial`` is used the equality will only be determined based on the expandable molecules, whereas ``full`` will check all molecules. +max_transforms 6 The maximum depth of the search tree. +iteration_limit 100 The maximum number of iterations for the tree search. +time_limit 120 The maximum number of seconds to complete the tree search. +return_first False If True, the tree search will be terminated as soon as one solution is found. +exclude_target_from_stock True If True, the target is in stock will be broken down. +break_bonds [] The list of lists of atom numbers of molecular bonds pairs to break during the search. +freeze_bonds [] The list of lists of atom numbers of molecular bonds pairs to freeze or retain during the search. +break_bonds_operator and If set to 'and', all bond pairs listed in `break_bonds` must be broken. If set to 'or', breaking any listed bond pair in `break_bonds` is sufficient. +============================================ ============== =========== + + +The ``post_processing`` settings are: + +============================================ ============== =========== +Setting Default value Description +============================================ ============== =========== +min_routes 5 The minumum number of routes to extract if ``all_routes`` is not set. +max_routes 25 The maximum number of routes to extract if ``all_routes`` is not set. +all_routes False If True, will extract all solved routes. +route_distance_model N/A If set, will load the quick route distance model from this checkpoint file. +route_scorer state score The scoring for routes when extracting them in the post processing step. +============================================ ============== =========== + + +The ``expansion`` settings are for template-based models: + +============================================ ============== =========== +Setting Default value Description +============================================ ============== =========== +template_column retro_template The column in the template file that contains the templates. +cutoff_cumulative 0.995 The accumulative probability of the suggested templates is capped at this value. All other templates above this threshold are discarded. +cutoff_number 50 The maximum number of templates that will be returned from the expansion policy. +use_rdchiral True If True, will apply templates with RDChiral, otherwise RDKit will be used. +use_remote_models False If True, will try to connect to remote Tensorflow servers. +rescale_prior False If True, will apply a softmax function to the priors. +mask "" The path to a numpy .npz file containing a Boolean vector of masks for the reaction templates. +============================================ ============== =========== + + +The ``filter`` settings are for quick-filter models: + +============================================ ============== =========== +Setting Default value Description +============================================ ============== =========== +exclude_from_policy [] The list of names of the filter policies to exclude. +filter_cutoff 0.05 The cut-off for the quick-filter policy. +use_remote_models False If True, will try to connect to remote Tensorflow servers. +============================================ ============== =========== diff --git a/_sources/gui.rst.txt b/_sources/gui.rst.txt new file mode 100644 index 0000000..443a59d --- /dev/null +++ b/_sources/gui.rst.txt @@ -0,0 +1,79 @@ +Graphical user interface +======================== + +This tool to provide the possibility to perform the tree search on a single compound using a GUI +through a Jupyter notebook. If you are unfamiliar with notebooks, you find some introduction `here `_. + +To bring up the notebook, use + +.. code-block:: bash + + jupyter notebook + +and browse to an existing notebook or create a new one. + +Add these lines to the first cell in the notebook. + +.. code-block:: + + from aizynthfinder.interfaces import AiZynthApp + app = AiZynthApp("/path/to/configfile.yaml") + +where the ``AiZynthApp`` class needs to be instantiated with the path to a configuration file (see :doc:`here `). + +To use the interface, follow these steps: + +1. Executed the code in the cell (press ``Ctrl+Enter``) and a simple GUI will appear +2. Enter the target SMILES and select stocks and policy model. +3. Press the ``Run Search`` button to perform the tree search. + +.. image:: gui_input.png + + +4. Press the ``Show Reactions`` to see the top-ranked routes + + +.. image:: gui_results.png + +You can also choose to select and sort the top-ranked routes based on another scoring function. + + +Creating the notebook +--------------------- + +It is possible to create a notebook automatically with the ``aizynthapp`` tool + +.. code-block:: bash + + aizynthapp --config config_local.yml + +which will also automatically opens up the created notebook. + +Analysing the results +--------------------- + +When the tree search has been finished. One can continue exploring the tree and extract output. +This is done by using the ``finder`` property of the app object. The finder holds a reference to an ``AiZynthFinder`` object. + +.. code-block:: + + finder = app.finder + stats = finder.extract_statistics() + + +Clustering +----------- + +There is a GUI extension to perform clustering of the routes. Enter the following a new cell + +.. code-block:: + + %matplotlib inline + from aizynthfinder.interfaces.gui.clustering import ClusteringGui + ClusteringGui.from_app(app) + + +A GUI like this will be shown, where you see the hierarchy of the routes and then can select how many +clusters you want to create. + +.. image:: gui_clustering.png \ No newline at end of file diff --git a/_sources/howto.rst.txt b/_sources/howto.rst.txt new file mode 100644 index 0000000..e29e6a6 --- /dev/null +++ b/_sources/howto.rst.txt @@ -0,0 +1,135 @@ +How-to +======= + +This page outlines a few guidelines on some more advanced use-cases of AiZynthFinder or +frequently raised issues. + + +Using Retro* +------------ + +AiZynthFinder implements other search algorithms than MCTS. This is an example of how Retro* can be used. + +The search algorithm is specified in the configuration file. + +.. code-block:: yaml + + search: + algorithm: aizynthfinder.search.retrostar.search_tree.SearchTree + + +This will use Retro* without a constant-valued oracle function. To specify the oracle function, you can +do + +.. code-block:: yaml + + search: + algorithm: aizynthfinder.search.retrostar.search_tree.SearchTree + algorithm_config: + molecule_cost: + cost: aizynthfinder.search.retrostar.cost.RetroStarCost + model_path: retrostar_value_model.pickle + fingerprint_length: 2048 + fingerprint_radius: 2 + dropout_rate: 0.1 + +The pickle file can be downloaded from `here `_ + + +Using multiple expansion policies +--------------------------------- + +AiZynthFinder can use multiple expansion policies. This gives an example how a general USPTO and a RingBreaker model +can be used together + +.. code-block:: yaml + + expansion: + uspto: + - uspto_keras_model.hdf5 + - uspto_unique_templates.csv.gz + ringbreaker: + - uspto_ringbreaker_keras_model.hdf5 + - uspto_ringbreaker_unique_templates.csv.gz + multi_expansion_strategy: + type: aizynthfinder.context.policy.MultiExpansionStrategy + expansion_strategies: [uspto, ringbreaker] + additive_expansion: True + +and then to use this with ``aizynthcli`` do something like this + +.. code-block:: + + aizynthcli --smiles smiles.txt --config config.yml --policy multi_expansion_strategy + + +Output more routes +------------------ + +The number of routes in the output of ``aizynthcli`` can be controlled from the configuration file. + +This is how you can extract at least 25 routes but not more than 50 per target + +.. code-block:: yaml + + post_processing: + min_routes: 25 + max_routes: 50 + +Alternatively, you can extract all solved routes. If a target is unsolved, it will return the number +of routes specified by ``min_routes`` and ``max_routes``. + +.. code-block:: yaml + + post_processing: + min_routes: 5 + max_routes: 10 + all_routes: True + + +Running multi-objective (MO) MCTS with disconnection-aware Chemformer +------------------ +Disconnection-aware retrosynthesis can be done with 1) MO-MCTS (state score + broken bonds score), 2) Chemformer or 3) both. + +First, you need to specify the bond constraints under search, see below. +To run the MO-MCTS with the "broken bonds" score, add the "broken bonds" score to the list of search_rewards: + +.. code-block:: yaml + + search: + break_bonds: [[1, 2], [3, 4]] + freeze_bonds: [] + algorithm_config: + search_rewards: ["state score", "broken bonds"] + +To use the disconnection-aware Chemformer, you first need to add the `plugins` folder to the `PYTHONPATH`, e.g. + + export PYTHONPATH=~/aizynthfinder/plugins/ + +The script for starting a disconnection-aware Chemformer service is available at https://github.com/MolecularAI/Chemformer. +The multi-expansion policy with template-based model and Chemformer is specified with: + +.. code-block:: yaml + expansion: + standard: + type: template-based + model: path/to/model + template: path/to/templates + chemformer_disconnect: + type: expansion_strategies.DisconnectionAwareExpansionStrategy + url: "http://localhost:8023/chemformer-disconnect-api/predict-disconnection" + n_beams: 5 + multi_expansion: + type: aizynthfinder.context.policy.MultiExpansionStrategy + expansion_strategies: [chemformer_disconnect, standard] + additive_expansion: True + cutoff_number: 50 + + +To use MO-tree ranking and building, set: + +.. code-block:: yaml + post_processing: + route_scorers: ["state score", "broken bonds"] + +Note: If post_processing.route_scorers is not specified, it will default to search.algorithm_config.search_rewards. \ No newline at end of file diff --git a/_sources/index.rst.txt b/_sources/index.rst.txt new file mode 100644 index 0000000..1ea8fea --- /dev/null +++ b/_sources/index.rst.txt @@ -0,0 +1,78 @@ +aizynthfinder documentation +=========================== + +aizynthfinder is a tool for retrosynthetic planning. The default algorithm is based on a Monte Carlo tree search that recursively breaks down a molecule to purchasable precursors. The tree search is guided by a policy that suggests possible precursors by utilizing a neural network trained on a library of known reaction templates. + +Introduction +------------ + +You run retrosynthesis experiments you need a trained model and a stock collection. You can download a public available model based on USPTO and a stock collection from ZINC database. + +.. code-block:: + + download_public_data . + +This will download the data to your current directory. The ``config.yml`` file can be used directly with the interfaces. + + +There are two main interfaces provided by the package: + + * a script that performs tree search in batch mode and + * an interface that is providing a GUI within a Jupyter notebook. + + +The GUI interface should be run in a Jupyter notebook. This is a simple example of the code in a Jupyter notebook cell. + +.. code-block:: + + from aizynthfinder.interfaces import AiZynthApp + app = AiZynthApp("/path/to/configfile.yaml") + +where the ``AiZynthApp`` class needs to be instantiated with the path to a configuration file (see :doc:`here `). + +To use the interface, follow these steps: + + 1. Executed the code in the cell (press ``Ctrl+Enter``) and a simple GUI will appear + 2. Enter the target SMILES and select stocks and policy model. + 3. Press the ``Run Search`` button to perform the tree search. + 4. Press the ``Show Reactions`` to see the top-ranked routes + + + +The batch-mode script is called ``aizynthcli`` and can be executed like: + +.. code-block:: bash + + aizynthcli --config config.yml --smiles smiles.txt + + +where `config.yml` contains configurations such as paths to policy models and stocks (see :doc:`here `), and `smiles.txt` is a simple text +file with SMILES (one on each row). + +If you just want to perform the tree search on a single molecule. You can directly specify it on the command-line +within quotes: + +.. code-block:: bash + + aizynthcli --config config.yml --smiles "COc1cccc(OC(=O)/C=C/c2cc(OC)c(OC)c(OC)c2)c1" + + +The output is some statistics about the tree search, the scores of the top-ranked routes, and the reaction tree +of the top-ranked routes. When smiles are provided in a text file the results are stored in a JSON file, +whereas if the SMILEs is provided on the command-line it is printed directly to the prompt +(except the reaction trees, which are written to a JSON file). + + +.. toctree:: + :hidden: + + gui + cli + python_interface + configuration + stocks + scoring + howto + aizynthfinder + sequences + relationships \ No newline at end of file diff --git a/_sources/modules.rst.txt b/_sources/modules.rst.txt new file mode 100644 index 0000000..bad1194 --- /dev/null +++ b/_sources/modules.rst.txt @@ -0,0 +1,7 @@ +aizynthfinder +============= + +.. toctree:: + :maxdepth: 4 + + aizynthfinder diff --git a/_sources/python_interface.rst.txt b/_sources/python_interface.rst.txt new file mode 100644 index 0000000..df283b9 --- /dev/null +++ b/_sources/python_interface.rst.txt @@ -0,0 +1,109 @@ +Python interface +================ + +This page gives a quick example of how the tree search can be completed +by writing your own python interface. This is not recommended for most users. + + +1. Import the necessary class + +.. code-block:: python + + from aizynthfinder.aizynthfinder import AiZynthFinder + + +2. Instantiate that class by providing a configuration file. + + +.. code-block:: python + + filename = "config.yml" + finder = AiZynthFinder(configfile=filename) + + +3. Select stock and policy + + +.. code-block:: python + + finder.stock.select("zinc") + finder.expansion_policy.select("uspto") + finder.filter_policy.select("uspto") + +`zinc` and `uspto` where the keys given to the stock and the policy in the configuration file. +The first policy set is the expansion policy and the second is the filter policy. The filter policy is optional. + +4. Set the target SMILES and perform the tree search + + +.. code-block:: python + + finder.target_smiles = "Cc1cccc(c1N(CC(=O)Nc2ccc(cc2)c3ncon3)C(=O)C4CCS(=O)(=O)CC4)C" + finder.tree_search() + + +5. Analyse the search tree and build routes + + +.. code-block:: python + + finder.build_routes() + stats = finder.extract_statistics() + + +The ``build_routes`` method needs to be called before any analysis can be done. + +Expansion interface +------------------- + +There is an interface for the expansion policy as well. It can be used to break down a molecule into reactants. + +.. code-block:: python + + filename = "config.yml" + expander = AiZynthExpander(configfile=filename) + expander.expansion_policy.select("uspto") + expander.filter_policy.select("uspto") + reactions = expander.do_expansion("Cc1cccc(c1N(CC(=O)Nc2ccc(cc2)c3ncon3)C(=O)C4CCS(=O)(=O)CC4)C") + +for this, you only need to select the policies. The filter policy is optional and using it will only add the +feasibility of the reactions not filter it out. + +The result is a nested list of `FixedRetroReaction` objects. This you can manipulate to for instance get +out all the reactants SMILES strings + +.. code-block:: python + + reactants_smiles = [] + for reaction_tuple in reactions: + reactants_smiles.append([mol.smiles for mol in reaction_tuple[0].reactants[0]) + +or you can put all the metadata of all the reactions in a pandas dataframe + +.. code-block:: python + + import pandas as pd + metadata = [] + for reaction_tuple in reactions: + for reaction in reaction_tuple: + metadata.append(reaction.metadata) + df = pd.DataFrame(metadata) + + +Further reading +--------------- + +The docstrings of all modules, classes and methods can be consulted :doc:`here ` + + +and you can always find them in an interactive Python shell using for instance: + +.. code-block:: python + + from aizynthfinder.chem import Molecule + help(Molecule) + help(Molecule.fingerprint) + + +If you are interested in the the relationships between the classes have a look :doc:`here ` +and if you want to dig deeper in to the main algorithmic sequences have a look :doc:`here ` \ No newline at end of file diff --git a/_sources/relationships.rst.txt b/_sources/relationships.rst.txt new file mode 100644 index 0000000..bef2980 --- /dev/null +++ b/_sources/relationships.rst.txt @@ -0,0 +1,24 @@ +Relationships +============= + +This page shows some relationship diagrams, i.e. how the different objects are connect in a typical retrosynthesis +analysis using Monte Carlo tree search. + +These are the tree different types of relationships used: + +.. image:: line-desc.png + +Tree search +----------- + +This diagram explains how the different object are connect that are responsible for the Monte-Carlo tree search. + +.. image:: treesearch-rel.png + + +Analysis / post-processing +-------------------------- + +This diagram explains how the different objects involved in the analysis of the search are connected. + +.. image:: analysis-rel.png diff --git a/_sources/scoring.rst.txt b/_sources/scoring.rst.txt new file mode 100644 index 0000000..6ff1d1d --- /dev/null +++ b/_sources/scoring.rst.txt @@ -0,0 +1,63 @@ +Scoring +======= + +aizynthfinder is capable of scoring reaction routes, both in the form of ``MctsNode`` objects when a search tree is available, +and in the form of ``ReactionTree`` objects if post-processing is required. + +Currently, there are a few scoring functions available + + * State score - a function of the number of precursors in stock and the length of the route + * Number of reactions - the number of steps in the route + * Number of pre-cursors - the number of pre-cursors in the route + * Number of pre-cursors in stock - the number of the pre-cursors that are purchaseable + * Average template occurrence - the average occurrence of the templates used in the route + * Sum of prices - the plain sum of the price of all pre-cursors + * Route cost score - the cost of the synthesizing the route (Badowski et al. Chem Sci. 2019, 10, 4640) + + +The *State score* is the score that is guiding the tree search in the :doc:`update phase `, and +this is not configurable. + +In the Jupyter notebook :doc:`GUI ` one can choose to score the routes with any of the loaded the scorers. + +The first four scoring functions are loaded automatically when an ``aizynthfinder`` object is created. + + +Add new scoring functions +------------------------- + + +Additional scoring functions can be implemented by inheriting from the class ``Scorer`` in the ``aizynthfinder.context.scoring.scorers`` module. +The scoring class needs to implement the ``_score_node``, ``_score_reaction_tree`` and the ``__repr__`` methods. + +This is an example of that. + +.. code-block:: python + + from aizynthfinder.context.scoring.scorers import Scorer + + class DeltaNumberOfTransformsScorer(Scorer): + + def __repr__(self): + return "delta number of transforms" + + def _score_node(self, node): + return self._config.max_transforms - node.state.max_transforms + + def _score_reaction_tree(self, tree): + return self._config.max_transforms - len(list(tree.reactions())) + + +This can then be added to the ``scorers`` attribute of an ``aizynthfinderfinder`` object. The ``scorers`` attribute is a collection +of ``Scorer`` objects. + +For instance to use this in the Jupyter notebook GUI, one can do + +.. code-block:: python + + from aizynthfinder.interfaces import AiZynthApp + app = AiZynthApp("config_local.yml", setup=False) + scorer = DeltaNumberOfTransformsScorer(app.finder.config) + app.finder.scorers.load(scorer) + app.setup() + diff --git a/_sources/sequences.rst.txt b/_sources/sequences.rst.txt new file mode 100644 index 0000000..c188505 --- /dev/null +++ b/_sources/sequences.rst.txt @@ -0,0 +1,62 @@ +Sequences +========= + +This page shows some sequence diagrams to aid in the understanding of how information +is passed between different objects in the Monte Carlo tree search. +The sequences are simplified, but explains the overall picture. +The flow of information / method call should be read top-down. + +Analysis / post-processing +-------------------------- + +This sequence explains how the ``AiZynthFinder`` object exports the top-ranked reaction tree +as a JSON. Note, this is only one possible sequence for analysis of the trees. + +.. image:: analysis-seq.png + + +Monte Carlo tree search +----------------------- + +This sequence explains how the Monte Carlo tree search is carried out by the ``AiZynthFinder`` object. + +.. image:: treesearch-seq.png + +The following text explains what is executed at each iteration of the tree search (the outer loop in the ``one_iteration()`` method of the ``MctsSearchTree`` class). + +First, a leaf is selected using the ``select_leaf()`` method of the ``MctsSearchTree`` class. This is called the `Selection` phase in the literature and will pick the most promising leaf to continue the search from. In the first iteration, this is simply the root node. For the rest of the iterations, the algorithm will execute the following: + +1. Set the current node to the root +2. Loop while the current is expanded, and the state of the current node is not solved + + a. Select the most promising child of the current node by calling the ``promising_child()`` method of the ``MctsNode`` class. + b. If there is such a child set current node to the child + +3. Return current node + +The loop condition in 2. will use the ``is_expanded`` flag of the current node and the ``is_solved`` flag of the state of the current node (see below). 2.a. might not return any child if all the children of the current node were rejected by the tree search (the templates were not applicable). + +Second, the selected leaf node is expanded. This is called the `Expansion` phase in the literature and is used to add new children to a node. The ``expand()`` method of the ``MctsNode`` class takes care of this, but it actually does not instantiate any children nodes. What it does is to use the expansion policy to extract ``RetroReaction`` objects and the probability of each such action. The probability for each action will also be the initial value of each child node. The ``expand()`` method will also set the visitation count for each child to 1. If the ``is_expanded`` flag of the ``MctsNode`` is set or if the ``is_expandable`` flag is not set (see below), the ``expand()`` method will not do anything. + +Third, we enter the inner loop of the tree search or the `Rollout` phase, which has the purpose of expanding the tree until we reach a terminal state., i.e. until the ``is_terminal`` flag of the current leaf node is set. The inner loop will execute the following steps: + +1. Retrieve the most promising child of the current leaf node (see above). +2. If such a child exists, expand it using the ``expand()`` method and the set current leaf node to this child. + +If 1. does return any child, the ``is_terminal`` flag of the leaf node will have been set and therefore the inner loop will break. Similarly, if the child returned by 1. and set to the current leaf in 2. contains a terminal state, the loop will break. + +Fourth, and finally the algorithm enters the `Backpropagation` phase, which is used to update the value of each node, from the current leaf node all the way to the root. This is done by calling the ``backpropagate()`` method of the ``MctsTreeSearch`` class, which in turn will call the ``backpropagate()`` method of each node on the path between the current leaf and the root. + +A few things are worth mentioning about the ``promising_child()`` method of the ``MctsNode`` class. If will select the most promising child by sorting them on the upper confidence bound (UCB) score. The child with the highest score will be selected for instantiation, which means that the ``RetroReaction`` associated with the child will be applied to create new precursors. These precursors will form the state of the new ``MctsNode`` object that is the child. If the application of the reaction failed to produce any precursors, the child value will be set to a large negative value that prevents it from being selected again. The child value will be set to a large negative value also if a filter policy is used in the search and the filter rejects the reaction. Furthermore, ``promising_child()`` will be called recursively until a child can be instantiated (the reaction can be applied). If none of the children can be instantiated the ``is_expanded`` and ``expandable`` flags are updated, and the method returns no child (``None``). + +This list explains the different flags of the Node and State objects that are used at various points in the tree search algorithm + +================= ============= =========================================================================================== ============================================ ================================================================================= ================================================================================================ +Flag Class Description Used when Initialized to Changed by +================= ============= =========================================================================================== ============================================ ================================================================================= ================================================================================================ +``is_expanded`` ``MctsNode`` is True when the node has been expanded Selection, Expansion False when node is created ``expand()``, sets it to True. ``promising_child()`` sets it to False if no child could be instantiated. +``is_expandable`` ``MctsNode`` is True if the node can be expanded Rollout (indirectly), Expansion Set to the opposite of the ``is_terminal`` flag of the state when node is created ``promising_child()`` sets it to False if no child could be instantiated. +``is_terminal()`` ``MctsNode`` is True if either the node is unexpandable or the ``is_terminal`` flag of the state is set Rollout N/A N/A +``is_solved`` ``MctsState`` is True if all precursors in the state is in stock Selection, State init(indirectly) True or False depending on stock Never +``is_terminal`` ``MctsState`` is True is ``is_solved`` is True or maximum number of transforms has been reached Rollout (indirectly), Node init (indirectly) True or False Never +================= ============= =========================================================================================== ============================================ ================================================================================= ================================================================================================ \ No newline at end of file diff --git a/_sources/stocks.rst.txt b/_sources/stocks.rst.txt new file mode 100644 index 0000000..a100a30 --- /dev/null +++ b/_sources/stocks.rst.txt @@ -0,0 +1,147 @@ +Stocks +====== + +The stock files specified in the configuration file are loaded and a set of inchi keys +are stored in-memory for lookup. However, the tool supports other stock queries as well as a way +to fully customize the lookup. + +Mongo database stock +-------------------- + +First, support for lookup inchi keys in a Mongo database is supported. The Mongo client should +have a database and a collection containing documents with at least two fields: `inchi_key` and `source`. +The `inchi_key` field will be used for lookup and `source` specifies the source database of the compound. + +By adding these lines to the configuration file, the Mongo database will be used: + +.. code-block:: yaml + + stock: + type: mongodb + host: user@myurl.com + database: database_name + collection: compounds + + +If no options are provided to the ``mongodb_stock`` key, the host, database and collection are taken to be `localhost`, +`stock_db`, and `molecules`, respectively. + +Stop criteria +------------- + +The stock can be used to stop the tree search based on three criteria: a) minimum price, b) maximum amount and c) count of different elements in the molecule. +Note that the stock query class need to support querying for price and amount, if the stop criteria should work properly. + +The stop criteria can be specified in the configuration file + +.. code-block:: yaml + + stock: + stop_criteria: + price: 10 + counts: + C: 10 + + +In the Jupyter GUI you can set the limit on the element occurences, but currently not the price and amount limits. + +Custom stock +------------ + +Support for any type of lookup is provided. You just need to write a python class that implements the ``__contains__`` +and subclasses the ``aizynthfinder.context.stock.queries.StockQueryMixin``. The ``__contains__`` method is used for lookup and should take a ``Molecule`` object as only argument. +The ``StockQueryMixin`` mixin class provide a default interface for some methods that perhaps isn't possible to implement in all query classes. + +This is an example: + +.. code-block:: + + from rdkit.Chem import Lipinski + from aizynthfinder.context.stock.queries import StockQueryMixin + class CriteriaStock(StockQueryMixin): + def __contains__(self, mol): + return Lipinski.HeavyAtomCount(mol.rd_mol) < 10 + + +To use this stock with the ``aizynthcli`` tool, save it in a ``custom_stock.py`` module that is located in a directory known to +the python interpreter. Add this line to the module. + +.. code-block:: + + stock = CriteriaStock() + + +and it will be automatically used in the tree search. + +Alternatively the custom query class can be used by the ``aizynthapp`` tool. + + +.. code-block:: + + from aizynthfinder import AiZynthApp + configfile="config_local.yml" + app = AiZynthApp(configfile, setup=False) + app.finder.stock.load(CriteriaStock(), "criteria") # This loads the custom stock class + app.setup() + + +Lastly, it is possible to specify a custom stock class in the configuration file if it is located in a module that +is known by the python interpreter. + +.. code-block:: + + stock: + type: aizynthfinder.contrib.stocks.CriteriaStock + + +can be used if the `aizynthfinder.contrib.stocks` is an existing sub-package and module. + + +Making stocks +------------- + +We provide a tool to create inchi key-based stocks from SMILES strings. Thereby, one +can create a stock based on for instance a subset of the ZINC database. + +The tool support both creating a stock in HDF5 format or adding them to an existing Mongo database. + +The tool is easiest to use if one has a number of plain text files, in which each row has one SMILES. + +Then one can use one of these two commands: + + +.. code-block:: + + smiles2stock --files file1.smi file2.smi --output stock.hdf5 + smiles2stock --files file1.smi file2.smi --output my_db --target mongo + + +to create either an HDF5 stock or a Mongo database stock, respectively. The ``file1.smi`` and ``file2.smi`` +are simple text files and ``my_db`` is the source tag for the Mongo database. + + +If one has SMILES in any other format, one has to provide a custom module that extract the SMILES from +the input files. This is an example of such a module that can be used with downloads from the Zinc database +where the first row contains headers and the SMILES are the first element on each line. + + +.. code-block:: + + def extract_smiles(filename): + with open(filename, "r") as fileobj: + for i, line in enumerate(fileobj.readlines()): + if i == 0: + continue + yield line.strip().split(" ")[0] + + +if this is saved as ``load_zinc.py`` in a path that is known to the Python interpreter, it can be +used like this + +.. code-block:: + + export PYTHONPATH=`pwd` + smiles2stock --files load_zinc file1.smi file2.smi --source module --output stock.hdf5 + + +where the first line adds the current directory to the python path (if you are using a Bash shell). diff --git a/_static/alabaster.css b/_static/alabaster.css new file mode 100644 index 0000000..75b472a --- /dev/null +++ b/_static/alabaster.css @@ -0,0 +1,714 @@ +@import url("basic.css"); + +/* -- page layout ----------------------------------------------------------- */ + +body { + font-family: Georgia, serif; + font-size: 17px; + background-color: #fff; + color: #000; + margin: 0; + padding: 0; +} + + +div.document { + width: 940px; + margin: 30px auto 0 auto; +} + +div.documentwrapper { + float: left; + width: 100%; +} + +div.bodywrapper { + margin: 0 0 0 220px; +} + +div.sphinxsidebar { + width: 220px; + font-size: 14px; + line-height: 1.5; +} + +hr { + border: 1px solid #B1B4B6; +} + +div.body { + background-color: #fff; + color: #3E4349; + padding: 0 30px 0 30px; +} + +div.body > .section { + text-align: left; +} + +div.footer { + width: 940px; + margin: 20px auto 30px auto; + font-size: 14px; + color: #888; + text-align: right; +} + +div.footer a { + color: #888; +} + +p.caption { + font-family: inherit; + font-size: inherit; +} + + +div.relations { + display: none; +} + + +div.sphinxsidebar { + max-height: 100%; + overflow-y: auto; +} + +div.sphinxsidebar a { + color: #444; + text-decoration: none; + border-bottom: 1px dotted #999; +} + +div.sphinxsidebar a:hover { + border-bottom: 1px solid #999; +} + +div.sphinxsidebarwrapper { + padding: 18px 10px; +} + +div.sphinxsidebarwrapper p.logo { + padding: 0; + margin: -10px 0 0 0px; + text-align: center; +} + +div.sphinxsidebarwrapper h1.logo { + margin-top: -10px; + text-align: center; + margin-bottom: 5px; + text-align: left; +} + +div.sphinxsidebarwrapper h1.logo-name { + margin-top: 0px; +} + +div.sphinxsidebarwrapper p.blurb { + margin-top: 0; + font-style: normal; +} + +div.sphinxsidebar h3, +div.sphinxsidebar h4 { + font-family: Georgia, serif; + color: #444; + font-size: 24px; + font-weight: normal; + margin: 0 0 5px 0; + padding: 0; +} + +div.sphinxsidebar h4 { + font-size: 20px; +} + +div.sphinxsidebar h3 a { + color: #444; +} + +div.sphinxsidebar p.logo a, +div.sphinxsidebar h3 a, +div.sphinxsidebar p.logo a:hover, +div.sphinxsidebar h3 a:hover { + border: none; +} + +div.sphinxsidebar p { + color: #555; + margin: 10px 0; +} + +div.sphinxsidebar ul { + margin: 10px 0; + padding: 0; + color: #000; +} + +div.sphinxsidebar ul li.toctree-l1 > a { + font-size: 120%; +} + +div.sphinxsidebar ul li.toctree-l2 > a { + font-size: 110%; +} + +div.sphinxsidebar input { + border: 1px solid #CCC; + font-family: Georgia, serif; + font-size: 1em; +} + +div.sphinxsidebar #searchbox input[type="text"] { + width: 160px; +} + +div.sphinxsidebar .search > div { + display: table-cell; +} + +div.sphinxsidebar hr { + border: none; + height: 1px; + color: #AAA; + background: #AAA; + + text-align: left; + margin-left: 0; + width: 50%; +} + +div.sphinxsidebar .badge { + border-bottom: none; +} + +div.sphinxsidebar .badge:hover { + border-bottom: none; +} + +/* To address an issue with donation coming after search */ +div.sphinxsidebar h3.donation { + margin-top: 10px; +} + +/* -- body styles ----------------------------------------------------------- */ + +a { + color: #004B6B; + text-decoration: underline; +} + +a:hover { + color: #6D4100; + text-decoration: underline; +} + +div.body h1, +div.body h2, +div.body h3, +div.body h4, +div.body h5, +div.body h6 { + font-family: Georgia, serif; + font-weight: normal; + margin: 30px 0px 10px 0px; + padding: 0; +} + +div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; } +div.body h2 { font-size: 180%; } +div.body h3 { font-size: 150%; } +div.body h4 { font-size: 130%; } +div.body h5 { font-size: 100%; } +div.body h6 { font-size: 100%; } + +a.headerlink { + color: #DDD; + padding: 0 4px; + text-decoration: none; +} + +a.headerlink:hover { + color: #444; + background: #EAEAEA; +} + +div.body p, div.body dd, div.body li { + line-height: 1.4em; +} + +div.admonition { + margin: 20px 0px; + padding: 10px 30px; + background-color: #EEE; + border: 1px solid #CCC; +} + +div.admonition tt.xref, div.admonition code.xref, div.admonition a tt { + background-color: #FBFBFB; + border-bottom: 1px solid #fafafa; +} + +div.admonition p.admonition-title { + font-family: Georgia, serif; + font-weight: normal; + font-size: 24px; + margin: 0 0 10px 0; + padding: 0; + line-height: 1; +} + +div.admonition p.last { + margin-bottom: 0; +} + +div.highlight { + background-color: #fff; +} + +dt:target, .highlight { + background: #FAF3E8; +} + +div.warning { + background-color: #FCC; + border: 1px solid #FAA; +} + +div.danger { + background-color: #FCC; + border: 1px solid #FAA; + -moz-box-shadow: 2px 2px 4px #D52C2C; + -webkit-box-shadow: 2px 2px 4px #D52C2C; + box-shadow: 2px 2px 4px #D52C2C; +} + +div.error { + background-color: #FCC; + border: 1px solid #FAA; + -moz-box-shadow: 2px 2px 4px #D52C2C; + -webkit-box-shadow: 2px 2px 4px #D52C2C; + box-shadow: 2px 2px 4px #D52C2C; +} + +div.caution { + background-color: #FCC; + border: 1px solid #FAA; +} + +div.attention { + background-color: #FCC; + border: 1px solid #FAA; +} + +div.important { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.note { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.tip { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.hint { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.seealso { + background-color: #EEE; + border: 1px solid #CCC; +} + +div.topic { + background-color: #EEE; +} + +p.admonition-title { + display: inline; +} + +p.admonition-title:after { + content: ":"; +} + +pre, tt, code { + font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; + font-size: 0.9em; +} + +.hll { + background-color: #FFC; + margin: 0 -12px; + padding: 0 12px; + display: block; +} + +img.screenshot { +} + +tt.descname, tt.descclassname, code.descname, code.descclassname { + font-size: 0.95em; +} + +tt.descname, code.descname { + padding-right: 0.08em; +} + +img.screenshot { + -moz-box-shadow: 2px 2px 4px #EEE; + -webkit-box-shadow: 2px 2px 4px #EEE; + box-shadow: 2px 2px 4px #EEE; +} + +table.docutils { + border: 1px solid #888; + -moz-box-shadow: 2px 2px 4px #EEE; + -webkit-box-shadow: 2px 2px 4px #EEE; + box-shadow: 2px 2px 4px #EEE; +} + +table.docutils td, table.docutils th { + border: 1px solid #888; + padding: 0.25em 0.7em; +} + +table.field-list, table.footnote { + border: none; + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; +} + +table.footnote { + margin: 15px 0; + width: 100%; + border: 1px solid #EEE; + background: #FDFDFD; + font-size: 0.9em; +} + +table.footnote + table.footnote { + margin-top: -15px; + border-top: none; +} + +table.field-list th { + padding: 0 0.8em 0 0; +} + +table.field-list td { + padding: 0; +} + +table.field-list p { + margin-bottom: 0.8em; +} + +/* Cloned from + * https://github.com/sphinx-doc/sphinx/commit/ef60dbfce09286b20b7385333d63a60321784e68 + */ +.field-name { + -moz-hyphens: manual; + -ms-hyphens: manual; + -webkit-hyphens: manual; + hyphens: manual; +} + +table.footnote td.label { + width: .1px; + padding: 0.3em 0 0.3em 0.5em; +} + +table.footnote td { + padding: 0.3em 0.5em; +} + +dl { + margin-left: 0; + margin-right: 0; + margin-top: 0; + padding: 0; +} + +dl dd { + margin-left: 30px; +} + +blockquote { + margin: 0 0 0 30px; + padding: 0; +} + +ul, ol { + /* Matches the 30px from the narrow-screen "li > ul" selector below */ + margin: 10px 0 10px 30px; + padding: 0; +} + +pre { + background: #EEE; + padding: 7px 30px; + margin: 15px 0px; + line-height: 1.3em; +} + +div.viewcode-block:target { + background: #ffd; +} + +dl pre, blockquote pre, li pre { + margin-left: 0; + padding-left: 30px; +} + +tt, code { + background-color: #ecf0f3; + color: #222; + /* padding: 1px 2px; */ +} + +tt.xref, code.xref, a tt { + background-color: #FBFBFB; + border-bottom: 1px solid #fff; +} + +a.reference { + text-decoration: none; + border-bottom: 1px dotted #004B6B; +} + +/* Don't put an underline on images */ +a.image-reference, a.image-reference:hover { + border-bottom: none; +} + +a.reference:hover { + border-bottom: 1px solid #6D4100; +} + +a.footnote-reference { + text-decoration: none; + font-size: 0.7em; + vertical-align: top; + border-bottom: 1px dotted #004B6B; +} + +a.footnote-reference:hover { + border-bottom: 1px solid #6D4100; +} + +a:hover tt, a:hover code { + background: #EEE; +} + + +@media screen and (max-width: 870px) { + + div.sphinxsidebar { + display: none; + } + + div.document { + width: 100%; + + } + + div.documentwrapper { + margin-left: 0; + margin-top: 0; + margin-right: 0; + margin-bottom: 0; + } + + div.bodywrapper { + margin-top: 0; + margin-right: 0; + margin-bottom: 0; + margin-left: 0; + } + + ul { + margin-left: 0; + } + + li > ul { + /* Matches the 30px from the "ul, ol" selector above */ + margin-left: 30px; + } + + .document { + width: auto; + } + + .footer { + width: auto; + } + + .bodywrapper { + margin: 0; + } + + .footer { + width: auto; + } + + .github { + display: none; + } + + + +} + + + +@media screen and (max-width: 875px) { + + body { + margin: 0; + padding: 20px 30px; + } + + div.documentwrapper { + float: none; + background: #fff; + } + + div.sphinxsidebar { + display: block; + float: none; + width: 102.5%; + margin: -20px -30px 20px -30px; + padding: 10px 20px; + background: #333; + color: #FFF; + } + + div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p, + div.sphinxsidebar h3 a { + color: #fff; + } + + div.sphinxsidebar a { + color: #AAA; + } + + div.sphinxsidebar p.logo { + display: none; + } + + div.document { + width: 100%; + margin: 0; + } + + div.footer { + display: none; + } + + div.bodywrapper { + margin: 0; + } + + div.body { + min-height: 0; + padding: 0; + } + + .rtd_doc_footer { + display: none; + } + + .document { + width: auto; + } + + .footer { + width: auto; + } + + .footer { + width: auto; + } + + .github { + display: none; + } +} +@media screen and (min-width: 876px) { + div.sphinxsidebar { + position: fixed; + margin-left: 0; + } +} + + +/* misc. */ + +.revsys-inline { + display: none!important; +} + +/* Hide ugly table cell borders in ..bibliography:: directive output */ +table.docutils.citation, table.docutils.citation td, table.docutils.citation th { + border: none; + /* Below needed in some edge cases; if not applied, bottom shadows appear */ + -moz-box-shadow: none; + -webkit-box-shadow: none; + box-shadow: none; +} + + +/* relbar */ + +.related { + line-height: 30px; + width: 100%; + font-size: 0.9rem; +} + +.related.top { + border-bottom: 1px solid #EEE; + margin-bottom: 20px; +} + +.related.bottom { + border-top: 1px solid #EEE; +} + +.related ul { + padding: 0; + margin: 0; + list-style: none; +} + +.related li { + display: inline; +} + +nav#rellinks { + float: right; +} + +nav#rellinks li+li:before { + content: "|"; +} + +nav#breadcrumbs li+li:before { + content: "\00BB"; +} + +/* Hide certain items when printing */ +@media print { + div.related { + display: none; + } +} \ No newline at end of file diff --git a/_static/basic.css b/_static/basic.css new file mode 100644 index 0000000..e5179b7 --- /dev/null +++ b/_static/basic.css @@ -0,0 +1,925 @@ +/* + * basic.css + * ~~~~~~~~~ + * + * Sphinx stylesheet -- basic theme. + * + * :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/* -- main layout ----------------------------------------------------------- */ + +div.clearer { + clear: both; +} + +div.section::after { + display: block; + content: ''; + clear: left; +} + +/* -- relbar ---------------------------------------------------------------- */ + +div.related { + width: 100%; + font-size: 90%; +} + +div.related h3 { + display: none; +} + +div.related ul { + margin: 0; + padding: 0 0 0 10px; + list-style: none; +} + +div.related li { + display: inline; +} + +div.related li.right { + float: right; + margin-right: 5px; +} + +/* -- sidebar --------------------------------------------------------------- */ + +div.sphinxsidebarwrapper { + padding: 10px 5px 0 10px; +} + +div.sphinxsidebar { + float: left; + width: 230px; + margin-left: -100%; + font-size: 90%; + word-wrap: break-word; + overflow-wrap : break-word; +} + +div.sphinxsidebar ul { + list-style: none; +} + +div.sphinxsidebar ul ul, +div.sphinxsidebar ul.want-points { + margin-left: 20px; + list-style: square; +} + +div.sphinxsidebar ul ul { + margin-top: 0; + margin-bottom: 0; +} + +div.sphinxsidebar form { + margin-top: 10px; +} + +div.sphinxsidebar input { + border: 1px solid #98dbcc; + font-family: sans-serif; + font-size: 1em; +} + +div.sphinxsidebar #searchbox form.search { + overflow: hidden; +} + +div.sphinxsidebar #searchbox input[type="text"] { + float: left; + width: 80%; + padding: 0.25em; + box-sizing: border-box; +} + +div.sphinxsidebar #searchbox input[type="submit"] { + float: left; + width: 20%; + border-left: none; + padding: 0.25em; + box-sizing: border-box; +} + + +img { + border: 0; + max-width: 100%; +} + +/* -- search page ----------------------------------------------------------- */ + +ul.search { + margin: 10px 0 0 20px; + padding: 0; +} + +ul.search li { + padding: 5px 0 5px 20px; + background-image: url(file.png); + background-repeat: no-repeat; + background-position: 0 7px; +} + +ul.search li a { + font-weight: bold; +} + +ul.search li p.context { + color: #888; + margin: 2px 0 0 30px; + text-align: left; +} + +ul.keywordmatches li.goodmatch a { + font-weight: bold; +} + +/* -- index page ------------------------------------------------------------ */ + +table.contentstable { + width: 90%; + margin-left: auto; + margin-right: auto; +} + +table.contentstable p.biglink { + line-height: 150%; +} + +a.biglink { + font-size: 1.3em; +} + +span.linkdescr { + font-style: italic; + padding-top: 5px; + font-size: 90%; +} + +/* -- general index --------------------------------------------------------- */ + +table.indextable { + width: 100%; +} + +table.indextable td { + text-align: left; + vertical-align: top; +} + +table.indextable ul { + margin-top: 0; + margin-bottom: 0; + list-style-type: none; +} + +table.indextable > tbody > tr > td > ul { + padding-left: 0em; +} + +table.indextable tr.pcap { + height: 10px; +} + +table.indextable tr.cap { + margin-top: 10px; + background-color: #f2f2f2; +} + +img.toggler { + margin-right: 3px; + margin-top: 3px; + cursor: pointer; +} + +div.modindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +div.genindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +/* -- domain module index --------------------------------------------------- */ + +table.modindextable td { + padding: 2px; + border-collapse: collapse; +} + +/* -- general body styles --------------------------------------------------- */ + +div.body { + min-width: inherit; + max-width: 800px; +} + +div.body p, div.body dd, div.body li, div.body blockquote { + -moz-hyphens: auto; + -ms-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; +} + +a.headerlink { + visibility: hidden; +} + +a:visited { + color: #551A8B; +} + +h1:hover > a.headerlink, +h2:hover > a.headerlink, +h3:hover > a.headerlink, +h4:hover > a.headerlink, +h5:hover > a.headerlink, +h6:hover > a.headerlink, +dt:hover > a.headerlink, +caption:hover > a.headerlink, +p.caption:hover > a.headerlink, +div.code-block-caption:hover > a.headerlink { + visibility: visible; +} + +div.body p.caption { + text-align: inherit; +} + +div.body td { + text-align: left; +} + +.first { + margin-top: 0 !important; +} + +p.rubric { + margin-top: 30px; + font-weight: bold; +} + +img.align-left, figure.align-left, .figure.align-left, object.align-left { + clear: left; + float: left; + margin-right: 1em; +} + +img.align-right, figure.align-right, .figure.align-right, object.align-right { + clear: right; + float: right; + margin-left: 1em; +} + +img.align-center, figure.align-center, .figure.align-center, object.align-center { + display: block; + margin-left: auto; + margin-right: auto; +} + +img.align-default, figure.align-default, .figure.align-default { + display: block; + margin-left: auto; + margin-right: auto; +} + +.align-left { + text-align: left; +} + +.align-center { + text-align: center; +} + +.align-default { + text-align: center; +} + +.align-right { + text-align: right; +} + +/* -- sidebars -------------------------------------------------------------- */ + +div.sidebar, +aside.sidebar { + margin: 0 0 0.5em 1em; + border: 1px solid #ddb; + padding: 7px; + background-color: #ffe; + width: 40%; + float: right; + clear: right; + overflow-x: auto; +} + +p.sidebar-title { + font-weight: bold; +} + +nav.contents, +aside.topic, +div.admonition, div.topic, blockquote { + clear: left; +} + +/* -- topics ---------------------------------------------------------------- */ + +nav.contents, +aside.topic, +div.topic { + border: 1px solid #ccc; + padding: 7px; + margin: 10px 0 10px 0; +} + +p.topic-title { + font-size: 1.1em; + font-weight: bold; + margin-top: 10px; +} + +/* -- admonitions ----------------------------------------------------------- */ + +div.admonition { + margin-top: 10px; + margin-bottom: 10px; + padding: 7px; +} + +div.admonition dt { + font-weight: bold; +} + +p.admonition-title { + margin: 0px 10px 5px 0px; + font-weight: bold; +} + +div.body p.centered { + text-align: center; + margin-top: 25px; +} + +/* -- content of sidebars/topics/admonitions -------------------------------- */ + +div.sidebar > :last-child, +aside.sidebar > :last-child, +nav.contents > :last-child, +aside.topic > :last-child, +div.topic > :last-child, +div.admonition > :last-child { + margin-bottom: 0; +} + +div.sidebar::after, +aside.sidebar::after, +nav.contents::after, +aside.topic::after, +div.topic::after, +div.admonition::after, +blockquote::after { + display: block; + content: ''; + clear: both; +} + +/* -- tables ---------------------------------------------------------------- */ + +table.docutils { + margin-top: 10px; + margin-bottom: 10px; + border: 0; + border-collapse: collapse; +} + +table.align-center { + margin-left: auto; + margin-right: auto; +} + +table.align-default { + margin-left: auto; + margin-right: auto; +} + +table caption span.caption-number { + font-style: italic; +} + +table caption span.caption-text { +} + +table.docutils td, table.docutils th { + padding: 1px 8px 1px 5px; + border-top: 0; + border-left: 0; + border-right: 0; + border-bottom: 1px solid #aaa; +} + +th { + text-align: left; + padding-right: 5px; +} + +table.citation { + border-left: solid 1px gray; + margin-left: 1px; +} + +table.citation td { + border-bottom: none; +} + +th > :first-child, +td > :first-child { + margin-top: 0px; +} + +th > :last-child, +td > :last-child { + margin-bottom: 0px; +} + +/* -- figures --------------------------------------------------------------- */ + +div.figure, figure { + margin: 0.5em; + padding: 0.5em; +} + +div.figure p.caption, figcaption { + padding: 0.3em; +} + +div.figure p.caption span.caption-number, +figcaption span.caption-number { + font-style: italic; +} + +div.figure p.caption span.caption-text, +figcaption span.caption-text { +} + +/* -- field list styles ----------------------------------------------------- */ + +table.field-list td, table.field-list th { + border: 0 !important; +} + +.field-list ul { + margin: 0; + padding-left: 1em; +} + +.field-list p { + margin: 0; +} + +.field-name { + -moz-hyphens: manual; + -ms-hyphens: manual; + -webkit-hyphens: manual; + hyphens: manual; +} + +/* -- hlist styles ---------------------------------------------------------- */ + +table.hlist { + margin: 1em 0; +} + +table.hlist td { + vertical-align: top; +} + +/* -- object description styles --------------------------------------------- */ + +.sig { + font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; +} + +.sig-name, code.descname { + background-color: transparent; + font-weight: bold; +} + +.sig-name { + font-size: 1.1em; +} + +code.descname { + font-size: 1.2em; +} + +.sig-prename, code.descclassname { + background-color: transparent; +} + +.optional { + font-size: 1.3em; +} + +.sig-paren { + font-size: larger; +} + +.sig-param.n { + font-style: italic; +} + +/* C++ specific styling */ + +.sig-inline.c-texpr, +.sig-inline.cpp-texpr { + font-family: unset; +} + +.sig.c .k, .sig.c .kt, +.sig.cpp .k, .sig.cpp .kt { + color: #0033B3; +} + +.sig.c .m, +.sig.cpp .m { + color: #1750EB; +} + +.sig.c .s, .sig.c .sc, +.sig.cpp .s, .sig.cpp .sc { + color: #067D17; +} + + +/* -- other body styles ----------------------------------------------------- */ + +ol.arabic { + list-style: decimal; +} + +ol.loweralpha { + list-style: lower-alpha; +} + +ol.upperalpha { + list-style: upper-alpha; +} + +ol.lowerroman { + list-style: lower-roman; +} + +ol.upperroman { + list-style: upper-roman; +} + +:not(li) > ol > li:first-child > :first-child, +:not(li) > ul > li:first-child > :first-child { + margin-top: 0px; +} + +:not(li) > ol > li:last-child > :last-child, +:not(li) > ul > li:last-child > :last-child { + margin-bottom: 0px; +} + +ol.simple ol p, +ol.simple ul p, +ul.simple ol p, +ul.simple ul p { + margin-top: 0; +} + +ol.simple > li:not(:first-child) > p, +ul.simple > li:not(:first-child) > p { + margin-top: 0; +} + +ol.simple p, +ul.simple p { + margin-bottom: 0; +} + +aside.footnote > span, +div.citation > span { + float: left; +} +aside.footnote > span:last-of-type, +div.citation > span:last-of-type { + padding-right: 0.5em; +} +aside.footnote > p { + margin-left: 2em; +} +div.citation > p { + margin-left: 4em; +} +aside.footnote > p:last-of-type, +div.citation > p:last-of-type { + margin-bottom: 0em; +} +aside.footnote > p:last-of-type:after, +div.citation > p:last-of-type:after { + content: ""; + clear: both; +} + +dl.field-list { + display: grid; + grid-template-columns: fit-content(30%) auto; +} + +dl.field-list > dt { + font-weight: bold; + word-break: break-word; + padding-left: 0.5em; + padding-right: 5px; +} + +dl.field-list > dd { + padding-left: 0.5em; + margin-top: 0em; + margin-left: 0em; + margin-bottom: 0em; +} + +dl { + margin-bottom: 15px; +} + +dd > :first-child { + margin-top: 0px; +} + +dd ul, dd table { + margin-bottom: 10px; +} + +dd { + margin-top: 3px; + margin-bottom: 10px; + margin-left: 30px; +} + +.sig dd { + margin-top: 0px; + margin-bottom: 0px; +} + +.sig dl { + margin-top: 0px; + margin-bottom: 0px; +} + +dl > dd:last-child, +dl > dd:last-child > :last-child { + margin-bottom: 0; +} + +dt:target, span.highlighted { + background-color: #fbe54e; +} + +rect.highlighted { + fill: #fbe54e; +} + +dl.glossary dt { + font-weight: bold; + font-size: 1.1em; +} + +.versionmodified { + font-style: italic; +} + +.system-message { + background-color: #fda; + padding: 5px; + border: 3px solid red; +} + +.footnote:target { + background-color: #ffa; +} + +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +.guilabel, .menuselection { + font-family: sans-serif; +} + +.accelerator { + text-decoration: underline; +} + +.classifier { + font-style: oblique; +} + +.classifier:before { + font-style: normal; + margin: 0 0.5em; + content: ":"; + display: inline-block; +} + +abbr, acronym { + border-bottom: dotted 1px; + cursor: help; +} + +.translated { + background-color: rgba(207, 255, 207, 0.2) +} + +.untranslated { + background-color: rgba(255, 207, 207, 0.2) +} + +/* -- code displays --------------------------------------------------------- */ + +pre { + overflow: auto; + overflow-y: hidden; /* fixes display issues on Chrome browsers */ +} + +pre, div[class*="highlight-"] { + clear: both; +} + +span.pre { + -moz-hyphens: none; + -ms-hyphens: none; + -webkit-hyphens: none; + hyphens: none; + white-space: nowrap; +} + +div[class*="highlight-"] { + margin: 1em 0; +} + +td.linenos pre { + border: 0; + background-color: transparent; + color: #aaa; +} + +table.highlighttable { + display: block; +} + +table.highlighttable tbody { + display: block; +} + +table.highlighttable tr { + display: flex; +} + +table.highlighttable td { + margin: 0; + padding: 0; +} + +table.highlighttable td.linenos { + padding-right: 0.5em; +} + +table.highlighttable td.code { + flex: 1; + overflow: hidden; +} + +.highlight .hll { + display: block; +} + +div.highlight pre, +table.highlighttable pre { + margin: 0; +} + +div.code-block-caption + div { + margin-top: 0; +} + +div.code-block-caption { + margin-top: 1em; + padding: 2px 5px; + font-size: small; +} + +div.code-block-caption code { + background-color: transparent; +} + +table.highlighttable td.linenos, +span.linenos, +div.highlight span.gp { /* gp: Generic.Prompt */ + user-select: none; + -webkit-user-select: text; /* Safari fallback only */ + -webkit-user-select: none; /* Chrome/Safari */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* IE10+ */ +} + +div.code-block-caption span.caption-number { + padding: 0.1em 0.3em; + font-style: italic; +} + +div.code-block-caption span.caption-text { +} + +div.literal-block-wrapper { + margin: 1em 0; +} + +code.xref, a code { + background-color: transparent; + font-weight: bold; +} + +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { + background-color: transparent; +} + +.viewcode-link { + float: right; +} + +.viewcode-back { + float: right; + font-family: sans-serif; +} + +div.viewcode-block:target { + margin: -1px -10px; + padding: 0 10px; +} + +/* -- math display ---------------------------------------------------------- */ + +img.math { + vertical-align: middle; +} + +div.body div.math p { + text-align: center; +} + +span.eqno { + float: right; +} + +span.eqno a.headerlink { + position: absolute; + z-index: 1; +} + +div.math:hover a.headerlink { + visibility: visible; +} + +/* -- printout stylesheet --------------------------------------------------- */ + +@media print { + div.document, + div.documentwrapper, + div.bodywrapper { + margin: 0 !important; + width: 100%; + } + + div.sphinxsidebar, + div.related, + div.footer, + #top-link { + display: none; + } +} \ No newline at end of file diff --git a/_static/custom.css b/_static/custom.css new file mode 100644 index 0000000..2a924f1 --- /dev/null +++ b/_static/custom.css @@ -0,0 +1 @@ +/* This file intentionally left blank. */ diff --git a/_static/doctools.js b/_static/doctools.js new file mode 100644 index 0000000..4d67807 --- /dev/null +++ b/_static/doctools.js @@ -0,0 +1,156 @@ +/* + * doctools.js + * ~~~~~~~~~~~ + * + * Base JavaScript utilities for all Sphinx HTML documentation. + * + * :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ +"use strict"; + +const BLACKLISTED_KEY_CONTROL_ELEMENTS = new Set([ + "TEXTAREA", + "INPUT", + "SELECT", + "BUTTON", +]); + +const _ready = (callback) => { + if (document.readyState !== "loading") { + callback(); + } else { + document.addEventListener("DOMContentLoaded", callback); + } +}; + +/** + * Small JavaScript module for the documentation. + */ +const Documentation = { + init: () => { + Documentation.initDomainIndexTable(); + Documentation.initOnKeyListeners(); + }, + + /** + * i18n support + */ + TRANSLATIONS: {}, + PLURAL_EXPR: (n) => (n === 1 ? 0 : 1), + LOCALE: "unknown", + + // gettext and ngettext don't access this so that the functions + // can safely bound to a different name (_ = Documentation.gettext) + gettext: (string) => { + const translated = Documentation.TRANSLATIONS[string]; + switch (typeof translated) { + case "undefined": + return string; // no translation + case "string": + return translated; // translation exists + default: + return translated[0]; // (singular, plural) translation tuple exists + } + }, + + ngettext: (singular, plural, n) => { + const translated = Documentation.TRANSLATIONS[singular]; + if (typeof translated !== "undefined") + return translated[Documentation.PLURAL_EXPR(n)]; + return n === 1 ? singular : plural; + }, + + addTranslations: (catalog) => { + Object.assign(Documentation.TRANSLATIONS, catalog.messages); + Documentation.PLURAL_EXPR = new Function( + "n", + `return (${catalog.plural_expr})` + ); + Documentation.LOCALE = catalog.locale; + }, + + /** + * helper function to focus on search bar + */ + focusSearchBar: () => { + document.querySelectorAll("input[name=q]")[0]?.focus(); + }, + + /** + * Initialise the domain index toggle buttons + */ + initDomainIndexTable: () => { + const toggler = (el) => { + const idNumber = el.id.substr(7); + const toggledRows = document.querySelectorAll(`tr.cg-${idNumber}`); + if (el.src.substr(-9) === "minus.png") { + el.src = `${el.src.substr(0, el.src.length - 9)}plus.png`; + toggledRows.forEach((el) => (el.style.display = "none")); + } else { + el.src = `${el.src.substr(0, el.src.length - 8)}minus.png`; + toggledRows.forEach((el) => (el.style.display = "")); + } + }; + + const togglerElements = document.querySelectorAll("img.toggler"); + togglerElements.forEach((el) => + el.addEventListener("click", (event) => toggler(event.currentTarget)) + ); + togglerElements.forEach((el) => (el.style.display = "")); + if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) togglerElements.forEach(toggler); + }, + + initOnKeyListeners: () => { + // only install a listener if it is really needed + if ( + !DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS && + !DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS + ) + return; + + document.addEventListener("keydown", (event) => { + // bail for input elements + if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; + // bail with special keys + if (event.altKey || event.ctrlKey || event.metaKey) return; + + if (!event.shiftKey) { + switch (event.key) { + case "ArrowLeft": + if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; + + const prevLink = document.querySelector('link[rel="prev"]'); + if (prevLink && prevLink.href) { + window.location.href = prevLink.href; + event.preventDefault(); + } + break; + case "ArrowRight": + if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; + + const nextLink = document.querySelector('link[rel="next"]'); + if (nextLink && nextLink.href) { + window.location.href = nextLink.href; + event.preventDefault(); + } + break; + } + } + + // some keyboard layouts may need Shift to get / + switch (event.key) { + case "/": + if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) break; + Documentation.focusSearchBar(); + event.preventDefault(); + } + }); + }, +}; + +// quick alias for translations +const _ = Documentation.gettext; + +_ready(Documentation.init); diff --git a/_static/documentation_options.js b/_static/documentation_options.js new file mode 100644 index 0000000..2828cc5 --- /dev/null +++ b/_static/documentation_options.js @@ -0,0 +1,13 @@ +const DOCUMENTATION_OPTIONS = { + VERSION: '4.3.1', + LANGUAGE: 'en', + COLLAPSE_INDEX: false, + BUILDER: 'html', + FILE_SUFFIX: '.html', + LINK_SUFFIX: '.html', + HAS_SOURCE: true, + SOURCELINK_SUFFIX: '.txt', + NAVIGATION_WITH_KEYS: false, + SHOW_SEARCH_SUMMARY: true, + ENABLE_SEARCH_SHORTCUTS: true, +}; \ No newline at end of file diff --git a/_static/file.png b/_static/file.png new file mode 100644 index 0000000..a858a41 Binary files /dev/null and b/_static/file.png differ diff --git a/_static/language_data.js b/_static/language_data.js new file mode 100644 index 0000000..367b8ed --- /dev/null +++ b/_static/language_data.js @@ -0,0 +1,199 @@ +/* + * language_data.js + * ~~~~~~~~~~~~~~~~ + * + * This script contains the language-specific data used by searchtools.js, + * namely the list of stopwords, stemmer, scorer and splitter. + * + * :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"]; + + +/* Non-minified version is copied as a separate JS file, if available */ + +/** + * Porter Stemmer + */ +var Stemmer = function() { + + var step2list = { + ational: 'ate', + tional: 'tion', + enci: 'ence', + anci: 'ance', + izer: 'ize', + bli: 'ble', + alli: 'al', + entli: 'ent', + eli: 'e', + ousli: 'ous', + ization: 'ize', + ation: 'ate', + ator: 'ate', + alism: 'al', + iveness: 'ive', + fulness: 'ful', + ousness: 'ous', + aliti: 'al', + iviti: 'ive', + biliti: 'ble', + logi: 'log' + }; + + var step3list = { + icate: 'ic', + ative: '', + alize: 'al', + iciti: 'ic', + ical: 'ic', + ful: '', + ness: '' + }; + + var c = "[^aeiou]"; // consonant + var v = "[aeiouy]"; // vowel + var C = c + "[^aeiouy]*"; // consonant sequence + var V = v + "[aeiou]*"; // vowel sequence + + var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 + var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 + var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 + var s_v = "^(" + C + ")?" + v; // vowel in stem + + this.stemWord = function (w) { + var stem; + var suffix; + var firstch; + var origword = w; + + if (w.length < 3) + return w; + + var re; + var re2; + var re3; + var re4; + + firstch = w.substr(0,1); + if (firstch == "y") + w = firstch.toUpperCase() + w.substr(1); + + // Step 1a + re = /^(.+?)(ss|i)es$/; + re2 = /^(.+?)([^s])s$/; + + if (re.test(w)) + w = w.replace(re,"$1$2"); + else if (re2.test(w)) + w = w.replace(re2,"$1$2"); + + // Step 1b + re = /^(.+?)eed$/; + re2 = /^(.+?)(ed|ing)$/; + if (re.test(w)) { + var fp = re.exec(w); + re = new RegExp(mgr0); + if (re.test(fp[1])) { + re = /.$/; + w = w.replace(re,""); + } + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1]; + re2 = new RegExp(s_v); + if (re2.test(stem)) { + w = stem; + re2 = /(at|bl|iz)$/; + re3 = new RegExp("([^aeiouylsz])\\1$"); + re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re2.test(w)) + w = w + "e"; + else if (re3.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + else if (re4.test(w)) + w = w + "e"; + } + } + + // Step 1c + re = /^(.+?)y$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(s_v); + if (re.test(stem)) + w = stem + "i"; + } + + // Step 2 + re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step2list[suffix]; + } + + // Step 3 + re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step3list[suffix]; + } + + // Step 4 + re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; + re2 = /^(.+?)(s|t)(ion)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + if (re.test(stem)) + w = stem; + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1] + fp[2]; + re2 = new RegExp(mgr1); + if (re2.test(stem)) + w = stem; + } + + // Step 5 + re = /^(.+?)e$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + re2 = new RegExp(meq1); + re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) + w = stem; + } + re = /ll$/; + re2 = new RegExp(mgr1); + if (re.test(w) && re2.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + + // and turn initial Y back to y + if (firstch == "y") + w = firstch.toLowerCase() + w.substr(1); + return w; + } +} + diff --git a/_static/minus.png b/_static/minus.png new file mode 100644 index 0000000..d96755f Binary files /dev/null and b/_static/minus.png differ diff --git a/_static/plus.png b/_static/plus.png new file mode 100644 index 0000000..7107cec Binary files /dev/null and b/_static/plus.png differ diff --git a/_static/pygments.css b/_static/pygments.css new file mode 100644 index 0000000..04a4174 --- /dev/null +++ b/_static/pygments.css @@ -0,0 +1,84 @@ +pre { line-height: 125%; } +td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } +td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +.highlight .hll { background-color: #ffffcc } +.highlight { background: #f8f8f8; } +.highlight .c { color: #8f5902; font-style: italic } /* Comment */ +.highlight .err { color: #a40000; border: 1px solid #ef2929 } /* Error */ +.highlight .g { color: #000000 } /* Generic */ +.highlight .k { color: #004461; font-weight: bold } /* Keyword */ +.highlight .l { color: #000000 } /* Literal */ +.highlight .n { color: #000000 } /* Name */ +.highlight .o { color: #582800 } /* Operator */ +.highlight .x { color: #000000 } /* Other */ +.highlight .p { color: #000000; font-weight: bold } /* Punctuation */ +.highlight .ch { color: #8f5902; font-style: italic } /* Comment.Hashbang */ +.highlight .cm { color: #8f5902; font-style: italic } /* Comment.Multiline */ +.highlight .cp { color: #8f5902 } /* Comment.Preproc */ +.highlight .cpf { color: #8f5902; font-style: italic } /* Comment.PreprocFile */ +.highlight .c1 { color: #8f5902; font-style: italic } /* Comment.Single */ +.highlight .cs { color: #8f5902; font-style: italic } /* Comment.Special */ +.highlight .gd { color: #a40000 } /* Generic.Deleted */ +.highlight .ge { color: #000000; font-style: italic } /* Generic.Emph */ +.highlight .ges { color: #000000 } /* Generic.EmphStrong */ +.highlight .gr { color: #ef2929 } /* Generic.Error */ +.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.highlight .gi { color: #00A000 } /* Generic.Inserted */ +.highlight .go { color: #888888 } /* Generic.Output */ +.highlight .gp { color: #745334 } /* Generic.Prompt */ +.highlight .gs { color: #000000; font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.highlight .gt { color: #a40000; font-weight: bold } /* Generic.Traceback */ +.highlight .kc { color: #004461; font-weight: bold } /* Keyword.Constant */ +.highlight .kd { color: #004461; font-weight: bold } /* Keyword.Declaration */ +.highlight .kn { color: #004461; font-weight: bold } /* Keyword.Namespace */ +.highlight .kp { color: #004461; font-weight: bold } /* Keyword.Pseudo */ +.highlight .kr { color: #004461; font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #004461; font-weight: bold } /* Keyword.Type */ +.highlight .ld { color: #000000 } /* Literal.Date */ +.highlight .m { color: #990000 } /* Literal.Number */ +.highlight .s { color: #4e9a06 } /* Literal.String */ +.highlight .na { color: #c4a000 } /* Name.Attribute */ +.highlight .nb { color: #004461 } /* Name.Builtin */ +.highlight .nc { color: #000000 } /* Name.Class */ +.highlight .no { color: #000000 } /* Name.Constant */ +.highlight .nd { color: #888888 } /* Name.Decorator */ +.highlight .ni { color: #ce5c00 } /* Name.Entity */ +.highlight .ne { color: #cc0000; font-weight: bold } /* Name.Exception */ +.highlight .nf { color: #000000 } /* Name.Function */ +.highlight .nl { color: #f57900 } /* Name.Label */ +.highlight .nn { color: #000000 } /* Name.Namespace */ +.highlight .nx { color: #000000 } /* Name.Other */ +.highlight .py { color: #000000 } /* Name.Property */ +.highlight .nt { color: #004461; font-weight: bold } /* Name.Tag */ +.highlight .nv { color: #000000 } /* Name.Variable */ +.highlight .ow { color: #004461; font-weight: bold } /* Operator.Word */ +.highlight .pm { color: #000000; font-weight: bold } /* Punctuation.Marker */ +.highlight .w { color: #f8f8f8 } /* Text.Whitespace */ +.highlight .mb { color: #990000 } /* Literal.Number.Bin */ +.highlight .mf { color: #990000 } /* Literal.Number.Float */ +.highlight .mh { color: #990000 } /* Literal.Number.Hex */ +.highlight .mi { color: #990000 } /* Literal.Number.Integer */ +.highlight .mo { color: #990000 } /* Literal.Number.Oct */ +.highlight .sa { color: #4e9a06 } /* Literal.String.Affix */ +.highlight .sb { color: #4e9a06 } /* Literal.String.Backtick */ +.highlight .sc { color: #4e9a06 } /* Literal.String.Char */ +.highlight .dl { color: #4e9a06 } /* Literal.String.Delimiter */ +.highlight .sd { color: #8f5902; font-style: italic } /* Literal.String.Doc */ +.highlight .s2 { color: #4e9a06 } /* Literal.String.Double */ +.highlight .se { color: #4e9a06 } /* Literal.String.Escape */ +.highlight .sh { color: #4e9a06 } /* Literal.String.Heredoc */ +.highlight .si { color: #4e9a06 } /* Literal.String.Interpol */ +.highlight .sx { color: #4e9a06 } /* Literal.String.Other */ +.highlight .sr { color: #4e9a06 } /* Literal.String.Regex */ +.highlight .s1 { color: #4e9a06 } /* Literal.String.Single */ +.highlight .ss { color: #4e9a06 } /* Literal.String.Symbol */ +.highlight .bp { color: #3465a4 } /* Name.Builtin.Pseudo */ +.highlight .fm { color: #000000 } /* Name.Function.Magic */ +.highlight .vc { color: #000000 } /* Name.Variable.Class */ +.highlight .vg { color: #000000 } /* Name.Variable.Global */ +.highlight .vi { color: #000000 } /* Name.Variable.Instance */ +.highlight .vm { color: #000000 } /* Name.Variable.Magic */ +.highlight .il { color: #990000 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/_static/searchtools.js b/_static/searchtools.js new file mode 100644 index 0000000..b08d58c --- /dev/null +++ b/_static/searchtools.js @@ -0,0 +1,620 @@ +/* + * searchtools.js + * ~~~~~~~~~~~~~~~~ + * + * Sphinx JavaScript utilities for the full-text search. + * + * :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ +"use strict"; + +/** + * Simple result scoring code. + */ +if (typeof Scorer === "undefined") { + var Scorer = { + // Implement the following function to further tweak the score for each result + // The function takes a result array [docname, title, anchor, descr, score, filename] + // and returns the new score. + /* + score: result => { + const [docname, title, anchor, descr, score, filename] = result + return score + }, + */ + + // query matches the full name of an object + objNameMatch: 11, + // or matches in the last dotted part of the object name + objPartialMatch: 6, + // Additive scores depending on the priority of the object + objPrio: { + 0: 15, // used to be importantResults + 1: 5, // used to be objectResults + 2: -5, // used to be unimportantResults + }, + // Used when the priority is not in the mapping. + objPrioDefault: 0, + + // query found in title + title: 15, + partialTitle: 7, + // query found in terms + term: 5, + partialTerm: 2, + }; +} + +const _removeChildren = (element) => { + while (element && element.lastChild) element.removeChild(element.lastChild); +}; + +/** + * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping + */ +const _escapeRegExp = (string) => + string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string + +const _displayItem = (item, searchTerms, highlightTerms) => { + const docBuilder = DOCUMENTATION_OPTIONS.BUILDER; + const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX; + const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX; + const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY; + const contentRoot = document.documentElement.dataset.content_root; + + const [docName, title, anchor, descr, score, _filename] = item; + + let listItem = document.createElement("li"); + let requestUrl; + let linkUrl; + if (docBuilder === "dirhtml") { + // dirhtml builder + let dirname = docName + "/"; + if (dirname.match(/\/index\/$/)) + dirname = dirname.substring(0, dirname.length - 6); + else if (dirname === "index/") dirname = ""; + requestUrl = contentRoot + dirname; + linkUrl = requestUrl; + } else { + // normal html builders + requestUrl = contentRoot + docName + docFileSuffix; + linkUrl = docName + docLinkSuffix; + } + let linkEl = listItem.appendChild(document.createElement("a")); + linkEl.href = linkUrl + anchor; + linkEl.dataset.score = score; + linkEl.innerHTML = title; + if (descr) { + listItem.appendChild(document.createElement("span")).innerHTML = + " (" + descr + ")"; + // highlight search terms in the description + if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js + highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); + } + else if (showSearchSummary) + fetch(requestUrl) + .then((responseData) => responseData.text()) + .then((data) => { + if (data) + listItem.appendChild( + Search.makeSearchSummary(data, searchTerms, anchor) + ); + // highlight search terms in the summary + if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js + highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); + }); + Search.output.appendChild(listItem); +}; +const _finishSearch = (resultCount) => { + Search.stopPulse(); + Search.title.innerText = _("Search Results"); + if (!resultCount) + Search.status.innerText = Documentation.gettext( + "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories." + ); + else + Search.status.innerText = _( + "Search finished, found ${resultCount} page(s) matching the search query." + ).replace('${resultCount}', resultCount); +}; +const _displayNextItem = ( + results, + resultCount, + searchTerms, + highlightTerms, +) => { + // results left, load the summary and display it + // this is intended to be dynamic (don't sub resultsCount) + if (results.length) { + _displayItem(results.pop(), searchTerms, highlightTerms); + setTimeout( + () => _displayNextItem(results, resultCount, searchTerms, highlightTerms), + 5 + ); + } + // search finished, update title and status message + else _finishSearch(resultCount); +}; +// Helper function used by query() to order search results. +// Each input is an array of [docname, title, anchor, descr, score, filename]. +// Order the results by score (in opposite order of appearance, since the +// `_displayNextItem` function uses pop() to retrieve items) and then alphabetically. +const _orderResultsByScoreThenName = (a, b) => { + const leftScore = a[4]; + const rightScore = b[4]; + if (leftScore === rightScore) { + // same score: sort alphabetically + const leftTitle = a[1].toLowerCase(); + const rightTitle = b[1].toLowerCase(); + if (leftTitle === rightTitle) return 0; + return leftTitle > rightTitle ? -1 : 1; // inverted is intentional + } + return leftScore > rightScore ? 1 : -1; +}; + +/** + * Default splitQuery function. Can be overridden in ``sphinx.search`` with a + * custom function per language. + * + * The regular expression works by splitting the string on consecutive characters + * that are not Unicode letters, numbers, underscores, or emoji characters. + * This is the same as ``\W+`` in Python, preserving the surrogate pair area. + */ +if (typeof splitQuery === "undefined") { + var splitQuery = (query) => query + .split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}]+/gu) + .filter(term => term) // remove remaining empty strings +} + +/** + * Search Module + */ +const Search = { + _index: null, + _queued_query: null, + _pulse_status: -1, + + htmlToText: (htmlString, anchor) => { + const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html'); + for (const removalQuery of [".headerlink", "script", "style"]) { + htmlElement.querySelectorAll(removalQuery).forEach((el) => { el.remove() }); + } + if (anchor) { + const anchorContent = htmlElement.querySelector(`[role="main"] ${anchor}`); + if (anchorContent) return anchorContent.textContent; + + console.warn( + `Anchored content block not found. Sphinx search tries to obtain it via DOM query '[role=main] ${anchor}'. Check your theme or template.` + ); + } + + // if anchor not specified or not found, fall back to main content + const docContent = htmlElement.querySelector('[role="main"]'); + if (docContent) return docContent.textContent; + + console.warn( + "Content block not found. Sphinx search tries to obtain it via DOM query '[role=main]'. Check your theme or template." + ); + return ""; + }, + + init: () => { + const query = new URLSearchParams(window.location.search).get("q"); + document + .querySelectorAll('input[name="q"]') + .forEach((el) => (el.value = query)); + if (query) Search.performSearch(query); + }, + + loadIndex: (url) => + (document.body.appendChild(document.createElement("script")).src = url), + + setIndex: (index) => { + Search._index = index; + if (Search._queued_query !== null) { + const query = Search._queued_query; + Search._queued_query = null; + Search.query(query); + } + }, + + hasIndex: () => Search._index !== null, + + deferQuery: (query) => (Search._queued_query = query), + + stopPulse: () => (Search._pulse_status = -1), + + startPulse: () => { + if (Search._pulse_status >= 0) return; + + const pulse = () => { + Search._pulse_status = (Search._pulse_status + 1) % 4; + Search.dots.innerText = ".".repeat(Search._pulse_status); + if (Search._pulse_status >= 0) window.setTimeout(pulse, 500); + }; + pulse(); + }, + + /** + * perform a search for something (or wait until index is loaded) + */ + performSearch: (query) => { + // create the required interface elements + const searchText = document.createElement("h2"); + searchText.textContent = _("Searching"); + const searchSummary = document.createElement("p"); + searchSummary.classList.add("search-summary"); + searchSummary.innerText = ""; + const searchList = document.createElement("ul"); + searchList.classList.add("search"); + + const out = document.getElementById("search-results"); + Search.title = out.appendChild(searchText); + Search.dots = Search.title.appendChild(document.createElement("span")); + Search.status = out.appendChild(searchSummary); + Search.output = out.appendChild(searchList); + + const searchProgress = document.getElementById("search-progress"); + // Some themes don't use the search progress node + if (searchProgress) { + searchProgress.innerText = _("Preparing search..."); + } + Search.startPulse(); + + // index already loaded, the browser was quick! + if (Search.hasIndex()) Search.query(query); + else Search.deferQuery(query); + }, + + _parseQuery: (query) => { + // stem the search terms and add them to the correct list + const stemmer = new Stemmer(); + const searchTerms = new Set(); + const excludedTerms = new Set(); + const highlightTerms = new Set(); + const objectTerms = new Set(splitQuery(query.toLowerCase().trim())); + splitQuery(query.trim()).forEach((queryTerm) => { + const queryTermLower = queryTerm.toLowerCase(); + + // maybe skip this "word" + // stopwords array is from language_data.js + if ( + stopwords.indexOf(queryTermLower) !== -1 || + queryTerm.match(/^\d+$/) + ) + return; + + // stem the word + let word = stemmer.stemWord(queryTermLower); + // select the correct list + if (word[0] === "-") excludedTerms.add(word.substr(1)); + else { + searchTerms.add(word); + highlightTerms.add(queryTermLower); + } + }); + + if (SPHINX_HIGHLIGHT_ENABLED) { // set in sphinx_highlight.js + localStorage.setItem("sphinx_highlight_terms", [...highlightTerms].join(" ")) + } + + // console.debug("SEARCH: searching for:"); + // console.info("required: ", [...searchTerms]); + // console.info("excluded: ", [...excludedTerms]); + + return [query, searchTerms, excludedTerms, highlightTerms, objectTerms]; + }, + + /** + * execute search (requires search index to be loaded) + */ + _performSearch: (query, searchTerms, excludedTerms, highlightTerms, objectTerms) => { + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const titles = Search._index.titles; + const allTitles = Search._index.alltitles; + const indexEntries = Search._index.indexentries; + + // Collect multiple result groups to be sorted separately and then ordered. + // Each is an array of [docname, title, anchor, descr, score, filename]. + const normalResults = []; + const nonMainIndexResults = []; + + _removeChildren(document.getElementById("search-progress")); + + const queryLower = query.toLowerCase().trim(); + for (const [title, foundTitles] of Object.entries(allTitles)) { + if (title.toLowerCase().trim().includes(queryLower) && (queryLower.length >= title.length/2)) { + for (const [file, id] of foundTitles) { + const score = Math.round(Scorer.title * queryLower.length / title.length); + const boost = titles[file] === title ? 1 : 0; // add a boost for document titles + normalResults.push([ + docNames[file], + titles[file] !== title ? `${titles[file]} > ${title}` : title, + id !== null ? "#" + id : "", + null, + score + boost, + filenames[file], + ]); + } + } + } + + // search for explicit entries in index directives + for (const [entry, foundEntries] of Object.entries(indexEntries)) { + if (entry.includes(queryLower) && (queryLower.length >= entry.length/2)) { + for (const [file, id, isMain] of foundEntries) { + const score = Math.round(100 * queryLower.length / entry.length); + const result = [ + docNames[file], + titles[file], + id ? "#" + id : "", + null, + score, + filenames[file], + ]; + if (isMain) { + normalResults.push(result); + } else { + nonMainIndexResults.push(result); + } + } + } + } + + // lookup as object + objectTerms.forEach((term) => + normalResults.push(...Search.performObjectSearch(term, objectTerms)) + ); + + // lookup as search terms in fulltext + normalResults.push(...Search.performTermsSearch(searchTerms, excludedTerms)); + + // let the scorer override scores with a custom scoring function + if (Scorer.score) { + normalResults.forEach((item) => (item[4] = Scorer.score(item))); + nonMainIndexResults.forEach((item) => (item[4] = Scorer.score(item))); + } + + // Sort each group of results by score and then alphabetically by name. + normalResults.sort(_orderResultsByScoreThenName); + nonMainIndexResults.sort(_orderResultsByScoreThenName); + + // Combine the result groups in (reverse) order. + // Non-main index entries are typically arbitrary cross-references, + // so display them after other results. + let results = [...nonMainIndexResults, ...normalResults]; + + // remove duplicate search results + // note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept + let seen = new Set(); + results = results.reverse().reduce((acc, result) => { + let resultStr = result.slice(0, 4).concat([result[5]]).map(v => String(v)).join(','); + if (!seen.has(resultStr)) { + acc.push(result); + seen.add(resultStr); + } + return acc; + }, []); + + return results.reverse(); + }, + + query: (query) => { + const [searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms] = Search._parseQuery(query); + const results = Search._performSearch(searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms); + + // for debugging + //Search.lastresults = results.slice(); // a copy + // console.info("search results:", Search.lastresults); + + // print the results + _displayNextItem(results, results.length, searchTerms, highlightTerms); + }, + + /** + * search for object names + */ + performObjectSearch: (object, objectTerms) => { + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const objects = Search._index.objects; + const objNames = Search._index.objnames; + const titles = Search._index.titles; + + const results = []; + + const objectSearchCallback = (prefix, match) => { + const name = match[4] + const fullname = (prefix ? prefix + "." : "") + name; + const fullnameLower = fullname.toLowerCase(); + if (fullnameLower.indexOf(object) < 0) return; + + let score = 0; + const parts = fullnameLower.split("."); + + // check for different match types: exact matches of full name or + // "last name" (i.e. last dotted part) + if (fullnameLower === object || parts.slice(-1)[0] === object) + score += Scorer.objNameMatch; + else if (parts.slice(-1)[0].indexOf(object) > -1) + score += Scorer.objPartialMatch; // matches in last name + + const objName = objNames[match[1]][2]; + const title = titles[match[0]]; + + // If more than one term searched for, we require other words to be + // found in the name/title/description + const otherTerms = new Set(objectTerms); + otherTerms.delete(object); + if (otherTerms.size > 0) { + const haystack = `${prefix} ${name} ${objName} ${title}`.toLowerCase(); + if ( + [...otherTerms].some((otherTerm) => haystack.indexOf(otherTerm) < 0) + ) + return; + } + + let anchor = match[3]; + if (anchor === "") anchor = fullname; + else if (anchor === "-") anchor = objNames[match[1]][1] + "-" + fullname; + + const descr = objName + _(", in ") + title; + + // add custom score for some objects according to scorer + if (Scorer.objPrio.hasOwnProperty(match[2])) + score += Scorer.objPrio[match[2]]; + else score += Scorer.objPrioDefault; + + results.push([ + docNames[match[0]], + fullname, + "#" + anchor, + descr, + score, + filenames[match[0]], + ]); + }; + Object.keys(objects).forEach((prefix) => + objects[prefix].forEach((array) => + objectSearchCallback(prefix, array) + ) + ); + return results; + }, + + /** + * search for full-text terms in the index + */ + performTermsSearch: (searchTerms, excludedTerms) => { + // prepare search + const terms = Search._index.terms; + const titleTerms = Search._index.titleterms; + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const titles = Search._index.titles; + + const scoreMap = new Map(); + const fileMap = new Map(); + + // perform the search on the required terms + searchTerms.forEach((word) => { + const files = []; + const arr = [ + { files: terms[word], score: Scorer.term }, + { files: titleTerms[word], score: Scorer.title }, + ]; + // add support for partial matches + if (word.length > 2) { + const escapedWord = _escapeRegExp(word); + if (!terms.hasOwnProperty(word)) { + Object.keys(terms).forEach((term) => { + if (term.match(escapedWord)) + arr.push({ files: terms[term], score: Scorer.partialTerm }); + }); + } + if (!titleTerms.hasOwnProperty(word)) { + Object.keys(titleTerms).forEach((term) => { + if (term.match(escapedWord)) + arr.push({ files: titleTerms[term], score: Scorer.partialTitle }); + }); + } + } + + // no match but word was a required one + if (arr.every((record) => record.files === undefined)) return; + + // found search word in contents + arr.forEach((record) => { + if (record.files === undefined) return; + + let recordFiles = record.files; + if (recordFiles.length === undefined) recordFiles = [recordFiles]; + files.push(...recordFiles); + + // set score for the word in each file + recordFiles.forEach((file) => { + if (!scoreMap.has(file)) scoreMap.set(file, {}); + scoreMap.get(file)[word] = record.score; + }); + }); + + // create the mapping + files.forEach((file) => { + if (!fileMap.has(file)) fileMap.set(file, [word]); + else if (fileMap.get(file).indexOf(word) === -1) fileMap.get(file).push(word); + }); + }); + + // now check if the files don't contain excluded terms + const results = []; + for (const [file, wordList] of fileMap) { + // check if all requirements are matched + + // as search terms with length < 3 are discarded + const filteredTermCount = [...searchTerms].filter( + (term) => term.length > 2 + ).length; + if ( + wordList.length !== searchTerms.size && + wordList.length !== filteredTermCount + ) + continue; + + // ensure that none of the excluded terms is in the search result + if ( + [...excludedTerms].some( + (term) => + terms[term] === file || + titleTerms[term] === file || + (terms[term] || []).includes(file) || + (titleTerms[term] || []).includes(file) + ) + ) + break; + + // select one (max) score for the file. + const score = Math.max(...wordList.map((w) => scoreMap.get(file)[w])); + // add result to the result list + results.push([ + docNames[file], + titles[file], + "", + null, + score, + filenames[file], + ]); + } + return results; + }, + + /** + * helper function to return a node containing the + * search summary for a given text. keywords is a list + * of stemmed words. + */ + makeSearchSummary: (htmlText, keywords, anchor) => { + const text = Search.htmlToText(htmlText, anchor); + if (text === "") return null; + + const textLower = text.toLowerCase(); + const actualStartPosition = [...keywords] + .map((k) => textLower.indexOf(k.toLowerCase())) + .filter((i) => i > -1) + .slice(-1)[0]; + const startWithContext = Math.max(actualStartPosition - 120, 0); + + const top = startWithContext === 0 ? "" : "..."; + const tail = startWithContext + 240 < text.length ? "..." : ""; + + let summary = document.createElement("p"); + summary.classList.add("context"); + summary.textContent = top + text.substr(startWithContext, 240).trim() + tail; + + return summary; + }, +}; + +_ready(Search.init); diff --git a/_static/sphinx_highlight.js b/_static/sphinx_highlight.js new file mode 100644 index 0000000..8a96c69 --- /dev/null +++ b/_static/sphinx_highlight.js @@ -0,0 +1,154 @@ +/* Highlighting utilities for Sphinx HTML documentation. */ +"use strict"; + +const SPHINX_HIGHLIGHT_ENABLED = true + +/** + * highlight a given string on a node by wrapping it in + * span elements with the given class name. + */ +const _highlight = (node, addItems, text, className) => { + if (node.nodeType === Node.TEXT_NODE) { + const val = node.nodeValue; + const parent = node.parentNode; + const pos = val.toLowerCase().indexOf(text); + if ( + pos >= 0 && + !parent.classList.contains(className) && + !parent.classList.contains("nohighlight") + ) { + let span; + + const closestNode = parent.closest("body, svg, foreignObject"); + const isInSVG = closestNode && closestNode.matches("svg"); + if (isInSVG) { + span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); + } else { + span = document.createElement("span"); + span.classList.add(className); + } + + span.appendChild(document.createTextNode(val.substr(pos, text.length))); + const rest = document.createTextNode(val.substr(pos + text.length)); + parent.insertBefore( + span, + parent.insertBefore( + rest, + node.nextSibling + ) + ); + node.nodeValue = val.substr(0, pos); + /* There may be more occurrences of search term in this node. So call this + * function recursively on the remaining fragment. + */ + _highlight(rest, addItems, text, className); + + if (isInSVG) { + const rect = document.createElementNS( + "http://www.w3.org/2000/svg", + "rect" + ); + const bbox = parent.getBBox(); + rect.x.baseVal.value = bbox.x; + rect.y.baseVal.value = bbox.y; + rect.width.baseVal.value = bbox.width; + rect.height.baseVal.value = bbox.height; + rect.setAttribute("class", className); + addItems.push({ parent: parent, target: rect }); + } + } + } else if (node.matches && !node.matches("button, select, textarea")) { + node.childNodes.forEach((el) => _highlight(el, addItems, text, className)); + } +}; +const _highlightText = (thisNode, text, className) => { + let addItems = []; + _highlight(thisNode, addItems, text, className); + addItems.forEach((obj) => + obj.parent.insertAdjacentElement("beforebegin", obj.target) + ); +}; + +/** + * Small JavaScript module for the documentation. + */ +const SphinxHighlight = { + + /** + * highlight the search words provided in localstorage in the text + */ + highlightSearchWords: () => { + if (!SPHINX_HIGHLIGHT_ENABLED) return; // bail if no highlight + + // get and clear terms from localstorage + const url = new URL(window.location); + const highlight = + localStorage.getItem("sphinx_highlight_terms") + || url.searchParams.get("highlight") + || ""; + localStorage.removeItem("sphinx_highlight_terms") + url.searchParams.delete("highlight"); + window.history.replaceState({}, "", url); + + // get individual terms from highlight string + const terms = highlight.toLowerCase().split(/\s+/).filter(x => x); + if (terms.length === 0) return; // nothing to do + + // There should never be more than one element matching "div.body" + const divBody = document.querySelectorAll("div.body"); + const body = divBody.length ? divBody[0] : document.querySelector("body"); + window.setTimeout(() => { + terms.forEach((term) => _highlightText(body, term, "highlighted")); + }, 10); + + const searchBox = document.getElementById("searchbox"); + if (searchBox === null) return; + searchBox.appendChild( + document + .createRange() + .createContextualFragment( + '" + ) + ); + }, + + /** + * helper function to hide the search marks again + */ + hideSearchWords: () => { + document + .querySelectorAll("#searchbox .highlight-link") + .forEach((el) => el.remove()); + document + .querySelectorAll("span.highlighted") + .forEach((el) => el.classList.remove("highlighted")); + localStorage.removeItem("sphinx_highlight_terms") + }, + + initEscapeListener: () => { + // only install a listener if it is really needed + if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) return; + + document.addEventListener("keydown", (event) => { + // bail for input elements + if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; + // bail with special keys + if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return; + if (DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS && (event.key === "Escape")) { + SphinxHighlight.hideSearchWords(); + event.preventDefault(); + } + }); + }, +}; + +_ready(() => { + /* Do not call highlightSearchWords() when we are on the search page. + * It will highlight words from the *previous* search query. + */ + if (typeof Search === "undefined") SphinxHighlight.highlightSearchWords(); + SphinxHighlight.initEscapeListener(); +}); diff --git a/aizynthfinder.analysis.html b/aizynthfinder.analysis.html new file mode 100644 index 0000000..b9dbc90 --- /dev/null +++ b/aizynthfinder.analysis.html @@ -0,0 +1,618 @@ + + + + + + + + aizynthfinder.analysis package — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

aizynthfinder.analysis package

+
+

Submodules

+
+
+

aizynthfinder.analysis.routes module

+

Module containing classes to store and manipulate collections of synthetic routes.

+
+
+class aizynthfinder.analysis.routes.RouteCollection(reaction_trees, **kwargs)
+

Bases: object

+

Holds a collections of reaction routes.

+

If can be the top scored nodes, their scores and +the reaction trees created from them. +It can also be a cluster of such routes.

+

The class has the functionality to compute collective results +for the different routes such as images.

+

Properties of individual route can be obtained with simple indexing.

+
route0 = collection[0]
+
+
+
+
Variables:
+
    +
  • all_scores – all the computed scores for the routes

  • +
  • nodes – the top-ranked MCTS-like nodes

  • +
  • scores – initial scores of top-ranked nodes or routes

  • +
  • reaction_trees – the reaction trees created from the top-ranked nodes

  • +
  • clusters – the created clusters from the collection

  • +
  • route_metadata – the metadata of the reaction trees

  • +
+
+
Parameters:
+

reaction_trees (Sequence[ReactionTree]) – the trees to base the collection on

+
+
+
+
+classmethod from_analysis(analysis, selection=None)
+

Create a collection from a tree analysis.

+
+
Parameters:
+
+
+
Returns:
+

the created collection

+
+
Return type:
+

RouteCollection

+
+
+
+ +
+
+property dicts: Sequence[StrDict]
+

Returns a list of dictionary representation of the routes

+
+ +
+
+property images: Sequence[PilImage | None]
+

Returns a list of pictoral representation of the routes

+
+ +
+
+property jsons: Sequence[str]
+

Returns a list of JSON string representation of the routes

+
+ +
+
+cluster(n_clusters, max_clusters=5, distances_model='ted', **kwargs)
+

Cluster the route collection into a number of clusters.

+

Additional arguments to the distance or clustering algorithm +can be passed in as key-word arguments.

+

When distances_model is “lstm”, a key-word argument model_path needs to be given +when distances_model is “ted”, two optional key-word arguments timeout and content +can be given.

+

If the number of reaction trees are less than 3, no clustering will be performed

+
+
Parameters:
+
    +
  • n_clusters (int) – the desired number of clusters, if less than 2 triggers optimization

  • +
  • max_clusters (int) – the maximum number of clusters to consider

  • +
  • distances_model (str) – can be ted or lstm and determines how the route distances are computed

  • +
  • kwargs (Any)

  • +
+
+
Returns:
+

the cluster labels

+
+
Return type:
+

np.ndarray

+
+
+
+ +
+
+combined_reaction_trees(recreate=False)
+

Return an object that combines all the reaction tree into a single reaction tree graph

+
+
Parameters:
+

recreate (bool) – if False will return a cached object if available, defaults to False

+
+
Returns:
+

the combined trees

+
+
Return type:
+

CombinedReactionTrees

+
+
+
+ +
+
+compute_scores(*scorers)
+

Compute new scores for all routes in this collection. +They can then be accessed with the all_scores attribute.

+
+
Parameters:
+

scorers (Scorer)

+
+
Return type:
+

None

+
+
+
+ +
+
+dict_with_extra(include_scores=False, include_metadata=False)
+

Return the routes as dictionaries with optionally all scores and +all metadata added to the root (target) node.

+
+
Returns:
+

the routes as dictionaries

+
+
Return type:
+

Sequence[StrDict]

+
+
+
+ +
+
+dict_with_scores()
+

Return the routes as dictionaries with all scores added +to the root (target) node.

+
+
Returns:
+

the routes as dictionaries

+
+
Return type:
+

Sequence[StrDict]

+
+
+
+ +
+
+distance_matrix(recreate=False, model='ted', **kwargs)
+

Compute the distance matrix between each pair of reaction trees

+

All key-word arguments are passed along to the route_distance_calculator +function from the route_distances package.

+

When model is “lstm”, a key-word argument model_path needs to be given +when model is “ted”, two optional key-word arguments timeout and content +can be given.

+
+
Parameters:
+
    +
  • recreate (bool) – if False, use a cached one if available

  • +
  • model (str) – the type of model to use “ted” or “lstm”

  • +
  • kwargs (Any)

  • +
+
+
Returns:
+

the square distance matrix

+
+
Return type:
+

np.ndarray

+
+
+
+ +
+
+make_dicts()
+

Convert all reaction trees to dictionaries

+
+
Return type:
+

Sequence[StrDict]

+
+
+
+ +
+
+make_images()
+

Convert all reaction trees to images

+
+
Return type:
+

Sequence[Optional[PilImage]]

+
+
+
+ +
+
+make_jsons()
+

Convert all reaction trees to JSON strings

+
+
Return type:
+

Sequence[str]

+
+
+
+ +
+
+rescore(scorer)
+

Rescore the routes in the collection, and thereby re-order them.

+

This will replace the scores attribute, and update the all_scores +attribute with another entry.

+
+
Parameters:
+

scorer (Scorer) – the scorer to use

+
+
Return type:
+

None

+
+
+
+ +
+ +
+
+

aizynthfinder.analysis.tree_analysis module

+

Module containing classes to perform analysis of the tree search results.

+
+
+class aizynthfinder.analysis.tree_analysis.TreeAnalysis(search_tree, scorer=None)
+

Bases: object

+

Class that encapsulate various analysis that can be +performed on a search tree.

+
+
Variables:
+
    +
  • scorers – the objects used to score the nodes

  • +
  • search_tree – the search tree

  • +
+
+
Parameters:
+
+
+
+
+
+best()
+

Returns the route or MCTS-like node with the highest score. +If several routes have the same score, it will return the first

+
+
Returns:
+

the top scoring node or route

+
+
Raises:
+

ValueError – if this is a multi-objective analysis, a single best solution cannot be return

+
+
Return type:
+

_Solution

+
+
+
+ +
+
+pareto_front()
+

Returns the Routes or MCTS-like Nodes that are the Pareto Front in the Multi-Objective search.

+
+
Returns:
+

the pareto front solutions.

+
+
Raises:
+

ValueError – if this is a single-objective analysis, there is no Pareto-front

+
+
Return type:
+

Tuple[_Solution, …]

+
+
+
+ +
+
+sort(selection=None)
+

Sort and select the nodes or routes in the search tree.

+

The score for each solution is a dictionary of scores, +one for each of the objectives.

+
+
Parameters:
+

selection (Optional[RouteSelectionArguments]) – selection criteria for the routes

+
+
Returns:
+

the sorted and selected items

+
+
Returns:
+

the scores of the sorted items

+
+
Return type:
+

Tuple[_AnyListOfSolutions, Sequence[Dict[str, float]]]

+
+
+
+ +
+
+tree_statistics()
+

Returns statistics of the tree

+

Currently it returns the number of nodes, the maximum number of transforms, +maximum number of children, top score, if the top score route is solved, +the number of molecule in the top score node, and information on pre-cursors

+
+
Returns:
+

the statistics

+
+
Return type:
+

StrDict

+
+
+
+ +
+ +
+
+

aizynthfinder.analysis.utils module

+

Helper routines and class for the aizynthfinder.analysis package. +To avoid clutter in that package, larger utility algorithms are placed herein.

+
+
+class aizynthfinder.analysis.utils.RouteSelectionArguments(nmin=5, nmax=25, return_all=False)
+

Bases: object

+

Selection arguments for the tree analysis class

+

If return_all is False, it will return at least nmin routes and if routes have the same +score it will return them as well up to nmax routes.

+

If return_all is True, it will return all solved routes if there is at least one is solved, otherwise +the nmin and nmax will be used.

+
+
Parameters:
+
    +
  • nmin (int)

  • +
  • nmax (int)

  • +
  • return_all (bool)

  • +
+
+
+
+
+nmin: int = 5
+
+ +
+
+nmax: int = 25
+
+ +
+
+return_all: bool = False
+
+ +
+ +
+
+class aizynthfinder.analysis.utils.CombinedReactionTrees(reaction_trees)
+

Bases: object

+

Encapsulation of an algorithm that combines several reaction trees into a +larger bipartite graph with all reactions and molecules.

+

The reactions at a specific level of the reaction trees are grouped based +on the reaction smiles.

+
+
Params reactions_trees:
+

the list of reaction trees to combine

+
+
Parameters:
+

reaction_trees (Sequence[ReactionTree])

+
+
+
+
+to_dict()
+

Returns the graph as a dictionary in a pre-defined format.

+
+
Returns:
+

the combined reaction trees

+
+
Return type:
+

StrDict

+
+
+
+ +
+
+to_visjs_page(filename, in_stock_colors=None)
+

Create a visualization of the combined reaction tree using the vis.js network library.

+

The HTML page and all the images will be put into a tar-ball.

+
+
Parameters:
+
    +
  • filename (str) – the name of the tarball

  • +
  • in_stock_colors (Optional[FrameColors]) – the colors around molecules, defaults to {True: “green”, False: “orange”}

  • +
+
+
Return type:
+

None

+
+
+
+ +
+ +
+
+

Module contents

+

Sub-package containing analysis routines

+
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/aizynthfinder.chem.html b/aizynthfinder.chem.html new file mode 100644 index 0000000..d4514c4 --- /dev/null +++ b/aizynthfinder.chem.html @@ -0,0 +1,873 @@ + + + + + + + + aizynthfinder.chem package — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

aizynthfinder.chem package

+
+

Submodules

+
+
+

aizynthfinder.chem.mol module

+

Module containing classes to deal with Molecules - mostly wrappers around rdkit routines.

+
+
+class aizynthfinder.chem.mol.Molecule(rd_mol=None, smiles=None, sanitize=False)
+

Bases: object

+

A base class for molecules. Encapsulate an RDKit mol object and +functions that can be applied to such a molecule.

+

The objects of this class is hashable by the inchi key and hence +comparable with the equality operator.

+
+
Variables:
+
    +
  • rd_mol – the RDkit mol object that is encapsulated

  • +
  • smiles – the SMILES representation of the molecule

  • +
+
+
Parameters:
+
    +
  • rd_mol (Optional[RdMol]) – a RDKit mol object to encapsulate, defaults to None

  • +
  • smiles (Optional[str]) – a SMILES to convert to a molecule object, defaults to None

  • +
  • sanitize (bool) – if True, the molecule will be immediately sanitized, defaults to False

  • +
+
+
Raises:
+

MoleculeException – if neither rd_mol or smiles is given, or if the molecule could not be sanitized

+
+
+
+
+property inchi: str
+

The inchi representation of the molecule +Created by lazy evaluation. Will cause the molecule to be sanitized.

+
+
Returns:
+

the inchi

+
+
+
+ +
+
+property inchi_key: str
+

The inchi key representation of the molecule +Created by lazy evaluation. Will cause the molecule to be sanitized.

+
+
Returns:
+

the inchi key

+
+
+
+ +
+
+property index_to_mapping: Dict[int, int]
+

Return a dictionary mapping to atom indices to atom mappings

+
+ +
+
+property mapping_to_index: Dict[int, int]
+

Return a dictionary mapping to atom mappings to atom indices

+
+ +
+
+property weight: float
+

Return the exact molecular weight of the molecule

+
+ +
+
+basic_compare(other)
+

Compare this molecule to another but only to +the basic part of the inchi key, thereby ignoring stereochemistry etc

+
+
Parameters:
+

other (Molecule) – the molecule to compare to

+
+
Returns:
+

True if chemical formula and connectivity is the same

+
+
Return type:
+

bool

+
+
+
+ +
+
+fingerprint(radius, nbits=2048, chiral=False)
+

Returns the Morgan fingerprint of the molecule

+
+
Parameters:
+
    +
  • radius (int) – the radius of the fingerprint

  • +
  • nbits (int) – the length of the fingerprint

  • +
  • chiral (bool) – if True, include chirality information

  • +
+
+
Returns:
+

the fingerprint

+
+
Return type:
+

ndarray

+
+
+
+ +
+
+has_atom_mapping()
+

Determines if a the molecule has atom mappings

+
+
Returns:
+

True if at least one atom has a mapping

+
+
Return type:
+

bool

+
+
+
+ +
+
+make_unique()
+

Returns an instance of the UniqueMolecule class that +is representing the same molecule but is not hashable or comparable.

+
+
Returns:
+

the unique molecule

+
+
Return type:
+

UniqueMolecule

+
+
+
+ +
+
+remove_atom_mapping(exceptions=None)
+

Remove all mappings of the atoms and update the smiles

+
+
Parameters:
+

exceptions (Optional[Sequence[int]]) – keep the listed atom mappings

+
+
Return type:
+

None

+
+
+
+ +
+
+sanitize(raise_exception=True)
+

Sanitizes the molecule if it has not been done before.

+
+
Parameters:
+

raise_exception (bool) – if True will raise exception on failed sanitation

+
+
Raises:
+

MoleculeException – if the molecule could not be sanitized

+
+
Return type:
+

None

+
+
+
+ +
+ +
+
+class aizynthfinder.chem.mol.TreeMolecule(parent, transform=None, rd_mol=None, smiles=None, sanitize=False, mapping_update_callback=None)
+

Bases: Molecule

+

A special molecule that keeps a reference to a parent molecule.

+

If the class is instantiated without specifying the transform argument, +it is computed by increasing the value of the parent.transform variable.

+

If no parent is provided the atoms with atom mapping number are tracked +and inherited to children.

+
+
Variables:
+
    +
  • mapped_mol – the tracked molecule with atom mappings

  • +
  • mapped_smiles – the SMILES of the tracked molecule with atom mappings

  • +
  • original_smiles – the SMILES as passed when instantiating the class

  • +
  • parent – parent molecule

  • +
  • transform – a numerical number corresponding to the depth in the tree

  • +
+
+
Parameters:
+
    +
  • parent (Optional['TreeMolecule']) – a TreeMolecule object that is the parent

  • +
  • transform (Optional[int]) – the transform value, defaults to None

  • +
  • rd_mol (Optional[RdMol]) – a RDKit mol object to encapsulate, defaults to None

  • +
  • smiles (Optional[str]) – a SMILES to convert to a molecule object, defaults to None

  • +
  • sanitize (bool) – if True, the molecule will be immediately sanitized, defaults to False

  • +
  • mapping_update_callback (Optional[Callable[['TreeMolecule'], None]]) – if given will call this method before setting up the mapped_smiles

  • +
+
+
Raises:
+

MoleculeException – if neither rd_mol or smiles is given, or if the molecule could not be sanitized

+
+
+
+
+property mapping_to_index: Dict[int, int]
+

Return a dictionary mapping to atom mappings to atom indices

+
+ +
+
+property mapped_atom_bonds: List[Tuple[int, int]]
+

Return a list of atom bonds as tuples on the mapped atom indices

+
+ +
+
+get_bonds_in_molecule(query_bonds)
+

Get bonds (from a list of bonds) that are present in the molecule. +:param bonds: List of bond (atom pairs) +:return: A list of bonds

+
+
Parameters:
+

query_bonds (Sequence[Sequence[int]])

+
+
Return type:
+

Sequence[Sequence[int]]

+
+
+
+ +
+
+has_all_focussed_bonds(bonds)
+

Checks that the focussed bonds exist in the target molecule’s atom bonds.

+
+
Parameters:
+
    +
  • bonds (Sequence[Sequence[int]]) – Focussed bonds.

  • +
  • target_mol – The target molecule.

  • +
+
+
Returns:
+

A boolean indicating if the input bonds exist in the target molecule.

+
+
Return type:
+

bool

+
+
+
+ +
+ +
+
+class aizynthfinder.chem.mol.UniqueMolecule(rd_mol=None, smiles=None, sanitize=False)
+

Bases: Molecule

+

A special molecule with the hash set to the id of the object. +Therefore no two instances of this class will be comparable.

+
+
Parameters:
+
    +
  • rd_mol (Optional[RdMol]) – a RDKit mol object to encapsulate, defaults to None

  • +
  • smiles (Optional[str]) – a SMILES to convert to a molecule object, defaults to None

  • +
  • sanitize (bool) – if True, the molecule will be immediately sanitized, defaults to False

  • +
+
+
Raises:
+

MoleculeException – if neither rd_mol or smiles is given, or if the molecule could not be sanitized

+
+
+
+ +
+
+aizynthfinder.chem.mol.none_molecule()
+

Return an empty molecule

+
+
Return type:
+

UniqueMolecule

+
+
+
+ +
+
+

aizynthfinder.chem.reaction module

+

Module containing classes to deal with Reactions.

+
+
+class aizynthfinder.chem.reaction.RetroReaction(mol, index=0, metadata=None, **kwargs)
+

Bases: ABC, _ReactionInterfaceMixin

+

A retrosynthesis reaction. Only a single molecule is the reactant.

+

This is an abstract class and child classes needs to implement the _apply and _make_smiles functions +that should create the reactants molecule objects and the reaction SMILES representation, respectively.

+
+
Variables:
+
    +
  • mol – the TreeMolecule object that this reaction is applied to

  • +
  • index – a unique index of this reaction, +to count for the fact that a reaction can produce more than one outcome

  • +
  • metadata – meta data associated with the reaction

  • +
+
+
Parameters:
+
    +
  • mol (TreeMolecule) – the molecule

  • +
  • index (int) – the index, defaults to 0

  • +
  • metadata (Optional[StrDict]) – some meta data

  • +
  • kwargs (Any)

  • +
+
+
Params kwargs:
+

any extra parameters for child classes

+
+
+
+
+classmethod from_serialization(init_args, reactants)
+

Create an object from a serialization. It does +1) instantiate an object using the init_args and +2) set the reactants to a tuple-form of `reactants

+
+
Parameters:
+
    +
  • init_args (StrDict) – the arguments passed to the __init__ method

  • +
  • reactants (List[List[TreeMolecule]]) – the reactants

  • +
+
+
Returns:
+

the deserialized object

+
+
Return type:
+

RetroReaction

+
+
+
+ +
+
+property reactants: Tuple[Tuple[TreeMolecule, ...], ...]
+

Returns the reactant molecules. +Apply the reaction if necessary.

+
+
Returns:
+

the products of the reaction

+
+
+
+ +
+
+property smiles: str
+

The reaction as a SMILES

+
+
Returns:
+

the SMILES

+
+
+
+ +
+
+property unqueried: bool
+

Return True if the reactants has never been retrieved

+
+ +
+
+copy(index=None)
+

Shallow copy of this instance.

+
+
Parameters:
+

index (Optional[int]) – new index, defaults to None

+
+
Returns:
+

the copy

+
+
Return type:
+

RetroReaction

+
+
+
+ +
+
+mapped_reaction_smiles()
+

Get the mapped reaction SMILES if it exists +:return: the SMILES

+
+
Return type:
+

str

+
+
+
+ +
+
+to_dict()
+

Return the retro reaction as dictionary +This dictionary is not suitable for serialization, but is used by other serialization routines +The elements of the dictionary can be used to instantiate a new reaction object

+
+
Return type:
+

StrDict

+
+
+
+ +
+ +
+
+class aizynthfinder.chem.reaction.TemplatedRetroReaction(mol, index=0, metadata=None, **kwargs)
+

Bases: RetroReaction

+

A retrosynthesis reaction that uses a reaction SMARTS and RDChiral to produce reactant molecules. +The SMILES representation of the reaction is the SMARTS (modified by RDKit)

+
+
Parameters:
+
    +
  • mol (TreeMolecule) – the molecule

  • +
  • index (int) – the index, defaults to 0

  • +
  • metadata (Optional[StrDict]) – some meta data

  • +
  • smarts – a string representing the template

  • +
  • kwargs (Any)

  • +
+
+
+
+
+property rd_reaction: RdReaction
+

Return the RDKit reaction created from the SMART

+
+ +
+
+to_dict()
+

Return the retro reaction as dictionary +This dictionary is not suitable for serialization, but is used by other serialization routines +The elements of the dictionary can be used to instantiate a new reaction object

+
+
Return type:
+

StrDict

+
+
+
+ +
+ +
+
+class aizynthfinder.chem.reaction.SmilesBasedRetroReaction(mol, index=0, metadata=None, **kwargs)
+

Bases: RetroReaction

+

A retrosynthesis reaction where the SMILES of the reactants are given on initiation

+

The SMILES representation of the reaction is the reaction SMILES

+
+
Parameters:
+
    +
  • mol (TreeMolecule) – the molecule

  • +
  • index (int) – the index, defaults to 0

  • +
  • metadata (Optional[StrDict]) – some meta data

  • +
  • reactants_str – a dot-separated string of reactant SMILES strings

  • +
  • kwargs (Any)

  • +
+
+
+
+
+to_dict()
+

Return the retro reaction as dictionary +This dictionary is not suitable for serialization, but is used by other serialization routines +The elements of the dictionary can be used to instantiate a new reaction object

+
+
Return type:
+

StrDict

+
+
+
+ +
+ +
+
+class aizynthfinder.chem.reaction.FixedRetroReaction(mol, smiles='', metadata=None)
+

Bases: _ReactionInterfaceMixin

+

A retrosynthesis reaction that has the same interface as RetroReaction +but it is fixed so it does not support SMARTS application or any creation of reactants.

+

The reactants are set by using the reactants property.

+
+
Variables:
+
    +
  • mol – the UniqueMolecule object that this reaction is applied to

  • +
  • smiles – the SMILES representation of the RDKit reaction

  • +
  • metadata – meta data associated with the reaction

  • +
  • reactants – the reactants of this reaction

  • +
+
+
Parameters:
+
    +
  • mol (UniqueMolecule) – the molecule

  • +
  • smiles (str) – the SMILES of the reaction

  • +
  • metadata (Optional[StrDict]) – some meta data

  • +
+
+
+
+
+copy()
+

Shallow copy of this instance.

+
+
Returns:
+

the copy

+
+
Return type:
+

FixedRetroReaction

+
+
+
+ +
+
+to_smiles_based_retroreaction()
+

Convert a FixedRetroReaction to a SmilesBasedRetroReaction.

+
+
Returns:
+

the SmilesBasedRetroReaction.

+
+
Return type:
+

SmilesBasedRetroReaction

+
+
+
+ +
+ +
+
+aizynthfinder.chem.reaction.hash_reactions(reactions, sort=True)
+

Creates a hash for a list of reactions

+
+
Parameters:
+
    +
  • reactions (Union[Iterable[RetroReaction], Iterable[FixedRetroReaction]]) – the reactions to hash

  • +
  • sort (bool) – if True will sort all molecules, defaults to True

  • +
+
+
Returns:
+

the hash string

+
+
Return type:
+

str

+
+
+
+ +
+
+

aizynthfinder.chem.serialization module

+

Module containing helper classes and routines for serialization.

+
+
+class aizynthfinder.chem.serialization.MoleculeSerializer
+

Bases: object

+

Utility class for serializing molecules

+

The id of the molecule to be serialized can be obtained with:

+
serializer = MoleculeSerializer()
+mol = Molecule(smiles="CCCO")
+idx = serializer[mol]
+
+
+

which will take care of the serialization of the molecule.

+
+
+
+
+property store: Dict[int, Any]
+

Return all serialized molecules as a dictionary

+
+ +
+ +
+
+class aizynthfinder.chem.serialization.MoleculeDeserializer(store)
+

Bases: object

+

Utility class for deserializing molecules. +The serialized molecules are created upon instantiation of the class.

+

The deserialized molecules can be obtained with:

+
deserializer = MoleculeDeserializer()
+mol = deserializer[idx]
+
+
+
+
Parameters:
+

store (Dict[int, Any])

+
+
+
+
+get_tree_molecules(ids)
+

Return multiple deserialized tree molecules

+
+
Parameters:
+

ids (Sequence[int]) – the list of IDs to deserialize

+
+
Returns:
+

the molecule objects

+
+
Return type:
+

Sequence[aizynthfinder.chem.TreeMolecule]

+
+
+
+ +
+ +
+
+aizynthfinder.chem.serialization.serialize_action(action, molecule_store)
+

Serialize a retrosynthesis action

+
+
Parameters:
+
+
+
Returns:
+

the action as a dictionary

+
+
Return type:
+

StrDict

+
+
+
+ +
+
+aizynthfinder.chem.serialization.deserialize_action(dict_, molecule_store)
+

Deserialize a retrosynthesis action

+
+
Parameters:
+
    +
  • dict – the (re)action as a dictionary

  • +
  • molecule_store (MoleculeDeserializer) – the molecule deserialization object

  • +
  • dict_ (StrDict)

  • +
+
+
Returns:
+

the created action object

+
+
Return type:
+

RetroReaction

+
+
+
+ +
+
+

Module contents

+

Sub-package containing chemistry routines

+
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/aizynthfinder.context.html b/aizynthfinder.context.html new file mode 100644 index 0000000..be7853c --- /dev/null +++ b/aizynthfinder.context.html @@ -0,0 +1,624 @@ + + + + + + + + aizynthfinder.context package — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

aizynthfinder.context package

+
+

Subpackages

+
+ +
+
+
+

Submodules

+
+
+

aizynthfinder.context.collection module

+

Module containing a class that is the base class for all collection classes (stock, policies, scorers)

+
+
+class aizynthfinder.context.collection.ContextCollection
+

Bases: ABC

+

Abstract base class for a collection of items +that can be loaded and then (de-)selected.

+
+

One can obtain individual items with:

+
+
an_item = collection["key"]
+
+
+

And delete items with

+
del collection["key"]
+
+
+
+
+
+
+property items: List[str]
+

The available item keys

+
+ +
+
+property selection: List[str] | str | None
+

The keys of the selected item(s)

+
+ +
+
+deselect(key=None)
+

Deselect one or all items

+

If no key is passed, all items will be deselected.

+
+
Parameters:
+

key (Optional[str]) – the key of the item to deselect, defaults to None

+
+
Raises:
+

KeyError – if the key is not among the selected ones

+
+
Return type:
+

None

+
+
+
+ +
+
+abstract load(*_)
+

Load an item. Needs to be implemented by a sub-class

+
+
Parameters:
+

_ (Any)

+
+
Return type:
+

None

+
+
+
+ +
+
+abstract load_from_config(**config)
+

Load items from a configuration. Needs to be implemented by a sub-class

+
+
Parameters:
+

config (Any)

+
+
Return type:
+

None

+
+
+
+ +
+
+select(value, append=False)
+

Select one or more items.

+

If this is a single selection collection, only a single value is accepted. +If this is a multiple selection collection it will overwrite the selection completely, +unless append is True and a single key is given.

+
+
Parameters:
+
    +
  • value (Union[str, List[str]]) – the key or keys of the item(s) to select

  • +
  • append (bool) – if True will append single keys to existing selection

  • +
+
+
Raises:
+
    +
  • ValueError – if this a single collection and value is multiple keys

  • +
  • KeyError – if at least one of the keys are not corresponding to a loaded item

  • +
+
+
Return type:
+

None

+
+
+
+ +
+
+select_all()
+

Select all loaded items

+
+
Return type:
+

None

+
+
+
+ +
+
+select_first()
+

Select the first loaded item

+
+
Return type:
+

None

+
+
+
+ +
+
+select_last()
+

Select the last loaded item

+
+
Return type:
+

None

+
+
+
+ +
+ +
+
+

aizynthfinder.context.config module

+

Module containing a class for encapsulating the settings of the tree search

+
+
+class aizynthfinder.context.config.Configuration(search=<factory>, post_processing=<factory>)
+

Bases: object

+

Encapsulating the settings of the tree search, including the policy, +the stock, the loaded scorers and various parameters.

+
+
Parameters:
+
    +
  • search (_SearchConfiguration)

  • +
  • post_processing (_PostprocessingConfiguration)

  • +
+
+
+
+
+search: _SearchConfiguration
+
+ +
+
+post_processing: _PostprocessingConfiguration
+
+ +
+
+stock: Stock
+
+ +
+
+expansion_policy: ExpansionPolicy
+
+ +
+
+filter_policy: FilterPolicy
+
+ +
+
+scorers: ScorerCollection
+
+ +
+
+classmethod from_dict(source)
+

Loads a configuration from a dictionary structure. +The parameters not set in the dictionary are taken from the default values. +The policies and stocks specified are directly loaded.

+
+
Parameters:
+

source (StrDict) – the dictionary source

+
+
Returns:
+

a Configuration object with settings from the source

+
+
Return type:
+

Configuration

+
+
+
+ +
+
+classmethod from_file(filename)
+

Loads a configuration from a yaml file. +The parameters not set in the yaml file are taken from the default values. +The policies and stocks specified in the yaml file are directly loaded. +The parameters in the yaml file may also contain environment variables as +values.

+
+
Parameters:
+

filename (str) – the path to a yaml file

+
+
Returns:
+

a Configuration object with settings from the yaml file

+
+
Raises:
+
+
ValueError: if parameter’s value expects an environment variable that

does not exist in the current environment

+
+
+
+
Return type:
+

Configuration

+
+
+
+ +
+ +
+
+

Module contents

+
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/aizynthfinder.context.policy.html b/aizynthfinder.context.policy.html new file mode 100644 index 0000000..6222afc --- /dev/null +++ b/aizynthfinder.context.policy.html @@ -0,0 +1,800 @@ + + + + + + + + aizynthfinder.context.policy package — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

aizynthfinder.context.policy package

+
+

Submodules

+
+
+

aizynthfinder.context.policy.expansion_strategies module

+

Module containing classes that implements different expansion policy strategies

+
+
+class aizynthfinder.context.policy.expansion_strategies.ExpansionStrategy(key, config, **kwargs)
+

Bases: ABC

+

A base class for all expansion strategies.

+

The strategy can be used by either calling the get_actions method +of by calling the instantiated class with a list of molecule.

+
expander = MyExpansionStrategy("dummy", config)
+actions, priors = expander.get_actions(molecules)
+actions, priors = expander(molecules)
+
+
+
+
Parameters:
+
    +
  • key (str) – the key or label

  • +
  • config (Configuration) – the configuration of the tree search

  • +
  • kwargs (str)

  • +
+
+
+
+
+abstract get_actions(molecules, cache_molecules=None)
+

Get all the probable actions of a set of molecules

+
+
Parameters:
+
    +
  • molecules (Sequence[TreeMolecule]) – the molecules to consider

  • +
  • cache_molecules (Optional[Sequence[TreeMolecule]]) – additional molecules to submit to the expansion +policy but that only will be cached for later use

  • +
+
+
Returns:
+

the actions and the priors of those actions

+
+
Return type:
+

Tuple[List[RetroReaction], List[float]]

+
+
+
+ +
+
+reset_cache()
+

Reset the prediction cache

+
+
Return type:
+

None

+
+
+
+ +
+ +
+
+class aizynthfinder.context.policy.expansion_strategies.MultiExpansionStrategy(key, config, **kwargs)
+

Bases: ExpansionStrategy

+

A base class for combining multiple expansion strategies.

+

The strategy can be used by either calling the get_actions method +or by calling the instantiated class with a list of molecules.

+
+
Variables:
+
    +
  • expansion_strategy_keys – the keys of the selected expansion strategies

  • +
  • additive_expansion – a conditional setting to specify whether all the actions +and priors of the selected expansion strategies should be combined or not. +Defaults to False.

  • +
  • expansion_strategy_weights – a list of weights for each expansion strategy. +The weights should sum to one. Exception is the default, where unity weight +is associated to each strategy.

  • +
+
+
Parameters:
+
    +
  • key (str) – the key or label

  • +
  • config (Configuration) – the configuration of the tree search

  • +
  • expansion_strategies – the keys of the selected expansion strategies. All keys +of the selected expansion strategies must exist in the expansion policies listed +in config

  • +
  • kwargs (Any)

  • +
+
+
+
+
+get_actions(molecules, cache_molecules=None)
+

Get all the probable actions of a set of molecules, using the selected policies.

+

The default implementation combines all the actions and priors of the +selected expansion strategies into two lists respectively if the +‘additive_expansion’ setting is set to True. This function can be overridden by +a sub class to combine different expansion strategies in different ways.

+
+
Parameters:
+
    +
  • molecules (Sequence[TreeMolecule]) – the molecules to consider

  • +
  • cache_molecules (Optional[Sequence[TreeMolecule]]) – additional molecules to submit to the expansion +policy but that only will be cached for later use

  • +
+
+
Returns:
+

the actions and the priors of those actions

+
+
Raises:
+

PolicyException: if the policy isn’t selected

+
+
Return type:
+

Tuple[List[RetroReaction], List[float]]

+
+
+
+ +
+ +
+
+class aizynthfinder.context.policy.expansion_strategies.TemplateBasedExpansionStrategy(key, config, **kwargs)
+

Bases: ExpansionStrategy

+

A template-based expansion strategy that will return TemplatedRetroReaction objects upon expansion.

+
+
Variables:
+
    +
  • template_column – the column in the template file that contains the templates

  • +
  • cutoff_cumulative – the accumulative probability of the suggested templates

  • +
  • cutoff_number – the maximum number of templates to returned

  • +
  • use_rdchiral – a boolean to apply templates with RDChiral

  • +
  • use_remote_models – a boolean to connect to remote TensorFlow servers

  • +
  • rescale_prior – a boolean to apply softmax to the priors

  • +
  • chiral_fingerprints – if True will base expansion on chiral fingerprint

  • +
  • mask – a boolean vector of masks for the reaction templates. The length of the vector should be equal to the +number of templates. It is set to None if no mask file is provided as input.

  • +
+
+
Parameters:
+
    +
  • key (str) – the key or label

  • +
  • config (Configuration) – the configuration of the tree search

  • +
  • model – the source of the policy model

  • +
  • template – the path to a HDF5 file with the templates

  • +
  • kwargs (str)

  • +
+
+
Raises:
+

PolicyException – if the length of the model output vector is not same as the +number of templates

+
+
+
+
+get_actions(molecules, cache_molecules=None)
+

Get all the probable actions of a set of molecules, using the selected policies and given cutoffs

+
+
Parameters:
+
    +
  • molecules (Sequence[TreeMolecule]) – the molecules to consider

  • +
  • cache_molecules (Optional[Sequence[TreeMolecule]]) – additional molecules to submit to the expansion +policy but that only will be cached for later use

  • +
+
+
Returns:
+

the actions and the priors of those actions

+
+
Return type:
+

Tuple[List[RetroReaction], List[float]]

+
+
+
+ +
+
+reset_cache()
+

Reset the prediction cache

+
+
Return type:
+

None

+
+
+
+ +
+ +
+
+class aizynthfinder.context.policy.expansion_strategies.TemplateBasedDirectExpansionStrategy(key, config, **kwargs)
+

Bases: TemplateBasedExpansionStrategy

+

A template-based expansion strategy that will return SmilesBasedRetroReaction objects upon expansion +by directly applying the template

+
+
Parameters:
+
    +
  • key (str) – the key or label

  • +
  • config (Configuration) – the configuration of the tree search

  • +
  • source – the source of the policy model

  • +
  • templatefile – the path to a HDF5 file with the templates

  • +
  • kwargs (str)

  • +
+
+
Raises:
+

PolicyException – if the length of the model output vector is not same as the number of templates

+
+
+
+
+get_actions(molecules, cache_molecules=None)
+

Get all the probable actions of a set of molecules, using the selected policies and given cutoffs

+
+
Parameters:
+
    +
  • molecules (Sequence[TreeMolecule]) – the molecules to consider

  • +
  • cache_molecules (Optional[Sequence[TreeMolecule]]) – additional molecules to submit to the expansion +policy but that only will be cached for later use

  • +
+
+
Returns:
+

the actions and the priors of those actions

+
+
Return type:
+

Tuple[List[RetroReaction], List[float]]

+
+
+
+ +
+ +
+
+

aizynthfinder.context.policy.filter_strategies module

+

Module containing classes that implements different filter policy strategies

+
+
+class aizynthfinder.context.policy.filter_strategies.FilterStrategy(key, config, **kwargs)
+

Bases: ABC

+

A base class for all filter strategies.

+

The filter can be applied by either calling the apply method +of by calling the instantiated class with a reaction.

+
filter = MyFilterStrategy("dummy", config)
+filter.apply(reaction)
+filter(reaction)
+
+
+
+
Parameters:
+
    +
  • key (str) – the key or label

  • +
  • config (Configuration) – the configuration of the tree search

  • +
  • kwargs (Any)

  • +
+
+
+
+
+abstract apply(reaction)
+

Apply the filter on the reaction. If the reaction +should be rejected a RejectionException is raised

+
+
Parameters:
+

reaction (RetroReaction) – the reaction to filter

+
+
Raises:
+

if the reaction should be rejected.

+
+
Return type:
+

None

+
+
+
+ +
+ +
+
+class aizynthfinder.context.policy.filter_strategies.BondFilter(key, config, **kwargs)
+

Bases: FilterStrategy

+

Check if focussed bonds to freeze stay frozen in a reaction.

+
+
Parameters:
+
    +
  • key (str) – the key or label

  • +
  • config (Configuration) – the configuration of the tree search

  • +
  • kwargs (Any)

  • +
+
+
+
+
+apply(reaction)
+

Apply the filter on the reaction. If the reaction +should be rejected a RejectionException is raised

+
+
Parameters:
+

reaction (RetroReaction) – the reaction to filter

+
+
Raises:
+

if the reaction should be rejected.

+
+
Return type:
+

None

+
+
+
+ +
+ +
+
+class aizynthfinder.context.policy.filter_strategies.QuickKerasFilter(key, config, **kwargs)
+

Bases: FilterStrategy

+

Filter quick-filter trained on artificial negative data

+
+
Variables:
+
    +
  • use_remote_models – a boolean to connect to remote TensorFlow servers. Defaults +to False.

  • +
  • filter_cutoff – the cut-off value

  • +
+
+
Parameters:
+
    +
  • key (str) – the key or label

  • +
  • config (Configuration) – the configuration of the tree search

  • +
  • model – the source of the policy model

  • +
  • kwargs (Any)

  • +
+
+
+
+
+apply(reaction)
+

Apply the filter on the reaction. If the reaction +should be rejected a RejectionException is raised

+
+
Parameters:
+

reaction (RetroReaction) – the reaction to filter

+
+
Raises:
+

if the reaction should be rejected.

+
+
Return type:
+

None

+
+
+
+ +
+
+feasibility(reaction)
+

Computes if a given reaction is feasible by given +the reaction fingerprint to a network model

+
+
Parameters:
+

reaction (RetroReaction) – the reaction to query

+
+
Returns:
+

if the reaction is feasible

+
+
Return type:
+

Tuple[bool, float]

+
+
+
+ +
+ +
+
+class aizynthfinder.context.policy.filter_strategies.ReactantsCountFilter(key, config, **kwargs)
+

Bases: FilterStrategy

+

Check that the number of reactants is was expected from the template

+
+
Parameters:
+
    +
  • key (str) – the key or label

  • +
  • config (Configuration) – the configuration of the tree search

  • +
  • kwargs (Any)

  • +
+
+
+
+
+apply(reaction)
+

Apply the filter on the reaction. If the reaction +should be rejected a RejectionException is raised

+
+
Parameters:
+

reaction (RetroReaction) – the reaction to filter

+
+
Raises:
+

if the reaction should be rejected.

+
+
Return type:
+

None

+
+
+
+ +
+ +
+
+

aizynthfinder.context.policy.policies module

+

Module containing classes that interfaces neural network policies

+
+
+class aizynthfinder.context.policy.policies.ExpansionPolicy(config)
+

Bases: ContextCollection

+

An abstraction of an expansion policy.

+

This policy provides actions that can be applied to a molecule

+
+
Parameters:
+

config (Configuration) – the configuration of the tree search

+
+
+
+
+get_actions(molecules, cache_molecules=None)
+

Get all the probable actions of a set of molecules, using the selected policies

+
+
Parameters:
+
    +
  • molecules (Sequence[TreeMolecule]) – the molecules to consider

  • +
  • cache_molecules (Sequence[TreeMolecule]) – additional molecules that potentially are sent to +the expansion model but for which predictions are not returned

  • +
+
+
Returns:
+

the actions and the priors of those actions

+
+
Raises:
+

PolicyException: if the policy isn’t selected

+
+
Return type:
+

Tuple[List[RetroReaction], List[float]]

+
+
+
+ +
+
+load(source)
+

Add a pre-initialized expansion strategy object to the policy

+
+
Parameters:
+

source (ExpansionStrategy) – the item to add

+
+
Return type:
+

None

+
+
+
+ +
+
+load_from_config(**config)
+

Load one or more expansion policy from a configuration

+

The format should be +key:

+
+

type: name of the expansion class or custom_package.custom_model.CustomClass +model: path_to_model +template: path_to_templates +other settings or params

+
+

or +key:

+
+
    +
  • path_to_model

  • +
  • path_to_templates

  • +
+
+
+
Parameters:
+

config (Any) – the configuration

+
+
Return type:
+

None

+
+
+
+ +
+
+reset_cache()
+

Reset the cache on all loaded policies

+
+
Return type:
+

None

+
+
+
+ +
+ +
+
+class aizynthfinder.context.policy.policies.FilterPolicy(config)
+

Bases: ContextCollection

+

An abstraction of a filter policy.

+

This policy provides a query on a reaction to determine whether it should be rejected

+
+
Parameters:
+

config (Configuration) – the configuration of the tree search

+
+
+
+
+apply(reaction)
+

Apply the all the selected filters on the reaction. If the reaction +should be rejected a RejectionException is raised

+
+
Parameters:
+

reaction (RetroReaction) – the reaction to filter

+
+
Raises:
+

if the reaction should be rejected or if a policy is selected

+
+
Return type:
+

None

+
+
+
+ +
+
+load(source)
+

Add a pre-initialized filter strategy object to the policy

+
+
Parameters:
+

source (FilterStrategy) – the item to add

+
+
Return type:
+

None

+
+
+
+ +
+
+load_from_config(**config)
+

Load one or more filter policy from a configuration

+

The format should be +key:

+
+

type: name of the filter class or custom_package.custom_model.CustomClass +model: path_to_model +other settings or params

+
+

or +key: path_to_model

+
+
Parameters:
+

config (Any) – the configuration

+
+
Return type:
+

None

+
+
+
+ +
+
+reset_cache()
+

Reset filtering cache.

+
+
Return type:
+

None

+
+
+
+ +
+ +
+
+

aizynthfinder.context.policy.utils module

+

Module containing helper routines for policies

+
+
+

Module contents

+

Sub-package containing policy routines

+
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/aizynthfinder.context.scoring.html b/aizynthfinder.context.scoring.html new file mode 100644 index 0000000..fc349a8 --- /dev/null +++ b/aizynthfinder.context.scoring.html @@ -0,0 +1,869 @@ + + + + + + + + aizynthfinder.context.scoring package — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

aizynthfinder.context.scoring package

+
+

Submodules

+
+
+

aizynthfinder.context.scoring.collection module

+

Module containing classes used to score the reaction routes.

+
+
+class aizynthfinder.context.scoring.collection.ScorerCollection(config)
+

Bases: ContextCollection

+

Store scorer objects for the aizynthfinder interface.

+

The scorers can be obtained by name with simple indexing

+
scorers = ScorerCollection()
+scorer = scorers['state score']
+
+
+

Scorers defined in this module and that does not require any +other argument to initialize than the config are auto-loaded.

+
+
Parameters:
+

config (Configuration) – the configuration of the tree search

+
+
+
+
+create_default_scorers()
+

Setup the scores that only need the config as their input.

+
+
Return type:
+

None

+
+
+
+ +
+
+load(scorer, silent=False)
+

Add a pre-initialized scorer object to the collection

+
+
Parameters:
+
    +
  • scorer (Scorer) – the item to add

  • +
  • silent (bool) – if True will not write out the name of the loaded scorer

  • +
+
+
Return type:
+

None

+
+
+
+ +
+
+load_from_config(**scorers_config)
+

Load one or several scorers from a configuration dictionary

+

The keys are the name of scorer class. If a scorer is not +defined in the aizynthfinder.context.scoring module, the module +name can be appended, e.g. mypackage.scoring.AwesomeScore.

+

The values of the configuration is passed directly to the scorer +class along with the config parameter.

+
+
Raises:
+

ScorerException – if module or class could not be found

+
+
Parameters:
+

scorers_config (Any)

+
+
Return type:
+

None

+
+
+
+ +
+
+make_subset(subset_names)
+

Make a new scorer collection by taking a subset of this +collection. The scorer instances will be shared between +the collections

+
+
Parameters:
+

subset_names (List[str]) – the scorers to copy over

+
+
Returns:
+

the newly formed collection

+
+
Return type:
+

ScorerCollection

+
+
+
+ +
+
+names()
+

Return a list of the names of all the loaded scorers

+
+
Return type:
+

List[str]

+
+
+
+ +
+
+objects()
+

Return a list of all the loaded scorer objects

+
+
Return type:
+

List[Scorer]

+
+
+
+ +
+
+score_vector(item)
+

For the given item, score it with all selected scorers +and return a vector

+
+
Parameters:
+

item (_Scoreable) – the item to be scored

+
+
Returns:
+

the vector with the scores

+
+
Return type:
+

Sequence[float]

+
+
+
+ +
+
+weighted_score(item, weights)
+

For the given item, score it with all selected scorers +and return a weighted sum of all the scores.

+

If weights is not the same length as the number of scorers +an exception is raised.

+

If no scorers are selected this will raise an exception

+
+
Parameters:
+
    +
  • item (_Scoreable) – the item to be scored

  • +
  • weights (Sequence[float]) – the weights of the scorers

  • +
+
+
Returns:
+

the weighted sum

+
+
Return type:
+

float

+
+
+
+ +
+ +
+
+

aizynthfinder.context.scoring.scorers module

+

Module containing classes used to score the reaction routes.

+
+
+class aizynthfinder.context.scoring.scorers.SquashScaler(slope, xoffset, yoffset)
+

Bases: object

+

Squash function loosely adapted from a sigmoid function with parameters +to modify and offset the shape

+
+
Parameters:
+
    +
  • slope (float) – the slope of the midpoint

  • +
  • xoffset (float) – the offset of the midpoint along the x-axis

  • +
  • yoffset (float) – the offset of the curve along the y-axis

  • +
+
+
+
+
+slope: float
+
+ +
+
+xoffset: float
+
+ +
+
+yoffset: float
+
+ +
+ +
+
+class aizynthfinder.context.scoring.scorers.MinMaxScaler(min_val, max_val, reverse, scale_factor=1)
+

Bases: object

+

Scaling function that normalises the value between 0 - 1, +the reverse variable controls the direction of scaling, +reverse should set to be true for rewards that need to be minimised +the scale_factor could be used to adjust the scores when they are too small or too big

+
+
Parameters:
+
    +
  • val – the value that is being scaled

  • +
  • min_val (float) – minimum val param val could take

  • +
  • max_val (float) – maximum val param val could take

  • +
  • scale_factor (float) – scaling factor applied to the minmax scaled output

  • +
  • reverse (bool)

  • +
+
+
+
+
+min_val: float
+
+ +
+
+max_val: float
+
+ +
+
+reverse: bool
+
+ +
+
+scale_factor: float = 1
+
+ +
+ +
+
+class aizynthfinder.context.scoring.scorers.Scorer(config=None, scaler_params=None)
+

Bases: ABC

+

Abstract base class for classes that do scoring on MCTS-like nodes or reaction trees.

+

The actual scoring is done be calling an instance of +a scorer class with a Node or ReactionTree object as only argument.

+
scorer = MyScorer()
+score = scorer(node1)
+
+
+

You can also give a list of such objects to the scorer

+
scorer = MyScorer()
+scores = scorer([node1, node2])
+
+
+
+
Parameters:
+
    +
  • config (Optional[Configuration]) – the configuration the tree search

  • +
  • scaler_params (Optional[StrDict]) – the parameter settings of the scaler

  • +
+
+
+
+
+scorer_name = 'base'
+
+ +
+
+sort(items)
+

Sort nodes or reaction trees in descending order based on the score

+
+
Parameters:
+

items (_Scoreables) – the items to sort

+
+
Returns:
+

the sorted items and their scores

+
+
Return type:
+

Tuple[_Scoreables, Sequence[float], Sequence[int]]

+
+
+
+ +
+ +
+
+class aizynthfinder.context.scoring.scorers.StateScorer(config, scaler_params=None)
+

Bases: Scorer

+

Class for scoring nodes based on the state score

+
+
Parameters:
+
+
+
+
+
+scorer_name = 'state score'
+
+ +
+ +
+
+class aizynthfinder.context.scoring.scorers.MaxTransformScorerer(config=None, scaler_params=None)
+

Bases: Scorer

+

Class for scoring nodes based on the maximum transform

+
+
Parameters:
+
    +
  • config (Optional[Configuration])

  • +
  • scaler_params (Optional[StrDict])

  • +
+
+
+
+
+scorer_name = 'max transform'
+
+ +
+ +
+
+class aizynthfinder.context.scoring.scorers.FractionInStockScorer(config, scaler_params=None)
+

Bases: Scorer

+

Class for scoring nodes based on the fraction in stock

+
+
Parameters:
+
+
+
+
+
+scorer_name = 'fraction in stock'
+
+ +
+ +
+
+class aizynthfinder.context.scoring.scorers.NumberOfReactionsScorer(config=None, scaler_params=None)
+

Bases: Scorer

+

Class for scoring nodes based on the number of reaction it took to get to a node

+
+
Parameters:
+
    +
  • config (Optional[Configuration])

  • +
  • scaler_params (Optional[StrDict])

  • +
+
+
+
+
+scorer_name = 'number of reactions'
+
+ +
+ +
+
+class aizynthfinder.context.scoring.scorers.NumberOfPrecursorsScorer(config=None, scaler_params=None)
+

Bases: Scorer

+

Class for scoring nodes based on the number of pre-cursors in a node or route

+
+
Parameters:
+
    +
  • config (Optional[Configuration])

  • +
  • scaler_params (Optional[StrDict])

  • +
+
+
+
+
+scorer_name = 'number of pre-cursors'
+
+ +
+ +
+
+class aizynthfinder.context.scoring.scorers.NumberOfPrecursorsInStockScorer(config, scaler_params=None)
+

Bases: Scorer

+

Class for scoring nodes based on the number of pre-cursors in stock a +node or route

+
+
Parameters:
+
+
+
+
+
+scorer_name = 'number of pre-cursors in stock'
+
+ +
+ +
+
+class aizynthfinder.context.scoring.scorers.AverageTemplateOccurrenceScorer(config=None, scaler_params=None)
+

Bases: Scorer

+

Class for scoring the nodes based on the average occurrence of the +templates used to get to a node

+
+
Parameters:
+
    +
  • config (Optional[Configuration])

  • +
  • scaler_params (Optional[StrDict])

  • +
+
+
+
+
+scorer_name = 'average template occurrence'
+
+ +
+ +
+
+class aizynthfinder.context.scoring.scorers.PriceSumScorer(config, scaler_params=None, default_cost=1.0, not_in_stock_multiplier=10)
+

Bases: Scorer

+

Scorer that sums the prices of all pre-cursors

+
+
Parameters:
+
    +
  • config (Configuration)

  • +
  • scaler_params (Optional[StrDict])

  • +
  • default_cost (float)

  • +
  • not_in_stock_multiplier (int)

  • +
+
+
+
+
+scorer_name = 'sum of prices'
+
+ +
+ +
+
+class aizynthfinder.context.scoring.scorers.RouteCostScorer(config, scaler_params=None, reaction_cost=1, average_yield=0.8, default_cost=1, not_in_stock_multiplier=10)
+

Bases: PriceSumScorer

+

Score based on the cost of molecules and reactions. +From Badowski et al. Chem Sci. 2019, 10, 4640

+
+
Parameters:
+
    +
  • config (Configuration)

  • +
  • scaler_params (Optional[StrDict])

  • +
  • reaction_cost (int)

  • +
  • average_yield (float)

  • +
  • default_cost (int)

  • +
  • not_in_stock_multiplier (int)

  • +
+
+
+
+
+scorer_name = 'route cost'
+
+ +
+ +
+
+class aizynthfinder.context.scoring.scorers.ReactionClassMembershipScorer(config, reaction_class_set, in_set_score=1.0, not_in_set_score=0.1)
+

Bases: Scorer

+

Scorer that checks if the reaction classes are in a specified set

+

The score is calculated as product over each reaction. For each reaction +the reaction classification is checked if it is in a given list of classes.

+
+
Parameters:
+
    +
  • config (Configuration)

  • +
  • reaction_class_set (Sequence[str])

  • +
  • in_set_score (float)

  • +
  • not_in_set_score (float)

  • +
+
+
+
+ +
+
+class aizynthfinder.context.scoring.scorers.StockAvailabilityScorer(config, source_score, default_score=0.1, other_source_score=None)
+

Bases: Scorer

+

Scorer that computes score based on the stock availability of the starting material

+

The score is calculated as a product of a stock score per starting material. The stock +score for each molecule is based on the source of the stock, or a default value if the +molecule is not in stock. The other_source_score parameter can be used to +distinguish between “not in stock” and “not in the specificed sources” cases.

+
+
Parameters:
+
    +
  • config (Configuration)

  • +
  • source_score (StrDict)

  • +
  • default_score (float)

  • +
  • other_source_score (Optional[float])

  • +
+
+
+
+ +
+
+class aizynthfinder.context.scoring.scorers.BrokenBondsScorer(config)
+

Bases: Scorer

+

Class for scoring nodes and reaction trees based on the breaking of atom bonds

+

The score is a summation of the depths in the tree where the focussed bonds +are found to break in the reaction. If a focussed bond is found to be unbroken +in the entire tree, the total length of the tree will be added to the score.

+
+
Parameters:
+

config (Configuration)

+
+
+
+
+scorer_name = 'broken bonds'
+
+ +
+ +
+
+class aizynthfinder.context.scoring.scorers.RouteSimilarityScorer(config, routes_path, model_path, scaler_params=None, agg_func='min', similarity=False)
+

Bases: Scorer

+

Class for scoring based on an LSTM model for computing Tree Edit Distance to +a set of reference routes.

+
+
Parameters:
+
    +
  • config (Configuration) – the configuration of the tree search

  • +
  • routes_path (str) – the filename of a JSON file with reference routes

  • +
  • model_path (str) – the filename of a checkpoint file with the LSTM model

  • +
  • scaler_params (Optional[StrDict]) – the parameter settings of the scaler

  • +
  • agg_func (str) – the name of numpy function used to aggregate the distances +to the reference routes

  • +
  • similarity (bool) – if True, will compute similarity score else distance scores

  • +
+
+
+
+
+scorer_name = 'route similarity'
+
+ +
+ +
+
+class aizynthfinder.context.scoring.scorers.DeltaSyntheticComplexityScorer(config, sc_score_model, scaler_params=None, horizon=3)
+

Bases: Scorer

+

Class for scoring nodes based on the delta-synthetic-complexity of the node +and its parent ‘horizon’ steps up in the tree.

+
+
Parameters:
+
    +
  • config (Configuration) – the configuration the tree search

  • +
  • sc_score_model (str) – the path to the SCScore model

  • +
  • scaler_params (Optional[StrDict]) – the parameter settings of the scaler, defaults to max-min between -1.5 and 4

  • +
  • horizon (int) – the number of steps backwards to look for parent molecule

  • +
+
+
+
+
+scorer_name: str = 'delta-SC score'
+
+ +
+
+sc_deltas(mols, parents)
+

Calculate delta SC-score among the list of mol-parent pairs.

+
+
Params mols:
+

the leaves of the tree

+
+
Parameters:
+
    +
  • parents (_Molecules) – the parent of the leaves

  • +
  • mols (_Molecules)

  • +
+
+
Returns:
+

the pair-wise difference in SCScore

+
+
Return type:
+

Sequence[float]

+
+
+
+ +
+ +
+
+class aizynthfinder.context.scoring.scorers.CombinedScorer(config, scorers, weights=None)
+

Bases: Scorer

+

Class for scoring nodes and reaction trees by combining weighted scores from a list of scorers

+

If no weights are provided as input, the scorer provides default weights that are +equal for all input scorers.

+

The CombinedScorer cannot be instantiated from the config file as it requires the +names of the scorers to combine as input.

+
+
Parameters:
+
    +
  • config (Configuration)

  • +
  • scorers (Sequence[str])

  • +
  • weights (Optional[Sequence[float]])

  • +
+
+
+
+ +
+
+

Module contents

+

Sub-package containing scoring routines

+
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/aizynthfinder.context.stock.html b/aizynthfinder.context.stock.html new file mode 100644 index 0000000..088085c --- /dev/null +++ b/aizynthfinder.context.stock.html @@ -0,0 +1,663 @@ + + + + + + + + aizynthfinder.context.stock package — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

aizynthfinder.context.stock package

+
+

Submodules

+
+
+

aizynthfinder.context.stock.queries module

+

Module containing classes that interfaces different stocks query classes

+
+
+class aizynthfinder.context.stock.queries.StockQueryMixin
+

Bases: object

+

Mixin class for all query classes, providing a default interface +to some methods that might not be possible to implement for each +query class.

+
+
+amount(mol)
+

Returns the maximum amount of the molecule in stock

+
+
Parameters:
+

mol (Molecule) – the query molecule

+
+
Raises:
+

StockException – if the amount cannot be computed

+
+
Returns:
+

the amount

+
+
Return type:
+

float

+
+
+
+ +
+
+availability_string(mol)
+

Returns the sources of the molecule

+
+
Parameters:
+

mol (Molecule) – the query molecule

+
+
Raises:
+

StockException – if the string cannot be computed

+
+
Returns:
+

a comma-separated list of sources

+
+
Return type:
+

str

+
+
+
+ +
+ +

Finds the entries of the molecule in the stock and cache them +if necessary.

+
+
Parameters:
+

mol (Molecule) – the query molecule

+
+
Returns:
+

if the molecule is in stock

+
+
Return type:
+

bool

+
+
+
+ +
+
+clear_cache()
+

Clear the internal search cache if available

+
+
Return type:
+

None

+
+
+
+ +
+
+price(mol)
+

Returns the minimum price of the molecule in stock

+
+
Parameters:
+

mol (Molecule) – the query molecule

+
+
Raises:
+

StockException – if the price cannot be computed

+
+
Return type:
+

float

+
+
+
+ +
+ +
+
+class aizynthfinder.context.stock.queries.InMemoryInchiKeyQuery(path, inchi_key_col='inchi_key', price_col=None)
+

Bases: StockQueryMixin

+

A stock query class that is based on an in-memory list +of pre-computed inchi-keys.

+
+
This list can be instantiated from
    +
  • A Pandas dataframe in HDF5 or CSV format

  • +
  • A text file with an inchi key on each row

  • +
+
+
+

The dataframe must have a column with InChIkeys that by default is “inchi_key”. +The HDF5 file must have a dataset called “table”.

+

If the source is a dataframe, then optionally it can contain prices and this +columns can be specified with the “price_column” argument.

+
+
Parameters:
+
    +
  • path (str) – the path to the file with inchi-keys

  • +
  • inchi_key_col (str) – the name of the column of the InChI keys

  • +
  • path

  • +
  • inchi_key_col

  • +
  • price_col (Optional[str])

  • +
+
+
Paramater price_col:
+

the name of the column with the optional prices

+
+
+
+
+property stock_inchikeys: Set[str]
+

Return the InChiKeys in this stock

+
+ +
+
+price(mol)
+

Returns the minimum price of the molecule in stock

+
+
Parameters:
+

mol (Molecule) – the query molecule

+
+
Raises:
+

StockException – if the price cannot be computed

+
+
Return type:
+

float

+
+
+
+ +
+ +
+
+class aizynthfinder.context.stock.queries.MongoDbInchiKeyQuery(host=None, database='stock_db', collection='molecules')
+

Bases: StockQueryMixin

+

A stock query class that is looking up inchi keys in a Mongo database.

+
+
The documents in the database collection should have at least 2 fields:
    +
  • inchi_key: the inchi key of the molecule

  • +
  • source: the original source of the molecule

  • +
+
+
+
+
Variables:
+
    +
  • client – the Mongo client

  • +
  • database – the database instance

  • +
  • molecules – the collection of documents

  • +
+
+
Parameters:
+
    +
  • host (Optional[str]) – the database host, defaults to None

  • +
  • database (str) – the database name, defaults to “stock_db”

  • +
  • collection (str) – the database collection, defaults to “molecules”

  • +
  • host

  • +
  • database

  • +
  • collection

  • +
+
+
+
+
+availability_string(mol)
+

Returns the sources of the molecule

+
+
Parameters:
+

mol (Molecule) – the query molecule

+
+
Raises:
+

StockException – if the string cannot be computed

+
+
Returns:
+

a comma-separated list of sources

+
+
Return type:
+

str

+
+
+
+ +
+ +
+
+class aizynthfinder.context.stock.queries.MolbloomFilterQuery(path, smiles_based=False)
+

Bases: StockQueryMixin

+

A stock query class that is based on an a molbloom filter +for SMILES strings or InChI keys

+
+
Parameters:
+
    +
  • path (str) – the path to the saved bloom filter

  • +
  • smiles_based (bool) – if True will use SMILES for lookup instead of InChI keys

  • +
  • path

  • +
  • smiles_based

  • +
+
+
+
+ +
+
+

aizynthfinder.context.stock.stock module

+

Module containing classes that interfaces different stock classes

+
+
+class aizynthfinder.context.stock.stock.Stock
+

Bases: ContextCollection

+

A collection of molecules that are in stock

+

A molecule can be queried on the stock with:

+
my_mol = Molecule(smiles="CCO")
+my_mol in stock
+
+
+

One can obtain individual stocks with:

+
sub_stock = stock["key"]
+
+
+

One can obtain the number of molecules in the selected stock with:

+
number_of_molecules = len(stock)
+
+
+
+
+
+
+property stop_criteria: dict
+

Return a copy of the stop criteria used by the stock

+
+ +
+
+amount(mol)
+

Calculate the maximum amount of a molecule in stock

+
+
Parameters:
+

mol (Molecule) – the molecule to query

+
+
Raises:
+

StockException – if the amount could not be computed

+
+
Returns:
+

the maximum amount

+
+
Return type:
+

float

+
+
+
+ +
+
+availability_list(mol)
+

Return a list of what stocks a given mol is available

+

If the molecule is not in stock it will return any empty list

+
+
Parameters:
+

mol (Molecule) – The molecule to query

+
+
Returns:
+

string with a list of stocks that mol was found in

+
+
Return type:
+

List[str]

+
+
+
+ +
+
+availability_string(mol)
+

Return a string of what stocks a given mol is available

+

If the molecule is not in stock it will return “Not in stock”

+
+
Parameters:
+

mol (Molecule) – The molecule to query

+
+
Returns:
+

string with a list of stocks that mol was found in

+
+
Return type:
+

str

+
+
+
+ +
+
+exclude(mol)
+

Exclude a molecule from the stock. +When this molecule is queried it will return False, +regardless if the molecule is in the stock.

+
+
Parameters:
+

mol (Molecule) – the molecule to exclude

+
+
Return type:
+

None

+
+
+
+ +
+
+load(source, key)
+

Add a pre-initialized stock query object to the stock

+
+
Parameters:
+
    +
  • source (StockQueryMixin) – the item to add

  • +
  • key (str) – The key that will be used to select the stock

  • +
+
+
Return type:
+

None

+
+
+
+ +
+
+load_from_config(**config)
+

Load one or more stock queries from a configuration

+

The key can be “stop_criteria” in case the config is given to the +set_stop_criteria method

+

The format should be +key:

+
+

type: name of the stock class or custom_package.custom_model.CustomClass +path: path to the stock file +other settings or params

+
+

or +key: path_to_model

+
+
Parameters:
+

config (Any) – the configuration

+
+
Return type:
+

None

+
+
+
+ +
+
+price(mol)
+

Calculate the minimum price of a molecule in stock

+
+
Parameters:
+

mol (Molecule) – the molecule to query

+
+
Raises:
+

StockException – if the price could not be computed

+
+
Returns:
+

the minimum price

+
+
Return type:
+

float

+
+
+
+ +
+
+reset_exclusion_list()
+

Remove all molecules in the exclusion list

+
+
Return type:
+

None

+
+
+
+ +
+
+select(value, append=False)
+

Select one or more stock queries

+
+
Parameters:
+
    +
  • value (Union[str, List[str]]) – the key of the stocks to select

  • +
  • append (bool) – if True and value is a single key append it to the current selection

  • +
+
+
Return type:
+

None

+
+
+
+ +
+
+set_stop_criteria(criteria=None)
+

Set criteria that stop the search

+

The keys of the criteria can be “price” or “amount” which accepts numerical settings, +or “counts” that should be dictionary of maximum allowed count for each atomic symbol.

+

Example:

+
criteria = {
+    "price": 5,
+    "amount": 100,
+    "counts": {
+        "C": 6,
+        "O": 4
+    }
+}
+
+
+
+
Parameters:
+

criteria (Optional[Dict]) – the criteria settings

+
+
Return type:
+

None

+
+
+
+ +
+
+smiles_in_stock(smiles)
+

Check if the SMILES is in the currently selected stocks

+
+
Parameters:
+

smiles (str) – SMILES string (must be RDKit sanitizable)

+
+
Returns:
+

if the SMILES was on stock

+
+
Return type:
+

bool

+
+
+
+ +
+ +
+
+

Module contents

+

Sub-package containing stock routines

+
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/aizynthfinder.html b/aizynthfinder.html new file mode 100644 index 0000000..18cb140 --- /dev/null +++ b/aizynthfinder.html @@ -0,0 +1,1055 @@ + + + + + + + + aizynthfinder package — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

aizynthfinder package

+
+

Subpackages

+
+ +
+
+
+

Submodules

+
+
+

aizynthfinder.aizynthfinder module

+

Module containing a class that is the main interface the retrosynthesis tool.

+
+
+class aizynthfinder.aizynthfinder.AiZynthFinder(configfile=None, configdict=None)
+

Bases: object

+

Public API to the aizynthfinder tool

+

If instantiated with the path to a yaml file or dictionary of settings +the stocks and policy networks are loaded directly. +Otherwise, the user is responsible for loading them prior to +executing the tree search.

+
+
Variables:
+
    +
  • config – the configuration of the search

  • +
  • expansion_policy – the expansion policy model

  • +
  • filter_policy – the filter policy model

  • +
  • stock – the stock

  • +
  • scorers – the loaded scores

  • +
  • tree – the search tree

  • +
  • analysis – the tree analysis

  • +
  • routes – the top-ranked routes

  • +
  • search_stats – statistics of the latest search

  • +
+
+
Parameters:
+
    +
  • configfile (Optional[str]) – the path to yaml file with configuration (has priority over configdict), defaults to None

  • +
  • configdict (Optional[StrDict]) – the config as a dictionary source, defaults to None

  • +
+
+
+
+
+property target_smiles: str
+

The SMILES representation of the molecule to predict routes on.

+
+ +
+
+property target_mol: Molecule | None
+

The molecule to predict routes on

+
+ +
+
+build_routes(selection=None, scorer=None)
+

Build reaction routes

+

This is necessary to call after the tree search has completed in order +to extract results from the tree search.

+
+
Parameters:
+
    +
  • selection (Optional[RouteSelectionArguments]) – the selection criteria for the routes

  • +
  • scorer (Optional[Union[str, List[str]]]) – a reference to the object used to score the nodes, can be a list

  • +
+
+
Raises:
+

ValueError – if the search tree not initialized

+
+
Return type:
+

None

+
+
+
+ +
+
+extract_statistics()
+

Extracts tree statistics as a dictionary

+
+
Return type:
+

StrDict

+
+
+
+ +
+
+prepare_tree()
+

Setup the tree for searching

+
+
Raises:
+

ValueError – if the target molecule was not set

+
+
Return type:
+

None

+
+
+
+ +
+
+stock_info()
+

Return the stock availability for all leaf nodes in all collected reaction trees

+

The key of the return dictionary will be the SMILES string of the leaves, +and the value will be the stock availability

+
+
Returns:
+

the collected stock information.

+
+
Return type:
+

StrDict

+
+
+
+ +
+ +

Perform the actual tree search

+
+
Parameters:
+

show_progress (bool) – if True, shows a progress bar

+
+
Returns:
+

the time past in seconds

+
+
Return type:
+

float

+
+
+
+ +
+ +
+
+class aizynthfinder.aizynthfinder.AiZynthExpander(configfile=None, configdict=None)
+

Bases: object

+

Public API to the AiZynthFinder expansion and filter policies

+

If instantiated with the path to a yaml file or dictionary of settings +the stocks and policy networks are loaded directly. +Otherwise, the user is responsible for loading them prior to +executing the tree search.

+
+
Variables:
+
    +
  • config – the configuration of the search

  • +
  • expansion_policy – the expansion policy model

  • +
  • filter_policy – the filter policy model

  • +
+
+
Parameters:
+
    +
  • configfile (Optional[str]) – the path to yaml file with configuration (has priority over configdict), defaults to None

  • +
  • configdict (Optional[StrDict]) – the config as a dictionary source, defaults to None

  • +
+
+
+
+
+do_expansion(smiles, return_n=5, filter_func=None)
+

Do the expansion of the given molecule returning a list of +reaction tuples. Each tuple in the list contains reactions +producing the same reactants. Hence, nested structure of the +return value is way to group reactions.

+

If filter policy is setup, the probability of the reactions are +added as metadata to the reaction.

+

The additional filter functions makes it possible to do customized +filtering. The callable should take as only argument a RetroReaction +object and return True if the reaction can be kept or False if it should +be removed.

+
+
Parameters:
+
    +
  • smiles (str) – the SMILES string of the target molecule

  • +
  • return_n (int) – the length of the return list

  • +
  • filter_func (Optional[Callable[[RetroReaction], bool]]) – an additional filter function

  • +
+
+
Returns:
+

the grouped reactions

+
+
Return type:
+

List[Tuple[FixedRetroReaction, …]]

+
+
+
+ +
+ +
+
+

aizynthfinder.reactiontree module

+

Module containing the implementation of a reaction tree or route and factory classes to make such trees

+
+
+class aizynthfinder.reactiontree.ReactionTree
+

Bases: object

+

Encapsulation of a bipartite reaction tree of a single route. +The nodes consists of either FixedRetroReaction or UniqueMolecule objects.

+

The reaction tree is initialized at instantiation and is not supposed to +be updated.

+
+
Variables:
+
    +
  • graph – the bipartite graph

  • +
  • is_solved – if all of the leaf nodes are in stock

  • +
  • root – the root of the tree

  • +
  • created_at_iteration – iteration the reaction tree was created

  • +
+
+
+
+
+classmethod from_dict(tree_dict)
+

Create a new ReactionTree by parsing a dictionary.

+

This is supposed to be the opposite of to_dict, +but because that format loses information, the returned +object is not a full copy as the stock will only contain +the list of molecules marked as in_stock in the dictionary.

+

The returned object should be sufficient to e.g. generate an image of the route.

+
+
Parameters:
+

tree_dict (StrDict) – the dictionary representation

+
+
Returns:
+

the reaction tree

+
+
Return type:
+

ReactionTree

+
+
+
+ +
+
+property metadata: StrDict
+

Return a dicitionary with route metadata

+
+ +
+
+depth(node)
+

Return the depth of a node in the route

+
+
Parameters:
+

node (Union[UniqueMolecule, FixedRetroReaction]) – the query node

+
+
Returns:
+

the depth

+
+
Return type:
+

int

+
+
+
+ +
+
+distance_to(other, content='both')
+

Calculate the distance to another reaction tree

+

This is a tree edit distance, with unit cost to +insert and deleted nodes, and the Jaccard distance for substituting nodes

+
+
Parameters:
+
    +
  • other (ReactionTree) – the reaction tree to compare to

  • +
  • content (str) – determine what part of the tree to include in the calculation

  • +
+
+
Returns:
+

the distance between the routes

+
+
Return type:
+

float

+
+
+
+ +
+
+hash_key()
+

Calculates a hash code for the tree using the sha224 hash function recursively

+
+
Returns:
+

the hash key

+
+
Return type:
+

str

+
+
+
+ +
+
+in_stock(node)
+

Return if a node in the route is in stock

+

Note that is a property set on creation and as such is not updated.

+
+
Parameters:
+

node (Union[UniqueMolecule, FixedRetroReaction]) – the query node

+
+
Returns:
+

if the molecule is in stock

+
+
Return type:
+

bool

+
+
+
+ +
+
+is_branched()
+

Returns if the route is branched

+

i.e. checks if the maximum depth is not equal to the number +of reactions.

+
+
Return type:
+

bool

+
+
+
+ +
+
+leafs()
+

Generates the molecules nodes of the reaction tree that has no predecessors, +i.e. molecules that has not been broken down

+
+
Yield:
+

the next leaf molecule in the tree

+
+
Return type:
+

Iterable[UniqueMolecule]

+
+
+
+ +
+
+molecules()
+

Generates the molecule nodes of the reaction tree

+
+
Yield:
+

the next molecule in the tree

+
+
Return type:
+

Iterable[UniqueMolecule]

+
+
+
+ +
+
+parent_molecule(mol)
+

Returns the parent molecule within the reaction tree. +:param mol: the query node (molecule) +:return: the parent molecule

+
+
Parameters:
+

mol (UniqueMolecule)

+
+
Return type:
+

UniqueMolecule

+
+
+
+ +
+
+reactions()
+

Generates the reaction nodes of the reaction tree

+
+
Yield:
+

the next reaction in the tree

+
+
Return type:
+

Iterable[FixedRetroReaction]

+
+
+
+ +
+
+subtrees()
+

Generates the subtrees of this reaction tree a +subtree is a reaction treee starting at a molecule node that has children.

+
+
Yield:
+

the next subtree

+
+
Return type:
+

Iterable[ReactionTree]

+
+
+
+ +
+
+to_dict(include_metadata=False)
+

Returns the reaction tree as a dictionary in a pre-defined format. +:param include_metadata: if True include metadata +:return: the reaction tree

+
+
Return type:
+

StrDict

+
+
+
+ +
+
+to_image(in_stock_colors=None, show_all=True)
+

Return a pictorial representation of the route

+
+
Parameters:
+
    +
  • in_stock_colors (Optional[FrameColors]) – the colors around molecules, defaults to {True: “green”, False: “orange”}

  • +
  • show_all (bool) – if True, also show nodes that are marked as hidden

  • +
+
+
Returns:
+

the image of the route

+
+
Return type:
+

PilImage

+
+
+
+ +
+
+to_json(include_metadata=False)
+

Returns the reaction tree as a JSON string in a pre-defined format.

+
+
Returns:
+

the reaction tree

+
+
Return type:
+

str

+
+
+
+ +
+ +
+
+class aizynthfinder.reactiontree.ReactionTreeLoader(*args, **kwargs)
+

Bases: ABC

+

Base class for classes that creates a reaction tree object

+

This class makes sure that node attributes are set after the +graph is generated, and provides utility methods.

+
+
Parameters:
+
    +
  • args (Any)

  • +
  • kwargs (Any)

  • +
+
+
+
+ +
+
+class aizynthfinder.reactiontree.ReactionTreeFromDict(*args, **kwargs)
+

Bases: ReactionTreeLoader

+

Creates a reaction tree object from a dictionary

+
+
Parameters:
+
    +
  • args (Any)

  • +
  • kwargs (Any)

  • +
+
+
+
+ +
+
+class aizynthfinder.reactiontree.ReactionTreeFromExpansion(*args, **kwargs)
+

Bases: ReactionTreeLoader

+

Create a ReactionTree from a single reaction

+

This is mainly intended as a convenience function for the expander interface

+
+
Parameters:
+
    +
  • args (Any)

  • +
  • kwargs (Any)

  • +
+
+
+
+ +
+
+

Module contents

+
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/aizynthfinder.interfaces.gui.html b/aizynthfinder.interfaces.gui.html new file mode 100644 index 0000000..0ffbe21 --- /dev/null +++ b/aizynthfinder.interfaces.gui.html @@ -0,0 +1,284 @@ + + + + + + + + aizynthfinder.interfaces.gui package — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

aizynthfinder.interfaces.gui package

+
+

Submodules

+
+
+

aizynthfinder.interfaces.gui.clustering module

+

Module containing a GUI extension for clustering

+
+
+class aizynthfinder.interfaces.gui.clustering.ClusteringGui(routes, content='both')
+

Bases: object

+

GUI extension to cluster routes

+
+
Parameters:
+
    +
  • routes (RouteCollection) – the routes to cluster

  • +
  • content (str) – what to cluster on

  • +
+
+
+
+
+classmethod from_app(app, content='both')
+

Helper function to create a GUI from a GUI app interface

+
+
Parameters:
+
    +
  • app (AiZynthApp) – the app to extract the routes from

  • +
  • content (str) – what to cluster on

  • +
+
+
Returns:
+

the GUI object

+
+
+
+ +
+ +
+
+

aizynthfinder.interfaces.gui.pareto_fronts module

+

Module containing a GUI extension for plotting pareto fronts

+
+
+class aizynthfinder.interfaces.gui.pareto_fronts.ParetoFrontsGUI(tree, scorers)
+

Bases: object

+

GUI extension for plotting pareto fronts of routes.

+
+
Parameters:
+
+
+
+
+
+classmethod from_app(app)
+

, +Helper function to create a GUI from a GUI app interface

+
+
Parameters:
+

app (AiZynthApp) – the app to extract the routes from

+
+
Returns:
+

the GUI object

+
+
+
+ +
+ +
+
+

aizynthfinder.interfaces.gui.utils module

+

Module containing utility functions for GUI.

+
+
+aizynthfinder.interfaces.gui.utils.pareto_fronts_plot(routes)
+

Plot the pareto front(s).

+
+
Parameters:
+

routes (RouteCollection) – the route collection to plot as Pareto fronts

+
+
Return type:
+

None

+
+
+
+ +
+
+aizynthfinder.interfaces.gui.utils.route_display(index, routes, output_widget)
+

Display a route with auxillary information in a widget

+
+
Parameters:
+
    +
  • index (Optional[int]) – the index of the route to display

  • +
  • routes (RouteCollection) – the route collection

  • +
  • output_widget (widgets.Output) – the widget to display the route on

  • +
+
+
Return type:
+

None

+
+
+
+ +
+
+

Module contents

+

Package for GUI extensions

+
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/aizynthfinder.interfaces.html b/aizynthfinder.interfaces.html new file mode 100644 index 0000000..25fb356 --- /dev/null +++ b/aizynthfinder.interfaces.html @@ -0,0 +1,261 @@ + + + + + + + + aizynthfinder.interfaces package — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

aizynthfinder.interfaces package

+
+

Subpackages

+ +
+
+

Submodules

+
+
+

aizynthfinder.interfaces.aizynthapp module

+

Module containing classes and routines for the GUI interface

+
+
+class aizynthfinder.interfaces.aizynthapp.AiZynthApp(configfile, setup=True)
+

Bases: object

+

Interface class to be used in a Jupyter Notebook. +Provides a basic GUI to setup and analyze the tree search.

+

Should be instantiated with the path of a yaml file with configuration:

+
from aizynthfinder.interfaces import AiZynthApp
+configfile = "/path/to/configfile.yaml"
+app = AiZynthApp(configfile)
+
+
+
+
Variables:
+

finder – the finder instance

+
+
Parameters:
+
    +
  • configfile (str) – the path to yaml file with configuration

  • +
  • setup (bool) – if True will create and display the GUI on instantiation, defaults to True

  • +
+
+
+
+
+setup()
+

Create the widgets and display the GUI. +This is typically done on instantiation, but this method +is for more advanced uses.

+
+
Return type:
+

None

+
+
+
+ +
+ +
+
+aizynthfinder.interfaces.aizynthapp.main()
+

Entry point for the aizynthapp command

+
+
Return type:
+

None

+
+
+
+ +
+
+

aizynthfinder.interfaces.aizynthcli module

+

Module containing classes and routines for the CLI

+
+
+aizynthfinder.interfaces.aizynthcli.main()
+

Entry point for the aizynthcli command

+
+
Return type:
+

None

+
+
+
+ +
+
+

Module contents

+

Module for interfaces to the AiZynthFinder application

+
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/aizynthfinder.search.breadth_first.html b/aizynthfinder.search.breadth_first.html new file mode 100644 index 0000000..1821d70 --- /dev/null +++ b/aizynthfinder.search.breadth_first.html @@ -0,0 +1,514 @@ + + + + + + + + aizynthfinder.search.breadth_first package — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

aizynthfinder.search.breadth_first package

+
+

Submodules

+
+
+

aizynthfinder.search.breadth_first.nodes module

+

Module containing a classes representation various tree nodes

+
+
+class aizynthfinder.search.breadth_first.nodes.MoleculeNode(mol, config, parent=None)
+

Bases: TreeNodeMixin

+

An OR node representing a molecule

+
+
Variables:
+
    +
  • expandable – if True, this node is part of the frontier

  • +
  • mol – the molecule represented by the node

  • +
  • in_stock – if True the molecule is in stock and hence should not be expanded

  • +
  • parent – the parent of the node

  • +
+
+
Parameters:
+
    +
  • mol (TreeMolecule) – the molecule to be represented by the node

  • +
  • config (Configuration) – the configuration of the search

  • +
  • parent (Optional[ReactionNode]) – the parent of the node, optional

  • +
+
+
+
+
+classmethod create_root(smiles, config)
+

Create a root node for a tree using a SMILES.

+
+
Parameters:
+
    +
  • smiles (str) – the SMILES representation of the root state

  • +
  • config (Configuration) – settings of the tree search algorithm

  • +
+
+
Returns:
+

the created node

+
+
Return type:
+

MoleculeNode

+
+
+
+ +
+
+classmethod from_dict(dict_, config, molecules, parent=None)
+

Create a new node from a dictionary, i.e. deserialization

+
+
Parameters:
+
    +
  • dict – the serialized node

  • +
  • config (Configuration) – settings of the tree search algorithm

  • +
  • molecules (MoleculeDeserializer) – the deserialized molecules

  • +
  • parent (Optional[ReactionNode]) – the parent node

  • +
  • dict_ (StrDict)

  • +
+
+
Returns:
+

a deserialized node

+
+
Return type:
+

MoleculeNode

+
+
+
+ +
+
+property children: List[ReactionNode]
+

Gives the reaction children nodes

+
+ +
+
+property prop: StrDict
+

Dictionary with publicly exposed properties

+
+ +
+
+add_stub(reaction)
+

Add a stub / sub-tree to this node

+
+
Parameters:
+

reaction (RetroReaction) – the reaction creating the stub

+
+
Returns:
+

list of all newly added molecular nodes

+
+
Return type:
+

Sequence[MoleculeNode]

+
+
+
+ +
+
+ancestors()
+

Return the ancestors of this node

+
+
Returns:
+

the ancestors

+
+
Return type:
+

set

+
+
+
+ +
+
+serialize(molecule_store)
+

Serialize the node object to a dictionary

+
+
Parameters:
+

molecule_store (MoleculeSerializer) – the serialized molecules

+
+
Returns:
+

the serialized node

+
+
Return type:
+

StrDict

+
+
+
+ +
+ +
+
+class aizynthfinder.search.breadth_first.nodes.ReactionNode(reaction, parent)
+

Bases: TreeNodeMixin

+

An AND node representing a reaction

+
+
Variables:
+
    +
  • parent – the parent of the node

  • +
  • reaction – the reaction represented by the node

  • +
+
+
Parameters:
+
    +
  • cost – the cost of the reaction

  • +
  • reaction (RetroReaction) – the reaction to be represented by the node

  • +
  • parent (MoleculeNode) – the parent of the node

  • +
+
+
+
+
+classmethod create_stub(reaction, parent, config)
+

Create a ReactionNode and creates all the MoleculeNode objects +that are the children of the node.

+
+
Parameters:
+
    +
  • reaction (RetroReaction) – the reaction to be represented by the node

  • +
  • parent (MoleculeNode) – the parent of the node

  • +
  • config (Configuration) – the configuration of the search tree

  • +
+
+
Return type:
+

ReactionNode

+
+
+
+ +
+
+classmethod from_dict(dict_, config, molecules, parent)
+

Create a new node from a dictionary, i.e. deserialization

+
+
Parameters:
+
+
+
Returns:
+

a deserialized node

+
+
Return type:
+

ReactionNode

+
+
+
+ +
+
+property children: List[MoleculeNode]
+

Gives the molecule children nodes

+
+ +
+
+property prop: StrDict
+

Dictionary with publicly exposed properties

+
+ +
+
+serialize(molecule_store)
+

Serialize the node object to a dictionary

+
+
Parameters:
+

molecule_store (MoleculeSerializer) – the serialized molecules

+
+
Returns:
+

the serialized node

+
+
Return type:
+

StrDict

+
+
+
+ +
+ +
+
+

aizynthfinder.search.breadth_first.search_tree module

+

Module containing a class that holds the tree search

+
+
+class aizynthfinder.search.breadth_first.search_tree.SearchTree(config, root_smiles=None)
+

Bases: AndOrSearchTreeBase

+

Encapsulation of the a breadth-first exhaustive search algorithm

+
+
Variables:
+
    +
  • config – settings of the tree search algorithm

  • +
  • root – the root node

  • +
+
+
Parameters:
+
    +
  • config (Configuration) – settings of the tree search algorithm

  • +
  • root_smiles (Optional[str]) – the root will be set to a node representing this molecule, defaults to None

  • +
+
+
+
+
+classmethod from_json(filename, config)
+

Create a new search tree by deserialization from a JSON file

+
+
Parameters:
+
    +
  • filename (str) – the path to the JSON node

  • +
  • config (Configuration) – the configuration of the search tree

  • +
+
+
Returns:
+

a deserialized tree

+
+
Return type:
+

SearchTree

+
+
+
+ +
+
+property mol_nodes: Sequence[MoleculeNode]
+

Return the molecule nodes of the tree

+
+ +
+
+one_iteration()
+

Perform one iteration expansion. +Expands all expandable molecule nodes in the tree, which should be +on the same depth of the tree.

+
+
Raises:
+

StopIteration – if the search should be pre-maturely terminated

+
+
Returns:
+

if a solution was found

+
+
Return type:
+

bool

+
+
+
+ +
+
+routes()
+

Extracts and returns routes from the AND/OR tree

+
+
Returns:
+

the routes

+
+
Return type:
+

List[ReactionTree]

+
+
+
+ +
+
+serialize(filename)
+

Seralize the search tree to a JSON file

+
+
Parameters:
+

filename (str) – the path to the JSON file

+
+
Return type:
+

None

+
+
+
+ +
+ +
+
+

Module contents

+

Sub-package containing breadth first routines

+
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/aizynthfinder.search.dfpn.html b/aizynthfinder.search.dfpn.html new file mode 100644 index 0000000..9d397a5 --- /dev/null +++ b/aizynthfinder.search.dfpn.html @@ -0,0 +1,443 @@ + + + + + + + + aizynthfinder.search.dfpn package — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

aizynthfinder.search.dfpn package

+
+

Submodules

+
+
+

aizynthfinder.search.dfpn.nodes module

+

Module containing a classes representation various tree nodes

+
+
+class aizynthfinder.search.dfpn.nodes.MoleculeNode(mol, config, owner, parent=None)
+

Bases: _SuperNode

+

An OR node representing a molecule

+
+
Variables:
+
    +
  • expandable – if True, this node is part of the frontier

  • +
  • mol – the molecule represented by the node

  • +
  • in_stock – if True the molecule is in stock and hence should not be expanded

  • +
  • parent – the parent of the node

  • +
  • pn – the proof number

  • +
  • dn – the disproof number

  • +
  • pn_threshold – the threshold for proof number

  • +
  • dn_threshold – the threshold for disproof number

  • +
+
+
Parameters:
+
+
+
+
+
+classmethod create_root(smiles, config, owner)
+

Create a root node for a tree using a SMILES.

+
+
Parameters:
+
    +
  • smiles (str) – the SMILES representation of the root state

  • +
  • config (Configuration) – settings of the tree search algorithm

  • +
  • owner (SearchTree)

  • +
+
+
Returns:
+

the created node

+
+
Return type:
+

MoleculeNode

+
+
+
+ +
+
+property prop: StrDict
+

Dictionary with publicly exposed properties

+
+ +
+
+expand()
+

Expand the molecule by utilising an expansion policy

+
+
Return type:
+

None

+
+
+
+ +
+
+promising_child()
+

Find and return the most promising child for exploration +Updates the thresholds on that child

+
+
Return type:
+

Optional[ReactionNode]

+
+
+
+ +
+
+update()
+

Update the proof and disproof numbers

+
+
Return type:
+

None

+
+
+
+ +
+ +
+
+class aizynthfinder.search.dfpn.nodes.ReactionNode(reaction, config, owner, parent)
+

Bases: _SuperNode

+

An AND node representing a reaction

+
+
Variables:
+
    +
  • parent – the parent of the node

  • +
  • reaction – the reaction represented by the node

  • +
  • pn – the proof number

  • +
  • dn – the disproof number

  • +
  • pn_threshold – the threshold for proof number

  • +
  • dn_threshold – the threshold for disproof number

  • +
  • expandable – if the node is expandable

  • +
+
+
Parameters:
+
+
+
+
+
+property children: List[MoleculeNode]
+

Gives the molecule children nodes

+
+ +
+
+property prop: StrDict
+

Dictionary with publicly exposed properties

+
+ +
+
+property proven: bool
+

Return if the node is proven

+
+ +
+
+property disproven: bool
+

Return if the node is disproven

+
+ +
+
+expand()
+

Expand the node by creating nodes for each reactant

+
+
Return type:
+

None

+
+
+
+ +
+
+promising_child()
+

Find and return the most promising child for exploration +Updates the thresholds on that child

+
+
Return type:
+

Optional[MoleculeNode]

+
+
+
+ +
+
+update()
+

Update the proof and disproof numbers

+
+
Return type:
+

None

+
+
+
+ +
+ +
+
+

aizynthfinder.search.dfpn.search_tree module

+

Module containing a class that holds the tree search

+
+
+class aizynthfinder.search.dfpn.search_tree.SearchTree(config, root_smiles=None)
+

Bases: AndOrSearchTreeBase

+

Encapsulation of the Depth-First Proof-Number (DFPN) search algorithm.

+
+
This algorithm does not support:
    +
  1. Filter policy

  2. +
  3. Serialization and deserialization

  4. +
+
+
+
+
Variables:
+
    +
  • config – settings of the tree search algorithm

  • +
  • root – the root node

  • +
+
+
Parameters:
+
    +
  • config (Configuration) – settings of the tree search algorithm

  • +
  • root_smiles (Optional[str]) – the root will be set to a node representing this molecule, defaults to None

  • +
+
+
+
+
+property mol_nodes: Sequence[MoleculeNode]
+

Return the molecule nodes of the tree

+
+ +
+
+one_iteration()
+

Perform one iteration of expansion.

+

If possible expand the frontier node twice, i.e. expanding an OR +node and then and AND node. If frontier not expandable step up in the +tree and find a new frontier to expand.

+

If a solution is found, mask that tree for exploration and start over.

+
+
Raises:
+

StopIteration – if the search should be pre-maturely terminated

+
+
Returns:
+

if a solution was found

+
+
Return type:
+

bool

+
+
+
+ +
+
+routes()
+

Extracts and returns routes from the AND/OR tree

+
+
Returns:
+

the routes

+
+
Return type:
+

List[ReactionTree]

+
+
+
+ +
+ +
+
+

Module contents

+

Sub-package containing DFPN routines

+
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/aizynthfinder.search.html b/aizynthfinder.search.html new file mode 100644 index 0000000..b509659 --- /dev/null +++ b/aizynthfinder.search.html @@ -0,0 +1,464 @@ + + + + + + + + aizynthfinder.search package — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

aizynthfinder.search package

+
+

Subpackages

+
+ +
+
+
+

Submodules

+
+
+

aizynthfinder.search.andor_trees module

+

Module for base classes for AND/OR trees and some tree utility code

+
+
+class aizynthfinder.search.andor_trees.TreeNodeMixin
+

Bases: object

+

A mixin class for node in a tree

+
+
+property prop: StrDict
+

Dictionary with publicly exposed properties

+
+ +
+
+property children: List['TreeNodeMixin']
+

List of children nodes

+
+ +
+ +
+
+class aizynthfinder.search.andor_trees.AndOrSearchTreeBase(config, root_smiles=None)
+

Bases: ABC

+

A base class for a search tree based on an AND/OR structure

+
+
Parameters:
+
+
+
+
+
+property mol_nodes: List[TreeNodeMixin]
+

Return the molecule nodes of the tree

+
+ +
+
+abstract one_iteration()
+

Perform one iteration of the search

+
+
Return type:
+

bool

+
+
+
+ +
+
+abstract routes()
+

Return the routes of the tree

+
+
Return type:
+

List[ReactionTree]

+
+
+
+ +
+ +
+
+class aizynthfinder.search.andor_trees.SplitAndOrTree(root_node, stock, max_routes=25000)
+

Bases: object

+

Encapsulation of an algorithm to split an AND/OR tree into separate routes

+

This is a modified algorithm of the one detailed in the CompRet paper: +Shibukawa et al. (2020) J. Cheminf. 12, 52

+

This implementation sets an upper-bound on the number of extracted routes +to avoid combinatorial explosion.

+

The routes are extracted on instantiation and the routes can be access from +the routes attribute.

+
+
Parameters:
+
    +
  • root_node (TreeNodeMixin) – the root of the AND/OR tree

  • +
  • stock (Stock) – the stock of the search

  • +
  • max_routes (int) – the maximum number of routes to extract

  • +
+
+
+
+ +
+
+class aizynthfinder.search.andor_trees.ReactionTreeFromAndOrTrace(*args, **kwargs)
+

Bases: ReactionTreeLoader

+

Creates a reaction tree object from an AND/OR Trace

+
+
Parameters:
+
    +
  • args (Any)

  • +
  • kwargs (Any)

  • +
+
+
+
+ +
+
+

Module contents

+
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/aizynthfinder.search.mcts.html b/aizynthfinder.search.mcts.html new file mode 100644 index 0000000..f93e5e0 --- /dev/null +++ b/aizynthfinder.search.mcts.html @@ -0,0 +1,873 @@ + + + + + + + + aizynthfinder.search.mcts package — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

aizynthfinder.search.mcts package

+
+

Submodules

+
+
+

aizynthfinder.search.mcts.node module

+

Module containing a class that represents a node in the search tree.

+
+
+class aizynthfinder.search.mcts.node.MctsNode(state, owner, config, parent=None)
+

Bases: object

+

A node in the search tree.

+

The children are instantiated lazily for efficiency: only when +a child is selected the reaction to create that child is applied.

+

Properties of an instantiated children to a node can be access with:

+
children_attr = node[child]
+
+
+

the return value is a dictionary with keys “action”, “value”, “prior” +and “visitations”.

+
+
Variables:
+
    +
  • is_expanded – if the node has had children added to it

  • +
  • is_expandable – if the node is expandable

  • +
  • tree – the tree owning this node

  • +
+
+
Parameters:
+
    +
  • state (MctsState) – the state of the node

  • +
  • owner (MctsSearchTree) – the tree that owns this node

  • +
  • config (Configuration) – settings of the tree search algorithm

  • +
  • parent (Optional[MctsNode]) – the parent node, defaults to None

  • +
+
+
+
+
+classmethod create_root(smiles, tree, config)
+

Create a root node for a tree using a SMILES.

+
+
Parameters:
+
    +
  • smiles (str) – the SMILES representation of the root state

  • +
  • tree (MctsSearchTree) – the search tree

  • +
  • config (Configuration) – settings of the tree search algorithm

  • +
+
+
Returns:
+

the created node

+
+
Return type:
+

MctsNode

+
+
+
+ +
+
+classmethod from_dict(dict_, tree, config, molecules, parent=None)
+

Create a new node from a dictionary, i.e. deserialization.

+
+
Parameters:
+
    +
  • dict – the serialized node

  • +
  • tree (MctsSearchTree) – the search tree

  • +
  • config (Configuration) – settings of the tree search algorithm

  • +
  • molecules (MoleculeDeserializer) – the deserialized molecules

  • +
  • parent (Optional['MctsNode']) – the parent node

  • +
  • dict_ (StrDict)

  • +
+
+
Returns:
+

a deserialized node

+
+
Return type:
+

MctsNode

+
+
+
+ +
+
+property children: List['MctsNode']
+

Returns all of the instantiated children.

+
+
Returns:
+

the children

+
+
+
+ +
+
+property is_solved: bool
+

Return if the state is solved.

+
+ +
+
+property parent: 'MctsNode' | None
+

Return the parent of the node.

+
+ +
+
+property state: MctsState
+

Return the underlying state of the node.

+
+ +
+
+actions_to()
+

Returns the actions leading to this node

+
+
Returns:
+

the list of actions

+
+
Return type:
+

List[RetroReaction]

+
+
+
+ +
+
+backpropagate(child, value_estimate)
+

Update the number of visitations of a particular child and its value.

+
+
Parameters:
+
    +
  • child (MctsNode) – the child node

  • +
  • value_estimate (float) – the value to add to the child value

  • +
+
+
Return type:
+

None

+
+
+
+ +
+
+children_view()
+

Creates a view of the children attributes. Each of the +list returned is a new list, although the actual children +are not copied.

+

The return dictionary will have keys “actions”, “values”, +“priors”, “visitations” and “objects”.

+
+
Returns:
+

the view

+
+
Return type:
+

StrDict

+
+
+
+ +
+
+expand()
+

Expand the node.

+

Expansion is the process of creating the children of the node, +without instantiating a child object. The actions and priors are +taken from the policy network.

+

If immediate instantiation is marked for some policies, however, the +children nodes will be instantiated.

+
+
Return type:
+

None

+
+
+
+ +
+
+is_terminal()
+

Node is terminal if its unexpandable, or the internal state is terminal (solved).

+
+
Returns:
+

the terminal attribute of the node

+
+
Return type:
+

bool

+
+
+
+ +
+
+path_to()
+

Return the path to this node, which is a list of actions and a list of node.

+
+
Returns:
+

the actions and nodes

+
+
Return type:
+

Tuple[List[RetroReaction], List[MctsNode]]

+
+
+
+ +
+
+promising_child()
+

Return the child with the currently highest Q+U.

+

The selected child will be instantiated if it has not been already.

+

If no actions could be found that were applicable, the method will +return None.

+
+
Returns:
+

the child

+
+
Return type:
+

Optional[‘MctsNode’]

+
+
+
+ +
+
+serialize(molecule_store)
+

Serialize the node object to a dictionary.

+
+
Parameters:
+

molecule_store (MoleculeSerializer) – the serialized molecules

+
+
Returns:
+

the serialized node

+
+
Return type:
+

StrDict

+
+
+
+ +
+
+to_reaction_tree()
+

Return reaction tree from the path of actions and nodes leading to this node.

+
+
Returns:
+

the constructed tree

+
+
Return type:
+

ReactionTree

+
+
+
+ +
+ +
+
+class aizynthfinder.search.mcts.node.ParetoMctsNode(state, owner, config, parent=None)
+

Bases: MctsNode

+

A node in a multi-objective tree search.

+
+
This implements the algorithm from:

Chen W., Liu L. Pareto Monte Carlo Tree Search for Multi-Objective Informative Planning +Robotics: Science and Systems 2019, 2012 arXiv:2111.01825

+
+
The main difference compared to the standard MCTS algorithm is:
    +
  • +
    Children stats: the values, cumulative reward and priors are nested

    list, with one value per objective

    +
    +
    +
  • +
  • +
    Selection: children on Pareto front are computed, and

    a child from this set is taken randomly

    +
    +
    +
  • +
+
+
+

This implementation disregards the prior of the children when it has been +visited once.

+

It is assumed that all objectives are to be maximised.

+
+
Parameters:
+
+
+
+
+
+backpropagate(child, value_estimate)
+

Update the number of visitations of a particular child and its value.

+
+
Parameters:
+
    +
  • child (MctsNode) – the child node

  • +
  • value_estimate (List[float]) – the value to add to the child value

  • +
+
+
Return type:
+

None

+
+
+
+ +
+
+children_view()
+

Creates a view of the children attributes. Each of the +list returned is a new list, although the actual children +are not copied.

+

The return dictionary will have keys “actions”, “values”, +“priors”, “visitations”, “rewards_cum”, and “objects”.

+
+
Returns:
+

the view

+
+
Return type:
+

StrDict

+
+
+
+ +
+
+serialize(molecule_store)
+

Serialize the node object to a dictionary.

+
+
Parameters:
+

molecule_store (MoleculeSerializer) – the serialized molecules

+
+
Returns:
+

the serialized node

+
+
Return type:
+

StrDict

+
+
+
+ +
+ +
+
+

aizynthfinder.search.mcts.search module

+

Module containing a class that holds the tree search

+
+
+class aizynthfinder.search.mcts.search.MctsSearchTree(config, root_smiles=None)
+

Bases: object

+

Encapsulation of the search tree.

+
+
Variables:
+
    +
  • root – the root node

  • +
  • config – the configuration of the search tree

  • +
+
+
Parameters:
+
    +
  • config (Configuration) – settings of the tree search algorithm

  • +
  • root_smiles (Optional[str]) – the root will be set to a node representing this molecule, defaults to None

  • +
+
+
+
+
+classmethod from_json(filename, config)
+

Create a new search tree by deserialization from a JSON file

+
+
Parameters:
+
    +
  • filename (str) – the path to the JSON node

  • +
  • config (Configuration) – the configuration of the search

  • +
+
+
Returns:
+

a deserialized tree

+
+
Return type:
+

MctsSearchTree

+
+
+
+ +
+
+backpropagate(from_node)
+

Backpropagate the value estimate and update all nodes from a +given node all the way to the root.

+
+
Parameters:
+

from_node (MctsNode) – the end node of the route to update

+
+
Return type:
+

None

+
+
+
+ +
+
+compute_reward(node)
+

Compute the reward of a node in the search tree, using one of

+
+
    +
  1. Single-objective

  2. +
  3. Multi-objective

  4. +
  5. Weighted-sum of multiple specified rewards

  6. +
+
+
+
Parameters:
+

node (MctsNode) – the node to compute the reward for

+
+
Returns:
+

the value from the scorer(s)

+
+
Return type:
+

Union[float, Sequence[float]]

+
+
+
+ +
+
+graph(recreate=False)
+

Construct a directed graph object with the nodes as +vertices and the actions as edges attribute “action”.

+
+
Parameters:
+

recreate (bool) – if True will construct the graph even though it is cached, defaults to False

+
+
Returns:
+

the graph object

+
+
Raises:
+

ValueError – if the tree is not defined

+
+
Return type:
+

DiGraph

+
+
+
+ +
+
+nodes()
+

Return all the nodes in the search tree

+
+
Return type:
+

List[MctsNode]

+
+
+
+ +
+
+one_iteration()
+
+
Perform one iteration of
    +
  1. Selection

  2. +
  3. Expansion

  4. +
  5. Rollout

  6. +
  7. Backpropagation

  8. +
+
+
+
+
Returns:
+

if a solution was found

+
+
Return type:
+

bool

+
+
+
+ +
+
+select_leaf()
+

Traverse the tree selecting the most promising child at +each step until leaf node returned.

+
+
Returns:
+

the leaf node

+
+
Raises:
+

ValueError – if the tree is not defined

+
+
Return type:
+

MctsNode

+
+
+
+ +
+
+serialize(filename)
+

Serialize the search tree to a JSON file

+
+
Parameters:
+

filename (str) – the path to the JSON file

+
+
Raises:
+

ValueError – if the tree is not defined

+
+
Return type:
+

None

+
+
+
+ +
+ +
+
+

aizynthfinder.search.mcts.state module

+

Module contain a class that encapsulate the state of search tree node.

+
+
+class aizynthfinder.search.mcts.state.MctsState(mols, config)
+

Bases: object

+

Encapsulation of the molecular state of a node.

+

A state consists of an immutable list of molecules that are either solved +(can be found in stock) or that potentially can be expanded to new molecules +by applying a reaction on them.

+

The class is hashable and comparable by the inchi keys of all the molecules.

+
+
Variables:
+
    +
  • mols – the list of molecules

  • +
  • expandable_mols – the list of molecules not in stock

  • +
  • stock – the configured stock

  • +
  • in_stock_list – for each molecule if they are in stock

  • +
  • is_solved – is true if all molecules are in stock:

  • +
  • max_transforms – the maximum of the transforms of the molecule

  • +
  • is_terminal – is true if the all molecules are in stock or if the maximum transforms has been reached

  • +
  • expandables_hash – an hash string computed on the expandable molecules

  • +
+
+
Parameters:
+
    +
  • mols (Sequence[TreeMolecule]) – the molecules of the state

  • +
  • config (Configuration) – settings of the tree search algorithm

  • +
+
+
+
+
+classmethod from_dict(dict_, config, molecules)
+

Create a new state from a dictionary, i.e. deserialization

+
+
Parameters:
+
    +
  • dict (dict) – the serialized state

  • +
  • config (Configuration) – settings of the tree search algorithm

  • +
  • molecules (MoleculeDeserializer) – the deserialized molecules

  • +
  • dict_ (StrDict)

  • +
+
+
Returns:
+

a deserialized state

+
+
Return type:
+

State

+
+
+
+ +
+
+property stock_availability: List[str]
+

Returns a list of availabilities for all molecules

+
+
Returns:
+

the list

+
+
Return type:
+

list of str

+
+
+
+ +
+
+serialize(molecule_store)
+

Serialize the state object to a dictionary

+
+
Parameters:
+

molecule_store (MolecularSerializer) – the serialized molecules

+
+
Returns:
+

the serialized state

+
+
Return type:
+

dict

+
+
+
+ +
+
+to_image(ncolumns=6)
+

Constructs an image representation of the state

+
+
Parameters:
+

ncolumns (int, optional) – number of molecules per row, defaults to 6

+
+
Returns:
+

the image representation

+
+
Return type:
+

a PIL image

+
+
+
+ +
+ +
+
+

aizynthfinder.search.mcts.utils module

+

Module containing utility routines for MCTS. This is not part of public interface

+
+
+class aizynthfinder.search.mcts.utils.ReactionTreeFromSuperNode(*args, **kwargs)
+

Bases: ReactionTreeLoader

+

Creates a reaction tree object from MCTS-like nodes and reaction objects

+
+
Parameters:
+
    +
  • args (Any)

  • +
  • kwargs (Any)

  • +
+
+
+
+ +
+
+aizynthfinder.search.mcts.utils.route_to_node(from_node)
+

Return the route to a give node to the root.

+

Will return both the actions taken to go between the nodes, +and the nodes in the route themselves.

+
+
Parameters:
+

from_node (MctsNode) – the end of the route

+
+
Returns:
+

the route

+
+
Return type:
+

Tuple[List[RetroReaction], List[MctsNode]]

+
+
+
+ +
+
+

Module contents

+

Sub-package containing MCTS routines

+
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/aizynthfinder.search.retrostar.html b/aizynthfinder.search.retrostar.html new file mode 100644 index 0000000..a617f22 --- /dev/null +++ b/aizynthfinder.search.retrostar.html @@ -0,0 +1,705 @@ + + + + + + + + aizynthfinder.search.retrostar package — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

aizynthfinder.search.retrostar package

+
+

Submodules

+
+
+

aizynthfinder.search.retrostar.cost module

+

Module containing Retro* cost models

+
+
+class aizynthfinder.search.retrostar.cost.MoleculeCost(config)
+

Bases: object

+

A class to compute the molecule cost.

+

The cost to be computed is taken from the input config. If no molecule_cost is +set, assigns ZeroMoleculeCost as the cost by default. The molecule_cost can be +set as a dictionary in config under search in the following format: +‘algorithm’: ‘retrostar’ +‘algorithm_config’: {

+
+
+
‘molecule_cost’: {

‘cost’: name of the search cost class or custom_package.custom_model.CustomClass, +other settings or params

+
+
+

}

+
+

}

+

The cost can be computed by calling the instantiated class with a molecule.

+
calculator = MyCost(config)
+cost = calculator.calculate(molecule)
+
+
+
+
Parameters:
+

config (Configuration) – the configuration of the tree search

+
+
+
+ +
+
+class aizynthfinder.search.retrostar.cost.RetroStarCost(**kwargs)
+

Bases: object

+

Encapsulation of the original Retro* molecular cost model

+

Numpy implementation of original pytorch model

+

The predictions of the score is made on a Molecule object

+
mol = Molecule(smiles="CCC")
+scorer = RetroStarCost()
+score = scorer.calculate(mol)
+
+
+

The model provided when creating the scorer object should be a pickled +tuple. +The first item of the tuple should be a list of the model weights for each layer. +The second item of the tuple should be a list of the model biases for each layer.

+
+
Parameters:
+
    +
  • model_path – the filename of the model weights and biases

  • +
  • fingerprint_length – the number of bits in the fingerprint

  • +
  • fingerprint_radius – the radius of the fingerprint

  • +
  • dropout_rate – the dropout_rate

  • +
  • kwargs (Any)

  • +
+
+
+
+
+calculate(mol)
+
+
Parameters:
+

mol (Molecule)

+
+
Return type:
+

float

+
+
+
+ +
+ +
+
+class aizynthfinder.search.retrostar.cost.ZeroMoleculeCost
+

Bases: object

+

Encapsulation of a Zero cost model

+
+
+calculate(_mol)
+
+
Parameters:
+

_mol (Molecule)

+
+
Return type:
+

float

+
+
+
+ +
+ +
+
+

aizynthfinder.search.retrostar.nodes module

+

Module containing a classes representation various tree nodes

+
+
+class aizynthfinder.search.retrostar.nodes.MoleculeNode(mol, config, molecule_cost, parent=None)
+

Bases: TreeNodeMixin

+

An OR node representing a molecule

+
+
Variables:
+
    +
  • cost – the cost of synthesizing the molecule

  • +
  • expandable – if True, this node is part of the frontier

  • +
  • mol – the molecule represented by the node

  • +
  • in_stock – if True the molecule is in stock and hence should not be expanded

  • +
  • parent – the parent of the node

  • +
  • solved – if True the molecule is in stock or at least one child node is solved

  • +
  • value – the current rn(m|T)

  • +
+
+
Parameters:
+
+
+
+
+
+classmethod create_root(smiles, config, molecule_cost)
+

Create a root node for a tree using a SMILES.

+
+
Parameters:
+
    +
  • smiles (str) – the SMILES representation of the root state

  • +
  • config (Configuration) – settings of the tree search algorithm

  • +
  • molecule_cost (MoleculeCost)

  • +
+
+
Returns:
+

the created node

+
+
Return type:
+

MoleculeNode

+
+
+
+ +
+
+classmethod from_dict(dict_, config, molecules, molecule_cost, parent=None)
+

Create a new node from a dictionary, i.e. deserialization

+
+
Parameters:
+
+
+
Returns:
+

a deserialized node

+
+
Return type:
+

MoleculeNode

+
+
+
+ +
+
+property children: List[ReactionNode]
+

Gives the reaction children nodes

+
+ +
+
+property target_value: float
+

The V_t(m|T) value, +the current cost of the tree containing this node

+
+
Returns:
+

the value

+
+
+
+ +
+
+property prop: StrDict
+

Dictionary with publicly exposed properties

+
+ +
+
+add_stub(cost, reaction)
+

Add a stub / sub-tree to this node

+
+
Parameters:
+
    +
  • cost (float) – the cost of the reaction

  • +
  • reaction (RetroReaction) – the reaction creating the stub

  • +
+
+
Returns:
+

list of all newly added molecular nodes

+
+
Return type:
+

Sequence[MoleculeNode]

+
+
+
+ +
+
+ancestors()
+

Return the ancestors of this node

+
+
Returns:
+

the ancestors

+
+
Return type:
+

set

+
+
+
+ +
+
+close()
+

Updates the values of this node after expanding it.

+
+
Returns:
+

the delta V value

+
+
Return type:
+

float

+
+
+
+ +
+
+serialize(molecule_store)
+

Serialize the node object to a dictionary

+
+
Parameters:
+

molecule_store (MoleculeSerializer) – the serialized molecules

+
+
Returns:
+

the serialized node

+
+
Return type:
+

StrDict

+
+
+
+ +
+
+update(solved)
+

Update the node as part of the update algorithm, +calling the update() method of its parent if available.

+
+
Parameters:
+

solved (bool) – if the child node was solved

+
+
Return type:
+

None

+
+
+
+ +
+ +
+
+class aizynthfinder.search.retrostar.nodes.ReactionNode(cost, reaction, parent)
+

Bases: TreeNodeMixin

+

An AND node representing a reaction

+
+
Variables:
+
    +
  • cost – the cost of the reaction

  • +
  • parent – the parent of the node

  • +
  • reaction – the reaction represented by the node

  • +
  • solved – if True all children nodes are solved

  • +
  • target_value – the V(m|T) for the children, the current cost

  • +
  • value – the current rn(r|T)

  • +
+
+
Parameters:
+
    +
  • cost (float) – the cost of the reaction

  • +
  • reaction (RetroReaction) – the reaction to be represented by the node

  • +
  • parent (MoleculeNode) – the parent of the node

  • +
+
+
+
+
+classmethod create_stub(cost, reaction, parent, config)
+

Create a ReactionNode and creates all the MoleculeNode objects +that are the children of the node.

+
+
Parameters:
+
    +
  • cost (float) – the cost of the reaction

  • +
  • reaction (RetroReaction) – the reaction to be represented by the node

  • +
  • parent (MoleculeNode) – the parent of the node

  • +
  • config (Configuration) – the configuration of the search tree

  • +
+
+
Return type:
+

ReactionNode

+
+
+
+ +
+
+classmethod from_dict(dict_, config, molecules, molecule_cost, parent)
+

Create a new node from a dictionary, i.e. deserialization

+
+
Parameters:
+
+
+
Returns:
+

a deserialized node

+
+
Return type:
+

ReactionNode

+
+
+
+ +
+
+property children: List[MoleculeNode]
+

Gives the molecule children nodes

+
+ +
+
+property prop: StrDict
+

Dictionary with publicly exposed properties

+
+ +
+
+serialize(molecule_store)
+

Serialize the node object to a dictionary

+
+
Parameters:
+

molecule_store (MoleculeSerializer) – the serialized molecules

+
+
Returns:
+

the serialized node

+
+
Return type:
+

StrDict

+
+
+
+ +
+
+update(value, from_mol=None)
+

Update the node as part of the update algorithm, +calling the update() method of its parent

+
+
Parameters:
+
    +
  • value (float) – the delta V value

  • +
  • from_mol (Optional[TreeMolecule]) – the molecule being expanded, used for excluding propagation

  • +
+
+
Return type:
+

None

+
+
+
+ +
+ +
+
+

aizynthfinder.search.retrostar.search_tree module

+

Module containing a class that holds the tree search

+
+
+class aizynthfinder.search.retrostar.search_tree.SearchTree(config, root_smiles=None)
+

Bases: AndOrSearchTreeBase

+

Encapsulation of the Retro* search tree (an AND/OR tree).

+
+
Variables:
+
    +
  • config – settings of the tree search algorithm

  • +
  • root – the root node

  • +
+
+
Parameters:
+
    +
  • config (Configuration) – settings of the tree search algorithm

  • +
  • root_smiles (Optional[str]) – the root will be set to a node representing this molecule, defaults to None

  • +
+
+
+
+
+classmethod from_json(filename, config)
+

Create a new search tree by deserialization from a JSON file

+
+
Parameters:
+
    +
  • filename (str) – the path to the JSON node

  • +
  • config (Configuration) – the configuration of the search tree

  • +
+
+
Returns:
+

a deserialized tree

+
+
Return type:
+

SearchTree

+
+
+
+ +
+
+property mol_nodes: Sequence[MoleculeNode]
+

Return the molecule nodes of the tree

+
+ +
+
+one_iteration()
+
+
Perform one iteration of
    +
  1. Selection

  2. +
  3. Expansion

  4. +
  5. Update

  6. +
+
+
+
+
Raises:
+

StopIteration – if the search should be pre-maturely terminated

+
+
Returns:
+

if a solution was found

+
+
Return type:
+

bool

+
+
+
+ +
+
+routes()
+

Extracts and returns routes from the AND/OR tree

+
+
Returns:
+

the routes

+
+
Return type:
+

List[ReactionTree]

+
+
+
+ +
+
+serialize(filename)
+

Seralize the search tree to a JSON file

+
+
Parameters:
+

filename (str) – the path to the JSON file

+
+
Return type:
+

None

+
+
+
+ +
+ +
+
+

Module contents

+
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/aizynthfinder.tools.html b/aizynthfinder.tools.html new file mode 100644 index 0000000..70147e9 --- /dev/null +++ b/aizynthfinder.tools.html @@ -0,0 +1,341 @@ + + + + + + + + aizynthfinder.tools package — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

aizynthfinder.tools package

+
+

Submodules

+
+
+

aizynthfinder.tools.cat_output module

+

Module containing a CLI for concatenating output files (hdf5/json.gz files)

+
+
+aizynthfinder.tools.cat_output.main()
+

Entry-point for the cat_aizynth_output CLI

+
+
Return type:
+

None

+
+
+
+ +
+
+

aizynthfinder.tools.download_public_data module

+

Module with script to download public data

+
+
+aizynthfinder.tools.download_public_data.main()
+

Entry-point for CLI

+
+
Return type:
+

None

+
+
+
+ +
+
+

aizynthfinder.tools.make_stock module

+

Module containing classes and routines for making stock input to the tree search.

+
+
+aizynthfinder.tools.make_stock.extract_plain_smiles(files)
+

Extract SMILES from plain text files, one SMILES on each line. +The SMILES are yielded to save memory.

+
+
Parameters:
+

files (List[str])

+
+
Return type:
+

_StrIterator

+
+
+
+ +
+
+aizynthfinder.tools.make_stock.extract_smiles_from_module(files)
+

Extract SMILES by loading a custom module, containing +the function extract_smiles.

+

The first element of the input argument is taken as the module name. +The other elements are taken as input to the extract_smiles method

+

The SMILES are yielded to save memory.

+
+
Parameters:
+

files (List[str])

+
+
Return type:
+

_StrIterator

+
+
+
+ +
+
+aizynthfinder.tools.make_stock.make_hdf5_stock(inchi_keys, filename)
+

Put all the inchi keys from the given iterable in a pandas +dataframe and save it as an HDF5 file. Only unique inchi keys +are stored.

+
+
Parameters:
+
    +
  • inchi_keys (_StrIterator)

  • +
  • filename (str)

  • +
+
+
Return type:
+

None

+
+
+
+ +
+
+aizynthfinder.tools.make_stock.make_molbloom(smiles_list, filename, filter_size, approx_mols)
+

Put all the unique SMILES in a new bloom filter.

+
+
Params smiles_list:
+

the SMILES

+
+
Params filename:
+

the path to the saved filter

+
+
Params filter_size:
+

the size of the filter in bits

+
+
Params approx_mols:
+

approximately the number of compounds

+
+
Parameters:
+
    +
  • smiles_list (_StrIterator)

  • +
  • filename (str)

  • +
  • filter_size (int)

  • +
  • approx_mols (int)

  • +
+
+
Return type:
+

None

+
+
+
+ +
+
+aizynthfinder.tools.make_stock.make_molbloom_inchi(inchi_keys, filename, filter_size, approx_mols)
+

Put all the unique InChI keys in a new bloom filter.

+
+
Params inchi_keys:
+

the Inchi Keys

+
+
Params filename:
+

the path to the saved filter

+
+
Params filter_size:
+

the size of the filter in bits

+
+
Params approx_mols:
+

approximately the number of compounds

+
+
Parameters:
+
    +
  • inchi_keys (_StrIterator)

  • +
  • filename (str)

  • +
  • filter_size (int)

  • +
  • approx_mols (int)

  • +
+
+
Return type:
+

None

+
+
+
+ +
+
+aizynthfinder.tools.make_stock.make_mongo_stock(inchi_keys, source_tag, host=None)
+

Put all the inchi keys from the given iterable in Mongo database as +a molecules collection. Only unique inchi keys are stored.

+
+
Parameters:
+
    +
  • inchi_keys (_StrIterator)

  • +
  • source_tag (str)

  • +
  • host (Optional[str])

  • +
+
+
Return type:
+

None

+
+
+
+ +
+
+aizynthfinder.tools.make_stock.main()
+

Entry-point for the smiles2stock tool

+
+
Return type:
+

None

+
+
+
+ +
+
+

Module contents

+
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/aizynthfinder.utils.html b/aizynthfinder.utils.html new file mode 100644 index 0000000..88103d6 --- /dev/null +++ b/aizynthfinder.utils.html @@ -0,0 +1,1028 @@ + + + + + + + + aizynthfinder.utils package — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

aizynthfinder.utils package

+
+

Submodules

+
+
+

aizynthfinder.utils.bonds module

+

Module containing a class to identify broken focussed bonds

+
+
+class aizynthfinder.utils.bonds.BrokenBonds(focussed_bonds)
+

Bases: object

+

A class to keep track of focussed bonds breaking in a target molecule.

+
+
Parameters:
+

focussed_bonds (Sequence[Sequence[int]]) – A list of focussed bond pairs. The bond pairs are represented +as tuples of size 2. These bond pairs exist in the target molecule’s atom bonds.

+
+
+
+ +
+
+aizynthfinder.utils.bonds.sort_bonds(bonds)
+
+
Parameters:
+

bonds (Sequence[Sequence[int]])

+
+
Return type:
+

List[Tuple[int, int]]

+
+
+
+ +
+
+

aizynthfinder.utils.exceptions module

+

Module containing custom exception classes

+
+
+exception aizynthfinder.utils.exceptions.CostException
+

Bases: Exception

+

Exception raised by molecule cost classes

+
+ +
+
+exception aizynthfinder.utils.exceptions.ExternalModelAPIError
+

Bases: Exception

+

Custom error type to signal failure in External model

+
+ +
+
+exception aizynthfinder.utils.exceptions.MoleculeException
+

Bases: Exception

+

An exception that is raised by molecule class

+
+ +
+
+exception aizynthfinder.utils.exceptions.NodeUnexpectedBehaviourException
+

Bases: Exception

+

Exception that is raised if the tree search is behaving unexpectedly.

+
+ +
+
+exception aizynthfinder.utils.exceptions.PolicyException
+

Bases: Exception

+

An exception raised by policy classes

+
+ +
+
+exception aizynthfinder.utils.exceptions.RejectionException
+

Bases: Exception

+

An exception raised if a retro action should be rejected

+
+ +
+
+exception aizynthfinder.utils.exceptions.ScorerException
+

Bases: Exception

+

Exception raised by scoring classes

+
+ +
+
+exception aizynthfinder.utils.exceptions.StockException
+

Bases: Exception

+

An exception raised by stock classes

+
+ +
+
+exception aizynthfinder.utils.exceptions.TreeAnalysisException
+

Bases: Exception

+

Exception raised when analysing trees

+
+ +
+
+

aizynthfinder.utils.files module

+

Module containing routines to work with files and processes.

+
+
+aizynthfinder.utils.files.read_datafile(filename)
+

Read aizynth output from disc in either .hdf5 or .json format

+
+
Parameters:
+

filename (Union[str, Path]) – the path to the data

+
+
Returns:
+

the loaded data

+
+
Return type:
+

pd.DataFrame

+
+
+
+ +
+
+aizynthfinder.utils.files.save_datafile(data, filename)
+

Save the given data to disc in either .hdf5 or .json format

+
+
Parameters:
+
    +
  • data (pd.DataFrame) – the data to save

  • +
  • filename (Union[str, Path]) – the path to the data

  • +
+
+
Return type:
+

None

+
+
+
+ +
+
+aizynthfinder.utils.files.cat_hdf_files(input_files, output_name, trees_name=None)
+

Concatenate hdf5 or json datafiles

+
+
Parameters:
+
    +
  • input_files (List[str])

  • +
  • output_name (str)

  • +
  • trees_name (Optional[str])

  • +
+
+
Return type:
+

None

+
+
+
+ +
+
+aizynthfinder.utils.files.cat_datafiles(input_files, output_name, trees_name=None)
+

Concatenate hdf5 or json datafiles

+

if tree_name is given, will take out the trees column +from the tables and save it to a gzipped-json file.

+
+
Parameters:
+
    +
  • input_files (List[str]) – the paths to the files to concatenate

  • +
  • output_name (str) – the name of the concatenated file

  • +
  • trees_name (Optional[str]) – the name of the concatenated trees

  • +
+
+
Return type:
+

None

+
+
+
+ +
+
+aizynthfinder.utils.files.split_file(filename, nparts)
+

Split the content of a text file into a given number of temporary files

+
+
Parameters:
+
    +
  • filename (str) – the path to the file to split

  • +
  • nparts (int) – the number of parts to create

  • +
+
+
Returns:
+

list of filenames of the parts

+
+
Return type:
+

List[str]

+
+
+
+ +
+
+aizynthfinder.utils.files.start_processes(inputs, log_prefix, cmd_callback, poll_freq=5)
+

Start a number of background processes and wait for them +to complete.

+

The standard output and standard error is saved to a log file.

+

The command to start for each process is given by the cmd_callback +function that takes the index of the process and an item of the input +as arguments.

+
+
Parameters:
+
    +
  • inputs (Sequence[Any]) – a sequence of input to the processes

  • +
  • log_prefix (str) – the prefix to the log file of each processes

  • +
  • cmd_callback (Callable) – function that creates the process commands

  • +
  • poll_freq (int) – the polling frequency for checking if processes are completed

  • +
+
+
Return type:
+

None

+
+
+
+ +
+
+

aizynthfinder.utils.image module

+

This module contains a collection of routines to produce pretty images

+
+
+aizynthfinder.utils.image.molecule_to_image(mol, frame_color, size=300)
+

Create a pretty image of a molecule, +with a colored frame around it

+
+
Parameters:
+
    +
  • mol (Molecule) – the molecule

  • +
  • frame_color (PilColor) – the color of the frame

  • +
  • size (int) – the size of the image

  • +
+
+
Returns:
+

the produced image

+
+
Return type:
+

PilImage

+
+
+
+ +
+
+aizynthfinder.utils.image.molecules_to_images(mols, frame_colors, size=300)
+

Create pretty images of molecules with a colored frame around each one of them.

+

The molecules will be resized to be of similar sizes.

+
+
Parameters:
+
    +
  • mols (Sequence[Molecule]) – the molecules

  • +
  • frame_colors (Sequence[PilColor]) – the color of the frame for each molecule

  • +
  • size (int) – the sub-image size

  • +
+
+
Returns:
+

the produced images

+
+
Return type:
+

List[PilImage]

+
+
+
+ +
+
+aizynthfinder.utils.image.crop_image(img, margin=20)
+

Crop an image by removing white space around it

+
+
Parameters:
+
    +
  • img (PilImage) – the image to crop

  • +
  • margin (int) – padding, defaults to 20

  • +
+
+
Returns:
+

the cropped image

+
+
Return type:
+

PilImage

+
+
+
+ +
+
+aizynthfinder.utils.image.draw_rounded_rectangle(img, color, arc_size=20)
+

Draw a rounded rectangle around an image

+
+
Parameters:
+
    +
  • img (PilImage) – the image to draw upon

  • +
  • color (PilColor) – the color of the rectangle

  • +
  • arc_size (int) – the size of the corner, defaults to 20

  • +
+
+
Returns:
+

the new image

+
+
Return type:
+

PilImage

+
+
+
+ +
+
+aizynthfinder.utils.image.save_molecule_images(molecules, frame_colors, size=300)
+

Create images of a list of molecules and save them to disc +a globally managed folder.

+
+
Parameters:
+
    +
  • molecules (Sequence[Molecule]) – the molecules to save as images

  • +
  • frame_colors (Sequence[PilColor]) – the color of the frame around each image

  • +
  • size (int) – the sub-image size for each molecule

  • +
+
+
Returns:
+

the filename of the created images

+
+
Return type:
+

Dict[Molecule, str]

+
+
+
+ +
+
+aizynthfinder.utils.image.make_visjs_page(filename, molecules, reactions, edges, frame_colors, hierarchical=False)
+

Create HTML code of a bipartite graph of molecules and reactions +using the vis.js network library.

+

Package the created HTML page and all images as tar-ball.

+
+
Parameters:
+
    +
  • filename (str) – the basename of the archive

  • +
  • molecules (Sequence[Molecule]) – the molecules nodes

  • +
  • reactions (Sequence[FixedRetroReaction]) – the reaction nodes

  • +
  • edges (Union[Sequence[Tuple[Any, Any]], nx.digraph.OutEdgeView]) – the edges of the graph

  • +
  • frame_colors (Sequence[PilColor]) – the color of the frame around each image

  • +
  • hierarchical (bool) – if True, will produce a hierarchical layout

  • +
+
+
Return type:
+

None

+
+
+
+ +
+
+class aizynthfinder.utils.image.RouteImageFactory(route, in_stock_colors=None, show_all=True, margin=100)
+

Bases: object

+

Factory class for drawing a route

+
+
Parameters:
+
    +
  • route (StrDict) – the dictionary representation of the route

  • +
  • in_stock_colors (FrameColors) – the colors around molecules, defaults to {True: “green”, False: “orange”}

  • +
  • show_all (bool) – if True, also show nodes that are marked as hidden

  • +
  • margin (int) – the margin between images

  • +
+
+
+
+ +
+
+

aizynthfinder.utils.loading module

+

Module containing routine to dynamically load a class from a specification

+
+
+aizynthfinder.utils.loading.load_dynamic_class(name_spec, default_module=None, exception_cls=<class 'ValueError'>)
+

Load an object from a dynamic specification.

+
+
The specification can be either:

ClassName, in-case the module name is taken from the default_module argument

+
+
or

package_name.module_name.ClassName, in-case the module is taken as package_name.module_name

+
+
+
+
Parameters:
+
    +
  • name_spec (str) – the class specification

  • +
  • default_module (Optional[str]) – the default module

  • +
  • exception_cls (Any) – the exception class to raise on exception

  • +
+
+
Returns:
+

the loaded class

+
+
Return type:
+

Any

+
+
+
+ +
+
+

aizynthfinder.utils.logging module

+

Module containing routines to setup proper logging

+
+
+aizynthfinder.utils.logging.logger()
+

Returns the logger that should be used by all classes

+
+
Returns:
+

the logger object

+
+
Return type:
+

Logger

+
+
+
+ +
+
+aizynthfinder.utils.logging.setup_logger(console_level, file_level=None)
+

Setup the logger that should be used by all classes

+

The logger configuration is read from the logging.yml file.

+
+
Parameters:
+
    +
  • console_level (int) – the level of logging to the console

  • +
  • file_level (int | None) – the level of logging to file, if not set logging to file is disabled, default to None

  • +
+
+
Returns:
+

the logger object

+
+
Return type:
+

Logger

+
+
+
+ +
+
+

aizynthfinder.utils.math module

+

Module containing diverse math functions, including neural network-related functions.

+
+
+aizynthfinder.utils.math.dense_layer_forward_pass(x, weights, bias, activation)
+

Forward pass through a dense neural network layer. +:param x: layer input +:param weights: layer weights +:param bias: layer bias +:param activation: layer activation function +:return: the layer output

+
+
Parameters:
+
    +
  • x (ndarray)

  • +
  • weights (ndarray)

  • +
  • bias (ndarray)

  • +
  • activation (Callable)

  • +
+
+
Return type:
+

ndarray

+
+
+
+ +
+
+aizynthfinder.utils.math.rectified_linear_unit(x)
+

ReLU activation function

+
+
Parameters:
+

x (ndarray)

+
+
Return type:
+

ndarray

+
+
+
+ +
+
+aizynthfinder.utils.math.sigmoid(x)
+

Sigmoid activation function

+
+
Parameters:
+

x (ndarray)

+
+
Return type:
+

ndarray

+
+
+
+ +
+
+aizynthfinder.utils.math.softmax(x)
+

Compute softmax values for each sets of scores in x.

+
+
Parameters:
+

x (ndarray)

+
+
Return type:
+

ndarray

+
+
+
+ +
+
+

aizynthfinder.utils.models module

+

Module containing helper routines for using Keras, Tensorflow and Onnx models

+
+
+aizynthfinder.utils.models.load_model(source, key, use_remote_models)
+

Load model from a configuration specification.

+
+
If use_remote_models is True, tries to load:
    +
  1. A Tensorflow server through gRPC

  2. +
  3. A Tensorflow server through REST API

  4. +
  5. A local Keras model

  6. +
+
+
+

otherwise it just loads the local model.

+
+
Parameters:
+
    +
  • source (str) – if fallbacks to a local model, this is the filename

  • +
  • key (str) – when connecting to Tensorflow server this is the model name

  • +
  • use_remote_models (bool) – if True will try to connect to remote model server

  • +
+
+
Returns:
+

a model object with a predict object

+
+
Return type:
+

Union[‘LocalKerasModel’, ‘LocalOnnxModel’, ‘ExternalModelViaGRPC’, ‘ExternalModelViaREST’]

+
+
+
+ +
+
+class aizynthfinder.utils.models.LocalKerasModel(filename)
+

Bases: object

+

A keras policy model that is executed locally.

+

The size of the input vector can be determined with the len() method.

+
+
Variables:
+
    +
  • model – the compiled model

  • +
  • output_size – the length of the output vector

  • +
+
+
Parameters:
+

filename (str) – the path to a Keras checkpoint file

+
+
+
+
+predict(*args, **_)
+

Perform a forward pass of the neural network.

+
+
Parameters:
+
    +
  • args (ndarray) – the input vectors

  • +
  • _ (ndarray)

  • +
+
+
Returns:
+

the vector of the output layer

+
+
Return type:
+

ndarray

+
+
+
+ +
+ +
+
+class aizynthfinder.utils.models.LocalOnnxModel(filename)
+

Bases: object

+

An Onnx model that is executed locally.

+

The size of the input vector can be determined with the len() method.

+
+
Variables:
+
    +
  • model – the compiled Onnx model

  • +
  • output_size – the length of the output vector

  • +
+
+
Parameters:
+

filename (str) – the path to a Onnx model checkpoint file

+
+
+
+
+predict(*args, **_)
+

Perform a prediction run on the onnx model.

+
+
Parameters:
+
    +
  • args (ndarray) – the input vectors

  • +
  • _ (ndarray)

  • +
+
+
Returns:
+

the vector of the output layer

+
+
Return type:
+

ndarray

+
+
+
+ +
+ +
+
+class aizynthfinder.utils.models.ExternalModelViaREST(name)
+

Bases: object

+

A neural network model implementation using TF Serving via REST API.

+
+
Parameters:
+

name (str) – the name of model

+
+
+
+
+predict(*args, **kwargs)
+

Get prediction from model.

+

If the keys in kwargs agree with the model input names, they +will be used in stead of arg

+
+
Parameters:
+
    +
  • args (ndarray) – the input vectors

  • +
  • kwargs (ndarray) – the named input vectors

  • +
+
+
Returns:
+

the vector of the output layer

+
+
Return type:
+

ndarray

+
+
+
+ +
+ +
+
+class aizynthfinder.utils.models.ExternalModelViaGRPC(name)
+

Bases: object

+

A neural network model implementation using TF Serving via gRPC.

+
+
Parameters:
+

name (str) – the name of model

+
+
+
+
+predict(*args, **kwargs)
+

Get prediction from model.

+

If the keys in kwargs agree with the model input names, they +will be used in stead of arg

+
+
Parameters:
+
    +
  • args (ndarray) – the input vectors

  • +
  • kwargs (ndarray) – the named input vectors

  • +
+
+
Returns:
+

the vector of the output layer

+
+
Return type:
+

ndarray

+
+
+
+ +
+ +
+
+

aizynthfinder.utils.mongo module

+

Module containing routines to obtain a MongoClient instance

+
+
+aizynthfinder.utils.mongo.get_mongo_client(host='localhost', port=27017, user=None, password=None, tls_certs_path='')
+

A helper function to create and reuse MongoClient

+

The client is only setup once. Therefore if this function is called a second +time with different parameters, it would still return the first client.

+
+
Parameters:
+
    +
  • host (str) – the host

  • +
  • port (int) – the host port

  • +
  • user (str | None) – username, defaults to None

  • +
  • password (str | None) – password, defaults to None

  • +
  • tls_certs_path (str) – the path to TLS certificates if to be used, defaults to “”

  • +
+
+
Raises:
+

ValueError – if host and port is not given first time

+
+
Returns:
+

the MongoDB client

+
+
Return type:
+

MongoClient | None

+
+
+
+ +
+
+

aizynthfinder.utils.paths module

+

Module containing routines for returning package paths

+
+
+aizynthfinder.utils.paths.package_path()
+

Return the path to the package

+
+
Return type:
+

str

+
+
+
+ +
+
+aizynthfinder.utils.paths.data_path()
+

Return the path to the data directory of the package

+
+
Return type:
+

str

+
+
+
+ +
+
+

aizynthfinder.utils.sc_score module

+

Module containing the implementation of the SC-score model for synthetic complexity scoring.

+
+
+class aizynthfinder.utils.sc_score.SCScore(model_path, fingerprint_length=1024, fingerprint_radius=2)
+

Bases: object

+

Encapsulation of the SCScore model

+

Re-write of the SCScorer from the scscorer package

+

The predictions of the score is made with a sanitized instance of an RDKit molecule

+
mol = Molecule(smiles="CCC", sanitize=True)
+scscorer = SCScorer("path_to_model")
+score = scscorer(mol.rd_mol)
+
+
+

The model provided when creating the scorer object should be pickled tuple. +The first item of the tuple should be a list of the model weights for each layer. +The second item of the tuple should be a list of the model biases for each layer.

+
+
Parameters:
+
    +
  • model_path (str) – the filename of the model weights and biases

  • +
  • fingerprint_length (int) – the number of bits in the fingerprint

  • +
  • fingerprint_radius (int) – the radius of the fingerprint

  • +
+
+
+
+
+forward(x)
+

Forward pass with dense neural network

+
+
Parameters:
+

x (ndarray)

+
+
Return type:
+

ndarray

+
+
+
+ +
+ +
+
+

aizynthfinder.utils.type_utils module

+

Module containing all types and type imports

+
+
+

Module contents

+
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/cli.html b/cli.html new file mode 100644 index 0000000..9cdf357 --- /dev/null +++ b/cli.html @@ -0,0 +1,287 @@ + + + + + + + + Command-line interface — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

Command-line interface

+

This tools provide the possibility to perform tree search on a batch of molecules.

+

In its simplest form, you type

+
aizynthcli --config config_local.yml --smiles smiles.txt
+
+
+

where config_local.yml contains configurations such as paths to policy models and stocks (see here) +and smiles.txt is a simple text file with SMILES (one on each row).

+

To find out what other arguments are available use the -h flag.

+
aizynthcli -h
+
+
+

That gives something like this:

+
usage: aizynthcli [-h] --smiles SMILES --config CONFIG
+                  [--policy POLICY [POLICY ...]]
+                  [--filter FILTER [FILTER ...]]
+                  [--stocks STOCKS [STOCKS ...]] [--output OUTPUT]
+                  [--log_to_file] [--nproc NPROC] [--cluster]
+                  [--route_distance_model ROUTE_DISTANCE_MODEL]
+                  [--post_processing POST_PROCESSING [POST_PROCESSING ...]]
+                  [--pre_processing PRE_PROCESSING] [--checkpoint CHECKPOINT]
+
+options:
+  -h, --help            show this help message and exit
+  --smiles SMILES       the target molecule smiles or the path of a file
+                        containing the smiles
+  --config CONFIG       the filename of a configuration file
+  --policy POLICY [POLICY ...]
+                        the name of the expansion policy to use
+  --filter FILTER [FILTER ...]
+                        the name of the filter to use
+  --stocks STOCKS [STOCKS ...]
+                        the name of the stocks to use
+  --output OUTPUT       the name of the output file (JSON or HDF5 file)
+  --log_to_file         if provided, detailed logging to file is enabled
+  --nproc NPROC         if given, the input is split over a number of
+                        processes
+  --cluster             if provided, perform automatic clustering
+  --route_distance_model ROUTE_DISTANCE_MODEL
+                        if provided, calculate route distances for clustering
+                        with this ML model
+  --post_processing POST_PROCESSING [POST_PROCESSING ...]
+                        a number of modules that performs post-processing
+                        tasks
+  --pre_processing PRE_PROCESSING
+                        a module that perform pre-processing tasks
+  --checkpoint CHECKPOINT
+                        the path to the checkpoint file
+
+
+

By default:

+
+
    +
  • All stocks are selected if no stock is specified

  • +
  • First expansion policy is selected if not expansion policy is specified

  • +
  • All filter policies are selected if it is not specified on the command-line

  • +
+
+
+

Analysing output

+

The results from the aizynthcli tool when supplying multiple SMILES is an JSON or HDF5 file that can be read as a pandas dataframe. +It will be called output.json.gz by default.

+

A checkpoint.json.gz will also be generated if a checkpoint file path is provided as input when calling the aizynthcli tool. The +checkpoint data will contain the processed smiles with their corresponding results in each line of the file.

+
import pandas as pd
+data = pd.read_json("output.json.gz", orient="table")
+
+
+

it will contain statistics about the tree search and the top-ranked routes (as JSONs) for each target compound, see below.

+

When a single SMILES is provided to the tool, the statistics will be written to the terminal, and the top-ranked routes to +a JSON file (trees.json by default).

+

This is an example of how to create images of the top-ranked routes for the first target compound

+
import pandas as pd
+from aizynthfinder.reactiontree import ReactionTree
+
+data = pd.read_json("output.json.gz", orient="table")
+all_trees = data.trees.values  # This contains a list of all the trees for all the compounds
+trees_for_first_target = all_trees[0]
+
+for itree, tree in enumerate(trees_for_first_target):
+    imagefile = f"route{itree:03d}.png"
+    ReactionTree.from_dict(tree).to_image().save(imagefile)
+
+
+

The images will be called route000.png, route001.png etc.

+
+
+

Specification of output

+

The JSON or HDF5 file created when running the tool with a list of SMILES will have the following columns

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Column

Description

target

The target SMILES

search_time

The total search time in seconds

first_solution_time

The time elapsed until the first solution was found

first_solution_iteration

The number of iterations completed until the first solution was found

number_of_nodes

The number of nodes in the search tree

max_transforms

The maximum number of transformations for all routes in the search tree

max_children

The maximum number of children for a search node

number_of_routes

The number of routes in the search tree

number_of_solved_routes

The number of solved routes in search tree

top_score

The score of the top-scored route (default to MCTS reward)

is_solved

If the top-scored route is solved

number_of_steps

The number of reactions in the top-scored route

number_of_precursors

The number of starting materials

number_of_precursors_in_stock

The number of starting materials in stock

precursors_in_stock

Comma-separated list of SMILES of starting material in stock

precursors_not_in_stock

Comma-separated list of SMILES of starting material not in stock

precursors_availability

Semi-colon separated list of stock availability of the staring material

policy_used_counts

Dictionary of the total number of times an expansion policy have been used

profiling

Profiling information from the search tree, including expansion models call and reactant generation

stock_info

Dictionary of the stock availability for each of the starting material in all extracted routes

top_scores

Comma-separated list of the score of the extracted routes (default to MCTS reward)

trees

A list of the extracted routes as dictionaries

+

If you running the tool with a single SMILES, all of this data will be printed to the screen, except +the stock_info and trees.

+
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/configuration.html b/configuration.html new file mode 100644 index 0000000..8ccba73 --- /dev/null +++ b/configuration.html @@ -0,0 +1,411 @@ + + + + + + + + Configuration file — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

Configuration file

+

The configuration file that is to be provided to the interfaces +specify file paths to policy models and stocks, in addition to +detailed parameters of the tree search.

+
+

Simple usage

+

Let’s say you have a

+
+
    +
  • A trained Keras expansion model that is called uspto_expansion.onnx

  • +
  • A library of unique templates called uspto_templates.csv.gz

  • +
  • A stock file in HDF5 format, called zinc_stock.hdf5

  • +
+
+

(this could have been created by the smiles2stock tool, see here)

+

then to use them in the tree search, create a file called config.yml that has the following content

+
expansion:
+  full:
+    - uspto_expansion.onnx
+    - uspto_templates.csv.gz
+stock:
+  zinc: zinc_stock.hdf5
+
+
+
+
+

Advanced usage

+

A more detailed configuration file is shown below

+
search:
+  algorithm: mcts
+  algorithm_config:
+    C: 1.4
+    default_prior: 0.5
+    use_prior: True
+    prune_cycles_in_search: True
+    search_rewards:
+      - state score
+  max_transforms: 6
+  iteration_limit: 100
+  return_first: false
+  time_limit: 120
+  exclude_target_from_stock: True
+  break_bonds: [[1, 2], [2, 3]]
+  freeze_bonds: [[3, 4]]
+  break_bonds_operator: or
+expansion:
+  my_policy:
+    type: template-based
+    model: /path/to/keras/model/weights.hdf5
+    template: /path/to/hdf5/templates.hdf5
+    template_column: retro_template
+    cutoff_cumulative: 0.995
+    cutoff_number: 50
+    use_rdchiral: True
+    use_remote_models: False
+  my_full_policy:
+    - /path/to/keras/model/weights.hdf5
+    - /path/to/hdf5/templates.hdf5
+filter:
+  uspto:
+    type: quick-filter
+    model: /path/to/keras/model/weights.hdf5
+    exclude_from_policy: rc
+    filter_cutoff: 0.05
+    use_remote_models: False
+  uspto_full: /path/to/keras/model/weights.hdf5
+stock:
+  buyables:
+    type: inchiset
+    path: /path/to/stock1.hdf5
+  emolecules: /path/to/stock1.hdf5
+
+
+
+
The (expansion) policy models are specified using two files
    +
  • a checkpoint files from Keras in ONNX or hdf5 format,

  • +
  • a HDF5 or a CSV file containing templates.

  • +
+
+
+

A key like my_policy should be set and the configuration contains type, model and template that must be provided. +If the other settings are not assigned, their default values are taken. +The policy my_full_policy exemplifies a short-cut to the template-based expansion model when no other settings need to be +provided, only the model and templates can be provided. The default settings will be taken in this case.

+

The template file should be readable by pandas using the table key and the retro_template column. +A policy can then be selected using the provided key, like my_policy in the above example.

+

The filter policy model is specified using a single checkpoint file. +Any key like uspto can be set. The settings contains type and model that must be provided. If the other +settings are not assigned, their default values are taken. +The filter uspto_full exemplifies a short-cut to the quick-filter model when no other settings need to be +provided, only the model can be provided. The default settings will be taken in this case.

+
+
The stock files can be
    +
  • HDF5 files with the table key an the inchi_key column.

  • +
  • A CSV file with a inchi_key column

  • +
  • A text file a single column

  • +
+
+
+

In all cases, the column should contain pre-computed inchi keys of the molecules. +The stocks can be set using any key, like buyables or emolecules in the above example. +The type and path parameters can also be set along with other parameters. +If no other settings need to be provided, only the path can be provided, whereby it will be +treated as a +short-cut to the inchiset class..

+

The values in the search sections are optional, and if missing, default values are considered. These +values can also be taken from environment variables. An example of this can be seen as below:

+
search:
+  iteration_limit: ${ITERATION_LIMIT}
+  algorithm_config:
+    C: ${C}
+  time_limit: ${TIME_LIMIT}
+  max_transforms: ${MAX_TRANSFORMS}
+
+
+

These are the available search settings. The algorithm_config refers to MCTS settings:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Setting

Default value

Description

algorithm

mcts

The search algorithm. Can be set to package.module.ClassName to use a custom search method.

algorithm_config: C

1.4

The C value used to balance exploitation and exploration in the upper confidence bound score of the nodes.

algorithm_config: default_prior

0.5

The prior that is used if policy-provided priors are not used.

algorithm_config: use_prior

True

If True, priors from the policy is used instead of the default_prior.

algorithm_config: prune_cycles_in_search

True

If True, prevents the MCTS from creating cycles by recreating previously seen molecules when it is expanded.

algorithm_config: search_rewards

[state score]

The scoring used for the MCTS search algorithm.

algorithm_config: search_rewards_weights

[]

The scoring weights used by the Combined Scorer for the MCTS search algorithm.

algorithm_config: immediate_instantiation

[]

list of expansion policies for which the MCTS algorithm immediately instantiate the children node upon expansion

algorithm_config: mcts_grouping

    +
  • +
+

if is partial or full the MCTS algorithm will group expansions that produce the same state. If partial is used the equality will only be determined based on the expandable molecules, whereas full will check all molecules.

max_transforms

6

The maximum depth of the search tree.

iteration_limit

100

The maximum number of iterations for the tree search.

time_limit

120

The maximum number of seconds to complete the tree search.

return_first

False

If True, the tree search will be terminated as soon as one solution is found.

exclude_target_from_stock

True

If True, the target is in stock will be broken down.

break_bonds

[]

The list of lists of atom numbers of molecular bonds pairs to break during the search.

freeze_bonds

[]

The list of lists of atom numbers of molecular bonds pairs to freeze or retain during the search.

break_bonds_operator

and

If set to ‘and’, all bond pairs listed in break_bonds must be broken. If set to ‘or’, breaking any listed bond pair in break_bonds is sufficient.

+

The post_processing settings are:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Setting

Default value

Description

min_routes

5

The minumum number of routes to extract if all_routes is not set.

max_routes

25

The maximum number of routes to extract if all_routes is not set.

all_routes

False

If True, will extract all solved routes.

route_distance_model

N/A

If set, will load the quick route distance model from this checkpoint file.

route_scorer

state score

The scoring for routes when extracting them in the post processing step.

+

The expansion settings are for template-based models:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Setting

Default value

Description

template_column

retro_template

The column in the template file that contains the templates.

cutoff_cumulative

0.995

The accumulative probability of the suggested templates is capped at this value. All other templates above this threshold are discarded.

cutoff_number

50

The maximum number of templates that will be returned from the expansion policy.

use_rdchiral

True

If True, will apply templates with RDChiral, otherwise RDKit will be used.

use_remote_models

False

If True, will try to connect to remote Tensorflow servers.

rescale_prior

False

If True, will apply a softmax function to the priors.

mask

“”

The path to a numpy .npz file containing a Boolean vector of masks for the reaction templates.

+

The filter settings are for quick-filter models:

+ + + + + + + + + + + + + + + + + + + + + +

Setting

Default value

Description

exclude_from_policy

[]

The list of names of the filter policies to exclude.

filter_cutoff

0.05

The cut-off for the quick-filter policy.

use_remote_models

False

If True, will try to connect to remote Tensorflow servers.

+
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/genindex.html b/genindex.html new file mode 100644 index 0000000..1510fab --- /dev/null +++ b/genindex.html @@ -0,0 +1,1783 @@ + + + + + + + Index — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ + +

Index

+ +
+ A + | B + | C + | D + | E + | F + | G + | H + | I + | J + | L + | M + | N + | O + | P + | Q + | R + | S + | T + | U + | W + | X + | Y + | Z + +
+

A

+ + + +
+ +

B

+ + + +
+ +

C

+ + + +
+ +

D

+ + + +
+ +

E

+ + + +
+ +

F

+ + + +
+ +

G

+ + + +
+ +

H

+ + + +
+ +

I

+ + + +
+ +

J

+ + +
+ +

L

+ + + +
+ +

M

+ + + +
+ +

N

+ + + +
+ +

O

+ + +
+ +

P

+ + + +
+ +

Q

+ + +
+ +

R

+ + + +
+ +

S

+ + + +
+ +

T

+ + + +
+ +

U

+ + +
+ +

W

+ + + +
+ +

X

+ + +
+ +

Y

+ + +
+ +

Z

+ + +
+ + + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/gui.html b/gui.html new file mode 100644 index 0000000..40d6bf8 --- /dev/null +++ b/gui.html @@ -0,0 +1,176 @@ + + + + + + + + Graphical user interface — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

Graphical user interface

+

This tool to provide the possibility to perform the tree search on a single compound using a GUI +through a Jupyter notebook. If you are unfamiliar with notebooks, you find some introduction here.

+

To bring up the notebook, use

+
jupyter notebook
+
+
+

and browse to an existing notebook or create a new one.

+

Add these lines to the first cell in the notebook.

+
from aizynthfinder.interfaces import AiZynthApp
+app = AiZynthApp("/path/to/configfile.yaml")
+
+
+

where the AiZynthApp class needs to be instantiated with the path to a configuration file (see here).

+

To use the interface, follow these steps:

+
    +
  1. Executed the code in the cell (press Ctrl+Enter) and a simple GUI will appear

  2. +
  3. Enter the target SMILES and select stocks and policy model.

  4. +
  5. Press the Run Search button to perform the tree search.

  6. +
+_images/gui_input.png +
    +
  1. Press the Show Reactions to see the top-ranked routes

  2. +
+_images/gui_results.png +

You can also choose to select and sort the top-ranked routes based on another scoring function.

+
+

Creating the notebook

+

It is possible to create a notebook automatically with the aizynthapp tool

+
aizynthapp --config config_local.yml
+
+
+

which will also automatically opens up the created notebook.

+
+
+

Analysing the results

+

When the tree search has been finished. One can continue exploring the tree and extract output. +This is done by using the finder property of the app object. The finder holds a reference to an AiZynthFinder object.

+
finder = app.finder
+stats = finder.extract_statistics()
+
+
+
+
+

Clustering

+

There is a GUI extension to perform clustering of the routes. Enter the following a new cell

+
%matplotlib inline
+from aizynthfinder.interfaces.gui.clustering import ClusteringGui
+ClusteringGui.from_app(app)
+
+
+

A GUI like this will be shown, where you see the hierarchy of the routes and then can select how many +clusters you want to create.

+_images/gui_clustering.png +
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/howto.html b/howto.html new file mode 100644 index 0000000..9e22897 --- /dev/null +++ b/howto.html @@ -0,0 +1,209 @@ + + + + + + + + How-to — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

How-to

+

This page outlines a few guidelines on some more advanced use-cases of AiZynthFinder or +frequently raised issues.

+
+

Using Retro*

+

AiZynthFinder implements other search algorithms than MCTS. This is an example of how Retro* can be used.

+

The search algorithm is specified in the configuration file.

+
search:
+  algorithm: aizynthfinder.search.retrostar.search_tree.SearchTree
+
+
+

This will use Retro* without a constant-valued oracle function. To specify the oracle function, you can +do

+
search:
+  algorithm: aizynthfinder.search.retrostar.search_tree.SearchTree
+  algorithm_config:
+    molecule_cost:
+      cost: aizynthfinder.search.retrostar.cost.RetroStarCost
+      model_path: retrostar_value_model.pickle
+      fingerprint_length: 2048
+      fingerprint_radius: 2
+      dropout_rate: 0.1
+
+
+

The pickle file can be downloaded from here

+
+
+

Using multiple expansion policies

+

AiZynthFinder can use multiple expansion policies. This gives an example how a general USPTO and a RingBreaker model +can be used together

+
expansion:
+  uspto:
+    - uspto_keras_model.hdf5
+    - uspto_unique_templates.csv.gz
+  ringbreaker:
+    - uspto_ringbreaker_keras_model.hdf5
+    - uspto_ringbreaker_unique_templates.csv.gz
+  multi_expansion_strategy:
+    type: aizynthfinder.context.policy.MultiExpansionStrategy
+    expansion_strategies: [uspto, ringbreaker]
+    additive_expansion: True
+
+
+

and then to use this with aizynthcli do something like this

+
aizynthcli --smiles smiles.txt --config config.yml --policy multi_expansion_strategy
+
+
+
+
+

Output more routes

+

The number of routes in the output of aizynthcli can be controlled from the configuration file.

+

This is how you can extract at least 25 routes but not more than 50 per target

+
post_processing:
+  min_routes: 25
+  max_routes: 50
+
+
+

Alternatively, you can extract all solved routes. If a target is unsolved, it will return the number +of routes specified by min_routes and max_routes.

+
post_processing:
+    min_routes: 5
+    max_routes: 10
+    all_routes: True
+
+
+
+
+

Running multi-objective (MO) MCTS with disconnection-aware Chemformer

+

Disconnection-aware retrosynthesis can be done with 1) MO-MCTS (state score + broken bonds score), 2) Chemformer or 3) both.

+

First, you need to specify the bond constraints under search, see below. +To run the MO-MCTS with the “broken bonds” score, add the “broken bonds” score to the list of search_rewards:

+
search:
+    break_bonds: [[1, 2], [3, 4]]
+    freeze_bonds: []
+    algorithm_config:
+      search_rewards: ["state score", "broken bonds"]
+
+
+

To use the disconnection-aware Chemformer, you first need to add the plugins folder to the PYTHONPATH, e.g.

+
+

export PYTHONPATH=~/aizynthfinder/plugins/

+
+

The script for starting a disconnection-aware Chemformer service is available at https://github.com/MolecularAI/Chemformer. +The multi-expansion policy with template-based model and Chemformer is specified with:

+

To use MO-tree ranking and building, set:

+

Note: If post_processing.route_scorers is not specified, it will default to search.algorithm_config.search_rewards.

+
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..8b18d9a --- /dev/null +++ b/index.html @@ -0,0 +1,163 @@ + + + + + + + + aizynthfinder documentation — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

aizynthfinder documentation

+

aizynthfinder is a tool for retrosynthetic planning. The default algorithm is based on a Monte Carlo tree search that recursively breaks down a molecule to purchasable precursors. The tree search is guided by a policy that suggests possible precursors by utilizing a neural network trained on a library of known reaction templates.

+
+

Introduction

+

You run retrosynthesis experiments you need a trained model and a stock collection. You can download a public available model based on USPTO and a stock collection from ZINC database.

+
download_public_data .
+
+
+

This will download the data to your current directory. The config.yml file can be used directly with the interfaces.

+

There are two main interfaces provided by the package:

+
+
    +
  • a script that performs tree search in batch mode and

  • +
  • an interface that is providing a GUI within a Jupyter notebook.

  • +
+
+

The GUI interface should be run in a Jupyter notebook. This is a simple example of the code in a Jupyter notebook cell.

+
from aizynthfinder.interfaces import AiZynthApp
+app = AiZynthApp("/path/to/configfile.yaml")
+
+
+

where the AiZynthApp class needs to be instantiated with the path to a configuration file (see here).

+

To use the interface, follow these steps:

+
+
    +
  1. Executed the code in the cell (press Ctrl+Enter) and a simple GUI will appear

  2. +
  3. Enter the target SMILES and select stocks and policy model.

  4. +
  5. Press the Run Search button to perform the tree search.

  6. +
  7. Press the Show Reactions to see the top-ranked routes

  8. +
+
+

The batch-mode script is called aizynthcli and can be executed like:

+
aizynthcli --config config.yml --smiles smiles.txt
+
+
+

where config.yml contains configurations such as paths to policy models and stocks (see here), and smiles.txt is a simple text +file with SMILES (one on each row).

+

If you just want to perform the tree search on a single molecule. You can directly specify it on the command-line +within quotes:

+
aizynthcli --config config.yml --smiles "COc1cccc(OC(=O)/C=C/c2cc(OC)c(OC)c(OC)c2)c1"
+
+
+

The output is some statistics about the tree search, the scores of the top-ranked routes, and the reaction tree +of the top-ranked routes. When smiles are provided in a text file the results are stored in a JSON file, +whereas if the SMILEs is provided on the command-line it is printed directly to the prompt +(except the reaction trees, which are written to a JSON file).

+
+
+
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/modules.html b/modules.html new file mode 100644 index 0000000..f9a8ef0 --- /dev/null +++ b/modules.html @@ -0,0 +1,230 @@ + + + + + + + + aizynthfinder — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

aizynthfinder

+
+ +
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/objects.inv b/objects.inv new file mode 100644 index 0000000..c308a6a Binary files /dev/null and b/objects.inv differ diff --git a/py-modindex.html b/py-modindex.html new file mode 100644 index 0000000..9e19f87 --- /dev/null +++ b/py-modindex.html @@ -0,0 +1,452 @@ + + + + + + + Python Module Index — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ + +

Python Module Index

+ +
+ a +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
+ a
+ aizynthfinder +
    + aizynthfinder.aizynthfinder +
    + aizynthfinder.analysis +
    + aizynthfinder.analysis.routes +
    + aizynthfinder.analysis.tree_analysis +
    + aizynthfinder.analysis.utils +
    + aizynthfinder.chem +
    + aizynthfinder.chem.mol +
    + aizynthfinder.chem.reaction +
    + aizynthfinder.chem.serialization +
    + aizynthfinder.context +
    + aizynthfinder.context.collection +
    + aizynthfinder.context.config +
    + aizynthfinder.context.policy +
    + aizynthfinder.context.policy.expansion_strategies +
    + aizynthfinder.context.policy.filter_strategies +
    + aizynthfinder.context.policy.policies +
    + aizynthfinder.context.policy.utils +
    + aizynthfinder.context.scoring +
    + aizynthfinder.context.scoring.collection +
    + aizynthfinder.context.scoring.scorers +
    + aizynthfinder.context.stock +
    + aizynthfinder.context.stock.queries +
    + aizynthfinder.context.stock.stock +
    + aizynthfinder.interfaces +
    + aizynthfinder.interfaces.aizynthapp +
    + aizynthfinder.interfaces.aizynthcli +
    + aizynthfinder.interfaces.gui +
    + aizynthfinder.interfaces.gui.clustering +
    + aizynthfinder.interfaces.gui.pareto_fronts +
    + aizynthfinder.interfaces.gui.utils +
    + aizynthfinder.reactiontree +
    + aizynthfinder.search +
    + aizynthfinder.search.andor_trees +
    + aizynthfinder.search.breadth_first +
    + aizynthfinder.search.breadth_first.nodes +
    + aizynthfinder.search.breadth_first.search_tree +
    + aizynthfinder.search.dfpn +
    + aizynthfinder.search.dfpn.nodes +
    + aizynthfinder.search.dfpn.search_tree +
    + aizynthfinder.search.mcts +
    + aizynthfinder.search.mcts.node +
    + aizynthfinder.search.mcts.search +
    + aizynthfinder.search.mcts.state +
    + aizynthfinder.search.mcts.utils +
    + aizynthfinder.search.retrostar +
    + aizynthfinder.search.retrostar.cost +
    + aizynthfinder.search.retrostar.nodes +
    + aizynthfinder.search.retrostar.search_tree +
    + aizynthfinder.tools +
    + aizynthfinder.tools.cat_output +
    + aizynthfinder.tools.download_public_data +
    + aizynthfinder.tools.make_stock +
    + aizynthfinder.utils +
    + aizynthfinder.utils.bonds +
    + aizynthfinder.utils.exceptions +
    + aizynthfinder.utils.files +
    + aizynthfinder.utils.image +
    + aizynthfinder.utils.loading +
    + aizynthfinder.utils.logging +
    + aizynthfinder.utils.math +
    + aizynthfinder.utils.models +
    + aizynthfinder.utils.mongo +
    + aizynthfinder.utils.paths +
    + aizynthfinder.utils.sc_score +
    + aizynthfinder.utils.type_utils +
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/python_interface.html b/python_interface.html new file mode 100644 index 0000000..62b9c26 --- /dev/null +++ b/python_interface.html @@ -0,0 +1,202 @@ + + + + + + + + Python interface — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

Python interface

+

This page gives a quick example of how the tree search can be completed +by writing your own python interface. This is not recommended for most users.

+
    +
  1. Import the necessary class

  2. +
+
from aizynthfinder.aizynthfinder import AiZynthFinder
+
+
+
    +
  1. Instantiate that class by providing a configuration file.

  2. +
+
filename = "config.yml"
+finder = AiZynthFinder(configfile=filename)
+
+
+
    +
  1. Select stock and policy

  2. +
+
finder.stock.select("zinc")
+finder.expansion_policy.select("uspto")
+finder.filter_policy.select("uspto")
+
+
+

zinc and uspto where the keys given to the stock and the policy in the configuration file. +The first policy set is the expansion policy and the second is the filter policy. The filter policy is optional.

+
    +
  1. Set the target SMILES and perform the tree search

  2. +
+
finder.target_smiles = "Cc1cccc(c1N(CC(=O)Nc2ccc(cc2)c3ncon3)C(=O)C4CCS(=O)(=O)CC4)C"
+finder.tree_search()
+
+
+
    +
  1. Analyse the search tree and build routes

  2. +
+
finder.build_routes()
+stats = finder.extract_statistics()
+
+
+

The build_routes method needs to be called before any analysis can be done.

+
+

Expansion interface

+

There is an interface for the expansion policy as well. It can be used to break down a molecule into reactants.

+
filename = "config.yml"
+expander = AiZynthExpander(configfile=filename)
+expander.expansion_policy.select("uspto")
+expander.filter_policy.select("uspto")
+reactions = expander.do_expansion("Cc1cccc(c1N(CC(=O)Nc2ccc(cc2)c3ncon3)C(=O)C4CCS(=O)(=O)CC4)C")
+
+
+

for this, you only need to select the policies. The filter policy is optional and using it will only add the +feasibility of the reactions not filter it out.

+

The result is a nested list of FixedRetroReaction objects. This you can manipulate to for instance get +out all the reactants SMILES strings

+
reactants_smiles = []
+for reaction_tuple in reactions:
+    reactants_smiles.append([mol.smiles for mol in reaction_tuple[0].reactants[0])
+
+
+

or you can put all the metadata of all the reactions in a pandas dataframe

+
import pandas as pd
+metadata = []
+for reaction_tuple in reactions:
+    for reaction in reaction_tuple:
+        metadata.append(reaction.metadata)
+df = pd.DataFrame(metadata)
+
+
+
+
+

Further reading

+

The docstrings of all modules, classes and methods can be consulted here

+

and you can always find them in an interactive Python shell using for instance:

+
from aizynthfinder.chem import Molecule
+help(Molecule)
+help(Molecule.fingerprint)
+
+
+

If you are interested in the the relationships between the classes have a look here +and if you want to dig deeper in to the main algorithmic sequences have a look here

+
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/relationships.html b/relationships.html new file mode 100644 index 0000000..43facf7 --- /dev/null +++ b/relationships.html @@ -0,0 +1,133 @@ + + + + + + + + Relationships — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

Relationships

+

This page shows some relationship diagrams, i.e. how the different objects are connect in a typical retrosynthesis +analysis using Monte Carlo tree search.

+

These are the tree different types of relationships used:

+_images/line-desc.png + +
+

Analysis / post-processing

+

This diagram explains how the different objects involved in the analysis of the search are connected.

+_images/analysis-rel.png +
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/scoring.html b/scoring.html new file mode 100644 index 0000000..76b28eb --- /dev/null +++ b/scoring.html @@ -0,0 +1,168 @@ + + + + + + + + Scoring — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

Scoring

+

aizynthfinder is capable of scoring reaction routes, both in the form of MctsNode objects when a search tree is available, +and in the form of ReactionTree objects if post-processing is required.

+

Currently, there are a few scoring functions available

+
+
    +
  • State score - a function of the number of precursors in stock and the length of the route

  • +
  • Number of reactions - the number of steps in the route

  • +
  • Number of pre-cursors - the number of pre-cursors in the route

  • +
  • Number of pre-cursors in stock - the number of the pre-cursors that are purchaseable

  • +
  • Average template occurrence - the average occurrence of the templates used in the route

  • +
  • Sum of prices - the plain sum of the price of all pre-cursors

  • +
  • Route cost score - the cost of the synthesizing the route (Badowski et al. Chem Sci. 2019, 10, 4640)

  • +
+
+

The State score is the score that is guiding the tree search in the update phase, and +this is not configurable.

+

In the Jupyter notebook GUI one can choose to score the routes with any of the loaded the scorers.

+

The first four scoring functions are loaded automatically when an aizynthfinder object is created.

+
+

Add new scoring functions

+

Additional scoring functions can be implemented by inheriting from the class Scorer in the aizynthfinder.context.scoring.scorers module. +The scoring class needs to implement the _score_node, _score_reaction_tree and the __repr__ methods.

+

This is an example of that.

+
from aizynthfinder.context.scoring.scorers import Scorer
+
+class DeltaNumberOfTransformsScorer(Scorer):
+
+    def __repr__(self):
+        return "delta number of transforms"
+
+    def _score_node(self, node):
+        return self._config.max_transforms - node.state.max_transforms
+
+    def _score_reaction_tree(self, tree):
+        return self._config.max_transforms - len(list(tree.reactions()))
+
+
+

This can then be added to the scorers attribute of an aizynthfinderfinder object. The scorers attribute is a collection +of Scorer objects.

+

For instance to use this in the Jupyter notebook GUI, one can do

+
from aizynthfinder.interfaces import AiZynthApp
+app = AiZynthApp("config_local.yml", setup=False)
+scorer = DeltaNumberOfTransformsScorer(app.finder.config)
+app.finder.scorers.load(scorer)
+app.setup()
+
+
+
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/search.html b/search.html new file mode 100644 index 0000000..5fe6595 --- /dev/null +++ b/search.html @@ -0,0 +1,129 @@ + + + + + + + Search — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +

Search

+ + + + +

+ Searching for multiple words only shows matches that contain + all words. +

+ + +
+ + + +
+ + +
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/searchindex.js b/searchindex.js new file mode 100644 index 0000000..7c291f8 --- /dev/null +++ b/searchindex.js @@ -0,0 +1 @@ +Search.setIndex({"alltitles": {"Add new scoring functions": [[24, "add-new-scoring-functions"]], "Advanced usage": [[17, "advanced-usage"]], "Analysing output": [[16, "analysing-output"]], "Analysing the results": [[18, "analysing-the-results"]], "Analysis / post-processing": [[23, "analysis-post-processing"], [25, "analysis-post-processing"]], "Clustering": [[18, "clustering"]], "Command-line interface": [[16, null]], "Configuration file": [[17, null]], "Creating the notebook": [[18, "creating-the-notebook"]], "Custom stock": [[26, "custom-stock"]], "Expansion interface": [[22, "expansion-interface"]], "Further reading": [[22, "further-reading"]], "Graphical user interface": [[18, null]], "How-to": [[19, null]], "Introduction": [[20, "introduction"]], "Making stocks": [[26, "making-stocks"]], "Module contents": [[0, "module-aizynthfinder"], [1, "module-aizynthfinder.analysis"], [2, "module-aizynthfinder.chem"], [3, "module-aizynthfinder.context"], [4, "module-aizynthfinder.context.policy"], [5, "module-aizynthfinder.context.scoring"], [6, "module-aizynthfinder.context.stock"], [7, "module-aizynthfinder.interfaces"], [8, "module-aizynthfinder.interfaces.gui"], [9, "module-aizynthfinder.search"], [10, "module-aizynthfinder.search.breadth_first"], [11, "module-aizynthfinder.search.dfpn"], [12, "module-aizynthfinder.search.mcts"], [13, "module-aizynthfinder.search.retrostar"], [14, "module-aizynthfinder.tools"], [15, "module-aizynthfinder.utils"]], "Mongo database stock": [[26, "mongo-database-stock"]], "Monte Carlo tree search": [[25, "monte-carlo-tree-search"]], "Output more routes": [[19, "output-more-routes"]], "Python interface": [[22, null]], "Relationships": [[23, null]], "Running multi-objective (MO) MCTS with disconnection-aware Chemformer": [[19, "running-multi-objective-mo-mcts-with-disconnection-aware-chemformer"]], "Scoring": [[24, null]], "Sequences": [[25, null]], "Simple usage": [[17, "simple-usage"]], "Specification of output": [[16, "specification-of-output"]], "Stocks": [[26, null]], "Stop criteria": [[26, "stop-criteria"]], "Submodules": [[0, "submodules"], [1, "submodules"], [2, "submodules"], [3, "submodules"], [4, "submodules"], [5, "submodules"], [6, "submodules"], [7, "submodules"], [8, "submodules"], [9, "submodules"], [10, "submodules"], [11, "submodules"], [12, "submodules"], [13, "submodules"], [14, "submodules"], [15, "submodules"]], "Subpackages": [[0, "subpackages"], [3, "subpackages"], [7, "subpackages"], [9, "subpackages"]], "Tree search": [[23, "tree-search"]], "Using Retro*": [[19, "using-retro"]], "Using multiple expansion policies": [[19, "using-multiple-expansion-policies"]], "aizynthfinder": [[21, null]], "aizynthfinder documentation": [[20, null]], "aizynthfinder package": [[0, null]], "aizynthfinder.aizynthfinder module": [[0, "module-aizynthfinder.aizynthfinder"]], "aizynthfinder.analysis package": [[1, null]], "aizynthfinder.analysis.routes module": [[1, "module-aizynthfinder.analysis.routes"]], "aizynthfinder.analysis.tree_analysis module": [[1, "module-aizynthfinder.analysis.tree_analysis"]], "aizynthfinder.analysis.utils module": [[1, "module-aizynthfinder.analysis.utils"]], "aizynthfinder.chem package": [[2, null]], "aizynthfinder.chem.mol module": [[2, "module-aizynthfinder.chem.mol"]], "aizynthfinder.chem.reaction module": [[2, "module-aizynthfinder.chem.reaction"]], "aizynthfinder.chem.serialization module": [[2, "module-aizynthfinder.chem.serialization"]], "aizynthfinder.context package": [[3, null]], "aizynthfinder.context.collection module": [[3, "module-aizynthfinder.context.collection"]], "aizynthfinder.context.config module": [[3, "module-aizynthfinder.context.config"]], "aizynthfinder.context.policy package": [[4, null]], "aizynthfinder.context.policy.expansion_strategies module": [[4, "module-aizynthfinder.context.policy.expansion_strategies"]], "aizynthfinder.context.policy.filter_strategies module": [[4, "module-aizynthfinder.context.policy.filter_strategies"]], "aizynthfinder.context.policy.policies module": [[4, "module-aizynthfinder.context.policy.policies"]], "aizynthfinder.context.policy.utils module": [[4, "module-aizynthfinder.context.policy.utils"]], "aizynthfinder.context.scoring package": [[5, null]], "aizynthfinder.context.scoring.collection module": [[5, "module-aizynthfinder.context.scoring.collection"]], "aizynthfinder.context.scoring.scorers module": [[5, "module-aizynthfinder.context.scoring.scorers"]], "aizynthfinder.context.stock package": [[6, null]], "aizynthfinder.context.stock.queries module": [[6, "module-aizynthfinder.context.stock.queries"]], "aizynthfinder.context.stock.stock module": [[6, "module-aizynthfinder.context.stock.stock"]], "aizynthfinder.interfaces package": [[7, null]], "aizynthfinder.interfaces.aizynthapp module": [[7, "module-aizynthfinder.interfaces.aizynthapp"]], "aizynthfinder.interfaces.aizynthcli module": [[7, "module-aizynthfinder.interfaces.aizynthcli"]], "aizynthfinder.interfaces.gui package": [[8, null]], "aizynthfinder.interfaces.gui.clustering module": [[8, "module-aizynthfinder.interfaces.gui.clustering"]], "aizynthfinder.interfaces.gui.pareto_fronts module": [[8, "module-aizynthfinder.interfaces.gui.pareto_fronts"]], "aizynthfinder.interfaces.gui.utils module": [[8, "module-aizynthfinder.interfaces.gui.utils"]], "aizynthfinder.reactiontree module": [[0, "module-aizynthfinder.reactiontree"]], "aizynthfinder.search package": [[9, null]], "aizynthfinder.search.andor_trees module": [[9, "module-aizynthfinder.search.andor_trees"]], "aizynthfinder.search.breadth_first package": [[10, null]], "aizynthfinder.search.breadth_first.nodes module": [[10, "module-aizynthfinder.search.breadth_first.nodes"]], "aizynthfinder.search.breadth_first.search_tree module": [[10, "module-aizynthfinder.search.breadth_first.search_tree"]], "aizynthfinder.search.dfpn package": [[11, null]], "aizynthfinder.search.dfpn.nodes module": [[11, "module-aizynthfinder.search.dfpn.nodes"]], "aizynthfinder.search.dfpn.search_tree module": [[11, "module-aizynthfinder.search.dfpn.search_tree"]], "aizynthfinder.search.mcts package": [[12, null]], "aizynthfinder.search.mcts.node module": [[12, "module-aizynthfinder.search.mcts.node"]], "aizynthfinder.search.mcts.search module": [[12, "module-aizynthfinder.search.mcts.search"]], "aizynthfinder.search.mcts.state module": [[12, "module-aizynthfinder.search.mcts.state"]], "aizynthfinder.search.mcts.utils module": [[12, "module-aizynthfinder.search.mcts.utils"]], "aizynthfinder.search.retrostar package": [[13, null]], "aizynthfinder.search.retrostar.cost module": [[13, "module-aizynthfinder.search.retrostar.cost"]], "aizynthfinder.search.retrostar.nodes module": [[13, "module-aizynthfinder.search.retrostar.nodes"]], "aizynthfinder.search.retrostar.search_tree module": [[13, "module-aizynthfinder.search.retrostar.search_tree"]], "aizynthfinder.tools package": [[14, null]], "aizynthfinder.tools.cat_output module": [[14, "module-aizynthfinder.tools.cat_output"]], "aizynthfinder.tools.download_public_data module": [[14, "module-aizynthfinder.tools.download_public_data"]], "aizynthfinder.tools.make_stock module": [[14, "module-aizynthfinder.tools.make_stock"]], "aizynthfinder.utils package": [[15, null]], "aizynthfinder.utils.bonds module": [[15, "module-aizynthfinder.utils.bonds"]], "aizynthfinder.utils.exceptions module": [[15, "module-aizynthfinder.utils.exceptions"]], "aizynthfinder.utils.files module": [[15, "module-aizynthfinder.utils.files"]], "aizynthfinder.utils.image module": [[15, "module-aizynthfinder.utils.image"]], "aizynthfinder.utils.loading module": [[15, "module-aizynthfinder.utils.loading"]], "aizynthfinder.utils.logging module": [[15, "module-aizynthfinder.utils.logging"]], "aizynthfinder.utils.math module": [[15, "module-aizynthfinder.utils.math"]], "aizynthfinder.utils.models module": [[15, "module-aizynthfinder.utils.models"]], "aizynthfinder.utils.mongo module": [[15, "module-aizynthfinder.utils.mongo"]], "aizynthfinder.utils.paths module": [[15, "module-aizynthfinder.utils.paths"]], "aizynthfinder.utils.sc_score module": [[15, "module-aizynthfinder.utils.sc_score"]], "aizynthfinder.utils.type_utils module": [[15, "module-aizynthfinder.utils.type_utils"]]}, "docnames": ["aizynthfinder", "aizynthfinder.analysis", "aizynthfinder.chem", "aizynthfinder.context", "aizynthfinder.context.policy", "aizynthfinder.context.scoring", "aizynthfinder.context.stock", "aizynthfinder.interfaces", "aizynthfinder.interfaces.gui", "aizynthfinder.search", "aizynthfinder.search.breadth_first", "aizynthfinder.search.dfpn", "aizynthfinder.search.mcts", "aizynthfinder.search.retrostar", "aizynthfinder.tools", "aizynthfinder.utils", "cli", "configuration", "gui", "howto", "index", "modules", "python_interface", "relationships", "scoring", "sequences", "stocks"], "envversion": {"sphinx": 62, "sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2}, "filenames": ["aizynthfinder.rst", "aizynthfinder.analysis.rst", "aizynthfinder.chem.rst", "aizynthfinder.context.rst", "aizynthfinder.context.policy.rst", "aizynthfinder.context.scoring.rst", "aizynthfinder.context.stock.rst", "aizynthfinder.interfaces.rst", "aizynthfinder.interfaces.gui.rst", "aizynthfinder.search.rst", "aizynthfinder.search.breadth_first.rst", "aizynthfinder.search.dfpn.rst", "aizynthfinder.search.mcts.rst", "aizynthfinder.search.retrostar.rst", "aizynthfinder.tools.rst", "aizynthfinder.utils.rst", "cli.rst", "configuration.rst", "gui.rst", "howto.rst", "index.rst", "modules.rst", "python_interface.rst", "relationships.rst", "scoring.rst", "sequences.rst", "stocks.rst"], "indexentries": {"actions_to() (aizynthfinder.search.mcts.node.mctsnode method)": [[12, "aizynthfinder.search.mcts.node.MctsNode.actions_to", false]], "add_stub() (aizynthfinder.search.breadth_first.nodes.moleculenode method)": [[10, "aizynthfinder.search.breadth_first.nodes.MoleculeNode.add_stub", false]], "add_stub() (aizynthfinder.search.retrostar.nodes.moleculenode method)": [[13, "aizynthfinder.search.retrostar.nodes.MoleculeNode.add_stub", false]], "aizynthapp (class in aizynthfinder.interfaces.aizynthapp)": [[7, "aizynthfinder.interfaces.aizynthapp.AiZynthApp", false]], "aizynthexpander (class in aizynthfinder.aizynthfinder)": [[0, "aizynthfinder.aizynthfinder.AiZynthExpander", false]], "aizynthfinder": [[0, "module-aizynthfinder", false]], "aizynthfinder (class in aizynthfinder.aizynthfinder)": [[0, "aizynthfinder.aizynthfinder.AiZynthFinder", false]], "aizynthfinder.aizynthfinder": [[0, "module-aizynthfinder.aizynthfinder", false]], "aizynthfinder.analysis": [[1, "module-aizynthfinder.analysis", false]], "aizynthfinder.analysis.routes": [[1, "module-aizynthfinder.analysis.routes", false]], "aizynthfinder.analysis.tree_analysis": [[1, "module-aizynthfinder.analysis.tree_analysis", false]], "aizynthfinder.analysis.utils": [[1, "module-aizynthfinder.analysis.utils", false]], "aizynthfinder.chem": [[2, "module-aizynthfinder.chem", false]], "aizynthfinder.chem.mol": [[2, "module-aizynthfinder.chem.mol", false]], "aizynthfinder.chem.reaction": [[2, "module-aizynthfinder.chem.reaction", false]], "aizynthfinder.chem.serialization": [[2, "module-aizynthfinder.chem.serialization", false]], "aizynthfinder.context": [[3, "module-aizynthfinder.context", false]], "aizynthfinder.context.collection": [[3, "module-aizynthfinder.context.collection", false]], "aizynthfinder.context.config": [[3, "module-aizynthfinder.context.config", false]], "aizynthfinder.context.policy": [[4, "module-aizynthfinder.context.policy", false]], "aizynthfinder.context.policy.expansion_strategies": [[4, "module-aizynthfinder.context.policy.expansion_strategies", false]], "aizynthfinder.context.policy.filter_strategies": [[4, "module-aizynthfinder.context.policy.filter_strategies", false]], "aizynthfinder.context.policy.policies": [[4, "module-aizynthfinder.context.policy.policies", false]], "aizynthfinder.context.policy.utils": [[4, "module-aizynthfinder.context.policy.utils", false]], "aizynthfinder.context.scoring": [[5, "module-aizynthfinder.context.scoring", false]], "aizynthfinder.context.scoring.collection": [[5, "module-aizynthfinder.context.scoring.collection", false]], "aizynthfinder.context.scoring.scorers": [[5, "module-aizynthfinder.context.scoring.scorers", false]], "aizynthfinder.context.stock": [[6, "module-aizynthfinder.context.stock", false]], "aizynthfinder.context.stock.queries": [[6, "module-aizynthfinder.context.stock.queries", false]], "aizynthfinder.context.stock.stock": [[6, "module-aizynthfinder.context.stock.stock", false]], "aizynthfinder.interfaces": [[7, "module-aizynthfinder.interfaces", false]], "aizynthfinder.interfaces.aizynthapp": [[7, "module-aizynthfinder.interfaces.aizynthapp", false]], "aizynthfinder.interfaces.aizynthcli": [[7, "module-aizynthfinder.interfaces.aizynthcli", false]], "aizynthfinder.interfaces.gui": [[8, "module-aizynthfinder.interfaces.gui", false]], "aizynthfinder.interfaces.gui.clustering": [[8, "module-aizynthfinder.interfaces.gui.clustering", false]], "aizynthfinder.interfaces.gui.pareto_fronts": [[8, "module-aizynthfinder.interfaces.gui.pareto_fronts", false]], "aizynthfinder.interfaces.gui.utils": [[8, "module-aizynthfinder.interfaces.gui.utils", false]], "aizynthfinder.reactiontree": [[0, "module-aizynthfinder.reactiontree", false]], "aizynthfinder.search": [[9, "module-aizynthfinder.search", false]], "aizynthfinder.search.andor_trees": [[9, "module-aizynthfinder.search.andor_trees", false]], "aizynthfinder.search.breadth_first": [[10, "module-aizynthfinder.search.breadth_first", false]], "aizynthfinder.search.breadth_first.nodes": [[10, "module-aizynthfinder.search.breadth_first.nodes", false]], "aizynthfinder.search.breadth_first.search_tree": [[10, "module-aizynthfinder.search.breadth_first.search_tree", false]], "aizynthfinder.search.dfpn": [[11, "module-aizynthfinder.search.dfpn", false]], "aizynthfinder.search.dfpn.nodes": [[11, "module-aizynthfinder.search.dfpn.nodes", false]], "aizynthfinder.search.dfpn.search_tree": [[11, "module-aizynthfinder.search.dfpn.search_tree", false]], "aizynthfinder.search.mcts": [[12, "module-aizynthfinder.search.mcts", false]], "aizynthfinder.search.mcts.node": [[12, "module-aizynthfinder.search.mcts.node", false]], "aizynthfinder.search.mcts.search": [[12, "module-aizynthfinder.search.mcts.search", false]], "aizynthfinder.search.mcts.state": [[12, "module-aizynthfinder.search.mcts.state", false]], "aizynthfinder.search.mcts.utils": [[12, "module-aizynthfinder.search.mcts.utils", false]], "aizynthfinder.search.retrostar": [[13, "module-aizynthfinder.search.retrostar", false]], "aizynthfinder.search.retrostar.cost": [[13, "module-aizynthfinder.search.retrostar.cost", false]], "aizynthfinder.search.retrostar.nodes": [[13, "module-aizynthfinder.search.retrostar.nodes", false]], "aizynthfinder.search.retrostar.search_tree": [[13, "module-aizynthfinder.search.retrostar.search_tree", false]], "aizynthfinder.tools": [[14, "module-aizynthfinder.tools", false]], "aizynthfinder.tools.cat_output": [[14, "module-aizynthfinder.tools.cat_output", false]], "aizynthfinder.tools.download_public_data": [[14, "module-aizynthfinder.tools.download_public_data", false]], "aizynthfinder.tools.make_stock": [[14, "module-aizynthfinder.tools.make_stock", false]], "aizynthfinder.utils": [[15, "module-aizynthfinder.utils", false]], "aizynthfinder.utils.bonds": [[15, "module-aizynthfinder.utils.bonds", false]], "aizynthfinder.utils.exceptions": [[15, "module-aizynthfinder.utils.exceptions", false]], "aizynthfinder.utils.files": [[15, "module-aizynthfinder.utils.files", false]], "aizynthfinder.utils.image": [[15, "module-aizynthfinder.utils.image", false]], "aizynthfinder.utils.loading": [[15, "module-aizynthfinder.utils.loading", false]], "aizynthfinder.utils.logging": [[15, "module-aizynthfinder.utils.logging", false]], "aizynthfinder.utils.math": [[15, "module-aizynthfinder.utils.math", false]], "aizynthfinder.utils.models": [[15, "module-aizynthfinder.utils.models", false]], "aizynthfinder.utils.mongo": [[15, "module-aizynthfinder.utils.mongo", false]], "aizynthfinder.utils.paths": [[15, "module-aizynthfinder.utils.paths", false]], "aizynthfinder.utils.sc_score": [[15, "module-aizynthfinder.utils.sc_score", false]], "aizynthfinder.utils.type_utils": [[15, "module-aizynthfinder.utils.type_utils", false]], "amount() (aizynthfinder.context.stock.queries.stockquerymixin method)": [[6, "aizynthfinder.context.stock.queries.StockQueryMixin.amount", false]], "amount() (aizynthfinder.context.stock.stock.stock method)": [[6, "aizynthfinder.context.stock.stock.Stock.amount", false]], "ancestors() (aizynthfinder.search.breadth_first.nodes.moleculenode method)": [[10, "aizynthfinder.search.breadth_first.nodes.MoleculeNode.ancestors", false]], "ancestors() (aizynthfinder.search.retrostar.nodes.moleculenode method)": [[13, "aizynthfinder.search.retrostar.nodes.MoleculeNode.ancestors", false]], "andorsearchtreebase (class in aizynthfinder.search.andor_trees)": [[9, "aizynthfinder.search.andor_trees.AndOrSearchTreeBase", false]], "apply() (aizynthfinder.context.policy.filter_strategies.bondfilter method)": [[4, "aizynthfinder.context.policy.filter_strategies.BondFilter.apply", false]], "apply() (aizynthfinder.context.policy.filter_strategies.filterstrategy method)": [[4, "aizynthfinder.context.policy.filter_strategies.FilterStrategy.apply", false]], "apply() (aizynthfinder.context.policy.filter_strategies.quickkerasfilter method)": [[4, "aizynthfinder.context.policy.filter_strategies.QuickKerasFilter.apply", false]], "apply() (aizynthfinder.context.policy.filter_strategies.reactantscountfilter method)": [[4, "aizynthfinder.context.policy.filter_strategies.ReactantsCountFilter.apply", false]], "apply() (aizynthfinder.context.policy.policies.filterpolicy method)": [[4, "aizynthfinder.context.policy.policies.FilterPolicy.apply", false]], "availability_list() (aizynthfinder.context.stock.stock.stock method)": [[6, "aizynthfinder.context.stock.stock.Stock.availability_list", false]], "availability_string() (aizynthfinder.context.stock.queries.mongodbinchikeyquery method)": [[6, "aizynthfinder.context.stock.queries.MongoDbInchiKeyQuery.availability_string", false]], "availability_string() (aizynthfinder.context.stock.queries.stockquerymixin method)": [[6, "aizynthfinder.context.stock.queries.StockQueryMixin.availability_string", false]], "availability_string() (aizynthfinder.context.stock.stock.stock method)": [[6, "aizynthfinder.context.stock.stock.Stock.availability_string", false]], "averagetemplateoccurrencescorer (class in aizynthfinder.context.scoring.scorers)": [[5, "aizynthfinder.context.scoring.scorers.AverageTemplateOccurrenceScorer", false]], "backpropagate() (aizynthfinder.search.mcts.node.mctsnode method)": [[12, "aizynthfinder.search.mcts.node.MctsNode.backpropagate", false]], "backpropagate() (aizynthfinder.search.mcts.node.paretomctsnode method)": [[12, "aizynthfinder.search.mcts.node.ParetoMctsNode.backpropagate", false]], "backpropagate() (aizynthfinder.search.mcts.search.mctssearchtree method)": [[12, "aizynthfinder.search.mcts.search.MctsSearchTree.backpropagate", false]], "basic_compare() (aizynthfinder.chem.mol.molecule method)": [[2, "aizynthfinder.chem.mol.Molecule.basic_compare", false]], "best() (aizynthfinder.analysis.tree_analysis.treeanalysis method)": [[1, "aizynthfinder.analysis.tree_analysis.TreeAnalysis.best", false]], "bondfilter (class in aizynthfinder.context.policy.filter_strategies)": [[4, "aizynthfinder.context.policy.filter_strategies.BondFilter", false]], "brokenbonds (class in aizynthfinder.utils.bonds)": [[15, "aizynthfinder.utils.bonds.BrokenBonds", false]], "brokenbondsscorer (class in aizynthfinder.context.scoring.scorers)": [[5, "aizynthfinder.context.scoring.scorers.BrokenBondsScorer", false]], "build_routes() (aizynthfinder.aizynthfinder.aizynthfinder method)": [[0, "aizynthfinder.aizynthfinder.AiZynthFinder.build_routes", false]], "cached_search() (aizynthfinder.context.stock.queries.stockquerymixin method)": [[6, "aizynthfinder.context.stock.queries.StockQueryMixin.cached_search", false]], "calculate() (aizynthfinder.search.retrostar.cost.retrostarcost method)": [[13, "aizynthfinder.search.retrostar.cost.RetroStarCost.calculate", false]], "calculate() (aizynthfinder.search.retrostar.cost.zeromoleculecost method)": [[13, "aizynthfinder.search.retrostar.cost.ZeroMoleculeCost.calculate", false]], "cat_datafiles() (in module aizynthfinder.utils.files)": [[15, "aizynthfinder.utils.files.cat_datafiles", false]], "cat_hdf_files() (in module aizynthfinder.utils.files)": [[15, "aizynthfinder.utils.files.cat_hdf_files", false]], "children (aizynthfinder.search.andor_trees.treenodemixin property)": [[9, "aizynthfinder.search.andor_trees.TreeNodeMixin.children", false]], "children (aizynthfinder.search.breadth_first.nodes.moleculenode property)": [[10, "aizynthfinder.search.breadth_first.nodes.MoleculeNode.children", false]], "children (aizynthfinder.search.breadth_first.nodes.reactionnode property)": [[10, "aizynthfinder.search.breadth_first.nodes.ReactionNode.children", false]], "children (aizynthfinder.search.dfpn.nodes.reactionnode property)": [[11, "aizynthfinder.search.dfpn.nodes.ReactionNode.children", false]], "children (aizynthfinder.search.mcts.node.mctsnode property)": [[12, "aizynthfinder.search.mcts.node.MctsNode.children", false]], "children (aizynthfinder.search.retrostar.nodes.moleculenode property)": [[13, "aizynthfinder.search.retrostar.nodes.MoleculeNode.children", false]], "children (aizynthfinder.search.retrostar.nodes.reactionnode property)": [[13, "aizynthfinder.search.retrostar.nodes.ReactionNode.children", false]], "children_view() (aizynthfinder.search.mcts.node.mctsnode method)": [[12, "aizynthfinder.search.mcts.node.MctsNode.children_view", false]], "children_view() (aizynthfinder.search.mcts.node.paretomctsnode method)": [[12, "aizynthfinder.search.mcts.node.ParetoMctsNode.children_view", false]], "clear_cache() (aizynthfinder.context.stock.queries.stockquerymixin method)": [[6, "aizynthfinder.context.stock.queries.StockQueryMixin.clear_cache", false]], "close() (aizynthfinder.search.retrostar.nodes.moleculenode method)": [[13, "aizynthfinder.search.retrostar.nodes.MoleculeNode.close", false]], "cluster() (aizynthfinder.analysis.routes.routecollection method)": [[1, "aizynthfinder.analysis.routes.RouteCollection.cluster", false]], "clusteringgui (class in aizynthfinder.interfaces.gui.clustering)": [[8, "aizynthfinder.interfaces.gui.clustering.ClusteringGui", false]], "combined_reaction_trees() (aizynthfinder.analysis.routes.routecollection method)": [[1, "aizynthfinder.analysis.routes.RouteCollection.combined_reaction_trees", false]], "combinedreactiontrees (class in aizynthfinder.analysis.utils)": [[1, "aizynthfinder.analysis.utils.CombinedReactionTrees", false]], "combinedscorer (class in aizynthfinder.context.scoring.scorers)": [[5, "aizynthfinder.context.scoring.scorers.CombinedScorer", false]], "compute_reward() (aizynthfinder.search.mcts.search.mctssearchtree method)": [[12, "aizynthfinder.search.mcts.search.MctsSearchTree.compute_reward", false]], "compute_scores() (aizynthfinder.analysis.routes.routecollection method)": [[1, "aizynthfinder.analysis.routes.RouteCollection.compute_scores", false]], "configuration (class in aizynthfinder.context.config)": [[3, "aizynthfinder.context.config.Configuration", false]], "contextcollection (class in aizynthfinder.context.collection)": [[3, "aizynthfinder.context.collection.ContextCollection", false]], "copy() (aizynthfinder.chem.reaction.fixedretroreaction method)": [[2, "aizynthfinder.chem.reaction.FixedRetroReaction.copy", false]], "copy() (aizynthfinder.chem.reaction.retroreaction method)": [[2, "aizynthfinder.chem.reaction.RetroReaction.copy", false]], "costexception": [[15, "aizynthfinder.utils.exceptions.CostException", false]], "create_default_scorers() (aizynthfinder.context.scoring.collection.scorercollection method)": [[5, "aizynthfinder.context.scoring.collection.ScorerCollection.create_default_scorers", false]], "create_root() (aizynthfinder.search.breadth_first.nodes.moleculenode class method)": [[10, "aizynthfinder.search.breadth_first.nodes.MoleculeNode.create_root", false]], "create_root() (aizynthfinder.search.dfpn.nodes.moleculenode class method)": [[11, "aizynthfinder.search.dfpn.nodes.MoleculeNode.create_root", false]], "create_root() (aizynthfinder.search.mcts.node.mctsnode class method)": [[12, "aizynthfinder.search.mcts.node.MctsNode.create_root", false]], "create_root() (aizynthfinder.search.retrostar.nodes.moleculenode class method)": [[13, "aizynthfinder.search.retrostar.nodes.MoleculeNode.create_root", false]], "create_stub() (aizynthfinder.search.breadth_first.nodes.reactionnode class method)": [[10, "aizynthfinder.search.breadth_first.nodes.ReactionNode.create_stub", false]], "create_stub() (aizynthfinder.search.retrostar.nodes.reactionnode class method)": [[13, "aizynthfinder.search.retrostar.nodes.ReactionNode.create_stub", false]], "crop_image() (in module aizynthfinder.utils.image)": [[15, "aizynthfinder.utils.image.crop_image", false]], "data_path() (in module aizynthfinder.utils.paths)": [[15, "aizynthfinder.utils.paths.data_path", false]], "deltasyntheticcomplexityscorer (class in aizynthfinder.context.scoring.scorers)": [[5, "aizynthfinder.context.scoring.scorers.DeltaSyntheticComplexityScorer", false]], "dense_layer_forward_pass() (in module aizynthfinder.utils.math)": [[15, "aizynthfinder.utils.math.dense_layer_forward_pass", false]], "depth() (aizynthfinder.reactiontree.reactiontree method)": [[0, "aizynthfinder.reactiontree.ReactionTree.depth", false]], "deselect() (aizynthfinder.context.collection.contextcollection method)": [[3, "aizynthfinder.context.collection.ContextCollection.deselect", false]], "deserialize_action() (in module aizynthfinder.chem.serialization)": [[2, "aizynthfinder.chem.serialization.deserialize_action", false]], "dict_with_extra() (aizynthfinder.analysis.routes.routecollection method)": [[1, "aizynthfinder.analysis.routes.RouteCollection.dict_with_extra", false]], "dict_with_scores() (aizynthfinder.analysis.routes.routecollection method)": [[1, "aizynthfinder.analysis.routes.RouteCollection.dict_with_scores", false]], "dicts (aizynthfinder.analysis.routes.routecollection property)": [[1, "aizynthfinder.analysis.routes.RouteCollection.dicts", false]], "disproven (aizynthfinder.search.dfpn.nodes.reactionnode property)": [[11, "aizynthfinder.search.dfpn.nodes.ReactionNode.disproven", false]], "distance_matrix() (aizynthfinder.analysis.routes.routecollection method)": [[1, "aizynthfinder.analysis.routes.RouteCollection.distance_matrix", false]], "distance_to() (aizynthfinder.reactiontree.reactiontree method)": [[0, "aizynthfinder.reactiontree.ReactionTree.distance_to", false]], "do_expansion() (aizynthfinder.aizynthfinder.aizynthexpander method)": [[0, "aizynthfinder.aizynthfinder.AiZynthExpander.do_expansion", false]], "draw_rounded_rectangle() (in module aizynthfinder.utils.image)": [[15, "aizynthfinder.utils.image.draw_rounded_rectangle", false]], "exclude() (aizynthfinder.context.stock.stock.stock method)": [[6, "aizynthfinder.context.stock.stock.Stock.exclude", false]], "expand() (aizynthfinder.search.dfpn.nodes.moleculenode method)": [[11, "aizynthfinder.search.dfpn.nodes.MoleculeNode.expand", false]], "expand() (aizynthfinder.search.dfpn.nodes.reactionnode method)": [[11, "aizynthfinder.search.dfpn.nodes.ReactionNode.expand", false]], "expand() (aizynthfinder.search.mcts.node.mctsnode method)": [[12, "aizynthfinder.search.mcts.node.MctsNode.expand", false]], "expansion_policy (aizynthfinder.context.config.configuration attribute)": [[3, "aizynthfinder.context.config.Configuration.expansion_policy", false]], "expansionpolicy (class in aizynthfinder.context.policy.policies)": [[4, "aizynthfinder.context.policy.policies.ExpansionPolicy", false]], "expansionstrategy (class in aizynthfinder.context.policy.expansion_strategies)": [[4, "aizynthfinder.context.policy.expansion_strategies.ExpansionStrategy", false]], "externalmodelapierror": [[15, "aizynthfinder.utils.exceptions.ExternalModelAPIError", false]], "externalmodelviagrpc (class in aizynthfinder.utils.models)": [[15, "aizynthfinder.utils.models.ExternalModelViaGRPC", false]], "externalmodelviarest (class in aizynthfinder.utils.models)": [[15, "aizynthfinder.utils.models.ExternalModelViaREST", false]], "extract_plain_smiles() (in module aizynthfinder.tools.make_stock)": [[14, "aizynthfinder.tools.make_stock.extract_plain_smiles", false]], "extract_smiles_from_module() (in module aizynthfinder.tools.make_stock)": [[14, "aizynthfinder.tools.make_stock.extract_smiles_from_module", false]], "extract_statistics() (aizynthfinder.aizynthfinder.aizynthfinder method)": [[0, "aizynthfinder.aizynthfinder.AiZynthFinder.extract_statistics", false]], "feasibility() (aizynthfinder.context.policy.filter_strategies.quickkerasfilter method)": [[4, "aizynthfinder.context.policy.filter_strategies.QuickKerasFilter.feasibility", false]], "filter_policy (aizynthfinder.context.config.configuration attribute)": [[3, "aizynthfinder.context.config.Configuration.filter_policy", false]], "filterpolicy (class in aizynthfinder.context.policy.policies)": [[4, "aizynthfinder.context.policy.policies.FilterPolicy", false]], "filterstrategy (class in aizynthfinder.context.policy.filter_strategies)": [[4, "aizynthfinder.context.policy.filter_strategies.FilterStrategy", false]], "fingerprint() (aizynthfinder.chem.mol.molecule method)": [[2, "aizynthfinder.chem.mol.Molecule.fingerprint", false]], "fixedretroreaction (class in aizynthfinder.chem.reaction)": [[2, "aizynthfinder.chem.reaction.FixedRetroReaction", false]], "forward() (aizynthfinder.utils.sc_score.scscore method)": [[15, "aizynthfinder.utils.sc_score.SCScore.forward", false]], "fractioninstockscorer (class in aizynthfinder.context.scoring.scorers)": [[5, "aizynthfinder.context.scoring.scorers.FractionInStockScorer", false]], "from_analysis() (aizynthfinder.analysis.routes.routecollection class method)": [[1, "aizynthfinder.analysis.routes.RouteCollection.from_analysis", false]], "from_app() (aizynthfinder.interfaces.gui.clustering.clusteringgui class method)": [[8, "aizynthfinder.interfaces.gui.clustering.ClusteringGui.from_app", false]], "from_app() (aizynthfinder.interfaces.gui.pareto_fronts.paretofrontsgui class method)": [[8, "aizynthfinder.interfaces.gui.pareto_fronts.ParetoFrontsGUI.from_app", false]], "from_dict() (aizynthfinder.context.config.configuration class method)": [[3, "aizynthfinder.context.config.Configuration.from_dict", false]], "from_dict() (aizynthfinder.reactiontree.reactiontree class method)": [[0, "aizynthfinder.reactiontree.ReactionTree.from_dict", false]], "from_dict() (aizynthfinder.search.breadth_first.nodes.moleculenode class method)": [[10, "aizynthfinder.search.breadth_first.nodes.MoleculeNode.from_dict", false]], "from_dict() (aizynthfinder.search.breadth_first.nodes.reactionnode class method)": [[10, "aizynthfinder.search.breadth_first.nodes.ReactionNode.from_dict", false]], "from_dict() (aizynthfinder.search.mcts.node.mctsnode class method)": [[12, "aizynthfinder.search.mcts.node.MctsNode.from_dict", false]], "from_dict() (aizynthfinder.search.mcts.state.mctsstate class method)": [[12, "aizynthfinder.search.mcts.state.MctsState.from_dict", false]], "from_dict() (aizynthfinder.search.retrostar.nodes.moleculenode class method)": [[13, "aizynthfinder.search.retrostar.nodes.MoleculeNode.from_dict", false]], "from_dict() (aizynthfinder.search.retrostar.nodes.reactionnode class method)": [[13, "aizynthfinder.search.retrostar.nodes.ReactionNode.from_dict", false]], "from_file() (aizynthfinder.context.config.configuration class method)": [[3, "aizynthfinder.context.config.Configuration.from_file", false]], "from_json() (aizynthfinder.search.breadth_first.search_tree.searchtree class method)": [[10, "aizynthfinder.search.breadth_first.search_tree.SearchTree.from_json", false]], "from_json() (aizynthfinder.search.mcts.search.mctssearchtree class method)": [[12, "aizynthfinder.search.mcts.search.MctsSearchTree.from_json", false]], "from_json() (aizynthfinder.search.retrostar.search_tree.searchtree class method)": [[13, "aizynthfinder.search.retrostar.search_tree.SearchTree.from_json", false]], "from_serialization() (aizynthfinder.chem.reaction.retroreaction class method)": [[2, "aizynthfinder.chem.reaction.RetroReaction.from_serialization", false]], "get_actions() (aizynthfinder.context.policy.expansion_strategies.expansionstrategy method)": [[4, "aizynthfinder.context.policy.expansion_strategies.ExpansionStrategy.get_actions", false]], "get_actions() (aizynthfinder.context.policy.expansion_strategies.multiexpansionstrategy method)": [[4, "aizynthfinder.context.policy.expansion_strategies.MultiExpansionStrategy.get_actions", false]], "get_actions() (aizynthfinder.context.policy.expansion_strategies.templatebaseddirectexpansionstrategy method)": [[4, "aizynthfinder.context.policy.expansion_strategies.TemplateBasedDirectExpansionStrategy.get_actions", false]], "get_actions() (aizynthfinder.context.policy.expansion_strategies.templatebasedexpansionstrategy method)": [[4, "aizynthfinder.context.policy.expansion_strategies.TemplateBasedExpansionStrategy.get_actions", false]], "get_actions() (aizynthfinder.context.policy.policies.expansionpolicy method)": [[4, "aizynthfinder.context.policy.policies.ExpansionPolicy.get_actions", false]], "get_bonds_in_molecule() (aizynthfinder.chem.mol.treemolecule method)": [[2, "aizynthfinder.chem.mol.TreeMolecule.get_bonds_in_molecule", false]], "get_mongo_client() (in module aizynthfinder.utils.mongo)": [[15, "aizynthfinder.utils.mongo.get_mongo_client", false]], "get_tree_molecules() (aizynthfinder.chem.serialization.moleculedeserializer method)": [[2, "aizynthfinder.chem.serialization.MoleculeDeserializer.get_tree_molecules", false]], "graph() (aizynthfinder.search.mcts.search.mctssearchtree method)": [[12, "aizynthfinder.search.mcts.search.MctsSearchTree.graph", false]], "has_all_focussed_bonds() (aizynthfinder.chem.mol.treemolecule method)": [[2, "aizynthfinder.chem.mol.TreeMolecule.has_all_focussed_bonds", false]], "has_atom_mapping() (aizynthfinder.chem.mol.molecule method)": [[2, "aizynthfinder.chem.mol.Molecule.has_atom_mapping", false]], "hash_key() (aizynthfinder.reactiontree.reactiontree method)": [[0, "aizynthfinder.reactiontree.ReactionTree.hash_key", false]], "hash_reactions() (in module aizynthfinder.chem.reaction)": [[2, "aizynthfinder.chem.reaction.hash_reactions", false]], "images (aizynthfinder.analysis.routes.routecollection property)": [[1, "aizynthfinder.analysis.routes.RouteCollection.images", false]], "in_stock() (aizynthfinder.reactiontree.reactiontree method)": [[0, "aizynthfinder.reactiontree.ReactionTree.in_stock", false]], "inchi (aizynthfinder.chem.mol.molecule property)": [[2, "aizynthfinder.chem.mol.Molecule.inchi", false]], "inchi_key (aizynthfinder.chem.mol.molecule property)": [[2, "aizynthfinder.chem.mol.Molecule.inchi_key", false]], "index_to_mapping (aizynthfinder.chem.mol.molecule property)": [[2, "aizynthfinder.chem.mol.Molecule.index_to_mapping", false]], "inmemoryinchikeyquery (class in aizynthfinder.context.stock.queries)": [[6, "aizynthfinder.context.stock.queries.InMemoryInchiKeyQuery", false]], "is_branched() (aizynthfinder.reactiontree.reactiontree method)": [[0, "aizynthfinder.reactiontree.ReactionTree.is_branched", false]], "is_solved (aizynthfinder.search.mcts.node.mctsnode property)": [[12, "aizynthfinder.search.mcts.node.MctsNode.is_solved", false]], "is_terminal() (aizynthfinder.search.mcts.node.mctsnode method)": [[12, "aizynthfinder.search.mcts.node.MctsNode.is_terminal", false]], "items (aizynthfinder.context.collection.contextcollection property)": [[3, "aizynthfinder.context.collection.ContextCollection.items", false]], "jsons (aizynthfinder.analysis.routes.routecollection property)": [[1, "aizynthfinder.analysis.routes.RouteCollection.jsons", false]], "leafs() (aizynthfinder.reactiontree.reactiontree method)": [[0, "aizynthfinder.reactiontree.ReactionTree.leafs", false]], "load() (aizynthfinder.context.collection.contextcollection method)": [[3, "aizynthfinder.context.collection.ContextCollection.load", false]], "load() (aizynthfinder.context.policy.policies.expansionpolicy method)": [[4, "aizynthfinder.context.policy.policies.ExpansionPolicy.load", false]], "load() (aizynthfinder.context.policy.policies.filterpolicy method)": [[4, "aizynthfinder.context.policy.policies.FilterPolicy.load", false]], "load() (aizynthfinder.context.scoring.collection.scorercollection method)": [[5, "aizynthfinder.context.scoring.collection.ScorerCollection.load", false]], "load() (aizynthfinder.context.stock.stock.stock method)": [[6, "aizynthfinder.context.stock.stock.Stock.load", false]], "load_dynamic_class() (in module aizynthfinder.utils.loading)": [[15, "aizynthfinder.utils.loading.load_dynamic_class", false]], "load_from_config() (aizynthfinder.context.collection.contextcollection method)": [[3, "aizynthfinder.context.collection.ContextCollection.load_from_config", false]], "load_from_config() (aizynthfinder.context.policy.policies.expansionpolicy method)": [[4, "aizynthfinder.context.policy.policies.ExpansionPolicy.load_from_config", false]], "load_from_config() (aizynthfinder.context.policy.policies.filterpolicy method)": [[4, "aizynthfinder.context.policy.policies.FilterPolicy.load_from_config", false]], "load_from_config() (aizynthfinder.context.scoring.collection.scorercollection method)": [[5, "aizynthfinder.context.scoring.collection.ScorerCollection.load_from_config", false]], "load_from_config() (aizynthfinder.context.stock.stock.stock method)": [[6, "aizynthfinder.context.stock.stock.Stock.load_from_config", false]], "load_model() (in module aizynthfinder.utils.models)": [[15, "aizynthfinder.utils.models.load_model", false]], "localkerasmodel (class in aizynthfinder.utils.models)": [[15, "aizynthfinder.utils.models.LocalKerasModel", false]], "localonnxmodel (class in aizynthfinder.utils.models)": [[15, "aizynthfinder.utils.models.LocalOnnxModel", false]], "logger() (in module aizynthfinder.utils.logging)": [[15, "aizynthfinder.utils.logging.logger", false]], "main() (in module aizynthfinder.interfaces.aizynthapp)": [[7, "aizynthfinder.interfaces.aizynthapp.main", false]], "main() (in module aizynthfinder.interfaces.aizynthcli)": [[7, "aizynthfinder.interfaces.aizynthcli.main", false]], "main() (in module aizynthfinder.tools.cat_output)": [[14, "aizynthfinder.tools.cat_output.main", false]], "main() (in module aizynthfinder.tools.download_public_data)": [[14, "aizynthfinder.tools.download_public_data.main", false]], "main() (in module aizynthfinder.tools.make_stock)": [[14, "aizynthfinder.tools.make_stock.main", false]], "make_dicts() (aizynthfinder.analysis.routes.routecollection method)": [[1, "aizynthfinder.analysis.routes.RouteCollection.make_dicts", false]], "make_hdf5_stock() (in module aizynthfinder.tools.make_stock)": [[14, "aizynthfinder.tools.make_stock.make_hdf5_stock", false]], "make_images() (aizynthfinder.analysis.routes.routecollection method)": [[1, "aizynthfinder.analysis.routes.RouteCollection.make_images", false]], "make_jsons() (aizynthfinder.analysis.routes.routecollection method)": [[1, "aizynthfinder.analysis.routes.RouteCollection.make_jsons", false]], "make_molbloom() (in module aizynthfinder.tools.make_stock)": [[14, "aizynthfinder.tools.make_stock.make_molbloom", false]], "make_molbloom_inchi() (in module aizynthfinder.tools.make_stock)": [[14, "aizynthfinder.tools.make_stock.make_molbloom_inchi", false]], "make_mongo_stock() (in module aizynthfinder.tools.make_stock)": [[14, "aizynthfinder.tools.make_stock.make_mongo_stock", false]], "make_subset() (aizynthfinder.context.scoring.collection.scorercollection method)": [[5, "aizynthfinder.context.scoring.collection.ScorerCollection.make_subset", false]], "make_unique() (aizynthfinder.chem.mol.molecule method)": [[2, "aizynthfinder.chem.mol.Molecule.make_unique", false]], "make_visjs_page() (in module aizynthfinder.utils.image)": [[15, "aizynthfinder.utils.image.make_visjs_page", false]], "mapped_atom_bonds (aizynthfinder.chem.mol.treemolecule property)": [[2, "aizynthfinder.chem.mol.TreeMolecule.mapped_atom_bonds", false]], "mapped_reaction_smiles() (aizynthfinder.chem.reaction.retroreaction method)": [[2, "aizynthfinder.chem.reaction.RetroReaction.mapped_reaction_smiles", false]], "mapping_to_index (aizynthfinder.chem.mol.molecule property)": [[2, "aizynthfinder.chem.mol.Molecule.mapping_to_index", false]], "mapping_to_index (aizynthfinder.chem.mol.treemolecule property)": [[2, "aizynthfinder.chem.mol.TreeMolecule.mapping_to_index", false]], "max_val (aizynthfinder.context.scoring.scorers.minmaxscaler attribute)": [[5, "aizynthfinder.context.scoring.scorers.MinMaxScaler.max_val", false]], "maxtransformscorerer (class in aizynthfinder.context.scoring.scorers)": [[5, "aizynthfinder.context.scoring.scorers.MaxTransformScorerer", false]], "mctsnode (class in aizynthfinder.search.mcts.node)": [[12, "aizynthfinder.search.mcts.node.MctsNode", false]], "mctssearchtree (class in aizynthfinder.search.mcts.search)": [[12, "aizynthfinder.search.mcts.search.MctsSearchTree", false]], "mctsstate (class in aizynthfinder.search.mcts.state)": [[12, "aizynthfinder.search.mcts.state.MctsState", false]], "metadata (aizynthfinder.reactiontree.reactiontree property)": [[0, "aizynthfinder.reactiontree.ReactionTree.metadata", false]], "min_val (aizynthfinder.context.scoring.scorers.minmaxscaler attribute)": [[5, "aizynthfinder.context.scoring.scorers.MinMaxScaler.min_val", false]], "minmaxscaler (class in aizynthfinder.context.scoring.scorers)": [[5, "aizynthfinder.context.scoring.scorers.MinMaxScaler", false]], "module": [[0, "module-aizynthfinder", false], [0, "module-aizynthfinder.aizynthfinder", false], [0, "module-aizynthfinder.reactiontree", false], [1, "module-aizynthfinder.analysis", false], [1, "module-aizynthfinder.analysis.routes", false], [1, "module-aizynthfinder.analysis.tree_analysis", false], [1, "module-aizynthfinder.analysis.utils", false], [2, "module-aizynthfinder.chem", false], [2, "module-aizynthfinder.chem.mol", false], [2, "module-aizynthfinder.chem.reaction", false], [2, "module-aizynthfinder.chem.serialization", false], [3, "module-aizynthfinder.context", false], [3, "module-aizynthfinder.context.collection", false], [3, "module-aizynthfinder.context.config", false], [4, "module-aizynthfinder.context.policy", false], [4, "module-aizynthfinder.context.policy.expansion_strategies", false], [4, "module-aizynthfinder.context.policy.filter_strategies", false], [4, "module-aizynthfinder.context.policy.policies", false], [4, "module-aizynthfinder.context.policy.utils", false], [5, "module-aizynthfinder.context.scoring", false], [5, "module-aizynthfinder.context.scoring.collection", false], [5, "module-aizynthfinder.context.scoring.scorers", false], [6, "module-aizynthfinder.context.stock", false], [6, "module-aizynthfinder.context.stock.queries", false], [6, "module-aizynthfinder.context.stock.stock", false], [7, "module-aizynthfinder.interfaces", false], [7, "module-aizynthfinder.interfaces.aizynthapp", false], [7, "module-aizynthfinder.interfaces.aizynthcli", false], [8, "module-aizynthfinder.interfaces.gui", false], [8, "module-aizynthfinder.interfaces.gui.clustering", false], [8, "module-aizynthfinder.interfaces.gui.pareto_fronts", false], [8, "module-aizynthfinder.interfaces.gui.utils", false], [9, "module-aizynthfinder.search", false], [9, "module-aizynthfinder.search.andor_trees", false], [10, "module-aizynthfinder.search.breadth_first", false], [10, "module-aizynthfinder.search.breadth_first.nodes", false], [10, "module-aizynthfinder.search.breadth_first.search_tree", false], [11, "module-aizynthfinder.search.dfpn", false], [11, "module-aizynthfinder.search.dfpn.nodes", false], [11, "module-aizynthfinder.search.dfpn.search_tree", false], [12, "module-aizynthfinder.search.mcts", false], [12, "module-aizynthfinder.search.mcts.node", false], [12, "module-aizynthfinder.search.mcts.search", false], [12, "module-aizynthfinder.search.mcts.state", false], [12, "module-aizynthfinder.search.mcts.utils", false], [13, "module-aizynthfinder.search.retrostar", false], [13, "module-aizynthfinder.search.retrostar.cost", false], [13, "module-aizynthfinder.search.retrostar.nodes", false], [13, "module-aizynthfinder.search.retrostar.search_tree", false], [14, "module-aizynthfinder.tools", false], [14, "module-aizynthfinder.tools.cat_output", false], [14, "module-aizynthfinder.tools.download_public_data", false], [14, "module-aizynthfinder.tools.make_stock", false], [15, "module-aizynthfinder.utils", false], [15, "module-aizynthfinder.utils.bonds", false], [15, "module-aizynthfinder.utils.exceptions", false], [15, "module-aizynthfinder.utils.files", false], [15, "module-aizynthfinder.utils.image", false], [15, "module-aizynthfinder.utils.loading", false], [15, "module-aizynthfinder.utils.logging", false], [15, "module-aizynthfinder.utils.math", false], [15, "module-aizynthfinder.utils.models", false], [15, "module-aizynthfinder.utils.mongo", false], [15, "module-aizynthfinder.utils.paths", false], [15, "module-aizynthfinder.utils.sc_score", false], [15, "module-aizynthfinder.utils.type_utils", false]], "mol_nodes (aizynthfinder.search.andor_trees.andorsearchtreebase property)": [[9, "aizynthfinder.search.andor_trees.AndOrSearchTreeBase.mol_nodes", false]], "mol_nodes (aizynthfinder.search.breadth_first.search_tree.searchtree property)": [[10, "aizynthfinder.search.breadth_first.search_tree.SearchTree.mol_nodes", false]], "mol_nodes (aizynthfinder.search.dfpn.search_tree.searchtree property)": [[11, "aizynthfinder.search.dfpn.search_tree.SearchTree.mol_nodes", false]], "mol_nodes (aizynthfinder.search.retrostar.search_tree.searchtree property)": [[13, "aizynthfinder.search.retrostar.search_tree.SearchTree.mol_nodes", false]], "molbloomfilterquery (class in aizynthfinder.context.stock.queries)": [[6, "aizynthfinder.context.stock.queries.MolbloomFilterQuery", false]], "molecule (class in aizynthfinder.chem.mol)": [[2, "aizynthfinder.chem.mol.Molecule", false]], "molecule_to_image() (in module aizynthfinder.utils.image)": [[15, "aizynthfinder.utils.image.molecule_to_image", false]], "moleculecost (class in aizynthfinder.search.retrostar.cost)": [[13, "aizynthfinder.search.retrostar.cost.MoleculeCost", false]], "moleculedeserializer (class in aizynthfinder.chem.serialization)": [[2, "aizynthfinder.chem.serialization.MoleculeDeserializer", false]], "moleculeexception": [[15, "aizynthfinder.utils.exceptions.MoleculeException", false]], "moleculenode (class in aizynthfinder.search.breadth_first.nodes)": [[10, "aizynthfinder.search.breadth_first.nodes.MoleculeNode", false]], "moleculenode (class in aizynthfinder.search.dfpn.nodes)": [[11, "aizynthfinder.search.dfpn.nodes.MoleculeNode", false]], "moleculenode (class in aizynthfinder.search.retrostar.nodes)": [[13, "aizynthfinder.search.retrostar.nodes.MoleculeNode", false]], "molecules() (aizynthfinder.reactiontree.reactiontree method)": [[0, "aizynthfinder.reactiontree.ReactionTree.molecules", false]], "molecules_to_images() (in module aizynthfinder.utils.image)": [[15, "aizynthfinder.utils.image.molecules_to_images", false]], "moleculeserializer (class in aizynthfinder.chem.serialization)": [[2, "aizynthfinder.chem.serialization.MoleculeSerializer", false]], "mongodbinchikeyquery (class in aizynthfinder.context.stock.queries)": [[6, "aizynthfinder.context.stock.queries.MongoDbInchiKeyQuery", false]], "multiexpansionstrategy (class in aizynthfinder.context.policy.expansion_strategies)": [[4, "aizynthfinder.context.policy.expansion_strategies.MultiExpansionStrategy", false]], "names() (aizynthfinder.context.scoring.collection.scorercollection method)": [[5, "aizynthfinder.context.scoring.collection.ScorerCollection.names", false]], "nmax (aizynthfinder.analysis.utils.routeselectionarguments attribute)": [[1, "aizynthfinder.analysis.utils.RouteSelectionArguments.nmax", false]], "nmin (aizynthfinder.analysis.utils.routeselectionarguments attribute)": [[1, "aizynthfinder.analysis.utils.RouteSelectionArguments.nmin", false]], "nodes() (aizynthfinder.search.mcts.search.mctssearchtree method)": [[12, "aizynthfinder.search.mcts.search.MctsSearchTree.nodes", false]], "nodeunexpectedbehaviourexception": [[15, "aizynthfinder.utils.exceptions.NodeUnexpectedBehaviourException", false]], "none_molecule() (in module aizynthfinder.chem.mol)": [[2, "aizynthfinder.chem.mol.none_molecule", false]], "numberofprecursorsinstockscorer (class in aizynthfinder.context.scoring.scorers)": [[5, "aizynthfinder.context.scoring.scorers.NumberOfPrecursorsInStockScorer", false]], "numberofprecursorsscorer (class in aizynthfinder.context.scoring.scorers)": [[5, "aizynthfinder.context.scoring.scorers.NumberOfPrecursorsScorer", false]], "numberofreactionsscorer (class in aizynthfinder.context.scoring.scorers)": [[5, "aizynthfinder.context.scoring.scorers.NumberOfReactionsScorer", false]], "objects() (aizynthfinder.context.scoring.collection.scorercollection method)": [[5, "aizynthfinder.context.scoring.collection.ScorerCollection.objects", false]], "one_iteration() (aizynthfinder.search.andor_trees.andorsearchtreebase method)": [[9, "aizynthfinder.search.andor_trees.AndOrSearchTreeBase.one_iteration", false]], "one_iteration() (aizynthfinder.search.breadth_first.search_tree.searchtree method)": [[10, "aizynthfinder.search.breadth_first.search_tree.SearchTree.one_iteration", false]], "one_iteration() (aizynthfinder.search.dfpn.search_tree.searchtree method)": [[11, "aizynthfinder.search.dfpn.search_tree.SearchTree.one_iteration", false]], "one_iteration() (aizynthfinder.search.mcts.search.mctssearchtree method)": [[12, "aizynthfinder.search.mcts.search.MctsSearchTree.one_iteration", false]], "one_iteration() (aizynthfinder.search.retrostar.search_tree.searchtree method)": [[13, "aizynthfinder.search.retrostar.search_tree.SearchTree.one_iteration", false]], "package_path() (in module aizynthfinder.utils.paths)": [[15, "aizynthfinder.utils.paths.package_path", false]], "parent (aizynthfinder.search.mcts.node.mctsnode property)": [[12, "aizynthfinder.search.mcts.node.MctsNode.parent", false]], "parent_molecule() (aizynthfinder.reactiontree.reactiontree method)": [[0, "aizynthfinder.reactiontree.ReactionTree.parent_molecule", false]], "pareto_front() (aizynthfinder.analysis.tree_analysis.treeanalysis method)": [[1, "aizynthfinder.analysis.tree_analysis.TreeAnalysis.pareto_front", false]], "pareto_fronts_plot() (in module aizynthfinder.interfaces.gui.utils)": [[8, "aizynthfinder.interfaces.gui.utils.pareto_fronts_plot", false]], "paretofrontsgui (class in aizynthfinder.interfaces.gui.pareto_fronts)": [[8, "aizynthfinder.interfaces.gui.pareto_fronts.ParetoFrontsGUI", false]], "paretomctsnode (class in aizynthfinder.search.mcts.node)": [[12, "aizynthfinder.search.mcts.node.ParetoMctsNode", false]], "path_to() (aizynthfinder.search.mcts.node.mctsnode method)": [[12, "aizynthfinder.search.mcts.node.MctsNode.path_to", false]], "policyexception": [[15, "aizynthfinder.utils.exceptions.PolicyException", false]], "post_processing (aizynthfinder.context.config.configuration attribute)": [[3, "aizynthfinder.context.config.Configuration.post_processing", false]], "predict() (aizynthfinder.utils.models.externalmodelviagrpc method)": [[15, "aizynthfinder.utils.models.ExternalModelViaGRPC.predict", false]], "predict() (aizynthfinder.utils.models.externalmodelviarest method)": [[15, "aizynthfinder.utils.models.ExternalModelViaREST.predict", false]], "predict() (aizynthfinder.utils.models.localkerasmodel method)": [[15, "aizynthfinder.utils.models.LocalKerasModel.predict", false]], "predict() (aizynthfinder.utils.models.localonnxmodel method)": [[15, "aizynthfinder.utils.models.LocalOnnxModel.predict", false]], "prepare_tree() (aizynthfinder.aizynthfinder.aizynthfinder method)": [[0, "aizynthfinder.aizynthfinder.AiZynthFinder.prepare_tree", false]], "price() (aizynthfinder.context.stock.queries.inmemoryinchikeyquery method)": [[6, "aizynthfinder.context.stock.queries.InMemoryInchiKeyQuery.price", false]], "price() (aizynthfinder.context.stock.queries.stockquerymixin method)": [[6, "aizynthfinder.context.stock.queries.StockQueryMixin.price", false]], "price() (aizynthfinder.context.stock.stock.stock method)": [[6, "aizynthfinder.context.stock.stock.Stock.price", false]], "pricesumscorer (class in aizynthfinder.context.scoring.scorers)": [[5, "aizynthfinder.context.scoring.scorers.PriceSumScorer", false]], "promising_child() (aizynthfinder.search.dfpn.nodes.moleculenode method)": [[11, "aizynthfinder.search.dfpn.nodes.MoleculeNode.promising_child", false]], "promising_child() (aizynthfinder.search.dfpn.nodes.reactionnode method)": [[11, "aizynthfinder.search.dfpn.nodes.ReactionNode.promising_child", false]], "promising_child() (aizynthfinder.search.mcts.node.mctsnode method)": [[12, "aizynthfinder.search.mcts.node.MctsNode.promising_child", false]], "prop (aizynthfinder.search.andor_trees.treenodemixin property)": [[9, "aizynthfinder.search.andor_trees.TreeNodeMixin.prop", false]], "prop (aizynthfinder.search.breadth_first.nodes.moleculenode property)": [[10, "aizynthfinder.search.breadth_first.nodes.MoleculeNode.prop", false]], "prop (aizynthfinder.search.breadth_first.nodes.reactionnode property)": [[10, "aizynthfinder.search.breadth_first.nodes.ReactionNode.prop", false]], "prop (aizynthfinder.search.dfpn.nodes.moleculenode property)": [[11, "aizynthfinder.search.dfpn.nodes.MoleculeNode.prop", false]], "prop (aizynthfinder.search.dfpn.nodes.reactionnode property)": [[11, "aizynthfinder.search.dfpn.nodes.ReactionNode.prop", false]], "prop (aizynthfinder.search.retrostar.nodes.moleculenode property)": [[13, "aizynthfinder.search.retrostar.nodes.MoleculeNode.prop", false]], "prop (aizynthfinder.search.retrostar.nodes.reactionnode property)": [[13, "aizynthfinder.search.retrostar.nodes.ReactionNode.prop", false]], "proven (aizynthfinder.search.dfpn.nodes.reactionnode property)": [[11, "aizynthfinder.search.dfpn.nodes.ReactionNode.proven", false]], "quickkerasfilter (class in aizynthfinder.context.policy.filter_strategies)": [[4, "aizynthfinder.context.policy.filter_strategies.QuickKerasFilter", false]], "rd_reaction (aizynthfinder.chem.reaction.templatedretroreaction property)": [[2, "aizynthfinder.chem.reaction.TemplatedRetroReaction.rd_reaction", false]], "reactants (aizynthfinder.chem.reaction.retroreaction property)": [[2, "aizynthfinder.chem.reaction.RetroReaction.reactants", false]], "reactantscountfilter (class in aizynthfinder.context.policy.filter_strategies)": [[4, "aizynthfinder.context.policy.filter_strategies.ReactantsCountFilter", false]], "reactionclassmembershipscorer (class in aizynthfinder.context.scoring.scorers)": [[5, "aizynthfinder.context.scoring.scorers.ReactionClassMembershipScorer", false]], "reactionnode (class in aizynthfinder.search.breadth_first.nodes)": [[10, "aizynthfinder.search.breadth_first.nodes.ReactionNode", false]], "reactionnode (class in aizynthfinder.search.dfpn.nodes)": [[11, "aizynthfinder.search.dfpn.nodes.ReactionNode", false]], "reactionnode (class in aizynthfinder.search.retrostar.nodes)": [[13, "aizynthfinder.search.retrostar.nodes.ReactionNode", false]], "reactions() (aizynthfinder.reactiontree.reactiontree method)": [[0, "aizynthfinder.reactiontree.ReactionTree.reactions", false]], "reactiontree (class in aizynthfinder.reactiontree)": [[0, "aizynthfinder.reactiontree.ReactionTree", false]], "reactiontreefromandortrace (class in aizynthfinder.search.andor_trees)": [[9, "aizynthfinder.search.andor_trees.ReactionTreeFromAndOrTrace", false]], "reactiontreefromdict (class in aizynthfinder.reactiontree)": [[0, "aizynthfinder.reactiontree.ReactionTreeFromDict", false]], "reactiontreefromexpansion (class in aizynthfinder.reactiontree)": [[0, "aizynthfinder.reactiontree.ReactionTreeFromExpansion", false]], "reactiontreefromsupernode (class in aizynthfinder.search.mcts.utils)": [[12, "aizynthfinder.search.mcts.utils.ReactionTreeFromSuperNode", false]], "reactiontreeloader (class in aizynthfinder.reactiontree)": [[0, "aizynthfinder.reactiontree.ReactionTreeLoader", false]], "read_datafile() (in module aizynthfinder.utils.files)": [[15, "aizynthfinder.utils.files.read_datafile", false]], "rectified_linear_unit() (in module aizynthfinder.utils.math)": [[15, "aizynthfinder.utils.math.rectified_linear_unit", false]], "rejectionexception": [[15, "aizynthfinder.utils.exceptions.RejectionException", false]], "remove_atom_mapping() (aizynthfinder.chem.mol.molecule method)": [[2, "aizynthfinder.chem.mol.Molecule.remove_atom_mapping", false]], "rescore() (aizynthfinder.analysis.routes.routecollection method)": [[1, "aizynthfinder.analysis.routes.RouteCollection.rescore", false]], "reset_cache() (aizynthfinder.context.policy.expansion_strategies.expansionstrategy method)": [[4, "aizynthfinder.context.policy.expansion_strategies.ExpansionStrategy.reset_cache", false]], "reset_cache() (aizynthfinder.context.policy.expansion_strategies.templatebasedexpansionstrategy method)": [[4, "aizynthfinder.context.policy.expansion_strategies.TemplateBasedExpansionStrategy.reset_cache", false]], "reset_cache() (aizynthfinder.context.policy.policies.expansionpolicy method)": [[4, "aizynthfinder.context.policy.policies.ExpansionPolicy.reset_cache", false]], "reset_cache() (aizynthfinder.context.policy.policies.filterpolicy method)": [[4, "aizynthfinder.context.policy.policies.FilterPolicy.reset_cache", false]], "reset_exclusion_list() (aizynthfinder.context.stock.stock.stock method)": [[6, "aizynthfinder.context.stock.stock.Stock.reset_exclusion_list", false]], "retroreaction (class in aizynthfinder.chem.reaction)": [[2, "aizynthfinder.chem.reaction.RetroReaction", false]], "retrostarcost (class in aizynthfinder.search.retrostar.cost)": [[13, "aizynthfinder.search.retrostar.cost.RetroStarCost", false]], "return_all (aizynthfinder.analysis.utils.routeselectionarguments attribute)": [[1, "aizynthfinder.analysis.utils.RouteSelectionArguments.return_all", false]], "reverse (aizynthfinder.context.scoring.scorers.minmaxscaler attribute)": [[5, "aizynthfinder.context.scoring.scorers.MinMaxScaler.reverse", false]], "route_display() (in module aizynthfinder.interfaces.gui.utils)": [[8, "aizynthfinder.interfaces.gui.utils.route_display", false]], "route_to_node() (in module aizynthfinder.search.mcts.utils)": [[12, "aizynthfinder.search.mcts.utils.route_to_node", false]], "routecollection (class in aizynthfinder.analysis.routes)": [[1, "aizynthfinder.analysis.routes.RouteCollection", false]], "routecostscorer (class in aizynthfinder.context.scoring.scorers)": [[5, "aizynthfinder.context.scoring.scorers.RouteCostScorer", false]], "routeimagefactory (class in aizynthfinder.utils.image)": [[15, "aizynthfinder.utils.image.RouteImageFactory", false]], "routes() (aizynthfinder.search.andor_trees.andorsearchtreebase method)": [[9, "aizynthfinder.search.andor_trees.AndOrSearchTreeBase.routes", false]], "routes() (aizynthfinder.search.breadth_first.search_tree.searchtree method)": [[10, "aizynthfinder.search.breadth_first.search_tree.SearchTree.routes", false]], "routes() (aizynthfinder.search.dfpn.search_tree.searchtree method)": [[11, "aizynthfinder.search.dfpn.search_tree.SearchTree.routes", false]], "routes() (aizynthfinder.search.retrostar.search_tree.searchtree method)": [[13, "aizynthfinder.search.retrostar.search_tree.SearchTree.routes", false]], "routeselectionarguments (class in aizynthfinder.analysis.utils)": [[1, "aizynthfinder.analysis.utils.RouteSelectionArguments", false]], "routesimilarityscorer (class in aizynthfinder.context.scoring.scorers)": [[5, "aizynthfinder.context.scoring.scorers.RouteSimilarityScorer", false]], "sanitize() (aizynthfinder.chem.mol.molecule method)": [[2, "aizynthfinder.chem.mol.Molecule.sanitize", false]], "save_datafile() (in module aizynthfinder.utils.files)": [[15, "aizynthfinder.utils.files.save_datafile", false]], "save_molecule_images() (in module aizynthfinder.utils.image)": [[15, "aizynthfinder.utils.image.save_molecule_images", false]], "sc_deltas() (aizynthfinder.context.scoring.scorers.deltasyntheticcomplexityscorer method)": [[5, "aizynthfinder.context.scoring.scorers.DeltaSyntheticComplexityScorer.sc_deltas", false]], "scale_factor (aizynthfinder.context.scoring.scorers.minmaxscaler attribute)": [[5, "aizynthfinder.context.scoring.scorers.MinMaxScaler.scale_factor", false]], "score_vector() (aizynthfinder.context.scoring.collection.scorercollection method)": [[5, "aizynthfinder.context.scoring.collection.ScorerCollection.score_vector", false]], "scorer (class in aizynthfinder.context.scoring.scorers)": [[5, "aizynthfinder.context.scoring.scorers.Scorer", false]], "scorer_name (aizynthfinder.context.scoring.scorers.averagetemplateoccurrencescorer attribute)": [[5, "aizynthfinder.context.scoring.scorers.AverageTemplateOccurrenceScorer.scorer_name", false]], "scorer_name (aizynthfinder.context.scoring.scorers.brokenbondsscorer attribute)": [[5, "aizynthfinder.context.scoring.scorers.BrokenBondsScorer.scorer_name", false]], "scorer_name (aizynthfinder.context.scoring.scorers.deltasyntheticcomplexityscorer attribute)": [[5, "aizynthfinder.context.scoring.scorers.DeltaSyntheticComplexityScorer.scorer_name", false]], "scorer_name (aizynthfinder.context.scoring.scorers.fractioninstockscorer attribute)": [[5, "aizynthfinder.context.scoring.scorers.FractionInStockScorer.scorer_name", false]], "scorer_name (aizynthfinder.context.scoring.scorers.maxtransformscorerer attribute)": [[5, "aizynthfinder.context.scoring.scorers.MaxTransformScorerer.scorer_name", false]], "scorer_name (aizynthfinder.context.scoring.scorers.numberofprecursorsinstockscorer attribute)": [[5, "aizynthfinder.context.scoring.scorers.NumberOfPrecursorsInStockScorer.scorer_name", false]], "scorer_name (aizynthfinder.context.scoring.scorers.numberofprecursorsscorer attribute)": [[5, "aizynthfinder.context.scoring.scorers.NumberOfPrecursorsScorer.scorer_name", false]], "scorer_name (aizynthfinder.context.scoring.scorers.numberofreactionsscorer attribute)": [[5, "aizynthfinder.context.scoring.scorers.NumberOfReactionsScorer.scorer_name", false]], "scorer_name (aizynthfinder.context.scoring.scorers.pricesumscorer attribute)": [[5, "aizynthfinder.context.scoring.scorers.PriceSumScorer.scorer_name", false]], "scorer_name (aizynthfinder.context.scoring.scorers.routecostscorer attribute)": [[5, "aizynthfinder.context.scoring.scorers.RouteCostScorer.scorer_name", false]], "scorer_name (aizynthfinder.context.scoring.scorers.routesimilarityscorer attribute)": [[5, "aizynthfinder.context.scoring.scorers.RouteSimilarityScorer.scorer_name", false]], "scorer_name (aizynthfinder.context.scoring.scorers.scorer attribute)": [[5, "aizynthfinder.context.scoring.scorers.Scorer.scorer_name", false]], "scorer_name (aizynthfinder.context.scoring.scorers.statescorer attribute)": [[5, "aizynthfinder.context.scoring.scorers.StateScorer.scorer_name", false]], "scorercollection (class in aizynthfinder.context.scoring.collection)": [[5, "aizynthfinder.context.scoring.collection.ScorerCollection", false]], "scorerexception": [[15, "aizynthfinder.utils.exceptions.ScorerException", false]], "scorers (aizynthfinder.context.config.configuration attribute)": [[3, "aizynthfinder.context.config.Configuration.scorers", false]], "scscore (class in aizynthfinder.utils.sc_score)": [[15, "aizynthfinder.utils.sc_score.SCScore", false]], "search (aizynthfinder.context.config.configuration attribute)": [[3, "aizynthfinder.context.config.Configuration.search", false]], "searchtree (class in aizynthfinder.search.breadth_first.search_tree)": [[10, "aizynthfinder.search.breadth_first.search_tree.SearchTree", false]], "searchtree (class in aizynthfinder.search.dfpn.search_tree)": [[11, "aizynthfinder.search.dfpn.search_tree.SearchTree", false]], "searchtree (class in aizynthfinder.search.retrostar.search_tree)": [[13, "aizynthfinder.search.retrostar.search_tree.SearchTree", false]], "select() (aizynthfinder.context.collection.contextcollection method)": [[3, "aizynthfinder.context.collection.ContextCollection.select", false]], "select() (aizynthfinder.context.stock.stock.stock method)": [[6, "aizynthfinder.context.stock.stock.Stock.select", false]], "select_all() (aizynthfinder.context.collection.contextcollection method)": [[3, "aizynthfinder.context.collection.ContextCollection.select_all", false]], "select_first() (aizynthfinder.context.collection.contextcollection method)": [[3, "aizynthfinder.context.collection.ContextCollection.select_first", false]], "select_last() (aizynthfinder.context.collection.contextcollection method)": [[3, "aizynthfinder.context.collection.ContextCollection.select_last", false]], "select_leaf() (aizynthfinder.search.mcts.search.mctssearchtree method)": [[12, "aizynthfinder.search.mcts.search.MctsSearchTree.select_leaf", false]], "selection (aizynthfinder.context.collection.contextcollection property)": [[3, "aizynthfinder.context.collection.ContextCollection.selection", false]], "serialize() (aizynthfinder.search.breadth_first.nodes.moleculenode method)": [[10, "aizynthfinder.search.breadth_first.nodes.MoleculeNode.serialize", false]], "serialize() (aizynthfinder.search.breadth_first.nodes.reactionnode method)": [[10, "aizynthfinder.search.breadth_first.nodes.ReactionNode.serialize", false]], "serialize() (aizynthfinder.search.breadth_first.search_tree.searchtree method)": [[10, "aizynthfinder.search.breadth_first.search_tree.SearchTree.serialize", false]], "serialize() (aizynthfinder.search.mcts.node.mctsnode method)": [[12, "aizynthfinder.search.mcts.node.MctsNode.serialize", false]], "serialize() (aizynthfinder.search.mcts.node.paretomctsnode method)": [[12, "aizynthfinder.search.mcts.node.ParetoMctsNode.serialize", false]], "serialize() (aizynthfinder.search.mcts.search.mctssearchtree method)": [[12, "aizynthfinder.search.mcts.search.MctsSearchTree.serialize", false]], "serialize() (aizynthfinder.search.mcts.state.mctsstate method)": [[12, "aizynthfinder.search.mcts.state.MctsState.serialize", false]], "serialize() (aizynthfinder.search.retrostar.nodes.moleculenode method)": [[13, "aizynthfinder.search.retrostar.nodes.MoleculeNode.serialize", false]], "serialize() (aizynthfinder.search.retrostar.nodes.reactionnode method)": [[13, "aizynthfinder.search.retrostar.nodes.ReactionNode.serialize", false]], "serialize() (aizynthfinder.search.retrostar.search_tree.searchtree method)": [[13, "aizynthfinder.search.retrostar.search_tree.SearchTree.serialize", false]], "serialize_action() (in module aizynthfinder.chem.serialization)": [[2, "aizynthfinder.chem.serialization.serialize_action", false]], "set_stop_criteria() (aizynthfinder.context.stock.stock.stock method)": [[6, "aizynthfinder.context.stock.stock.Stock.set_stop_criteria", false]], "setup() (aizynthfinder.interfaces.aizynthapp.aizynthapp method)": [[7, "aizynthfinder.interfaces.aizynthapp.AiZynthApp.setup", false]], "setup_logger() (in module aizynthfinder.utils.logging)": [[15, "aizynthfinder.utils.logging.setup_logger", false]], "sigmoid() (in module aizynthfinder.utils.math)": [[15, "aizynthfinder.utils.math.sigmoid", false]], "slope (aizynthfinder.context.scoring.scorers.squashscaler attribute)": [[5, "aizynthfinder.context.scoring.scorers.SquashScaler.slope", false]], "smiles (aizynthfinder.chem.reaction.retroreaction property)": [[2, "aizynthfinder.chem.reaction.RetroReaction.smiles", false]], "smiles_in_stock() (aizynthfinder.context.stock.stock.stock method)": [[6, "aizynthfinder.context.stock.stock.Stock.smiles_in_stock", false]], "smilesbasedretroreaction (class in aizynthfinder.chem.reaction)": [[2, "aizynthfinder.chem.reaction.SmilesBasedRetroReaction", false]], "softmax() (in module aizynthfinder.utils.math)": [[15, "aizynthfinder.utils.math.softmax", false]], "sort() (aizynthfinder.analysis.tree_analysis.treeanalysis method)": [[1, "aizynthfinder.analysis.tree_analysis.TreeAnalysis.sort", false]], "sort() (aizynthfinder.context.scoring.scorers.scorer method)": [[5, "aizynthfinder.context.scoring.scorers.Scorer.sort", false]], "sort_bonds() (in module aizynthfinder.utils.bonds)": [[15, "aizynthfinder.utils.bonds.sort_bonds", false]], "split_file() (in module aizynthfinder.utils.files)": [[15, "aizynthfinder.utils.files.split_file", false]], "splitandortree (class in aizynthfinder.search.andor_trees)": [[9, "aizynthfinder.search.andor_trees.SplitAndOrTree", false]], "squashscaler (class in aizynthfinder.context.scoring.scorers)": [[5, "aizynthfinder.context.scoring.scorers.SquashScaler", false]], "start_processes() (in module aizynthfinder.utils.files)": [[15, "aizynthfinder.utils.files.start_processes", false]], "state (aizynthfinder.search.mcts.node.mctsnode property)": [[12, "aizynthfinder.search.mcts.node.MctsNode.state", false]], "statescorer (class in aizynthfinder.context.scoring.scorers)": [[5, "aizynthfinder.context.scoring.scorers.StateScorer", false]], "stock (aizynthfinder.context.config.configuration attribute)": [[3, "aizynthfinder.context.config.Configuration.stock", false]], "stock (class in aizynthfinder.context.stock.stock)": [[6, "aizynthfinder.context.stock.stock.Stock", false]], "stock_availability (aizynthfinder.search.mcts.state.mctsstate property)": [[12, "aizynthfinder.search.mcts.state.MctsState.stock_availability", false]], "stock_inchikeys (aizynthfinder.context.stock.queries.inmemoryinchikeyquery property)": [[6, "aizynthfinder.context.stock.queries.InMemoryInchiKeyQuery.stock_inchikeys", false]], "stock_info() (aizynthfinder.aizynthfinder.aizynthfinder method)": [[0, "aizynthfinder.aizynthfinder.AiZynthFinder.stock_info", false]], "stockavailabilityscorer (class in aizynthfinder.context.scoring.scorers)": [[5, "aizynthfinder.context.scoring.scorers.StockAvailabilityScorer", false]], "stockexception": [[15, "aizynthfinder.utils.exceptions.StockException", false]], "stockquerymixin (class in aizynthfinder.context.stock.queries)": [[6, "aizynthfinder.context.stock.queries.StockQueryMixin", false]], "stop_criteria (aizynthfinder.context.stock.stock.stock property)": [[6, "aizynthfinder.context.stock.stock.Stock.stop_criteria", false]], "store (aizynthfinder.chem.serialization.moleculeserializer property)": [[2, "aizynthfinder.chem.serialization.MoleculeSerializer.store", false]], "subtrees() (aizynthfinder.reactiontree.reactiontree method)": [[0, "aizynthfinder.reactiontree.ReactionTree.subtrees", false]], "target_mol (aizynthfinder.aizynthfinder.aizynthfinder property)": [[0, "aizynthfinder.aizynthfinder.AiZynthFinder.target_mol", false]], "target_smiles (aizynthfinder.aizynthfinder.aizynthfinder property)": [[0, "aizynthfinder.aizynthfinder.AiZynthFinder.target_smiles", false]], "target_value (aizynthfinder.search.retrostar.nodes.moleculenode property)": [[13, "aizynthfinder.search.retrostar.nodes.MoleculeNode.target_value", false]], "templatebaseddirectexpansionstrategy (class in aizynthfinder.context.policy.expansion_strategies)": [[4, "aizynthfinder.context.policy.expansion_strategies.TemplateBasedDirectExpansionStrategy", false]], "templatebasedexpansionstrategy (class in aizynthfinder.context.policy.expansion_strategies)": [[4, "aizynthfinder.context.policy.expansion_strategies.TemplateBasedExpansionStrategy", false]], "templatedretroreaction (class in aizynthfinder.chem.reaction)": [[2, "aizynthfinder.chem.reaction.TemplatedRetroReaction", false]], "to_dict() (aizynthfinder.analysis.utils.combinedreactiontrees method)": [[1, "aizynthfinder.analysis.utils.CombinedReactionTrees.to_dict", false]], "to_dict() (aizynthfinder.chem.reaction.retroreaction method)": [[2, "aizynthfinder.chem.reaction.RetroReaction.to_dict", false]], "to_dict() (aizynthfinder.chem.reaction.smilesbasedretroreaction method)": [[2, "aizynthfinder.chem.reaction.SmilesBasedRetroReaction.to_dict", false]], "to_dict() (aizynthfinder.chem.reaction.templatedretroreaction method)": [[2, "aizynthfinder.chem.reaction.TemplatedRetroReaction.to_dict", false]], "to_dict() (aizynthfinder.reactiontree.reactiontree method)": [[0, "aizynthfinder.reactiontree.ReactionTree.to_dict", false]], "to_image() (aizynthfinder.reactiontree.reactiontree method)": [[0, "aizynthfinder.reactiontree.ReactionTree.to_image", false]], "to_image() (aizynthfinder.search.mcts.state.mctsstate method)": [[12, "aizynthfinder.search.mcts.state.MctsState.to_image", false]], "to_json() (aizynthfinder.reactiontree.reactiontree method)": [[0, "aizynthfinder.reactiontree.ReactionTree.to_json", false]], "to_reaction_tree() (aizynthfinder.search.mcts.node.mctsnode method)": [[12, "aizynthfinder.search.mcts.node.MctsNode.to_reaction_tree", false]], "to_smiles_based_retroreaction() (aizynthfinder.chem.reaction.fixedretroreaction method)": [[2, "aizynthfinder.chem.reaction.FixedRetroReaction.to_smiles_based_retroreaction", false]], "to_visjs_page() (aizynthfinder.analysis.utils.combinedreactiontrees method)": [[1, "aizynthfinder.analysis.utils.CombinedReactionTrees.to_visjs_page", false]], "tree_search() (aizynthfinder.aizynthfinder.aizynthfinder method)": [[0, "aizynthfinder.aizynthfinder.AiZynthFinder.tree_search", false]], "tree_statistics() (aizynthfinder.analysis.tree_analysis.treeanalysis method)": [[1, "aizynthfinder.analysis.tree_analysis.TreeAnalysis.tree_statistics", false]], "treeanalysis (class in aizynthfinder.analysis.tree_analysis)": [[1, "aizynthfinder.analysis.tree_analysis.TreeAnalysis", false]], "treeanalysisexception": [[15, "aizynthfinder.utils.exceptions.TreeAnalysisException", false]], "treemolecule (class in aizynthfinder.chem.mol)": [[2, "aizynthfinder.chem.mol.TreeMolecule", false]], "treenodemixin (class in aizynthfinder.search.andor_trees)": [[9, "aizynthfinder.search.andor_trees.TreeNodeMixin", false]], "uniquemolecule (class in aizynthfinder.chem.mol)": [[2, "aizynthfinder.chem.mol.UniqueMolecule", false]], "unqueried (aizynthfinder.chem.reaction.retroreaction property)": [[2, "aizynthfinder.chem.reaction.RetroReaction.unqueried", false]], "update() (aizynthfinder.search.dfpn.nodes.moleculenode method)": [[11, "aizynthfinder.search.dfpn.nodes.MoleculeNode.update", false]], "update() (aizynthfinder.search.dfpn.nodes.reactionnode method)": [[11, "aizynthfinder.search.dfpn.nodes.ReactionNode.update", false]], "update() (aizynthfinder.search.retrostar.nodes.moleculenode method)": [[13, "aizynthfinder.search.retrostar.nodes.MoleculeNode.update", false]], "update() (aizynthfinder.search.retrostar.nodes.reactionnode method)": [[13, "aizynthfinder.search.retrostar.nodes.ReactionNode.update", false]], "weight (aizynthfinder.chem.mol.molecule property)": [[2, "aizynthfinder.chem.mol.Molecule.weight", false]], "weighted_score() (aizynthfinder.context.scoring.collection.scorercollection method)": [[5, "aizynthfinder.context.scoring.collection.ScorerCollection.weighted_score", false]], "xoffset (aizynthfinder.context.scoring.scorers.squashscaler attribute)": [[5, "aizynthfinder.context.scoring.scorers.SquashScaler.xoffset", false]], "yoffset (aizynthfinder.context.scoring.scorers.squashscaler attribute)": [[5, "aizynthfinder.context.scoring.scorers.SquashScaler.yoffset", false]], "zeromoleculecost (class in aizynthfinder.search.retrostar.cost)": [[13, "aizynthfinder.search.retrostar.cost.ZeroMoleculeCost", false]]}, "objects": {"": [[0, 0, 0, "-", "aizynthfinder"]], "aizynthfinder": [[0, 0, 0, "-", "aizynthfinder"], [1, 0, 0, "-", "analysis"], [2, 0, 0, "-", "chem"], [3, 0, 0, "-", "context"], [7, 0, 0, "-", "interfaces"], [0, 0, 0, "-", "reactiontree"], [9, 0, 0, "-", "search"], [14, 0, 0, "-", "tools"], [15, 0, 0, "-", "utils"]], "aizynthfinder.aizynthfinder": [[0, 1, 1, "", "AiZynthExpander"], [0, 1, 1, "", "AiZynthFinder"]], "aizynthfinder.aizynthfinder.AiZynthExpander": [[0, 2, 1, "", "do_expansion"]], "aizynthfinder.aizynthfinder.AiZynthFinder": [[0, 2, 1, "", "build_routes"], [0, 2, 1, "", "extract_statistics"], [0, 2, 1, "", "prepare_tree"], [0, 2, 1, "", "stock_info"], [0, 3, 1, "", "target_mol"], [0, 3, 1, "", "target_smiles"], [0, 2, 1, "", "tree_search"]], "aizynthfinder.analysis": [[1, 0, 0, "-", "routes"], [1, 0, 0, "-", "tree_analysis"], [1, 0, 0, "-", "utils"]], "aizynthfinder.analysis.routes": [[1, 1, 1, "", "RouteCollection"]], "aizynthfinder.analysis.routes.RouteCollection": [[1, 2, 1, "", "cluster"], [1, 2, 1, "", "combined_reaction_trees"], [1, 2, 1, "", "compute_scores"], [1, 2, 1, "", "dict_with_extra"], [1, 2, 1, "", "dict_with_scores"], [1, 3, 1, "", "dicts"], [1, 2, 1, "", "distance_matrix"], [1, 2, 1, "", "from_analysis"], [1, 3, 1, "", "images"], [1, 3, 1, "", "jsons"], [1, 2, 1, "", "make_dicts"], [1, 2, 1, "", "make_images"], [1, 2, 1, "", "make_jsons"], [1, 2, 1, "", "rescore"]], "aizynthfinder.analysis.tree_analysis": [[1, 1, 1, "", "TreeAnalysis"]], "aizynthfinder.analysis.tree_analysis.TreeAnalysis": [[1, 2, 1, "", "best"], [1, 2, 1, "", "pareto_front"], [1, 2, 1, "", "sort"], [1, 2, 1, "", "tree_statistics"]], "aizynthfinder.analysis.utils": [[1, 1, 1, "", "CombinedReactionTrees"], [1, 1, 1, "", "RouteSelectionArguments"]], "aizynthfinder.analysis.utils.CombinedReactionTrees": [[1, 2, 1, "", "to_dict"], [1, 2, 1, "", "to_visjs_page"]], "aizynthfinder.analysis.utils.RouteSelectionArguments": [[1, 4, 1, "", "nmax"], [1, 4, 1, "", "nmin"], [1, 4, 1, "", "return_all"]], "aizynthfinder.chem": [[2, 0, 0, "-", "mol"], [2, 0, 0, "-", "reaction"], [2, 0, 0, "-", "serialization"]], "aizynthfinder.chem.mol": [[2, 1, 1, "", "Molecule"], [2, 1, 1, "", "TreeMolecule"], [2, 1, 1, "", "UniqueMolecule"], [2, 5, 1, "", "none_molecule"]], "aizynthfinder.chem.mol.Molecule": [[2, 2, 1, "", "basic_compare"], [2, 2, 1, "", "fingerprint"], [2, 2, 1, "", "has_atom_mapping"], [2, 3, 1, "", "inchi"], [2, 3, 1, "", "inchi_key"], [2, 3, 1, "", "index_to_mapping"], [2, 2, 1, "", "make_unique"], [2, 3, 1, "", "mapping_to_index"], [2, 2, 1, "", "remove_atom_mapping"], [2, 2, 1, "", "sanitize"], [2, 3, 1, "", "weight"]], "aizynthfinder.chem.mol.TreeMolecule": [[2, 2, 1, "", "get_bonds_in_molecule"], [2, 2, 1, "", "has_all_focussed_bonds"], [2, 3, 1, "", "mapped_atom_bonds"], [2, 3, 1, "", "mapping_to_index"]], "aizynthfinder.chem.reaction": [[2, 1, 1, "", "FixedRetroReaction"], [2, 1, 1, "", "RetroReaction"], [2, 1, 1, "", "SmilesBasedRetroReaction"], [2, 1, 1, "", "TemplatedRetroReaction"], [2, 5, 1, "", "hash_reactions"]], "aizynthfinder.chem.reaction.FixedRetroReaction": [[2, 2, 1, "", "copy"], [2, 2, 1, "", "to_smiles_based_retroreaction"]], "aizynthfinder.chem.reaction.RetroReaction": [[2, 2, 1, "", "copy"], [2, 2, 1, "", "from_serialization"], [2, 2, 1, "", "mapped_reaction_smiles"], [2, 3, 1, "", "reactants"], [2, 3, 1, "", "smiles"], [2, 2, 1, "", "to_dict"], [2, 3, 1, "", "unqueried"]], "aizynthfinder.chem.reaction.SmilesBasedRetroReaction": [[2, 2, 1, "", "to_dict"]], "aizynthfinder.chem.reaction.TemplatedRetroReaction": [[2, 3, 1, "", "rd_reaction"], [2, 2, 1, "", "to_dict"]], "aizynthfinder.chem.serialization": [[2, 1, 1, "", "MoleculeDeserializer"], [2, 1, 1, "", "MoleculeSerializer"], [2, 5, 1, "", "deserialize_action"], [2, 5, 1, "", "serialize_action"]], "aizynthfinder.chem.serialization.MoleculeDeserializer": [[2, 2, 1, "", "get_tree_molecules"]], "aizynthfinder.chem.serialization.MoleculeSerializer": [[2, 3, 1, "", "store"]], "aizynthfinder.context": [[3, 0, 0, "-", "collection"], [3, 0, 0, "-", "config"], [4, 0, 0, "-", "policy"], [5, 0, 0, "-", "scoring"], [6, 0, 0, "-", "stock"]], "aizynthfinder.context.collection": [[3, 1, 1, "", "ContextCollection"]], "aizynthfinder.context.collection.ContextCollection": [[3, 2, 1, "", "deselect"], [3, 3, 1, "", "items"], [3, 2, 1, "", "load"], [3, 2, 1, "", "load_from_config"], [3, 2, 1, "", "select"], [3, 2, 1, "", "select_all"], [3, 2, 1, "", "select_first"], [3, 2, 1, "", "select_last"], [3, 3, 1, "", "selection"]], "aizynthfinder.context.config": [[3, 1, 1, "", "Configuration"]], "aizynthfinder.context.config.Configuration": [[3, 4, 1, "", "expansion_policy"], [3, 4, 1, "", "filter_policy"], [3, 2, 1, "", "from_dict"], [3, 2, 1, "", "from_file"], [3, 4, 1, "", "post_processing"], [3, 4, 1, "", "scorers"], [3, 4, 1, "", "search"], [3, 4, 1, "", "stock"]], "aizynthfinder.context.policy": [[4, 0, 0, "-", "expansion_strategies"], [4, 0, 0, "-", "filter_strategies"], [4, 0, 0, "-", "policies"], [4, 0, 0, "-", "utils"]], "aizynthfinder.context.policy.expansion_strategies": [[4, 1, 1, "", "ExpansionStrategy"], [4, 1, 1, "", "MultiExpansionStrategy"], [4, 1, 1, "", "TemplateBasedDirectExpansionStrategy"], [4, 1, 1, "", "TemplateBasedExpansionStrategy"]], "aizynthfinder.context.policy.expansion_strategies.ExpansionStrategy": [[4, 2, 1, "", "get_actions"], [4, 2, 1, "", "reset_cache"]], "aizynthfinder.context.policy.expansion_strategies.MultiExpansionStrategy": [[4, 2, 1, "", "get_actions"]], "aizynthfinder.context.policy.expansion_strategies.TemplateBasedDirectExpansionStrategy": [[4, 2, 1, "", "get_actions"]], "aizynthfinder.context.policy.expansion_strategies.TemplateBasedExpansionStrategy": [[4, 2, 1, "", "get_actions"], [4, 2, 1, "", "reset_cache"]], "aizynthfinder.context.policy.filter_strategies": [[4, 1, 1, "", "BondFilter"], [4, 1, 1, "", "FilterStrategy"], [4, 1, 1, "", "QuickKerasFilter"], [4, 1, 1, "", "ReactantsCountFilter"]], "aizynthfinder.context.policy.filter_strategies.BondFilter": [[4, 2, 1, "", "apply"]], "aizynthfinder.context.policy.filter_strategies.FilterStrategy": [[4, 2, 1, "", "apply"]], "aizynthfinder.context.policy.filter_strategies.QuickKerasFilter": [[4, 2, 1, "", "apply"], [4, 2, 1, "", "feasibility"]], "aizynthfinder.context.policy.filter_strategies.ReactantsCountFilter": [[4, 2, 1, "", "apply"]], "aizynthfinder.context.policy.policies": [[4, 1, 1, "", "ExpansionPolicy"], [4, 1, 1, "", "FilterPolicy"]], "aizynthfinder.context.policy.policies.ExpansionPolicy": [[4, 2, 1, "", "get_actions"], [4, 2, 1, "", "load"], [4, 2, 1, "", "load_from_config"], [4, 2, 1, "", "reset_cache"]], "aizynthfinder.context.policy.policies.FilterPolicy": [[4, 2, 1, "", "apply"], [4, 2, 1, "", "load"], [4, 2, 1, "", "load_from_config"], [4, 2, 1, "", "reset_cache"]], "aizynthfinder.context.scoring": [[5, 0, 0, "-", "collection"], [5, 0, 0, "-", "scorers"]], "aizynthfinder.context.scoring.collection": [[5, 1, 1, "", "ScorerCollection"]], "aizynthfinder.context.scoring.collection.ScorerCollection": [[5, 2, 1, "", "create_default_scorers"], [5, 2, 1, "", "load"], [5, 2, 1, "", "load_from_config"], [5, 2, 1, "", "make_subset"], [5, 2, 1, "", "names"], [5, 2, 1, "", "objects"], [5, 2, 1, "", "score_vector"], [5, 2, 1, "", "weighted_score"]], "aizynthfinder.context.scoring.scorers": [[5, 1, 1, "", "AverageTemplateOccurrenceScorer"], [5, 1, 1, "", "BrokenBondsScorer"], [5, 1, 1, "", "CombinedScorer"], [5, 1, 1, "", "DeltaSyntheticComplexityScorer"], [5, 1, 1, "", "FractionInStockScorer"], [5, 1, 1, "", "MaxTransformScorerer"], [5, 1, 1, "", "MinMaxScaler"], [5, 1, 1, "", "NumberOfPrecursorsInStockScorer"], [5, 1, 1, "", "NumberOfPrecursorsScorer"], [5, 1, 1, "", "NumberOfReactionsScorer"], [5, 1, 1, "", "PriceSumScorer"], [5, 1, 1, "", "ReactionClassMembershipScorer"], [5, 1, 1, "", "RouteCostScorer"], [5, 1, 1, "", "RouteSimilarityScorer"], [5, 1, 1, "", "Scorer"], [5, 1, 1, "", "SquashScaler"], [5, 1, 1, "", "StateScorer"], [5, 1, 1, "", "StockAvailabilityScorer"]], "aizynthfinder.context.scoring.scorers.AverageTemplateOccurrenceScorer": [[5, 4, 1, "", "scorer_name"]], "aizynthfinder.context.scoring.scorers.BrokenBondsScorer": [[5, 4, 1, "", "scorer_name"]], "aizynthfinder.context.scoring.scorers.DeltaSyntheticComplexityScorer": [[5, 2, 1, "", "sc_deltas"], [5, 4, 1, "", "scorer_name"]], "aizynthfinder.context.scoring.scorers.FractionInStockScorer": [[5, 4, 1, "", "scorer_name"]], "aizynthfinder.context.scoring.scorers.MaxTransformScorerer": [[5, 4, 1, "", "scorer_name"]], "aizynthfinder.context.scoring.scorers.MinMaxScaler": [[5, 4, 1, "", "max_val"], [5, 4, 1, "", "min_val"], [5, 4, 1, "", "reverse"], [5, 4, 1, "", "scale_factor"]], "aizynthfinder.context.scoring.scorers.NumberOfPrecursorsInStockScorer": [[5, 4, 1, "", "scorer_name"]], "aizynthfinder.context.scoring.scorers.NumberOfPrecursorsScorer": [[5, 4, 1, "", "scorer_name"]], "aizynthfinder.context.scoring.scorers.NumberOfReactionsScorer": [[5, 4, 1, "", "scorer_name"]], "aizynthfinder.context.scoring.scorers.PriceSumScorer": [[5, 4, 1, "", "scorer_name"]], "aizynthfinder.context.scoring.scorers.RouteCostScorer": [[5, 4, 1, "", "scorer_name"]], "aizynthfinder.context.scoring.scorers.RouteSimilarityScorer": [[5, 4, 1, "", "scorer_name"]], "aizynthfinder.context.scoring.scorers.Scorer": [[5, 4, 1, "", "scorer_name"], [5, 2, 1, "", "sort"]], "aizynthfinder.context.scoring.scorers.SquashScaler": [[5, 4, 1, "", "slope"], [5, 4, 1, "", "xoffset"], [5, 4, 1, "", "yoffset"]], "aizynthfinder.context.scoring.scorers.StateScorer": [[5, 4, 1, "", "scorer_name"]], "aizynthfinder.context.stock": [[6, 0, 0, "-", "queries"], [6, 0, 0, "-", "stock"]], "aizynthfinder.context.stock.queries": [[6, 1, 1, "", "InMemoryInchiKeyQuery"], [6, 1, 1, "", "MolbloomFilterQuery"], [6, 1, 1, "", "MongoDbInchiKeyQuery"], [6, 1, 1, "", "StockQueryMixin"]], "aizynthfinder.context.stock.queries.InMemoryInchiKeyQuery": [[6, 2, 1, "", "price"], [6, 3, 1, "", "stock_inchikeys"]], "aizynthfinder.context.stock.queries.MongoDbInchiKeyQuery": [[6, 2, 1, "", "availability_string"]], "aizynthfinder.context.stock.queries.StockQueryMixin": [[6, 2, 1, "", "amount"], [6, 2, 1, "", "availability_string"], [6, 2, 1, "", "cached_search"], [6, 2, 1, "", "clear_cache"], [6, 2, 1, "", "price"]], "aizynthfinder.context.stock.stock": [[6, 1, 1, "", "Stock"]], "aizynthfinder.context.stock.stock.Stock": [[6, 2, 1, "", "amount"], [6, 2, 1, "", "availability_list"], [6, 2, 1, "", "availability_string"], [6, 2, 1, "", "exclude"], [6, 2, 1, "", "load"], [6, 2, 1, "", "load_from_config"], [6, 2, 1, "", "price"], [6, 2, 1, "", "reset_exclusion_list"], [6, 2, 1, "", "select"], [6, 2, 1, "", "set_stop_criteria"], [6, 2, 1, "", "smiles_in_stock"], [6, 3, 1, "", "stop_criteria"]], "aizynthfinder.interfaces": [[7, 0, 0, "-", "aizynthapp"], [7, 0, 0, "-", "aizynthcli"], [8, 0, 0, "-", "gui"]], "aizynthfinder.interfaces.aizynthapp": [[7, 1, 1, "", "AiZynthApp"], [7, 5, 1, "", "main"]], "aizynthfinder.interfaces.aizynthapp.AiZynthApp": [[7, 2, 1, "", "setup"]], "aizynthfinder.interfaces.aizynthcli": [[7, 5, 1, "", "main"]], "aizynthfinder.interfaces.gui": [[8, 0, 0, "-", "clustering"], [8, 0, 0, "-", "pareto_fronts"], [8, 0, 0, "-", "utils"]], "aizynthfinder.interfaces.gui.clustering": [[8, 1, 1, "", "ClusteringGui"]], "aizynthfinder.interfaces.gui.clustering.ClusteringGui": [[8, 2, 1, "", "from_app"]], "aizynthfinder.interfaces.gui.pareto_fronts": [[8, 1, 1, "", "ParetoFrontsGUI"]], "aizynthfinder.interfaces.gui.pareto_fronts.ParetoFrontsGUI": [[8, 2, 1, "", "from_app"]], "aizynthfinder.interfaces.gui.utils": [[8, 5, 1, "", "pareto_fronts_plot"], [8, 5, 1, "", "route_display"]], "aizynthfinder.reactiontree": [[0, 1, 1, "", "ReactionTree"], [0, 1, 1, "", "ReactionTreeFromDict"], [0, 1, 1, "", "ReactionTreeFromExpansion"], [0, 1, 1, "", "ReactionTreeLoader"]], "aizynthfinder.reactiontree.ReactionTree": [[0, 2, 1, "", "depth"], [0, 2, 1, "", "distance_to"], [0, 2, 1, "", "from_dict"], [0, 2, 1, "", "hash_key"], [0, 2, 1, "", "in_stock"], [0, 2, 1, "", "is_branched"], [0, 2, 1, "", "leafs"], [0, 3, 1, "", "metadata"], [0, 2, 1, "", "molecules"], [0, 2, 1, "", "parent_molecule"], [0, 2, 1, "", "reactions"], [0, 2, 1, "", "subtrees"], [0, 2, 1, "", "to_dict"], [0, 2, 1, "", "to_image"], [0, 2, 1, "", "to_json"]], "aizynthfinder.search": [[9, 0, 0, "-", "andor_trees"], [10, 0, 0, "-", "breadth_first"], [11, 0, 0, "-", "dfpn"], [12, 0, 0, "-", "mcts"], [13, 0, 0, "-", "retrostar"]], "aizynthfinder.search.andor_trees": [[9, 1, 1, "", "AndOrSearchTreeBase"], [9, 1, 1, "", "ReactionTreeFromAndOrTrace"], [9, 1, 1, "", "SplitAndOrTree"], [9, 1, 1, "", "TreeNodeMixin"]], "aizynthfinder.search.andor_trees.AndOrSearchTreeBase": [[9, 3, 1, "", "mol_nodes"], [9, 2, 1, "", "one_iteration"], [9, 2, 1, "", "routes"]], "aizynthfinder.search.andor_trees.TreeNodeMixin": [[9, 3, 1, "", "children"], [9, 3, 1, "", "prop"]], "aizynthfinder.search.breadth_first": [[10, 0, 0, "-", "nodes"], [10, 0, 0, "-", "search_tree"]], "aizynthfinder.search.breadth_first.nodes": [[10, 1, 1, "", "MoleculeNode"], [10, 1, 1, "", "ReactionNode"]], "aizynthfinder.search.breadth_first.nodes.MoleculeNode": [[10, 2, 1, "", "add_stub"], [10, 2, 1, "", "ancestors"], [10, 3, 1, "", "children"], [10, 2, 1, "", "create_root"], [10, 2, 1, "", "from_dict"], [10, 3, 1, "", "prop"], [10, 2, 1, "", "serialize"]], "aizynthfinder.search.breadth_first.nodes.ReactionNode": [[10, 3, 1, "", "children"], [10, 2, 1, "", "create_stub"], [10, 2, 1, "", "from_dict"], [10, 3, 1, "", "prop"], [10, 2, 1, "", "serialize"]], "aizynthfinder.search.breadth_first.search_tree": [[10, 1, 1, "", "SearchTree"]], "aizynthfinder.search.breadth_first.search_tree.SearchTree": [[10, 2, 1, "", "from_json"], [10, 3, 1, "", "mol_nodes"], [10, 2, 1, "", "one_iteration"], [10, 2, 1, "", "routes"], [10, 2, 1, "", "serialize"]], "aizynthfinder.search.dfpn": [[11, 0, 0, "-", "nodes"], [11, 0, 0, "-", "search_tree"]], "aizynthfinder.search.dfpn.nodes": [[11, 1, 1, "", "MoleculeNode"], [11, 1, 1, "", "ReactionNode"]], "aizynthfinder.search.dfpn.nodes.MoleculeNode": [[11, 2, 1, "", "create_root"], [11, 2, 1, "", "expand"], [11, 2, 1, "", "promising_child"], [11, 3, 1, "", "prop"], [11, 2, 1, "", "update"]], "aizynthfinder.search.dfpn.nodes.ReactionNode": [[11, 3, 1, "", "children"], [11, 3, 1, "", "disproven"], [11, 2, 1, "", "expand"], [11, 2, 1, "", "promising_child"], [11, 3, 1, "", "prop"], [11, 3, 1, "", "proven"], [11, 2, 1, "", "update"]], "aizynthfinder.search.dfpn.search_tree": [[11, 1, 1, "", "SearchTree"]], "aizynthfinder.search.dfpn.search_tree.SearchTree": [[11, 3, 1, "", "mol_nodes"], [11, 2, 1, "", "one_iteration"], [11, 2, 1, "", "routes"]], "aizynthfinder.search.mcts": [[12, 0, 0, "-", "node"], [12, 0, 0, "-", "search"], [12, 0, 0, "-", "state"], [12, 0, 0, "-", "utils"]], "aizynthfinder.search.mcts.node": [[12, 1, 1, "", "MctsNode"], [12, 1, 1, "", "ParetoMctsNode"]], "aizynthfinder.search.mcts.node.MctsNode": [[12, 2, 1, "", "actions_to"], [12, 2, 1, "", "backpropagate"], [12, 3, 1, "", "children"], [12, 2, 1, "", "children_view"], [12, 2, 1, "", "create_root"], [12, 2, 1, "", "expand"], [12, 2, 1, "", "from_dict"], [12, 3, 1, "", "is_solved"], [12, 2, 1, "", "is_terminal"], [12, 3, 1, "", "parent"], [12, 2, 1, "", "path_to"], [12, 2, 1, "", "promising_child"], [12, 2, 1, "", "serialize"], [12, 3, 1, "", "state"], [12, 2, 1, "", "to_reaction_tree"]], "aizynthfinder.search.mcts.node.ParetoMctsNode": [[12, 2, 1, "", "backpropagate"], [12, 2, 1, "", "children_view"], [12, 2, 1, "", "serialize"]], "aizynthfinder.search.mcts.search": [[12, 1, 1, "", "MctsSearchTree"]], "aizynthfinder.search.mcts.search.MctsSearchTree": [[12, 2, 1, "", "backpropagate"], [12, 2, 1, "", "compute_reward"], [12, 2, 1, "", "from_json"], [12, 2, 1, "", "graph"], [12, 2, 1, "", "nodes"], [12, 2, 1, "", "one_iteration"], [12, 2, 1, "", "select_leaf"], [12, 2, 1, "", "serialize"]], "aizynthfinder.search.mcts.state": [[12, 1, 1, "", "MctsState"]], "aizynthfinder.search.mcts.state.MctsState": [[12, 2, 1, "", "from_dict"], [12, 2, 1, "", "serialize"], [12, 3, 1, "", "stock_availability"], [12, 2, 1, "", "to_image"]], "aizynthfinder.search.mcts.utils": [[12, 1, 1, "", "ReactionTreeFromSuperNode"], [12, 5, 1, "", "route_to_node"]], "aizynthfinder.search.retrostar": [[13, 0, 0, "-", "cost"], [13, 0, 0, "-", "nodes"], [13, 0, 0, "-", "search_tree"]], "aizynthfinder.search.retrostar.cost": [[13, 1, 1, "", "MoleculeCost"], [13, 1, 1, "", "RetroStarCost"], [13, 1, 1, "", "ZeroMoleculeCost"]], "aizynthfinder.search.retrostar.cost.RetroStarCost": [[13, 2, 1, "", "calculate"]], "aizynthfinder.search.retrostar.cost.ZeroMoleculeCost": [[13, 2, 1, "", "calculate"]], "aizynthfinder.search.retrostar.nodes": [[13, 1, 1, "", "MoleculeNode"], [13, 1, 1, "", "ReactionNode"]], "aizynthfinder.search.retrostar.nodes.MoleculeNode": [[13, 2, 1, "", "add_stub"], [13, 2, 1, "", "ancestors"], [13, 3, 1, "", "children"], [13, 2, 1, "", "close"], [13, 2, 1, "", "create_root"], [13, 2, 1, "", "from_dict"], [13, 3, 1, "", "prop"], [13, 2, 1, "", "serialize"], [13, 3, 1, "", "target_value"], [13, 2, 1, "", "update"]], "aizynthfinder.search.retrostar.nodes.ReactionNode": [[13, 3, 1, "", "children"], [13, 2, 1, "", "create_stub"], [13, 2, 1, "", "from_dict"], [13, 3, 1, "", "prop"], [13, 2, 1, "", "serialize"], [13, 2, 1, "", "update"]], "aizynthfinder.search.retrostar.search_tree": [[13, 1, 1, "", "SearchTree"]], "aizynthfinder.search.retrostar.search_tree.SearchTree": [[13, 2, 1, "", "from_json"], [13, 3, 1, "", "mol_nodes"], [13, 2, 1, "", "one_iteration"], [13, 2, 1, "", "routes"], [13, 2, 1, "", "serialize"]], "aizynthfinder.tools": [[14, 0, 0, "-", "cat_output"], [14, 0, 0, "-", "download_public_data"], [14, 0, 0, "-", "make_stock"]], "aizynthfinder.tools.cat_output": [[14, 5, 1, "", "main"]], "aizynthfinder.tools.download_public_data": [[14, 5, 1, "", "main"]], "aizynthfinder.tools.make_stock": [[14, 5, 1, "", "extract_plain_smiles"], [14, 5, 1, "", "extract_smiles_from_module"], [14, 5, 1, "", "main"], [14, 5, 1, "", "make_hdf5_stock"], [14, 5, 1, "", "make_molbloom"], [14, 5, 1, "", "make_molbloom_inchi"], [14, 5, 1, "", "make_mongo_stock"]], "aizynthfinder.utils": [[15, 0, 0, "-", "bonds"], [15, 0, 0, "-", "exceptions"], [15, 0, 0, "-", "files"], [15, 0, 0, "-", "image"], [15, 0, 0, "-", "loading"], [15, 0, 0, "-", "logging"], [15, 0, 0, "-", "math"], [15, 0, 0, "-", "models"], [15, 0, 0, "-", "mongo"], [15, 0, 0, "-", "paths"], [15, 0, 0, "-", "sc_score"], [15, 0, 0, "-", "type_utils"]], "aizynthfinder.utils.bonds": [[15, 1, 1, "", "BrokenBonds"], [15, 5, 1, "", "sort_bonds"]], "aizynthfinder.utils.exceptions": [[15, 6, 1, "", "CostException"], [15, 6, 1, "", "ExternalModelAPIError"], [15, 6, 1, "", "MoleculeException"], [15, 6, 1, "", "NodeUnexpectedBehaviourException"], [15, 6, 1, "", "PolicyException"], [15, 6, 1, "", "RejectionException"], [15, 6, 1, "", "ScorerException"], [15, 6, 1, "", "StockException"], [15, 6, 1, "", "TreeAnalysisException"]], "aizynthfinder.utils.files": [[15, 5, 1, "", "cat_datafiles"], [15, 5, 1, "", "cat_hdf_files"], [15, 5, 1, "", "read_datafile"], [15, 5, 1, "", "save_datafile"], [15, 5, 1, "", "split_file"], [15, 5, 1, "", "start_processes"]], "aizynthfinder.utils.image": [[15, 1, 1, "", "RouteImageFactory"], [15, 5, 1, "", "crop_image"], [15, 5, 1, "", "draw_rounded_rectangle"], [15, 5, 1, "", "make_visjs_page"], [15, 5, 1, "", "molecule_to_image"], [15, 5, 1, "", "molecules_to_images"], [15, 5, 1, "", "save_molecule_images"]], "aizynthfinder.utils.loading": [[15, 5, 1, "", "load_dynamic_class"]], "aizynthfinder.utils.logging": [[15, 5, 1, "", "logger"], [15, 5, 1, "", "setup_logger"]], "aizynthfinder.utils.math": [[15, 5, 1, "", "dense_layer_forward_pass"], [15, 5, 1, "", "rectified_linear_unit"], [15, 5, 1, "", "sigmoid"], [15, 5, 1, "", "softmax"]], "aizynthfinder.utils.models": [[15, 1, 1, "", "ExternalModelViaGRPC"], [15, 1, 1, "", "ExternalModelViaREST"], [15, 1, 1, "", "LocalKerasModel"], [15, 1, 1, "", "LocalOnnxModel"], [15, 5, 1, "", "load_model"]], "aizynthfinder.utils.models.ExternalModelViaGRPC": [[15, 2, 1, "", "predict"]], "aizynthfinder.utils.models.ExternalModelViaREST": [[15, 2, 1, "", "predict"]], "aizynthfinder.utils.models.LocalKerasModel": [[15, 2, 1, "", "predict"]], "aizynthfinder.utils.models.LocalOnnxModel": [[15, 2, 1, "", "predict"]], "aizynthfinder.utils.mongo": [[15, 5, 1, "", "get_mongo_client"]], "aizynthfinder.utils.paths": [[15, 5, 1, "", "data_path"], [15, 5, 1, "", "package_path"]], "aizynthfinder.utils.sc_score": [[15, 1, 1, "", "SCScore"]], "aizynthfinder.utils.sc_score.SCScore": [[15, 2, 1, "", "forward"]]}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "class", "Python class"], "2": ["py", "method", "Python method"], "3": ["py", "property", "Python property"], "4": ["py", "attribute", "Python attribute"], "5": ["py", "function", "Python function"], "6": ["py", "exception", "Python exception"]}, "objtypes": {"0": "py:module", "1": "py:class", "2": "py:method", "3": "py:property", "4": "py:attribute", "5": "py:function", "6": "py:exception"}, "terms": {"": [2, 3, 8, 12, 15, 17], "0": [1, 2, 5, 16, 17, 19, 22, 26], "01825": 12, "03d": 16, "05": 17, "1": [2, 5, 17, 19, 25], "10": [5, 19, 24, 26], "100": [6, 15, 17], "1024": 15, "12": 9, "120": 17, "2": [1, 2, 6, 15, 17, 19, 25], "20": 15, "2012": 12, "2019": [5, 12, 24], "2020": 9, "2048": [2, 19], "2111": 12, "25": [1, 17, 19], "25000": 9, "27017": 15, "3": [1, 5, 17, 19], "300": 15, "4": [5, 6, 17, 19], "4640": [5, 24], "5": [0, 1, 5, 6, 15, 17, 19], "50": [17, 19], "52": 9, "6": [6, 12, 17], "8": 5, "995": 17, "A": [2, 4, 6, 9, 12, 13, 15, 16, 17, 18, 25], "AND": [9, 10, 11, 13], "And": 3, "By": [16, 26], "For": [5, 24, 25], "If": [0, 1, 2, 3, 4, 5, 6, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 25, 26], "In": [16, 17, 24, 25, 26], "It": [1, 2, 4, 12, 16, 18, 22], "Not": 6, "OR": [9, 10, 11, 13], "One": [3, 6, 18], "That": 16, "The": [0, 1, 2, 3, 4, 5, 6, 9, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 24, 25, 26], "Then": 26, "There": [18, 20, 22], "These": [15, 17, 23, 25], "To": [1, 16, 18, 19, 20, 26], "Will": [2, 12], "_": [3, 15], "__contains__": 26, "__init__": 2, "__repr__": 24, "_anylistofsolut": 1, "_appli": 2, "_config": 24, "_make_smil": 2, "_mol": 13, "_molecul": 5, "_postprocessingconfigur": 3, "_reactioninterfacemixin": 2, "_score_nod": 24, "_score_reaction_tre": 24, "_scoreabl": 5, "_searchconfigur": 3, "_solut": 1, "_striter": 14, "_supernod": 11, "abc": [0, 2, 3, 4, 5, 9], "about": [16, 20, 25], "abov": [17, 25], "abstract": [2, 3, 4, 5, 9], "accept": [3, 6], "access": [1, 9, 12], "accumul": [4, 17], "action": [2, 4, 12, 15, 25], "actions_to": [9, 12], "activ": 15, "actual": [0, 5, 12, 25], "ad": [0, 1, 5, 10, 12, 13, 24, 26], "adapt": 5, "add": [4, 5, 6, 10, 12, 13, 18, 19, 22, 25, 26], "add_stub": [9, 10, 13], "addit": [0, 1, 4, 17, 24], "additive_expans": [4, 19], "adjust": 5, "advanc": [7, 19], "after": [0, 13], "again": 25, "agg_func": 5, "aggreg": 5, "agre": 15, "aid": 25, "aizynth": 15, "aizynthapp": [0, 8, 18, 20, 21, 24, 26], "aizynthcli": [0, 16, 19, 20, 21, 26], "aizynthexpand": [0, 21, 22], "aizynthfind": [16, 18, 19, 22, 24, 25, 26], "aizynthfinderfind": 24, "al": [5, 9, 24], "algorithm": [1, 9, 10, 11, 12, 13, 17, 19, 20, 22, 25], "algorithm_config": [13, 17, 19], "all": [0, 1, 2, 3, 4, 5, 6, 10, 12, 13, 14, 15, 16, 17, 19, 22, 24, 25, 26], "all_rout": [17, 19], "all_scor": 1, "all_tre": 16, "allow": 6, "along": [1, 5, 17], "alreadi": 12, "also": [0, 1, 3, 5, 15, 16, 17, 18, 25], "altern": [19, 26], "although": 12, "alwai": 22, "among": [3, 5], "amount": [3, 6, 26], "an": [0, 1, 2, 3, 4, 5, 6, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 24, 26], "an_item": 3, "analys": [15, 22], "analysi": [0, 21, 22], "analyz": 7, "ancestor": [9, 10, 13], "andor_tre": [0, 21], "andorsearchtreebas": [0, 1, 8, 9, 10, 11, 13], "ani": [0, 1, 2, 3, 4, 5, 6, 9, 12, 13, 15, 17, 22, 24, 25, 26], "anoth": [0, 1, 2, 18], "anyth": 25, "api": [0, 15], "app": [7, 8, 18, 20, 24, 26], "appear": [18, 20], "append": [3, 5, 6, 22], "appli": [2, 3, 4, 5, 12, 17, 25], "applic": [2, 7, 12, 25], "approx_mol": 14, "approxim": 14, "ar": [0, 1, 2, 3, 4, 5, 6, 9, 10, 12, 13, 14, 15, 16, 17, 18, 20, 22, 23, 24, 25, 26], "arc_siz": 15, "archiv": 15, "arg": [0, 9, 12, 15], "argument": [0, 1, 2, 5, 6, 14, 15, 16, 26], "around": [0, 1, 2, 15], "artifici": 4, "arxiv": 12, "assign": [13, 17], "associ": [2, 4, 25], "assum": 12, "atom": [2, 5, 6, 15, 17], "attribut": [0, 1, 9, 12, 24], "auto": 5, "automat": [16, 18, 24, 26], "auxillari": 8, "avail": [0, 1, 3, 5, 6, 8, 12, 13, 16, 17, 19, 20, 24], "availability_list": [3, 6], "availability_str": [3, 6], "averag": [5, 24], "average_yield": 5, "averagetemplateoccurrencescor": [3, 5], "avoid": [1, 9], "awesomescor": 5, "axi": 5, "b": 26, "background": 15, "backpropag": [9, 12, 25], "backward": 5, "badowski": [5, 24], "balanc": 17, "ball": [1, 15], "bar": 0, "base": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 17, 18, 19, 20, 26], "basenam": 15, "bash": 26, "basic": [2, 7], "basic_compar": [0, 2], "batch": [16, 20], "becaus": 0, "been": [0, 2, 12, 16, 17, 18, 25], "befor": [2, 22], "behav": 15, "being": [5, 13, 25], "below": [16, 17, 19, 25], "best": [0, 1], "between": [0, 1, 5, 12, 15, 22, 25], "bia": 15, "bias": [13, 15], "big": 5, "bipartit": [0, 1, 15], "bit": [13, 14, 15], "bloom": [6, 14], "bond": [0, 2, 4, 5, 17, 19, 21], "bondfilt": [3, 4], "bool": [0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 15], "boolean": [2, 4, 17], "both": [0, 8, 12, 19, 24, 26], "bound": [9, 17, 25], "branch": 0, "breadth": 10, "breadth_first": [0, 9], "break": [5, 15, 17, 20, 22, 25], "break_bond": [17, 19], "break_bonds_oper": 17, "bring": 18, "broken": [0, 5, 15, 17, 19], "brokenbond": [0, 15], "brokenbondsscor": [3, 5], "brows": 18, "build": [0, 19, 22], "build_rout": [0, 21, 22], "button": [18, 20], "buyabl": 17, "c": [6, 17, 20, 22, 26], "c1": 20, "c1n": 22, "c2": 20, "c2cc": 20, "c3ncon3": 22, "c4cc": 22, "cach": [1, 4, 6, 12], "cache_molecul": 4, "cached_search": [3, 6], "calcul": [0, 5, 6, 9, 13, 16], "call": [0, 2, 4, 5, 6, 13, 15, 16, 17, 20, 22, 25], "callabl": [0, 2, 15], "can": [0, 1, 2, 3, 4, 5, 6, 9, 12, 13, 15, 16, 17, 18, 19, 20, 22, 24, 25, 26], "cannot": [1, 5, 6], "cap": 17, "capabl": 24, "care": [2, 25], "carlo": [12, 20, 23], "carri": 25, "case": [5, 6, 15, 17, 19], "cat_aizynth_output": 14, "cat_datafil": [0, 15], "cat_hdf_fil": [0, 15], "cat_output": [0, 21], "caus": 2, "cc": 22, "cc1cccc": 22, "cc2": 22, "cc4": 22, "ccc": [13, 15], "ccco": 2, "cco": 6, "cell": [18, 20], "certif": 15, "chang": 25, "check": [0, 2, 4, 5, 6, 15, 17], "checkpoint": [5, 15, 16, 17], "chem": [0, 5, 21, 22, 24, 26], "chemic": 2, "cheminf": 9, "chemistri": 2, "chen": 12, "child": [2, 11, 12, 13, 25], "children": [0, 1, 2, 9, 10, 11, 12, 13, 16, 17, 25], "children_attr": 12, "children_view": [9, 12], "chiral": [2, 4], "chiral_fingerprint": 4, "choos": [18, 24], "class": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 20, 22, 24, 25, 26], "classif": 5, "classmethod": [0, 1, 2, 3, 8, 10, 11, 12, 13], "classnam": [15, 17], "clear": 6, "clear_cach": [3, 6], "cli": [7, 14], "client": [6, 15, 26], "close": [9, 13], "cluster": [0, 1, 7, 16], "clusteringgui": [7, 8, 18], "clutter": 1, "cmd_callback": 15, "coc1cccc": 20, "code": [0, 9, 15, 18, 20], "collect": [0, 1, 6, 8, 14, 15, 20, 21, 24, 26], "colon": 16, "color": [0, 1, 15], "column": [4, 6, 15, 16, 17], "com": [19, 26], "combin": [1, 4, 5, 17], "combinatori": 9, "combined_reaction_tre": [0, 1], "combinedreactiontre": [0, 1], "combinedscor": [3, 5], "comma": [6, 16], "command": [7, 15, 20, 26], "compar": [0, 2, 12], "compil": 15, "complet": [0, 3, 15, 16, 17, 22], "complex": [5, 15], "compound": [14, 16, 18, 26], "compret": 9, "comput": [1, 2, 4, 5, 6, 12, 13, 15, 17], "compute_reward": [9, 12], "compute_scor": [0, 1], "concaten": [14, 15], "condit": [4, 25], "confid": [17, 25], "config": [0, 4, 5, 6, 9, 10, 11, 12, 13, 16, 17, 18, 19, 20, 21, 22, 24], "config_loc": [16, 18, 24, 26], "configdict": 0, "configfil": [0, 7, 18, 20, 22, 26], "configur": [0, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 15, 16, 18, 19, 20, 22, 24, 26], "connect": [2, 4, 15, 17, 23], "consid": [1, 4, 17], "consist": [0, 12], "consol": 15, "console_level": 15, "constant": 19, "constraint": 19, "construct": 12, "consult": 22, "contain": [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 20, 25, 26], "content": [17, 21], "context": [0, 19, 21, 24, 26], "contextcollect": [0, 3, 4, 5, 6], "continu": [18, 25, 26], "contrib": 26, "control": [5, 19], "conveni": 0, "convert": [1, 2], "copi": [0, 2, 5, 6, 12], "corner": 15, "correspond": [2, 3, 16], "cost": [0, 5, 9, 10, 15, 19, 24], "costexcept": [0, 15], "could": [2, 5, 6, 12, 17, 25], "count": [2, 6, 25, 26], "creat": [0, 1, 2, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 24, 25, 26], "create_default_scor": [3, 5], "create_root": [9, 10, 11, 12, 13], "create_stub": [9, 10, 13], "created_at_iter": 0, "creation": [0, 2], "criteria": [0, 1, 6], "criteriastock": 26, "crop": 15, "crop_imag": [0, 15], "csv": [6, 17, 19], "ctrl": [18, 20], "cumul": 12, "current": [1, 3, 6, 12, 13, 20, 24, 25, 26], "cursor": [1, 5, 24], "curv": 5, "custom": [0, 14, 15, 17], "custom_model": [4, 6, 13], "custom_packag": [4, 6, 13], "custom_stock": 26, "customclass": [4, 6, 13], "cut": [4, 17], "cutoff": 4, "cutoff_cumul": [4, 17], "cutoff_numb": [4, 17], "cycl": 17, "data": [2, 4, 14, 15, 16, 20], "data_path": [0, 15], "databas": [6, 14, 20], "database_nam": 26, "datafil": 15, "datafram": [6, 14, 15, 16, 22], "dataset": 6, "de": 3, "deal": 2, "deeper": 22, "def": [24, 26], "default": [0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 15, 16, 17, 19, 20, 26], "default_cost": 5, "default_modul": 15, "default_prior": 17, "default_scor": 5, "defin": [0, 1, 5, 12], "del": 3, "delet": [0, 3], "delta": [5, 13, 24], "deltanumberoftransformsscor": 24, "deltasyntheticcomplexityscor": [3, 5], "dens": 15, "dense_layer_forward_pass": [0, 15], "depend": 25, "depth": [0, 2, 5, 10, 11, 17, 21], "descend": 5, "descript": [16, 17, 25], "deselect": [0, 3], "deseri": [2, 10, 11, 12, 13], "deserialize_act": [0, 2], "desir": 1, "detail": [9, 16, 17], "determin": [0, 1, 2, 4, 15, 17], "df": 22, "dfpn": [0, 9], "diagram": [23, 25], "dicitionari": 0, "dict": [0, 1, 2, 6, 10, 12, 13, 15], "dict_": [2, 10, 12, 13], "dict_with_extra": [0, 1], "dict_with_scor": [0, 1], "dictionari": [0, 1, 2, 3, 5, 6, 9, 10, 11, 12, 13, 15, 16], "differ": [1, 4, 5, 6, 12, 15, 23, 25, 26], "dig": 22, "digraph": [12, 15], "direct": [5, 12], "directli": [0, 3, 4, 5, 20], "directori": [15, 20, 26], "disabl": 15, "disc": 15, "discard": 17, "displai": [7, 8], "disproof": 11, "disproven": [9, 11], "disregard": 12, "distanc": [0, 1, 5, 16, 17], "distance_matrix": [0, 1], "distance_to": [0, 21], "distances_model": 1, "distinguish": 5, "divers": 15, "dn": 11, "dn_threshold": 11, "do": [0, 1, 5, 19, 24, 25], "do_expans": [0, 21, 22], "docstr": 22, "document": [6, 26], "doe": [2, 3, 5, 11, 25], "done": [2, 5, 7, 18, 19, 22, 25], "dot": 2, "down": [0, 17, 20, 22, 25], "download": [14, 19, 20, 26], "download_public_data": [0, 20, 21], "draw": 15, "draw_rounded_rectangl": [0, 15], "dropout_r": [13, 19], "dummi": 4, "dure": 17, "dynam": 15, "e": [0, 5, 10, 11, 12, 13, 19, 23, 25], "each": [0, 1, 4, 5, 6, 11, 12, 13, 14, 15, 16, 20, 25, 26], "easiest": 26, "edg": [12, 15], "edit": [0, 5], "effici": 12, "either": [0, 4, 12, 15, 25, 26], "elaps": 16, "element": [2, 14, 26], "els": 5, "emolecul": 17, "empti": [2, 6], "enabl": 16, "encapsul": [0, 1, 2, 3, 9, 10, 11, 12, 13, 15], "end": 12, "enter": [18, 20, 25], "entir": 5, "entri": [1, 6, 7, 14], "enumer": [16, 26], "environ": [3, 17], "equal": [0, 2, 4, 5, 17], "error": 15, "estim": 12, "et": [5, 9, 24], "etc": [2, 16], "evalu": 2, "even": 12, "exact": 2, "exampl": [6, 16, 17, 19, 20, 22, 24, 26], "except": [0, 2, 4, 5, 16, 20, 21], "exception_cl": 15, "exclud": [3, 6, 13, 17], "exclude_from_polici": 17, "exclude_target_from_stock": 17, "exclus": 6, "execut": [0, 15, 18, 20, 25], "exemplifi": 17, "exhaust": 10, "exist": [2, 3, 4, 15, 18, 25, 26], "exit": 16, "expand": [0, 4, 9, 10, 11, 12, 13, 17, 22, 25], "expandable_mol": 12, "expandables_hash": 12, "expans": [0, 4, 10, 11, 12, 13, 16, 17, 25], "expansion_polici": [0, 3, 22], "expansion_strategi": [0, 3, 19], "expansion_strategy_kei": 4, "expansion_strategy_weight": 4, "expansionpolici": [3, 4], "expansionstrategi": [3, 4], "expect": [3, 4], "experi": 20, "explain": [23, 25], "exploit": 17, "explor": [11, 17, 18], "explos": 9, "export": [19, 25, 26], "expos": [9, 10, 11, 13], "extens": [8, 18], "extern": 15, "externalmodelapierror": [0, 15], "externalmodelviagrpc": [0, 15], "externalmodelviarest": [0, 15], "extra": 2, "extract": [0, 8, 9, 10, 11, 13, 14, 16, 17, 18, 19, 25, 26], "extract_plain_smil": [0, 14], "extract_smil": [14, 26], "extract_smiles_from_modul": [0, 14], "extract_statist": [0, 18, 21, 22], "f": 16, "fact": 2, "factor": 5, "factori": [0, 3, 15], "fail": [2, 25], "failur": 15, "fallback": 15, "fals": [0, 1, 2, 3, 4, 5, 6, 12, 15, 17, 24, 25, 26], "feasibl": [3, 4, 22], "few": [19, 24, 25], "field": [6, 26], "file": [0, 3, 4, 5, 6, 7, 10, 12, 13, 14, 16, 18, 19, 20, 21, 22, 26], "file1": 26, "file2": 26, "file_level": 15, "filenam": [1, 3, 5, 10, 12, 13, 14, 15, 16, 22, 26], "fileobj": 26, "filter": [0, 4, 6, 11, 14, 16, 17, 22, 25], "filter_cutoff": [4, 17], "filter_func": 0, "filter_polici": [0, 3, 22], "filter_s": 14, "filter_strategi": [0, 3], "filterpolici": [3, 4], "filterstrategi": [3, 4], "final": 25, "find": [6, 11, 16, 18, 22], "finder": [7, 18, 22, 24, 26], "fingerprint": [0, 2, 4, 13, 15, 22], "fingerprint_length": [13, 15, 19], "fingerprint_radiu": [13, 15, 19], "finish": 18, "first": [1, 3, 10, 11, 13, 14, 15, 16, 18, 19, 22, 24, 25, 26], "first_solution_iter": 16, "first_solution_tim": 16, "fix": 2, "fixedretroreact": [0, 2, 15, 22], "flag": [16, 25], "float": [0, 1, 2, 4, 5, 6, 12, 13], "flow": 25, "focuss": [2, 4, 5, 15], "focussed_bond": 15, "folder": [15, 19], "follow": [13, 16, 17, 18, 20, 25], "form": [2, 5, 16, 24, 25], "format": [0, 1, 4, 6, 13, 15, 17, 26], "formula": 2, "forward": [0, 15], "found": [5, 6, 10, 11, 12, 13, 16, 17], "four": 24, "fourth": 25, "fraction": 5, "fractioninstockscor": [3, 5], "frame": 15, "frame_color": 15, "framecolor": [0, 1, 15], "freez": [4, 17], "freeze_bond": [17, 19], "frequenc": 15, "frequent": 19, "from": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 24, 25, 26], "from_analysi": [0, 1], "from_app": [7, 8, 18], "from_dict": [0, 3, 9, 10, 12, 13, 16, 21], "from_fil": [0, 3], "from_json": [9, 10, 12, 13], "from_mol": 13, "from_nod": 12, "from_seri": [0, 2], "front": [1, 8, 12], "frontier": [10, 11, 13], "frozen": 4, "full": [0, 17], "fulli": 26, "function": [0, 1, 2, 4, 5, 8, 14, 15, 17, 18, 19], "furthermor": 25, "g": [0, 5, 19], "gener": [0, 16, 19], "get": [2, 4, 5, 15, 22], "get_act": [3, 4], "get_bonds_in_molecul": [0, 2], "get_mongo_cli": [0, 15], "get_tree_molecul": [0, 2], "github": 19, "give": [5, 10, 11, 12, 13, 16, 19, 22], "given": [0, 1, 2, 3, 4, 5, 6, 12, 14, 15, 16, 22], "global": 15, "go": 12, "graph": [0, 1, 9, 12, 15], "green": [0, 1, 15], "group": [0, 1, 17], "grpc": 15, "gui": [0, 7, 18, 20, 24, 26], "guid": [20, 24], "guidelin": 19, "gz": [14, 16, 17, 19], "gzip": 15, "h": 16, "ha": [0, 1, 2, 12, 17, 18, 25, 26], "had": 12, "has_all_focussed_bond": [0, 2], "has_atom_map": [0, 2], "hash": [0, 2, 12], "hash_kei": [0, 21], "hash_react": [0, 2], "hashabl": [2, 12], "have": [1, 6, 12, 16, 17, 22, 25, 26], "hdf5": [4, 6, 14, 15, 16, 17, 19, 26], "header": 26, "heavyatomcount": 26, "help": [16, 22], "helper": [1, 2, 4, 8, 15], "henc": [0, 2, 10, 11, 13], "here": [16, 17, 18, 19, 20, 22], "herein": 1, "hidden": [0, 15], "hierarch": 15, "hierarchi": 18, "highest": [1, 12, 25], "hold": [1, 10, 11, 12, 13, 18], "horizon": 5, "host": [6, 14, 15, 26], "how": [1, 16, 18, 22, 23, 25], "howev": [12, 26], "html": [1, 15], "http": 19, "i": [0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26], "id": 2, "identifi": 15, "idx": 2, "ignor": 2, "imag": [0, 1, 12, 16, 21], "imagefil": 16, "img": 15, "immedi": [2, 12, 17], "immediate_instanti": 17, "immut": 12, "implement": [0, 2, 3, 4, 6, 9, 12, 13, 15, 19, 24, 26], "import": [7, 15, 16, 18, 20, 22, 24, 26], "in_set_scor": 5, "in_stock": [0, 10, 11, 13, 21], "in_stock_color": [0, 1, 15], "in_stock_list": 12, "inchi": [0, 2, 6, 12, 14, 17, 26], "inchi_kei": [0, 2, 6, 14, 17, 26], "inchi_key_col": 6, "inchikei": 6, "inchiset": 17, "includ": [0, 2, 3, 15, 16], "include_metadata": [0, 1], "include_scor": 1, "increas": 2, "index": [1, 2, 5, 8, 15], "index_to_map": [0, 2], "indic": 2, "indirectli": 25, "individu": [1, 3, 6], "inform": [0, 1, 2, 8, 12, 16, 25], "inherit": [2, 24], "init": 25, "init_arg": 2, "initi": [0, 1, 2, 4, 5, 6, 25], "inlin": 18, "inmemoryinchikeyqueri": [3, 6], "inner": 25, "input": [2, 4, 5, 13, 14, 15, 16, 26], "input_fil": 15, "insert": 0, "instanc": [2, 5, 6, 7, 15, 22, 24, 26], "instanti": [0, 2, 4, 5, 6, 7, 9, 12, 13, 17, 18, 20, 22, 25], "instead": [6, 17], "int": [0, 1, 2, 5, 8, 9, 12, 14, 15], "intend": 0, "interact": 22, "interest": 22, "interfac": [0, 2, 4, 5, 6, 12, 17, 20, 21, 24, 26], "intern": [6, 12], "interpret": 26, "introduct": 18, "involv": 23, "is_branch": [0, 21], "is_expand": [12, 25], "is_solv": [0, 9, 12, 16, 25], "is_termin": [9, 12, 25], "isn": [4, 26], "issu": 19, "item": [0, 1, 3, 4, 5, 6, 13, 15], "iter": [0, 2, 9, 10, 11, 12, 13, 14, 16, 17, 25], "iteration_limit": 17, "itre": 16, "its": [5, 12, 13, 16], "j": [1, 9, 15], "jaccard": 0, "json": [0, 1, 5, 10, 12, 13, 14, 15, 16, 20, 25], "jupyt": [7, 18, 20, 24, 26], "just": [15, 20, 26], "keep": [2, 15], "kei": [0, 1, 2, 3, 4, 5, 6, 12, 14, 15, 17, 22, 26], "kept": 0, "kera": [15, 17], "keyerror": 3, "known": [20, 26], "kwarg": [0, 1, 2, 4, 9, 12, 13, 15], "l": 12, "label": [1, 4], "larg": 25, "larger": 1, "last": 3, "lastli": 26, "later": 4, "latest": 0, "layer": [13, 15], "layout": 15, "lazi": 2, "lazili": 12, "lead": 12, "leaf": [0, 12, 21, 25], "least": [1, 2, 3, 6, 13, 19, 26], "leav": [0, 5], "len": [6, 15, 24], "length": [0, 2, 4, 5, 15, 24], "less": 1, "let": 17, "level": [1, 15], "librari": [1, 15, 17, 20], "like": [1, 5, 12, 16, 17, 18, 19, 20, 26], "limit": 26, "line": [14, 18, 20, 26], "lipinski": 26, "list": [0, 1, 2, 3, 4, 5, 6, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 22, 24, 25], "literatur": 25, "liu": 12, "load": [0, 3, 4, 5, 6, 14, 17, 21, 24, 26], "load_dynamic_class": [0, 15], "load_from_config": [0, 3, 4, 5, 6], "load_model": [0, 15], "load_zinc": 26, "local": 15, "localhost": [15, 26], "localkerasmodel": [0, 15], "localonnxmodel": [0, 15], "locat": 26, "log": [0, 16, 21], "log_prefix": 15, "log_to_fil": 16, "logger": [0, 15], "look": [5, 6, 22], "lookup": [6, 26], "loop": 25, "loos": 5, "lose": 0, "lstm": [1, 5], "m": 13, "made": [13, 15], "mai": 3, "main": [0, 7, 12, 14, 20, 22], "mainli": 0, "make": [0, 5, 14], "make_dict": [0, 1], "make_hdf5_stock": [0, 14], "make_imag": [0, 1], "make_json": [0, 1], "make_molbloom": [0, 14], "make_molbloom_inchi": [0, 14], "make_mongo_stock": [0, 14], "make_stock": [0, 21], "make_subset": [3, 5], "make_uniqu": [0, 2], "make_visjs_pag": [0, 15], "manag": 15, "mani": 18, "manipul": [1, 22], "map": 2, "mapped_atom_bond": [0, 2], "mapped_mol": 2, "mapped_reaction_smil": [0, 2], "mapped_smil": 2, "mapping_to_index": [0, 2], "mapping_update_callback": 2, "margin": 15, "mark": [0, 12, 15], "mask": [4, 11, 17], "materi": [5, 16], "math": [0, 21], "matplotlib": 18, "matrix": 1, "matur": [10, 11, 13], "max": 5, "max_children": 16, "max_clust": 1, "max_rout": [9, 17, 19], "max_transform": [12, 16, 17, 24], "max_val": [3, 5], "maximis": 12, "maximum": [0, 1, 4, 5, 6, 9, 12, 16, 17, 25, 26], "maxtransformscorer": [3, 5], "mct": [0, 1, 5, 9, 16, 17], "mcts_group": 17, "mctsnode": [9, 12, 24, 25], "mctssearchtre": [1, 8, 9, 12, 25], "mctsstate": [9, 12, 25], "mctstreesearch": 25, "mean": 25, "memori": [6, 14, 26], "mention": 25, "messag": 16, "meta": 2, "metadata": [0, 1, 2, 21, 22], "method": [0, 2, 4, 6, 7, 12, 13, 14, 15, 17, 22, 24, 25, 26], "midpoint": 5, "might": [6, 25], "min": 5, "min_rout": [17, 19], "min_val": [3, 5], "minimis": 5, "minimum": [5, 6, 26], "minmax": 5, "minmaxscal": [3, 5], "minumum": 17, "miss": 17, "mixin": [6, 9, 26], "ml": 16, "mode": 20, "model": [0, 1, 4, 5, 13, 16, 17, 18, 19, 20, 21], "model_path": [1, 5, 13, 15, 19], "modifi": [2, 5, 9], "modul": [16, 17, 21, 22, 24, 26], "module_nam": 15, "mol": [0, 5, 6, 10, 11, 12, 13, 15, 21, 22, 26], "mol_nod": [0, 9, 10, 11, 13], "molbloom": 6, "molbloomfilterqueri": [3, 6], "molecul": [0, 1, 2, 4, 5, 6, 9, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21, 22, 26], "molecular": [2, 10, 12, 13, 17], "molecularai": 19, "molecularseri": 12, "molecule_cost": [13, 19], "molecule_stor": [2, 10, 12, 13], "molecule_to_imag": [0, 15], "moleculecost": [9, 13], "moleculedeseri": [0, 2, 10, 12, 13], "moleculeexcept": [0, 2, 15], "moleculenod": [9, 10, 11, 13], "molecules_to_imag": [0, 15], "moleculeseri": [0, 2, 10, 12, 13], "mongo": [0, 6, 14, 21], "mongocli": 15, "mongodb": [15, 26], "mongodb_stock": 26, "mongodbinchikeyqueri": [3, 6], "mont": [12, 20, 23], "more": [2, 3, 4, 6, 7, 17], "morgan": 2, "most": [11, 12, 22, 25], "mostli": 2, "multi": [1, 12], "multi_expansion_strategi": 19, "multiexpansionstrategi": [3, 4, 19], "multipl": [2, 3, 4, 12, 16], "must": [4, 6, 17], "my_db": 26, "my_full_polici": 17, "my_mol": 6, "my_polici": 17, "mycost": 13, "myexpansionstrategi": 4, "myfilterstrategi": 4, "mypackag": 5, "myscor": 5, "myurl": 26, "n": [17, 25], "n_cluster": 1, "name": [1, 3, 4, 5, 6, 13, 14, 15, 16, 17], "name_spec": 15, "nbit": 2, "nc2ccc": 22, "ncolumn": 12, "ndarrai": [1, 2, 15], "necessari": [0, 2, 6, 22], "need": [1, 2, 3, 5, 17, 18, 19, 20, 22, 24, 26], "neg": [4, 25], "neither": 2, "nest": [0, 12, 22], "network": [0, 1, 4, 12, 15, 20], "neural": [4, 15, 20], "never": [2, 25], "new": [0, 1, 2, 5, 10, 11, 12, 13, 14, 15, 18, 25], "newli": [5, 10, 13], "next": 0, "nmax": [0, 1], "nmin": [0, 1], "node": [0, 1, 5, 9, 15, 16, 17, 24, 25], "node1": 5, "node2": 5, "nodeunexpectedbehaviourexcept": [0, 15], "none": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 25], "none_molecul": [0, 2], "normalis": 5, "not_in_set_scor": 5, "not_in_stock_multipli": 5, "note": [0, 19, 25, 26], "notebook": [7, 20, 24], "np": 1, "npart": 15, "nproc": 16, "npz": 17, "number": [0, 1, 2, 4, 5, 6, 9, 11, 12, 13, 14, 15, 16, 17, 19, 24, 25, 26], "number_of_molecul": 6, "number_of_nod": 16, "number_of_precursor": 16, "number_of_precursors_in_stock": 16, "number_of_rout": 16, "number_of_solved_rout": 16, "number_of_step": 16, "numberofprecursorsinstockscor": [3, 5], "numberofprecursorsscor": [3, 5], "numberofreactionsscor": [3, 5], "numer": [2, 6], "numpi": [5, 13, 17], "nx": 15, "o": [6, 20, 22], "object": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 15, 18, 22, 23, 24, 25, 26], "obtain": [1, 2, 3, 5, 6, 15], "oc": 20, "occur": 26, "occurr": [5, 24], "off": [4, 17], "offset": 5, "onc": [12, 15], "one": [1, 2, 3, 4, 5, 6, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 24, 25, 26], "one_iter": [0, 9, 10, 11, 12, 13, 25], "ones": 3, "onli": [0, 2, 3, 4, 5, 12, 14, 15, 17, 22, 25, 26], "onnx": [15, 17], "open": [18, 26], "oper": 2, "opposit": [0, 25], "optim": 1, "option": [0, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 22, 26], "oracl": 19, "orang": [0, 1, 15], "order": [0, 1, 5], "orient": 16, "origin": [6, 13], "original_smil": 2, "other": [0, 2, 4, 5, 6, 13, 14, 16, 17, 19, 26], "other_source_scor": 5, "otherwis": [0, 1, 15, 17], "out": [5, 15, 16, 22, 25], "outcom": 2, "outedgeview": 15, "outer": 25, "outlin": 19, "output": [4, 5, 8, 14, 15, 18, 20, 26], "output_nam": 15, "output_s": 15, "output_widget": 8, "over": [0, 5, 11, 16], "overal": 25, "overridden": 4, "overwrit": 3, "own": [12, 22], "owner": [11, 12], "packag": [17, 20, 21, 26], "package_nam": 15, "package_path": [0, 15], "pad": 15, "page": [1, 15, 19, 22, 23, 25], "pair": [1, 2, 5, 15, 17], "panda": [6, 14, 16, 17, 22], "paper": 9, "param": [0, 1, 2, 4, 5, 6, 13, 14, 15], "paramat": 6, "paramet": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17], "parent": [0, 2, 5, 9, 10, 11, 12, 13], "parent_molecul": [0, 21], "pareto": [1, 8, 12], "pareto_front": [0, 1, 7], "pareto_fronts_plot": [7, 8], "paretofrontsgui": [7, 8], "paretomctsnod": [9, 12], "pars": 0, "part": [0, 2, 10, 11, 12, 13, 15], "partial": 17, "particular": 12, "pass": [1, 2, 3, 5, 15, 25], "password": 15, "past": 0, "path": [0, 3, 4, 5, 6, 7, 10, 12, 13, 14, 16, 17, 18, 20, 21, 25, 26], "path_to": [9, 12], "path_to_model": [4, 6, 15], "path_to_templ": 4, "pd": [15, 16, 22], "per": [5, 12, 19], "perform": [0, 1, 9, 10, 11, 12, 13, 15, 16, 18, 20, 22], "perhap": 26, "phase": [24, 25], "pick": 25, "pickl": [13, 15, 19], "pictor": 1, "pictori": 0, "pictur": 25, "pil": 12, "pilcolor": 15, "pilimag": [0, 1, 15], "place": 1, "plain": [14, 24, 26], "plan": [12, 20], "plot": 8, "plugin": 19, "pn": 11, "pn_threshold": 11, "png": 16, "point": [7, 14, 25], "polici": [0, 3, 11, 12, 15, 16, 17, 18, 20, 22, 25], "policy_used_count": 16, "policyexcept": [0, 4, 15], "poll": 15, "poll_freq": 15, "port": 15, "possibl": [0, 6, 11, 16, 18, 20, 25, 26], "post": [16, 17, 24], "post_process": [0, 3, 16, 17, 19], "potenti": [4, 12], "pre": [0, 1, 4, 5, 6, 10, 11, 13, 16, 17, 24], "pre_process": 16, "precursor": [20, 24, 25], "precursors_avail": 16, "precursors_in_stock": 16, "precursors_not_in_stock": 16, "predecessor": 0, "predict": [0, 4, 13, 15], "prefix": 15, "prepare_tre": [0, 21], "present": 2, "press": [18, 20], "pretti": 15, "prevent": [17, 25], "previous": 17, "price": [3, 5, 6, 24, 26], "price_col": 6, "price_column": 6, "pricesumscor": [3, 5], "print": [16, 20], "prior": [0, 4, 12, 17], "prioriti": 0, "probabl": [0, 4, 17, 25], "process": [12, 15, 16, 17, 24], "produc": [0, 2, 15, 17, 25], "product": [2, 5], "profil": 16, "progress": 0, "promis": [11, 12, 25], "promising_child": [9, 11, 12, 25], "prompt": 20, "proof": 11, "prop": [0, 9, 10, 11, 13], "propag": 13, "proper": 15, "properli": 26, "properti": [0, 1, 2, 3, 6, 9, 10, 11, 12, 13, 18], "proven": [9, 11], "provid": [0, 2, 4, 5, 6, 7, 13, 15, 16, 17, 18, 20, 22, 26], "prune_cycles_in_search": 17, "public": [0, 12, 14, 20], "publicli": [9, 10, 11, 13], "purchas": [20, 24], "purpos": 25, "put": [1, 14, 22], "pwd": 26, "py": 26, "python": 26, "pythonpath": [19, 26], "pytorch": 13, "q": 12, "queri": [0, 3, 4, 26], "query_bond": 2, "quick": [4, 17, 22], "quickkerasfilt": [3, 4], "quot": 20, "r": [13, 26], "radiu": [2, 13, 15], "rais": [0, 1, 2, 3, 4, 5, 6, 10, 11, 12, 13, 15, 19], "raise_except": 2, "randomli": 12, "rank": [0, 1, 16, 18, 19, 20, 25], "rc": 17, "rd_mol": [2, 15, 26], "rd_reaction": [0, 2], "rdchiral": [2, 4, 17], "rdkit": [2, 6, 15, 17, 26], "rdmol": 2, "rdreaction": 2, "re": [1, 2, 15], "reach": [12, 25], "reactant": [0, 2, 4, 11, 16, 22], "reactants_smil": 22, "reactants_str": 2, "reactantscountfilt": [3, 4], "reaction": [0, 1, 4, 5, 9, 10, 11, 12, 13, 15, 16, 17, 18, 20, 21, 22, 24, 25], "reaction_class_set": 5, "reaction_cost": 5, "reaction_tre": 1, "reaction_tupl": 22, "reactionclassmembershipscor": [3, 5], "reactionnod": [9, 10, 11, 13], "reactions_tre": 1, "reactiontre": [1, 5, 9, 10, 11, 12, 13, 16, 21, 24], "reactiontreefromandortrac": [0, 9], "reactiontreefromdict": [0, 21], "reactiontreefromexpans": [0, 21], "reactiontreefromsupernod": [9, 12], "reactiontreeload": [0, 9, 12, 21], "read": [15, 16, 25], "read_datafil": [0, 15], "read_json": 16, "readabl": 17, "readlin": 26, "recommend": 22, "recreat": [1, 12, 17], "rectangl": 15, "rectified_linear_unit": [0, 15], "recurs": [0, 20, 25], "refer": [0, 2, 5, 17, 18], "regardless": 6, "reject": [4, 15, 25], "rejectionexcept": [0, 4, 15], "relat": 15, "relationship": 22, "relu": 15, "remot": [4, 15, 17], "remov": [0, 2, 6, 15], "remove_atom_map": [0, 2], "replac": 1, "repres": [2, 10, 11, 12, 13, 15], "represent": [0, 1, 2, 10, 11, 12, 13, 15], "requir": [5, 24], "rescale_prior": [4, 17], "rescor": [0, 1], "reset": 4, "reset_cach": [3, 4], "reset_exclusion_list": [3, 6], "resiz": 15, "respect": [2, 4, 26], "respons": [0, 23], "rest": [15, 25], "result": [0, 1, 16, 20, 22], "retain": 17, "retriev": [2, 25], "retro": [2, 13, 15], "retro_templ": 17, "retroreact": [0, 2, 4, 10, 11, 12, 13, 25], "retrostar": [0, 9, 19], "retrostar_value_model": 19, "retrostarcost": [9, 13, 19], "retrosynthesi": [0, 2, 19, 20, 23], "retrosynthet": 20, "return": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 19, 24, 25, 26], "return_al": [0, 1], "return_first": 17, "return_n": 0, "reus": 15, "revers": [3, 5], "reward": [5, 12, 16], "rewards_cum": 12, "ringbreak": 19, "rn": 13, "robot": 12, "rollout": [12, 25], "root": [0, 1, 9, 10, 11, 12, 13, 25], "root_nod": 9, "root_smil": [9, 10, 11, 12, 13], "round": 15, "rout": [0, 5, 8, 9, 10, 11, 12, 13, 15, 16, 17, 18, 20, 21, 22, 24], "route0": 1, "route000": 16, "route001": 16, "route_displai": [7, 8], "route_dist": 1, "route_distance_calcul": 1, "route_distance_model": [16, 17], "route_metadata": 1, "route_scor": [17, 19], "route_to_nod": [9, 12], "routecollect": [0, 1, 8], "routecostscor": [3, 5], "routeimagefactori": [0, 15], "routes_path": 5, "routeselectionargu": [0, 1], "routesimilarityscor": [3, 5], "routin": [1, 2, 4, 5, 6, 7, 10, 11, 12, 14, 15], "row": [6, 12, 16, 20, 26], "run": [15, 16, 18, 20], "sai": 17, "same": [0, 1, 2, 4, 5, 10, 17], "sanit": [0, 2, 15], "sanitiz": 6, "save": [6, 14, 15, 16, 26], "save_datafil": [0, 15], "save_molecule_imag": [0, 15], "sc": [5, 15], "sc_delta": [3, 5], "sc_score": [0, 21], "sc_score_model": 5, "scale": 5, "scale_factor": [3, 5], "scaler": 5, "scaler_param": 5, "sci": [5, 24], "scienc": 12, "score": [0, 1, 3, 13, 15, 16, 17, 18, 19, 20, 25], "score_vector": [3, 5], "scorer": [0, 1, 3, 8, 12, 13, 15, 17, 24], "scorer_nam": [3, 5], "scorercollect": [3, 5, 8], "scorerexcept": [0, 5, 15], "scorers_config": 5, "screen": 16, "script": [14, 19, 20], "scscore": [0, 5, 15], "scscorer": 15, "search": [0, 1, 3, 4, 5, 6, 7, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 26], "search_reward": [17, 19], "search_rewards_weight": 17, "search_stat": 0, "search_tim": 16, "search_tre": [0, 1, 9, 19], "searchtre": [9, 10, 11, 13, 19], "second": [0, 13, 15, 16, 17, 22, 25], "section": 17, "see": [16, 17, 18, 19, 20, 25], "seen": 17, "select": [0, 1, 3, 4, 5, 6, 12, 13, 16, 17, 18, 20, 22, 25], "select_al": [0, 3], "select_first": [0, 3], "select_last": [0, 3], "select_leaf": [9, 12, 25], "self": [24, 26], "semi": 16, "sent": 4, "separ": [2, 6, 9, 16], "sequenc": [1, 2, 4, 5, 10, 11, 12, 13, 15, 22], "seral": [10, 13], "serial": [0, 9, 10, 11, 12, 13, 21], "serialize_act": [0, 2], "serv": 15, "server": [4, 15, 17], "servic": 19, "set": [0, 2, 3, 4, 5, 6, 9, 10, 11, 12, 13, 15, 17, 19, 22, 25, 26], "set_stop_criteria": [3, 6], "setup": [0, 5, 7, 15, 24, 26], "setup_logg": [0, 15], "sever": [1, 5], "sha224": 0, "shallow": 2, "shape": 5, "share": 5, "shell": [22, 26], "shibukawa": 9, "short": 17, "should": [0, 2, 4, 5, 6, 7, 10, 11, 13, 15, 17, 20, 25, 26], "show": [0, 15, 16, 18, 20, 23, 25], "show_al": [0, 15], "show_progress": 0, "shown": [17, 18], "sigmoid": [0, 5, 15], "signal": 15, "silent": 5, "similar": [5, 15], "similarli": 25, "simpl": [1, 5, 16, 18, 20, 26], "simplest": 16, "simpli": 25, "simplifi": 25, "singl": [0, 1, 2, 3, 6, 12, 16, 17, 18, 20], "size": [14, 15], "slope": [3, 5], "small": 5, "smart": 2, "smi": 26, "smile": [0, 1, 2, 6, 10, 11, 12, 13, 14, 15, 16, 18, 19, 20, 22, 26], "smiles2stock": [14, 17, 26], "smiles_bas": 6, "smiles_in_stock": [3, 6], "smiles_list": 14, "smilesbasedretroreact": [0, 2, 4], "so": 2, "softmax": [0, 4, 15, 17], "solut": [1, 10, 11, 12, 13, 16, 17], "solv": [1, 12, 13, 16, 17, 19, 25], "some": [2, 6, 9, 12, 18, 19, 20, 23, 25, 26], "someth": [16, 19], "soon": 17, "sort": [0, 1, 2, 3, 5, 18, 25], "sort_bond": [0, 15], "sourc": [0, 3, 4, 5, 6, 15, 26], "source_scor": 5, "source_tag": 14, "space": 15, "special": 2, "specif": [1, 5, 15], "specifi": [2, 3, 4, 5, 6, 12, 16, 17, 19, 20, 26], "split": [9, 15, 16, 26], "split_fil": [0, 15], "splitandortre": [0, 9], "squar": 1, "squash": 5, "squashscal": [3, 5], "stai": 4, "standard": [12, 15], "stare": 16, "start": [0, 5, 11, 15, 16, 19], "start_process": [0, 15], "stat": [12, 18, 22], "state": [0, 5, 9, 10, 11, 13, 17, 19, 24, 25], "statescor": [1, 3, 5], "statist": [0, 1, 16, 20], "stead": 15, "step": [5, 11, 12, 17, 18, 20, 24, 25], "stereochemistri": 2, "still": 15, "stock": [0, 3, 5, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 25], "stock1": 17, "stock_avail": [9, 12], "stock_db": [6, 26], "stock_inchikei": [3, 6], "stock_info": [0, 16, 21], "stockavailabilityscor": [3, 5], "stockexcept": [0, 6, 15], "stockquerymixin": [3, 6, 26], "stop": 6, "stop_criteria": [3, 6, 26], "stopiter": [10, 11, 13], "store": [0, 1, 2, 5, 14, 20, 26], "str": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], "strategi": 4, "strdict": [0, 1, 2, 3, 5, 9, 10, 11, 12, 13, 15], "string": [0, 1, 2, 6, 12, 22, 26], "strip": 26, "structur": [0, 3, 9], "stub": [10, 13], "sub": [1, 2, 3, 4, 5, 6, 10, 11, 12, 13, 15, 26], "sub_stock": 6, "subclass": 26, "submit": 4, "submodul": 21, "subpackag": 21, "subset": [5, 26], "subset_nam": 5, "substitut": 0, "subtre": [0, 21], "suffici": [0, 17], "suggest": [4, 17, 20], "suitabl": 2, "sum": [4, 5, 12, 24], "summat": 5, "suppli": 16, "support": [2, 11, 26], "suppos": 0, "sure": 0, "symbol": 6, "synthes": [13, 24], "synthet": [1, 5, 15], "system": 12, "t": [4, 13, 26], "tabl": [6, 15, 16, 17], "tag": 26, "take": [0, 2, 5, 15, 25, 26], "taken": [3, 12, 13, 14, 15, 17, 26], "tar": [1, 15], "tarbal": 1, "target": [0, 1, 2, 15, 16, 17, 18, 19, 20, 22, 26], "target_mol": [0, 2, 21], "target_smil": [0, 21, 22], "target_valu": [9, 13], "task": 16, "ted": 1, "templat": [2, 4, 5, 17, 19, 20, 24, 25], "template_column": [4, 17], "templatebaseddirectexpansionstrategi": [3, 4], "templatebasedexpansionstrategi": [3, 4], "templatedretroreact": [0, 2, 4], "templatefil": 4, "temporari": 15, "tensorflow": [4, 15, 17], "termin": [10, 11, 12, 13, 16, 17, 25], "text": [6, 14, 15, 16, 17, 20, 25, 26], "tf": 15, "than": [1, 2, 5, 19], "thei": [1, 5, 12, 15], "them": [0, 1, 6, 12, 15, 17, 22, 25, 26], "themselv": 12, "therebi": [1, 2, 26], "therefor": [2, 15, 25], "thi": [0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 24, 25, 26], "thing": 25, "third": 25, "those": 4, "though": 12, "three": 26, "threshold": [11, 17], "through": [15, 18], "time": [0, 15, 16], "time_limit": 17, "timeout": 1, "tl": 15, "tls_certs_path": 15, "to_dict": [0, 1, 2, 21], "to_imag": [0, 9, 12, 16, 21], "to_json": [0, 21], "to_reaction_tre": [9, 12], "to_smiles_based_retroreact": [0, 2], "to_visjs_pag": [0, 1], "togeth": 19, "too": 5, "took": 5, "tool": [0, 16, 17, 18, 20, 21, 26], "top": [0, 1, 16, 18, 20, 25], "top_scor": 16, "total": [5, 16], "trace": 9, "track": [2, 15], "train": [4, 17, 20], "transform": [1, 2, 5, 12, 16, 24, 25], "travers": 12, "treat": 17, "tree": [0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 24, 26], "tree_analysi": [0, 21], "tree_dict": 0, "tree_nam": 15, "tree_search": [0, 21, 22], "tree_statist": [0, 1], "treeanalysi": [0, 1], "treeanalysisexcept": [0, 15], "treee": 0, "treemolecul": [0, 2, 4, 10, 11, 12, 13], "treenodemixin": [0, 9, 10, 13], "trees_for_first_target": 16, "trees_nam": 15, "tri": 15, "trigger": 1, "true": [0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 15, 17, 19, 25], "try": [15, 17], "tupl": [0, 1, 2, 4, 5, 12, 13, 15], "turn": 25, "twice": 11, "two": [1, 2, 4, 17, 20, 26], "txt": [16, 19, 20], "type": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 23, 26], "type_util": [0, 21], "typic": [7, 23], "u": 12, "ucb": 25, "unbroken": 5, "under": [13, 19], "underli": 12, "understand": 25, "unexpand": [12, 25], "unexpectedli": 15, "unfamiliar": 18, "union": [0, 1, 2, 3, 6, 8, 12, 15], "uniqu": [2, 14, 17], "uniquemolecul": [0, 2], "unit": 0, "uniti": 4, "unless": 3, "unqueri": [0, 2], "unsolv": 19, "until": [12, 16, 25], "up": [1, 2, 5, 6, 11, 18], "updat": [0, 1, 2, 9, 11, 12, 13, 24, 25], "upon": [2, 4, 15, 17], "upper": [9, 17, 25], "us": [0, 1, 2, 4, 5, 6, 7, 10, 11, 12, 13, 15, 16, 17, 18, 20, 22, 23, 24, 25, 26], "usag": 16, "use_prior": 17, "use_rdchir": [4, 17], "use_remote_model": [4, 15, 17], "user": [0, 15, 22, 26], "usernam": 15, "uspto": [17, 19, 20, 22], "uspto_expans": 17, "uspto_ful": 17, "uspto_keras_model": 19, "uspto_ringbreaker_keras_model": 19, "uspto_ringbreaker_unique_templ": 19, "uspto_templ": 17, "uspto_unique_templ": 19, "util": [0, 2, 3, 7, 9, 20, 21], "utilis": 11, "v": 13, "v_t": 13, "val": 5, "valu": [0, 2, 3, 4, 5, 6, 12, 13, 15, 16, 17, 19, 25], "value_estim": 12, "valueerror": [0, 1, 3, 12, 15], "variabl": [0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 15, 17], "variou": [1, 3, 10, 11, 13, 25], "vector": [4, 5, 15, 17], "vertic": 12, "vi": [1, 15], "via": 15, "view": 12, "visit": [12, 25], "visual": 1, "w": 12, "wa": [0, 4, 6, 10, 11, 12, 13, 16], "wai": [0, 4, 12, 25, 26], "wait": 15, "want": [18, 20, 22], "we": [25, 26], "weight": [0, 2, 4, 5, 12, 13, 15, 17], "weighted_scor": [3, 5], "well": [1, 22, 26], "were": [12, 25], "what": [0, 6, 8, 16, 25], "when": [1, 2, 5, 6, 12, 13, 15, 16, 17, 18, 20, 24, 25], "where": [2, 4, 5, 16, 18, 20, 22, 26], "wherea": [17, 20], "wherebi": 17, "whether": 4, "which": [2, 4, 6, 10, 12, 17, 18, 20, 25, 26], "while": 25, "white": 15, "widget": [7, 8], "wise": 5, "within": [0, 20], "without": [2, 12, 19], "word": 1, "work": [15, 26], "worth": 25, "would": 15, "wrapper": 2, "write": [5, 15, 22, 26], "written": [16, 20], "x": [5, 15], "xoffset": [3, 5], "y": 5, "yaml": [0, 3, 7, 18, 20], "yield": [0, 14, 26], "yml": [15, 16, 17, 18, 19, 20, 22, 24, 26], "yoffset": [3, 5], "you": [5, 16, 17, 18, 19, 20, 22, 26], "your": [20, 22], "zero": 13, "zeromoleculecost": [9, 13], "zinc": [17, 20, 22, 26], "zinc_stock": 17}, "titles": ["aizynthfinder package", "aizynthfinder.analysis package", "aizynthfinder.chem package", "aizynthfinder.context package", "aizynthfinder.context.policy package", "aizynthfinder.context.scoring package", "aizynthfinder.context.stock package", "aizynthfinder.interfaces package", "aizynthfinder.interfaces.gui package", "aizynthfinder.search package", "aizynthfinder.search.breadth_first package", "aizynthfinder.search.dfpn package", "aizynthfinder.search.mcts package", "aizynthfinder.search.retrostar package", "aizynthfinder.tools package", "aizynthfinder.utils package", "Command-line interface", "Configuration file", "Graphical user interface", "How-to", "aizynthfinder documentation", "aizynthfinder", "Python interface", "Relationships", "Scoring", "Sequences", "Stocks"], "titleterms": {"add": 24, "advanc": 17, "aizynthapp": 7, "aizynthcli": 7, "aizynthfind": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 21], "analys": [16, 18], "analysi": [1, 23, 25], "andor_tre": 9, "awar": 19, "bond": 15, "breadth_first": 10, "carlo": 25, "cat_output": 14, "chem": 2, "chemform": 19, "cluster": [8, 18], "collect": [3, 5], "command": 16, "config": 3, "configur": 17, "content": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], "context": [3, 4, 5, 6], "cost": 13, "creat": 18, "criteria": 26, "custom": 26, "databas": 26, "dfpn": 11, "disconnect": 19, "document": 20, "download_public_data": 14, "except": 15, "expans": [19, 22], "expansion_strategi": 4, "file": [15, 17], "filter_strategi": 4, "function": 24, "further": 22, "graphic": 18, "gui": 8, "how": 19, "imag": 15, "interfac": [7, 8, 16, 18, 22], "introduct": 20, "line": 16, "load": 15, "log": 15, "make": 26, "make_stock": 14, "math": 15, "mct": [12, 19], "mo": 19, "model": 15, "modul": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], "mol": 2, "mongo": [15, 26], "mont": 25, "more": 19, "multi": 19, "multipl": 19, "new": 24, "node": [10, 11, 12, 13], "notebook": 18, "object": 19, "output": [16, 19], "packag": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], "pareto_front": 8, "path": 15, "polici": [4, 19], "post": [23, 25], "process": [23, 25], "python": 22, "queri": 6, "reaction": 2, "reactiontre": 0, "read": 22, "relationship": 23, "result": 18, "retro": 19, "retrostar": 13, "rout": [1, 19], "run": 19, "sc_score": 15, "score": [5, 24], "scorer": 5, "search": [9, 10, 11, 12, 13, 23, 25], "search_tre": [10, 11, 13], "sequenc": 25, "serial": 2, "simpl": 17, "specif": 16, "state": 12, "stock": [6, 26], "stop": 26, "submodul": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], "subpackag": [0, 3, 7, 9], "tool": 14, "tree": [23, 25], "tree_analysi": 1, "type_util": 15, "us": 19, "usag": 17, "user": 18, "util": [1, 4, 8, 12, 15]}}) \ No newline at end of file diff --git a/sequences.html b/sequences.html new file mode 100644 index 0000000..90e9c77 --- /dev/null +++ b/sequences.html @@ -0,0 +1,210 @@ + + + + + + + + Sequences — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

Sequences

+

This page shows some sequence diagrams to aid in the understanding of how information +is passed between different objects in the Monte Carlo tree search. +The sequences are simplified, but explains the overall picture. +The flow of information / method call should be read top-down.

+
+

Analysis / post-processing

+

This sequence explains how the AiZynthFinder object exports the top-ranked reaction tree +as a JSON. Note, this is only one possible sequence for analysis of the trees.

+_images/analysis-seq.png +
+ +
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/stocks.html b/stocks.html new file mode 100644 index 0000000..19203c4 --- /dev/null +++ b/stocks.html @@ -0,0 +1,223 @@ + + + + + + + + Stocks — aizynthfinder 4.3.1 documentation + + + + + + + + + + + + + + + + + +
+ + +
+
+ + +
+ +
+

Stocks

+

The stock files specified in the configuration file are loaded and a set of inchi keys +are stored in-memory for lookup. However, the tool supports other stock queries as well as a way +to fully customize the lookup.

+
+

Mongo database stock

+

First, support for lookup inchi keys in a Mongo database is supported. The Mongo client should +have a database and a collection containing documents with at least two fields: inchi_key and source. +The inchi_key field will be used for lookup and source specifies the source database of the compound.

+

By adding these lines to the configuration file, the Mongo database will be used:

+
stock:
+    type: mongodb
+    host: user@myurl.com
+    database: database_name
+    collection: compounds
+
+
+

If no options are provided to the mongodb_stock key, the host, database and collection are taken to be localhost, +stock_db, and molecules, respectively.

+
+
+

Stop criteria

+

The stock can be used to stop the tree search based on three criteria: a) minimum price, b) maximum amount and c) count of different elements in the molecule. +Note that the stock query class need to support querying for price and amount, if the stop criteria should work properly.

+

The stop criteria can be specified in the configuration file

+
stock:
+    stop_criteria:
+        price: 10
+        counts:
+            C: 10
+
+
+

In the Jupyter GUI you can set the limit on the element occurences, but currently not the price and amount limits.

+
+
+

Custom stock

+

Support for any type of lookup is provided. You just need to write a python class that implements the __contains__ +and subclasses the aizynthfinder.context.stock.queries.StockQueryMixin. The __contains__ method is used for lookup and should take a Molecule object as only argument. +The StockQueryMixin mixin class provide a default interface for some methods that perhaps isn’t possible to implement in all query classes.

+

This is an example:

+
from rdkit.Chem import Lipinski
+from aizynthfinder.context.stock.queries import StockQueryMixin
+class CriteriaStock(StockQueryMixin):
+    def __contains__(self, mol):
+        return Lipinski.HeavyAtomCount(mol.rd_mol) < 10
+
+
+

To use this stock with the aizynthcli tool, save it in a custom_stock.py module that is located in a directory known to +the python interpreter. Add this line to the module.

+
stock = CriteriaStock()
+
+
+

and it will be automatically used in the tree search.

+

Alternatively the custom query class can be used by the aizynthapp tool.

+
from aizynthfinder import AiZynthApp
+configfile="config_local.yml"
+app = AiZynthApp(configfile, setup=False)
+app.finder.stock.load(CriteriaStock(), "criteria") # This loads the custom stock class
+app.setup()
+
+
+

Lastly, it is possible to specify a custom stock class in the configuration file if it is located in a module that +is known by the python interpreter.

+
stock:
+    type: aizynthfinder.contrib.stocks.CriteriaStock
+
+
+

can be used if the aizynthfinder.contrib.stocks is an existing sub-package and module.

+
+
+

Making stocks

+

We provide a tool to create inchi key-based stocks from SMILES strings. Thereby, one +can create a stock based on for instance a subset of the ZINC database.

+

The tool support both creating a stock in HDF5 format or adding them to an existing Mongo database.

+

The tool is easiest to use if one has a number of plain text files, in which each row has one SMILES.

+

Then one can use one of these two commands:

+
smiles2stock --files file1.smi file2.smi --output stock.hdf5
+smiles2stock --files file1.smi file2.smi --output my_db --target mongo
+
+
+

to create either an HDF5 stock or a Mongo database stock, respectively. The file1.smi and file2.smi +are simple text files and my_db is the source tag for the Mongo database.

+

If one has SMILES in any other format, one has to provide a custom module that extract the SMILES from +the input files. This is an example of such a module that can be used with downloads from the Zinc database +where the first row contains headers and the SMILES are the first element on each line.

+
def extract_smiles(filename):
+    with open(filename, "r") as fileobj:
+        for i, line in enumerate(fileobj.readlines()):
+            if i == 0:
+                continue
+            yield line.strip().split(" ")[0]
+
+
+

if this is saved as load_zinc.py in a path that is known to the Python interpreter, it can be +used like this

+
export PYTHONPATH=`pwd`
+smiles2stock --files load_zinc file1.smi file2.smi --source module --output stock.hdf5
+
+
+

where the first line adds the current directory to the python path (if you are using a Bash shell).

+
+
+ + +
+ +
+
+
+
+ + + + + + + \ No newline at end of file