schrodinger.application.desmond.struc module¶
A collection of miscellaneous molecular-structure-related functions.
Copyright Schrodinger, LLC. All rights reserved.
- class schrodinger.application.desmond.struc.FormMols(canonical: rdkit.Chem.rdchem.Mol, neutral: rdkit.Chem.rdchem.Mol, reduced: rdkit.Chem.rdchem.Mol)¶
Bases:
object
Mol
representations of different forms of a structure.- Variables
canonical – original structure
neutral – structure after each atom has been neutralized
reduced – structure after neutralization, tautomeric standardization
- canonical: rdkit.Chem.rdchem.Mol¶
- neutral: rdkit.Chem.rdchem.Mol¶
- reduced: rdkit.Chem.rdchem.Mol¶
- __init__(canonical: rdkit.Chem.rdchem.Mol, neutral: rdkit.Chem.rdchem.Mol, reduced: rdkit.Chem.rdchem.Mol) None ¶
- class schrodinger.application.desmond.struc.FormHashes(canonical: str, neutral: str, reduced: str)¶
Bases:
object
String hashes that identify different “forms” of a structure at the conformer level.
In other words, we expect identifiers of conformeres to be the same, and of non-conformers to be different.
- Variables
canonical – conformer hash of original structure
neutral – conformer hash of structure after neutralization
reduced – conformer hash of structure after neutralization, tautomeric standardization
- canonical: str¶
- neutral: str¶
- reduced: str¶
- __init__(canonical: str, neutral: str, reduced: str) None ¶
- schrodinger.application.desmond.struc.filter_monatomic_mols(st: schrodinger.structure._structure.Structure, atom_indices: List[int]) List[int] ¶
Filter out indices of monatomic atoms from the atom list.
- schrodinger.application.desmond.struc.get_sidechain_att_atom(residue: schrodinger.structure._structure.Residue) Optional[Tuple[schrodinger.structure._structure.StructureAtom, schrodinger.structure._structure.StructureAtom]] ¶
Given an amino acid residue
residue
, this function returns two atoms: The first atom is the alpha carbon, and the 2nd is the beta atom belonging to the sidechain and is bonded to the first atom.If no attachment atoms cannot be identified,
None
is returned.
- schrodinger.application.desmond.struc.get_residue_sitename(residue: schrodinger.structure._structure.Residue)¶
Given a
_Residue
object (‘residue’), this function returns a string that represents the name of the residue site.The string is in the format C:RESXX[I] where C is the chain name, RES is the residue type name, XX is the residue number in the chain, and I is the insertion code. For example, a string could be “A:Tyr45[B]”.
If there is no insertion code, the string will be reduced to C:RESXX, e.g. “A:Tyr45”.
- schrodinger.application.desmond.struc.all_atoms(structures)¶
Returns an iterator over all atoms in all given structures. The order of iteration is the following: The atoms of the first structure, the atoms of the second, and so on. If a
Cms' object is given, the order of iteration is the atoms of the full-system CT, those of an internal copy of the full-systemm CT within the `Cms
object [when writing theCms
object into a file (or string), it’s this copy that is outputted], the atoms of the first component CT, of the 2nd component CT, and so on.
- schrodinger.application.desmond.struc.selected_atoms(st: schrodinger.structure._structure.Structure, atom_indices: Iterable[int] = None, asl: str = None) Iterator[schrodinger.structure._structure.StructureAtom] ¶
Returns an iterator over the atoms selected either by
atom_indices
orasl
. The order of the iteration is the same as that ofatom_indices
or the result ofanalyze.evaluate_asl
. It’s an error to provide bothatom_indices
andasl
arguments.
- schrodinger.application.desmond.struc.set_atom_properties(atoms, propnames, values=None)¶
Set atom properties for the given atoms.
- Parameters
atoms (Iterable[_StructureAtom]) – Atoms whose properties will be set.
propnames (List[str]) – A list of atom property names
values – A list of atom property values. Each value is for the corresponding property in
propnames
. If not given, the default value will be0
,False
, and""
for the numeric types, the boolean type, and the string type, respectively.
- schrodinger.application.desmond.struc.delete_atom_properties(st, propnames)¶
Deletes atom properties for all atoms of the given structure(s).
- schrodinger.application.desmond.struc.set_structure_properties(structures, keyvalues)¶
Set the structure properties with the key-value pairs.
- Parameters
structures (Union[Structure, Iterable[Structure]]) – a list of structures (or a single structure) for which to set the specified properties
keyvalues (Optional[Union[dict, Iterable[Tuple[str, value]]]]) – The value must be either an iterable of
(key, value)
tuples, or adict
object whose key values will be used to update the structure properties. Note that the keys must bestr
and follow the MAE property name format.
- schrodinger.application.desmond.struc.delete_ffio_ff(ffio_ct: schrodinger.application.desmond.ffiostructure.FFIOStructure) schrodinger.structure._structure.Structure ¶
Remove ffio_ff block by first converting FFIOStructure to Structure and then deleting the block.
- schrodinger.application.desmond.struc.delete_structure_properties(structures, propnames)¶
For a supplied list of structures and structure property keys, delete the property values associated with those keys from each structure if possible.
- Parameters
structures (Union[Structrue, Iterable[Structure]]) – a list of structure (or a single structure) from which to delete the specified properties
propnames (Union[str, Iterable[str]]) – a list of structure property keys (or a single structure property keys) that should be deleted from the supplied structures
- schrodinger.application.desmond.struc.read_all_ct(fname)¶
- schrodinger.application.desmond.struc.read_all_structures(fname: str) List[schrodinger.structure._structure.Structure] ¶
Read a
*.mae
file and return all CTs in a list.
- schrodinger.application.desmond.struc.set_atom_reference_coordinates(atom: schrodinger.structure._structure.StructureAtom, coords: List[float], prop_names=['r_fep_original_coord_x', 'r_fep_original_coord_y', 'r_fep_original_coord_z'])¶
- Parameters
atom – An atom whose properties will be updated to save the given reference coordinates
coords – [x, y, z] coordinates for atom
prop_names – Property names for the reference coordinates. Default REFERENCE_COORD_PROPERTIES.
- schrodinger.application.desmond.struc.get_atom_reference_coordinates(atom: schrodinger.structure._structure.StructureAtom, prop_names=['r_fep_original_coord_x', 'r_fep_original_coord_y', 'r_fep_original_coord_z']) List[float] ¶
Return the given atom’s reference coordinates that have been previously saved into the atom properties. If no reference coordinates was saved before, return the atom’s current coordinates.
- Parameters
prop_names – Property names for the reference coordinates. Default REFERENCE_COORD_PROPERTIES.
- schrodinger.application.desmond.struc.set_ct_reference_coordinates(ct: schrodinger.structure._structure.Structure, prop_names=['r_fep_original_coord_x', 'r_fep_original_coord_y', 'r_fep_original_coord_z'])¶
Set reference coordinates for all atoms in
ct
using current coordinates.- Parameters
prop_names – Property names for the reference coordinates. Default REFERENCE_COORD_PROPERTIES.
- schrodinger.application.desmond.struc.get_reference_ct(ct: schrodinger.structure._structure.Structure, prop_names=['r_fep_original_coord_x', 'r_fep_original_coord_y', 'r_fep_original_coord_z']) schrodinger.structure._structure.Structure ¶
Returns a copy of the input structure. If the input structure contains previously saved reference coordinates, these coordinates are recovered in the return structure.
- Parameters
prop_names – Property names for the reference coordinates. Default REFERENCE_COORD_PROPERTIES.
- schrodinger.application.desmond.struc.fixup_duplicate_properties(cts: List[schrodinger.structure._structure.Structure]) List[schrodinger.structure._structure.Structure] ¶
Return a copy of the original structures. In the returned structures, properties that only differ by the type are deleted.
- schrodinger.application.desmond.struc.get_res_ct_and_atom_idx(res: schrodinger.structure._structure.Residue, cap=False) Tuple[schrodinger.structure._structure.Structure, Dict[int, int]] ¶
Given a
_Residue
object, extract the residue structure and a map of from the original atom index to the residue fragment atom index.- Parameters
res – Residue to extract
cap – Set to True to add capping groups, default is False. These atoms are not included in the atom index.
- schrodinger.application.desmond.struc.align_cap(ct0: schrodinger.structure._structure.Structure, ct1: schrodinger.structure._structure.Structure) None ¶
Given two capped peptides, set the coordinates for the cap groups in
ct1
to match those ofct0
.- Parameters
ct0 – The reference structure.
ct1 – The structure to modify in place.
- schrodinger.application.desmond.struc.hash_title(ct: schrodinger.structure._structure.Structure) str ¶
Hash a structure’s title string and return the hash. :param ct: Structure to get title from.
- schrodinger.application.desmond.struc.struc_iter(*structures)¶
Iterates over all structures passed in as the arguments. Containers of
Structure
objects will be flatten out and iterated over. Non-Structure
objects will be skipped. For example:struc_iter(st0, st1, None, [st2, st3, [st4, None, 1, “2”, 3.0, st5]])
The iteration sequence will be
st0, st1, st2, st3, st4, st5
.
- schrodinger.application.desmond.struc.struc_merge(*structures)¶
Merges all given structures and returns a single
Structure
object. For example:struc_merge(st0, st1, None, [st2, st3, [st4, None, 1, “2”, 3.0, st5]])
The returned object will be a merged structure containing
st0
,st1
,st2
,st3
,st4
, andst5
, in that order.
- class schrodinger.application.desmond.struc.CompStruc(*args)¶
Bases:
object
- __init__(*args)¶
- __len__()¶
- solute¶
- membrane¶
- ion¶
- solvent¶
- cosolvent¶
- crystal_water¶
- alchemical_water¶
- positive_salt¶
- negative_salt¶
- receptor¶
- ligand¶
- fep_ref¶
- fep_mut¶
- gcmc_solvent¶
- schrodinger.application.desmond.struc.component_structures(model: Cms) schrodinger.application.desmond.struc.CompStruc ¶
- schrodinger.application.desmond.struc.write_structures(strucs: Iterable[Optional[schrodinger.structure._structure.Structure]], fname: Optional[str] = None, *, overwrite: bool = True) Optional[str] ¶
Writes the given
Structure
objects into the same file (or string) in the MAE format.Similar functions:
structure.write_ct_to_string
structure.write_cts
- Parameters
structures –
Structure
objects to be written.None
, are allowed to be in the iterable and will be ignored. If the iterable is empty or contains onlyNone
, for writing to a file this function will have no side effects, for writing to a string an empty string will be returned.fname – Name of the file to be written. If it’s
None
or an empty string, the structures will be written into a string.overwrite – If true, this function will overwrite the file; otherwise, it will append the structures into the existing file.
- Returns
Returns a string which the structures are written into, or
None
if the structures are written into a file.
- schrodinger.application.desmond.struc.find_duplicate_titles(strucs: Iterable[schrodinger.structure._structure.Structure]) List[Tuple[int, str]] ¶
Return a list of tuples, where each tuple gives the duplicate index and title in
strucs
. Return an empty list if no duplicate titles were found.
- schrodinger.application.desmond.struc.get_fep_structures(strucs: Iterable[schrodinger.structure._structure.Structure], struc_tags: List[str]) List[schrodinger.structure._structure.Structure] ¶
Structures with a
FEP_STRUC_TAG
that match one of thestruc_tags
will be returned.
- schrodinger.application.desmond.struc.is_charged_or_formal_charged(st: schrodinger.structure._structure.Structure) bool ¶
- schrodinger.application.desmond.struc.find_box(cts: Iterable[schrodinger.structure._structure.Structure]) Optional[Tuple[float]] ¶
Look for box dimension properties on any of the given structures.
- Raises
ValueError – if there are different box values on different environment strucs
- Returns
a 9-tuple of box vector values or None if no box is found
- schrodinger.application.desmond.struc.get_reduced_smiles(st: schrodinger.structure._structure.Structure) str ¶
Read in a molecular structure and return a SMILES that has canonicalized the charge and tautomer state.
NOTE: Canonicalization is tied to a specific schrodinger release, and can only be compared to other keys generated from this function. Different versions may produce different results as bugs are fixed.
- Parameters
st – A structure of a molecule that could be in an arbitrary charge or tautomer state.
- Returns
The SMILES of the structure that has a canonical charge and tautomer.
- schrodinger.application.desmond.struc.get_form_mols(st: schrodinger.structure._structure.Structure) schrodinger.application.desmond.struc.FormMols ¶
- Parameters
st – a structure
- Returns
RDKit
Mol
objects for the supplied structure, plus those of its neutral and reduced forms
- schrodinger.application.desmond.struc.get_form_hashes(st: schrodinger.structure._structure.Structure) schrodinger.application.desmond.struc.FormHashes ¶
- Parameters
st – a structure
- Returns
a collection of strings that identify the supplied structure (at the conformer level) as well as its neutral and reduced forms
- schrodinger.application.desmond.struc.encode_string_into_structure_property(st: schrodinger.structure._structure.Structure, propname: str, value: str)¶
Encode a string into a structure property. This is necessary when the string contains special characters like square brackets that would get sanitized during the AssignForcefield stage; the base64 encoding method fixes this issue as it does not use these characters.
- Parameters
st – Structure to modify in place.
propname – Structure property.
value – String to encode in the property.
- schrodinger.application.desmond.struc.decode_string_from_structure_property(st: schrodinger.structure._structure.Structure, propname: str) Optional[str] ¶
Decode an encoded string from a structure property.
- Parameters
st – Structure to read the encoded string from.
propname – Structure property.
- Returns
The decoded string, if found. Otherwise, return
None
.
- schrodinger.application.desmond.struc.generate_atom_groups(st: schrodinger.structure._structure.Structure, residue_groups_asl: str, ligand_group_asl: str, name: str = 'energy', cutoff: float = 7.0) schrodinger.utils.sea.sea.List[schrodinger.utils.sea.sea.Map] ¶
Generate atom groups sea object for receptor-ligand interaction calculations that will be embedded in the msj file. These definitions will be used to set up energy_groups that desmond backend will use to calculate the interaction.
- Parameters
st – either a
Structure
or aCms
object. Reference-coordinates will be used if they are stored in atom properties.residue_groups_asl – ASL for the residue groups. If this selection spans multple residues then each residue will be used as a group.
ligand_group_asl – ASL for the ligand group
name – Name of the group
cutoff – Distance cutoff in Angstrom units.
- Returns
sea.List
object with predefined groups