schrodinger.structutils.createfragments module¶
This script will break up a set of input molecules into fragments based on some simple rules, similar to those described in the original RECAP paper. Run with -h to see the basic rules.
If -murcko option is specified, then Murco Assembly scaffolds are generated instead of fragments. This is done by removing terminal from each “branch” until reacing a ring.
If -recap option is specified, then rules are as follows:
- Only break the bonds matching the RECAP SMARTS patterns.
- Amide
- Ester
- Amine
- Urea
- Ether
- Olefin
- Quarternary nitrogen
- Aromatic nitrogen - aliphatic carbon
- Lactam nitrogen - aliphatic carbon
- Aromatic carbon - aromatic carbon
- Sulphonamide
- Do not break ring bonds
- Do not break bonds that would yield one of the following fragments: hydrogen, methane, ethane, prone, butane.
NOTE: -recap_use can be used to specify which RECAP rules to use. The value must be a list of comma-separated numbers (no spaces).
Example usage:
from schrodinger.structutils import createfragments
frag_creator = createfragments.FragmentCreator(atoms=options.atoms,
bonds=options.bonds, smarts=options.smarts,
carbon_hetero=options.carbon_hetero,
maxatoms=options.maxatoms,
removedup=options.removedup, murcko=options.murcko,
recap=options.recap, recap_use=recap_list,
complete=options.complete,
add_h=options.add_h, verbose=True)
for struct in my_structures:
# fragments is a list of Structure objects
fragments = frag_creator.fragmentStructure(struct)
Copyright Schrodinger, LLC. All rights reserved.
-
schrodinger.structutils.createfragments.
are_sts_the_same
(st1, st2)¶ Checks coordinates of each atom in the specified structures and returns true if they are the same
Parameters: - st1 (
structure.Structure
) – The first structure for comparison - st2 (
structure.Structure
) – The second structure for comparison
Return type: bool
Returns: True if the structures have the same coordinates, False if not
- st1 (
-
schrodinger.structutils.createfragments.
find_recap_bonds
(st, options)¶ Find all bonds that match the RECAP rules described in J. Chem. Inf. Comput. Sci. 1998, 38, 511-522
Will return a list of [(atom1, atom2, rule_num)].
Parameters: - st (
schrodinger.structure.Structure
) – The structure to search for RECAP rule bonds - options – The object holding the compute options
Return type: set of tuples
Returns: Each tuple is (atom1, atom2, rule_num) where atom1 and atom2 are the atoms involved in the bond and rule_num is the recap rule that the bond matches. atom1 and atom2 are sorted.
- st (
-
class
schrodinger.structutils.createfragments.
FragmentCreator
(**kwargs)¶ Bases:
object
This class will break up input structures into fragments based on some simple rules. The basic rules are:
- Cut one of these 2 types of bonds
- Bonds to rings
- Do not cut bonds to hydrogens
- Do not cut any in-ring bonds
- Do not cut bonds between ring-carbon and a non-carbon atoms (allowed with -c option)
- Carbon-carbon bonds a. Do not cut any bonds if either atom is in any ring
- Refuse a fragment if any part of it matches a line in the SMARTS file specified by -smarts.
- Refuse a fragment if the number of broken bonds exceeds -bonds.
- Refuse a fragment if the number of atoms is less than -atoms.
- Do not attempt to fragment molecules with more than -maxatoms atoms.
For -recap option, here are the rules that are used:
- [#6][C;X3](=O)!@[N;X3] Amide
- [!#1][O;X2]!@[C;X3](=O)[C;X4;H2,H3] Ester
- [#7;X3](!@[C,N&X3,#1])([C,N&X3,#1])[C,N&X3,#1] Amine
- [#7;X3]!@[C;X3](=O)[#7;X3] Urea
- [#6]!@[O;X2][#6] Ether
- [#6]=!@[#6] Olefin
- [#7;X4]!@[#6] Quarternary nitrogen
- [n]!@[C] Aromatic nitrogen - aliphatic carbon
- C!@N@C=O Lactam nitrogen - aliphatic carbon
- c!@c Aromatic carbon - aromatic carbon
- [#7][S;X4](=O)(=O) Sulphonamide
-
__init__
(**kwargs)¶ Create a FragmentCreator object.
Parameters: - atoms (int) – Minimum number of non-hydrogen atoms in a fragment (default=2)
- bonds (int) – Maximum number of broken bonds allowed in creating a fragment (default=100)
- smarts (str) – Path to a file of SMARTS patterns (one per line) to identify and eliminate fragments containing undesired features.
- carbon_hetero (bool) – Allows cutting of bonds between ring-carbon and hetero atoms (default=False)
- maxatoms (int) – Maximum number of atoms allowed in molecule to be fragmented (default=200).
- removedup (bool) – Keep only one copy of identical fragment but with different coordinates. (default=False)
- murcko (bool) – Generate Murco Assembly scaffold instead of regular fragments. (default=False)
- recap (bool) – Use RECAP rules to find bonds to break.
- recap_use (list of int) – Specify which RECAP rules to use (default is to use all). Value must be a list of integers (example: [1, 2, 10, 11]).
- complete (bool) – Retain the complete list of fragments created, including intermediates. Only works with RECAP rules. (Default: False)
- complete – Add hydrogens to complete lewis structures. I some calses, you do not want to do this (Default: True)
- verbose (bool) – True if progress should be logged, False if not
-
getPatternString
()¶ Get a string that describes the RECAP patterns
Return type: str Returns: A string describing the RECAP patterns.
-
checkArgs
()¶ Check the input arguments for appropriate usage
-
fragmentStructure
(struct)¶ Break the input structure into fragments.
Parameters: struct ( schrodinger.structure.Structure
) – The structure to break into fragmentsReturn type: list Returns: list of schrodinger.structure.Structure
objects for the fragments.
-
fragmentStructureForEA
(struct)¶ Break the input structure into fragments. Used for Event Analyis (EA)
Returns: list of schrodinger.structure.Structure
objects for the fragments
-
__class__
¶ alias of
builtins.type
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.structutils.createfragments', '__doc__': '\n This class will break up input structures into fragments based on some\n simple rules. The basic rules are:\n\n 1. Cut one of these 2 types of bonds\n I. Bonds to rings\n a. Do not cut bonds to hydrogens\n b. Do not cut any in-ring bonds\n c. Do not cut bonds between ring-carbon and a non-carbon atoms\n (allowed with -c option)\n II. Carbon-carbon bonds\n a. Do not cut any bonds if either atom is in any ring\n 2. Refuse a fragment if any part of it matches a line in the SMARTS file\n specified by -smarts.\n 3. Refuse a fragment if the number of broken bonds exceeds -bonds.\n 4. Refuse a fragment if the number of atoms is less than -atoms.\n 5. Do not attempt to fragment molecules with more than -maxatoms atoms.\n\n For -recap option, here are the rules that are used:\n\n 1. [#6][C;X3](=O)!@[N;X3] Amide\n 2. [!#1][O;X2]!@[C;X3](=O)[C;X4;H2,H3] Ester\n 3. [#7;X3](!@[C,N&X3,#1])([C,N&X3,#1])[C,N&X3,#1] Amine\n 4. [#7;X3]!@[C;X3](=O)[#7;X3] Urea\n 5. [#6]!@[O;X2][#6] Ether\n 6. [#6]=!@[#6] Olefin\n 7. [#7;X4]!@[#6] Quarternary nitrogen\n 8. [n]!@[C] Aromatic nitrogen - aliphatic carbon\n 9. C!@N@C=O Lactam nitrogen - aliphatic carbon\n 10. c!@c Aromatic carbon - aromatic carbon\n 11. [#7][S;X4](=O)(=O) Sulphonamide\n\n ', '__init__': <function FragmentCreator.__init__>, 'getPatternString': <function FragmentCreator.getPatternString>, 'checkArgs': <function FragmentCreator.checkArgs>, 'fragmentStructure': <function FragmentCreator.fragmentStructure>, 'fragmentStructureForEA': <function FragmentCreator.fragmentStructureForEA>, '__dict__': <attribute '__dict__' of 'FragmentCreator' objects>, '__weakref__': <attribute '__weakref__' of 'FragmentCreator' objects>})¶
-
__dir__
() → list¶ default dir() implementation
-
__eq__
¶ Return self==value.
-
__format__
()¶ default object formatter
-
__ge__
¶ Return self>=value.
-
__getattribute__
¶ Return getattr(self, name).
-
__gt__
¶ Return self>value.
-
__hash__
¶ Return hash(self).
-
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__le__
¶ Return self<=value.
-
__lt__
¶ Return self<value.
-
__module__
= 'schrodinger.structutils.createfragments'¶
-
__ne__
¶ Return self!=value.
-
__new__
()¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶ Return repr(self).
-
__setattr__
¶ Implement setattr(self, name, value).
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶ Return str(self).
-
__subclasshook__
()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__weakref__
¶ list of weak references to the object (if defined)