schrodinger.application.canvas.r_group module¶
Detect r-groups from CanvasMCS, CombiGlide, or SMARTS r_group.py
Description: A module that contains function to detect r-groups. The core is determined either from CombiGlide results, a user-submitted SMARTS pattern, or a Canvas Maximum Common Substructure. These functions were split from python/scripts/r_group_analysis.py
Copyright Schrodinger, LLC. All rights reserved.
-
class
schrodinger.application.canvas.r_group.
Data
¶ Class to store intermediary and finals data structures for R-group analysis. Methods starting with add append information on a CT by CT basis to data structures.
-
add_attachment_points
(ct_data, index)¶
-
add_bonds_in_rings
(lol, index)¶
-
add_core
(core, i)¶
-
add_core_bonds
(bonds, i)¶
-
add_core_ct
(ct)¶
-
add_ct_offset
(file_offset)¶
-
add_functional_rings
(rings, ct_index)¶
-
add_position
()¶
-
add_property_value
(prop, value)¶ Add property value to self.property_values dict Done in order of cts
-
add_r_group
(position_number, smiles, ct_index)¶
-
add_r_groups_to_atom
(atom_index, value)¶
-
add_rg_ct
(position, ct)¶
-
add_rings
(rings, i)¶
-
get_attachment_points
()¶
-
get_bonds_in_rings
()¶
-
get_core
(index)¶
-
get_core_bonds
(index)¶
-
get_cores
()¶
-
get_ct_offsets
()¶
-
get_functional_rings
()¶
-
get_prop_list
()¶
-
get_prop_values
()¶
-
get_r_group_for_atom
(atom)¶
-
get_r_groups
()¶
-
get_r_groups_per_atom
()¶
-
get_rg_ct
()¶
-
get_rings
()¶
-
print_attachment_points
()¶
-
print_attachment_points_ct
(ct_index)¶
-
set_prop_list
(proplist)¶ Create list (self.property_list) of every non string property in a ct Checks for existing properties and prevents duplicates
-
-
exception
schrodinger.application.canvas.r_group.
RGroupException
¶ Bases:
exceptions.Exception
This is a special exception, which is thrown when for some reason r-group calculation can not be completed. When this exception is caught remaining function calls in calculate() function are not made.
-
classmethod
fromSmartsError
(err)¶ This function checks whether an exception err was due to invalid SMARTS pattern.
Parameters: err (Exception) – exception Returns: exception with specific message Return type: RGroupException
-
classmethod
-
class
schrodinger.application.canvas.r_group.
RGroupFinder
(input_file, smarts, temp_dir=None, thread=None, use_mm=1, use_fp_sim=False, sa_seed=None, t_factor=None, tmax_mult=None)¶ This class is used to find optimal core alignments and determines r-groups for input structures. This is a base class that uses ‘original’ algorithm that tries to minimize the number of r-groups.
-
calculate
()¶ This function is called to compute optimal molecule alignment and determine attached r-groups. It defines the order of calls that need to be made as in ‘Template Method’ design pattern. When calculation is done here self.data object can be retrieved to get results.
-
-
class
schrodinger.application.canvas.r_group.
TempAtom
(x, y, z, index, atomtype, attach='')¶ -
get_attach
()¶
-
get_index
()¶
-
get_type
()¶
-
get_x
()¶
-
get_y
()¶
-
get_z
()¶
-
is_from_atom
()¶
-
set_from_atom
()¶
-
-
schrodinger.application.canvas.r_group.
add_ct_data
(data, core, ct, ct_index)¶ Add to the determine the rings and r-groups per atom for each ct and add the following data structures: data.add_functional_rings data.add_rings data.add_r_groups_to_atom
Parameters: - core (list) – list of atoms belonging to the core
- ct (schrodinger.structure.Structure object) – structure object corresponding to the core atoms
-
schrodinger.application.canvas.r_group.
add_methyl_ring
(ct, principal_bond, bond_list, attachment_positions, output, grow=True)¶ Add capping methyls to ring like r_groups
Parameters: - ct (schrodinger.structure.Structure object) – structure that you are adding a capping group to
- principal_bond (list) – [ _StructureAtom of to_atom, _StructureAtom of from_atom, bond_order ]
- bond_list (list) – This contains an outer list of all bonds (specified in in the same way as principal_bond) which contain rings that will need to be capped
- attachment_positions (list) – list of the index of bonds (from the data.r_group_attachment_bonds ), which need to be capped with rings
Returns: Returns a tuple of structure of the fragment, to_atom index and from-atom index
-
schrodinger.application.canvas.r_group.
add_methyl_standard
(ct, core_atom, side_atom, output, grow=True)¶ Breaks bond between core and side atom Grows Carbon off of side-atom, maintaining bond order of core_atom - side_atom bond
Parameters: - ct (schrodinger.structure.Structure object) – structure that you are adding a capping group to
- core_atom (int) – index of the core atom
- side_atom (int) – index of the attachment atom
Returns: Returns a tuple of structure of the fragment, to_atom index and from-atom index
-
schrodinger.application.canvas.r_group.
add_to_data
(data, fragment, from_atom, to_atom, to_atom_chirality, j, ct_index)¶
-
schrodinger.application.canvas.r_group.
bond_in_ring
(ring, bond)¶
-
schrodinger.application.canvas.r_group.
checkMultipleMappings
(fragment, smiles, from_atom, to_atom)¶ This function checks whether a given fragment may match SMILES string multiple times. In that case a ‘canonical’ match is selected. In no mapping is found we return (-1, -1) as in previous version of add_to_data function. We assume that calling functions know how to deal with this case.
Parameters: - fragment (
structure.Structure
) – r-group structure - from_atom (int) – atom index of ‘from’ atom in fragment. This is a core atom that was replaced with a cap group.
- to_atom (int) – atom index of ‘to’ atom in fragment. This is atom in r-group attached to core.
Parame smiles: SMILES string
Returns: tuple that contains positions of ‘from’ and ‘to’ atoms in SMILES mapping. These values are 0-indexed. If no mapping is found we return (-1, -1).
Return type: tuple
- fragment (
-
schrodinger.application.canvas.r_group.
conglomerate_rings
(rings, core)¶ This function takes the mmssr and combines rings if they are entirely part of the core structure. Since we know in RGA we are never breaking the core structure, this is a safe operation.
Parameters: - rings – output from a mmsssr calculation on the entire output structure
- core – list of atoms in the core structure
-
schrodinger.application.canvas.r_group.
determine_attachment_bonds
(ct, core, r_groups_per_atom)¶ - :return list of lists. Inner element is the
- [core_atom, bonded_atom, bond_order ] of each attachment point
-
schrodinger.application.canvas.r_group.
determine_attachments
(core, ct, ct_index, data)¶
-
schrodinger.application.canvas.r_group.
determine_rgroup_indexes
(ct, number_of_groups)¶
-
schrodinger.application.canvas.r_group.
determine_rings_in_attachments
(functional_rings, r_group_attachment_bonds)¶
-
schrodinger.application.canvas.r_group.
evaluate_smarts_ex
(structure, smarts, stereo='annotation_and_geom', start_index=1, uniqueFilter=False, allowRelativeStereo=False, rigorousValidationOfSource=False, hydrogensInterchangeable=True)¶ Evaluate SMARTS patterns using the Canvas libraries.
Returns a list of lists of ints. Each list of ints is a list of atom indices matching the SMARTS pattern.
Parameters: - structure (
Structure
orschrodinger.application.canvas.base.ChmMol
) – Structure to search for matching substructures. - smarts (str) – SMARTS string used to match substructures.
- stereo (enum) – Specify how to determine the stereochemistry of a ChmMol from a
Structure. Can be STEREO_FROM_GEOMETRY, STEREO_FROM_ANNOTATION,
STEREO_FROM_ANNOTATION_AND_GEOM, or NO_STEREO. See
schrodinger.structutils.smiles.SmilesGenerator.__init__
for descriptions of these options. - start_index (int) – Specify the start index of the atom indices returned. Defaults to Structure mode, which is 1-based. Pass in 0 for 0-based indices.
Return type: list
Returns: Each value is a list of atom indices matching the SMARTS pattern.
- structure (
-
schrodinger.application.canvas.r_group.
find_best_core_match
(ct, cores, ref_ct=None, ref_core=None)¶
-
schrodinger.application.canvas.r_group.
getMCSMatches
(input_file, MCS_index, temp_dir=None, thread=None)¶ This function is used to setup and run MCS calculation on a given input file. It returns a list of matching SMARTS patterns.
Parameters: Returns: list of matching SMARTS patterns
Return type: list
-
schrodinger.application.canvas.r_group.
get_atom_chirality
(ct, atom)¶
-
schrodinger.application.canvas.r_group.
get_connected_ring_bonds
(ct_rings, ring)¶ This function returns any other rings that are also connected to any attachment bonds that are part of the ring fed to the function.
Parameters: - ct_rings (list) – Outer list is a list of each ring that is stored in the data class. Inner list is an index of the attachment bond that is present in that ring
- ring (list) – List of attachment bonds that are present in the ring
-
schrodinger.application.canvas.r_group.
get_rgroup_DEE
(input_file, SMARTS, temp_dir=None, thread=None, use_mm=1, use_fp_sim=False, sa_seed=None, t_factor=None, tmax_mult=None)¶
-
schrodinger.application.canvas.r_group.
get_rgroup_MCS
(input_file, MCS_index, temp_dir=None, thread=None, use_mm=0, use_fp_sim=False, sa_seed=None, t_factor=None, tmax_mult=None)¶ Determines the core and r-groups using the canvasMCS method.
Parameters: - input_file (string) – Absolute path to mae file to run the canvasMCS utility on
- MCS_index (int/str) – atomtyping scheme to use in canvasMCS
- temp_dir (str) – name of temporary directory
- thread (calculation_thread) – calculation thread (optional)
- use_mm (int) – type of multiple matching algorithm (0-Original method, 1-SA and 2-DEE)
- use_fp_sim (bool) – True to use fingerprint similarity between pairs of ‘states’
- sa_seed (int) – SimulatedAnnealing random number generator seed. ‘None’ will use the SimulatedAnnealing defaults.
- t_factor – SimulatedAnnealing temperature factor. ‘None’ will use the SimulatedAnnealing defaults.
- tmax_mult (float) – SimulatedAnnealing parameter to set starting temperature. ‘None’ will use the SimulatedAnnealing defaults.
-
schrodinger.application.canvas.r_group.
get_rgroup_SMARTS
(input_file, SMARTS, temp_dir=None, thread=None)¶ Takes input_file and SMARTS_pattern and defines r-groups input_file - input .mae file SMARTS_pattern defining core
-
schrodinger.application.canvas.r_group.
get_rgroup_combgen
(input_file, temp_dir=None)¶ Takes an input_file and creates instance of Data class That stores r_groups as SMILE patterns
-
schrodinger.application.canvas.r_group.
import_canvas
()¶ Perform a lazy import of canvas libraries to speed up loading time.
-
schrodinger.application.canvas.r_group.
import_canvas2d
()¶
-
schrodinger.application.canvas.r_group.
write_core_only
(structure, attachment_points, core_indexes, core_bonds, temp_dir=None)¶
-
schrodinger.application.canvas.r_group.
write_output
(data, input_file, smarts, cli=False, temp_dir=None, thread=None, settings=None)¶ This function writes RGA results to output files.
Parameters: - data (Data) – data object that contains calculation results
- input_file (str) – name of input file used in calculation
- smarts (bool) – True when MCS/SMARTS method was used and False otherwise
- cli (bool) – True if RGA was run from CL without GUI (this is a guess!)
- temp_dir (str) – name of temporary directory
- thread (calculation_thread) – thread used to run RGA calculation
Return type: Settings
Returns: Settings data object, which is used in RGA GUI