perses.rjmc.topology_proposal.SmallMoleculeAtomMapper¶
-
class
perses.rjmc.topology_proposal.
SmallMoleculeAtomMapper
(list_of_smiles: List[str], atom_match_expression: int = None, bond_match_expression: int = None, prohibit_hydrogen_mapping: bool = True)[source]¶ This is a utility class for generating and retrieving sets of atom maps between molecules using OpenEye. It additionally verifies that all atom maps lead to valid proposals, as well as checking that the graph of proposals is not disconnected.
Attributes: - n_molecules
- proposal_matrix
- smiles_list
Methods
from_json
(json_string)Restore this class from a saved JSON file. generate_and_check_proposal_matrix
()Generate a proposal matrix and check it for connectivity. get_atom_maps
(smiles_A, smiles_B)Given two canonical smiles strings, get the atom maps. get_oemol_from_smiles
(smiles_string)Get the OEMol corresponding to the smiles string requested. get_smiles_index
(smiles)Get the index of the smiles in question map_all_molecules
()Run the atom mapping routines to get all atom maps. molecule_library_from_string
(molecule_string)Given a library of molecules in a mol2-format string, return a dictionary that maps the respective canonical smiles to the oemol object. molecule_library_to_string
(molecule_library)Given a list of oechem.OEMol objects, write all of them in mol2 format to a string to_json
()Write out this class to JSON. -
__init__
(list_of_smiles: List[str], atom_match_expression: int = None, bond_match_expression: int = None, prohibit_hydrogen_mapping: bool = True)[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
(list_of_smiles, …)Initialize self. from_json
(json_string)Restore this class from a saved JSON file. generate_and_check_proposal_matrix
()Generate a proposal matrix and check it for connectivity. get_atom_maps
(smiles_A, smiles_B)Given two canonical smiles strings, get the atom maps. get_oemol_from_smiles
(smiles_string)Get the OEMol corresponding to the smiles string requested. get_smiles_index
(smiles)Get the index of the smiles in question map_all_molecules
()Run the atom mapping routines to get all atom maps. molecule_library_from_string
(molecule_string)Given a library of molecules in a mol2-format string, return a dictionary that maps the respective canonical smiles to the oemol object. molecule_library_to_string
(molecule_library)Given a list of oechem.OEMol objects, write all of them in mol2 format to a string to_json
()Write out this class to JSON. Attributes
n_molecules
proposal_matrix
smiles_list
-
classmethod
from_json
(json_string: str)[source]¶ Restore this class from a saved JSON file.
Returns: - atom_mapper : SmallMoleculeAtomMapper
An instance of the SmallMoleculeAtomMapper
-
generate_and_check_proposal_matrix
()[source]¶ Generate a proposal matrix and check it for connectivity. Note that if constraints have not been checked, this may produce a proposal matrix that makes proposals changing constraint lengths.
-
get_atom_maps
(smiles_A: str, smiles_B: str) → List[Dict][source]¶ Given two canonical smiles strings, get the atom maps.
Returns: - atom_maps : list of dict
List of map of molecule_A_atom : molecule_B_atom
-
get_oemol_from_smiles
(smiles_string: str) → openeye.oechem.OEMol[source]¶ Get the OEMol corresponding to the smiles string requested. This method exists to avoid having atom order rearranged by regeneration from smiles.
Returns: - mol : oechem.OEMol
The OEMol corresponding to the requested smiles string.
-
get_smiles_index
(smiles: str) → int[source]¶ Get the index of the smiles in question
Returns: - mol_index : int
Index of molecule in list
-
map_all_molecules
()[source]¶ Run the atom mapping routines to get all atom maps. This automatically preserves only maps that contain enough torsions to propose. It does not ensure that constraints do not change–use verify_constraints to check that property. This method is idempotent–running it a second time will have no effect.
-
static
molecule_library_from_string
(molecule_string: str) → Dict[str, openeye.oechem.OEMol][source]¶ Given a library of molecules in a mol2-format string, return a dictionary that maps the respective canonical smiles to the oemol object.
Parameters: - molecule_string : str
The string containing the molecule data
Returns: - molecule_dictionary : dict of str: oemol
Dictionary mapping smiles strings to OEMols
-
static
molecule_library_to_string
(molecule_library: List[openeye.oechem.OEMol]) → str[source]¶ Given a list of oechem.OEMol objects, write all of them in mol2 format to a string
Parameters: - molecule_library : list of oechem.OEMol
molecules to write to string
Returns: - molecule_string : str
String containing molecules in mol2 format.