schrodinger.application.pathfinder.analysis module

A module to perform retrosynthetic analysis.

Examples:

# retrosynthetic analysis
reactions = reaction.read_reactions_file('reactions.json')
retrosynthesis = analysis.retrosynthesize(amide, reactions)
print(retrosynthesis.asString())
for route in retrosynthesis.getRoutes():
    print(route.asString())
    print("Starting materials:")
    for sm in route.getStartingNodes():
        print("-", sm)
    route.write('route.json')
class schrodinger.application.pathfinder.analysis.RetrosynthesisState(mols_analyzed, depth, done, tree)

Bases: tuple

__contains__

Return key in self.

__init__

Initialize self. See help(type(self)) for accurate signature.

__len__

Return len(self).

count(value) → integer -- return number of occurrences of value
depth

Depth of the last node to be analyzed (int)

done

Flag indicating whether the analysis ran to completion (bool)

index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

mols_analyzed

Number of molecules analyzed so far (int)

tree

Retrosynthetic tree (RetrosynthesisNode)

schrodinger.application.pathfinder.analysis.retrosynthesize(*a, **d)

Convenience wrapper for retrosynthesize_gen for backward compatibility. Takes takes the same arguments as retrosynthesize_gen and returns a RetrosynthesisNode.

schrodinger.application.pathfinder.analysis.retrosynthesize_gen(target_mol, reactions_dict, max_depth=1, exclude=None, require_bonds=None, frozen_atoms=None, broken_bonds=None, fragments=None, label_attachment_atoms=False)

Generate a retrosynthetic tree to the desired depth based on the target molecule. This function is a generator which yields after analyzing each molecule (node in the tree). The search is done breadth-first and the caller can break out at any time, getting a valid (but possibly incomplete) tree.

Parameters:
  • reactions_dict (dict {str: Reaction}) – Reaction dictionary by name.
  • exclude (set of str) – Set of tags or reaction names to exclude. Tags are matched exactly; names are matched using shell globbing (*, ?, []).
  • require_bonds (set of tuple of int) – If provided, only reactions which break at least one bond in this set will be used for the analysis. Each bond is a sorted tuple of two 1-based atom indexes.
  • frozen_atoms (set of int) – If provided, reactions which break any bond between two atoms in this set are skipped.
  • broken_bonds ({(int, int): set(str)}) – If provided, this dict will be filled with a bond: reactions mapping, where a bond is a pair of atom indexes, and the reactions a set of strings (reaction names) for all the bonds that were broken during the analysis.
  • fragments (set of tuple of int) – If provided, this set will be filled with tuples of atom indexes for the fragments identified during the analysis. “Fragment” here is understood as a subset of atoms in the original molecule that is also present in a precursor.
  • label_attachment_atoms – if true, add atom mapping numbers to “attachment atoms”, which are atoms that were present in the target molecule and which were involved in any broken bond.
Returns:

yields a RetrosynthesisState after analyzing each molecule. The current tree can be found in the .tree property of the state object. NOTE: the same (evolving) tree object is returned with each state! This is for efficiency reasons and because there’s not a strong use case for keeping a “trajectory”.

Return type:

generator of RetrosynthesisState

schrodinger.application.pathfinder.analysis.reaction_is_excluded(reaction, exclude)

Check if a reaction meets any of the exclusion criteria.

Parameters:exclude (set of str) – Set of tags or reaction names to exclude. Tags are matched exactly; names are matched using shell globbing (*, ?, []).
Returns:True if reaction is meets any of the exclusion criteria
Return type:bool
schrodinger.application.pathfinder.analysis.filter_reactions(reactions, exclude)

Return a shallow copy of a list of reactions, filtering out those matching any of the exclusion criteria.

Parameters:exclude (set of str) – Set of tags or reaction names to exclude. Tags are matched exactly; names are matched using shell globbing (*, ?, []).
Return type:list of reaction