schrodinger.application.desmond.struc module

A collection of miscellaneous molecular-structure-related functions.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.application.desmond.struc.get_sidechain_att_atom(residue: schrodinger.structure._structure._Residue) → Optional[Tuple[schrodinger.structure._structure._StructureAtom, schrodinger.structure._structure._StructureAtom]][source]

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)[source]

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)[source]

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 the Cms 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][source]

Returns an iterator over the atoms selected either by atom_indices or asl. The order of the iteration is the same as that of atom_indices or the result of analyze.evaluate_asl. It’s an error to provide both atom_indices and asl arguments.

schrodinger.application.desmond.struc.set_atom_properties(atoms, propnames, values=None)[source]

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 be 0, False, and "" for the numeric types, the boolean type, and the string type, respectively.

schrodinger.application.desmond.struc.delete_atom_properties(st, propnames)[source]

Deletes atom properties for all atoms of the given structure(s).

schrodinger.application.desmond.struc.rename_atom_property(st, old_name, new_name)[source]

Renames an atom property’s name from old_name to new_name for the given structure(s) st.

schrodinger.application.desmond.struc.set_structure_properties(structures, keyvalues)[source]

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 a dict object whose key values will be used to update the structure properties. Note that the keys must be str 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[source]

Remove ffio_ff block by first converting FFIOStructure to Structure and then deleting the block.

schrodinger.application.desmond.struc.delete_structure_properties(structures, propnames)[source]

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)[source]
schrodinger.application.desmond.struc.read_all_structures(fname: str) → List[schrodinger.structure._structure.Structure][source]

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'])[source]
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][source]

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'])[source]

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[source]

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][source]

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]][source]

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[source]

Given two capped peptides, set the coordinates for the cap groups in ct1 to match those of ct0.

Parameters
  • ct0 – The reference structure.

  • ct1 – The structure to modify in place.

schrodinger.application.desmond.struc.hash_title(ct: schrodinger.structure._structure.Structure) → str[source]

Hash a structure’s title string and return the hash. :param ct: Structure to get title from.

schrodinger.application.desmond.struc.struc_iter(*structures)[source]

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)[source]

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, and st5, in that order.

class schrodinger.application.desmond.struc.CompStruc(*args)[source]

Bases: object

__init__(*args)[source]

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

__len__()[source]
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[source]
schrodinger.application.desmond.struc.write_structures(strucs: Iterable[Optional[schrodinger.structure._structure.Structure]], fname: Optional[str] = None, *, overwrite: bool = True) → Optional[str][source]

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
  • structuresStructure objects to be written. `None`s are allowed to be in the iterable and will be ignored. If the iterable is empty or contains only `None`s, 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]][source]

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][source]

Structures with a FEP_STRUC_TAG that match one of the struc_tags will be returned.

schrodinger.application.desmond.struc.is_charged_or_formal_charged(st: schrodinger.structure._structure.Structure) → bool[source]
schrodinger.application.desmond.struc.find_box(cts: Iterable[schrodinger.structure._structure.Structure]) → Optional[Tuple[float]][source]

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[source]

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.