schrodinger.structutils.build module

Functions for modifying chemical structures.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.structutils.build.connect(st, atomlist1, atomlist2)

Perform a connect between the atoms in the CT “st” based on the heavy atoms in atomlist1 and those in atomlist2. Usually each list will contain one atom each, from different molecules. Hydrogens bound to the specified atoms are removed as necessary, and the molecule of atomlist2 will be rotated and translated such that the newly formed bond(s) are proper length, and bond angles are valid.

Returns a dictionary of atom renumbering. Keys are old atom numbers, values are new atom numbers (or None if the atom was deleted, i.e. a hydrogen).

schrodinger.structutils.build.attach_fragment(st, fromatom, toatom, fraggroup, fragname, direction=None, torsion_group=None, conformation=None)

Attach fragment <fragname> of group <fraggroup> to <fromatom> in place of atom <toatom>. Will use growbond atom labels in the incoming fragment.

Optionally specify a <direction> string. Usually one of the following: ‘forward’, ‘backward’, ‘forward(N-to-C)’, ‘backward(C-to-N)’.

Optionally specify a torsion group and associated conformation. Usually this will be a secondary structure string such as “extended” for torsion group “Secondary_Structure:”

Returns a dictionary of atom renumbering. Keys are old atom numbers, values are new atom numbers (or None if the atom was deleted, i.e. a hydrogen).

Parameters
  • st (structure.Structure) – structure to work on

  • fromatom (int) – atom on which to make the attachment

  • toatom (int) – atom to be replaced by the attachment

  • fraggroup (str) – mmfrag category of the fragment to attach

  • fragname (str) – name of the fragment to attach

  • direction (str) – direction of the attachment

  • torsion_group (str) – a torsion group specifier

  • conformation (str) – a conformations specifier

schrodinger.structutils.build.grow_mult(st, mmfrag_handle, grow_atoms1, grow_atoms2)

Grow for fragments with multiple connections, such as two-stranded DNA & RNA.

The st is the structure to which to add the fragment. The frag handle is an mmfrag instance of the fragment to grow.

Returns a tuple of (new-grow-atom-1, new-grow-atom-2, renumber-map). The new-grow-atom-1 and new-grow-atom-2 are lists that match the renumbered atoms corresponding to grow_atoms1 and grow_atoms2. The reunumber map is a dictionary of atom renumbering. Keys are old atom numbers, values are new atom numbers (or None if the atom was deleted, i.e. a hydrogen).

schrodinger.structutils.build.attach_structure(st, st_atom_from, st_atom_to, frag_st, frag_atom_from, frag_atom_to)

Similar to attach_fragment(), but takes a fragment CT instead of name. From and to atoms in the fragment must also be specified.

schrodinger.structutils.build.mutate(st, atom_in_res, res_type)

Mutate the residue containing atom number ‘atom_in_res’ in Structure object ‘st’ to be of residue type ‘res_type’. The residue type may be one of the 20 amino acids (including the HIS/HIP/HIE variants), a D-amino acids, or other non-standard residues. For a list of alternate residues, see the $MMSHARE/data/res/nonstandard_peptide.bld.

There is no error if the residue is already of the type requested.

Parameters
  • st (Structure object) – Structure object which should be mutated.

  • atom_in_res (int) – Mutate the residue that this atom is in.

  • res_type (str) – Desired residue type (e.g. “ALA”).

Return type

dict

Returns

A dictionary of renumbered atoms. Keys are old atom numbers, values are new atom numbers or None if the atom was deleted.

schrodinger.structutils.build.mutate_nucleic_acid(atom_idx, res_type, lib_type)

Mutates a residue to the specified nucleobase. This function exists because calls to mmbuild.mutate() for nucleobases are not well supported in pyhthon.

Parameters
  • atom_idx (int) – Atom number in the structure to mutate.

  • res_type (str) – Desired residue type (e.g. “Adenine”).

  • lib_type (str) – Library type (e.g. “dna” or “rna”).

schrodinger.structutils.build.get_frag_structure(fraggroup, frag_name)

Returns a Structure object for the fragment with the given name. The fragment must be in the given fragment group.

Parameters
  • fraggroup (str) – Fragment group name.

  • frag_name (str) – Fragment name.

Returns

Structure object for the fragment.

Return type

Structure object

schrodinger.structutils.build.add_hydrogens(st, treatment='All-atom with No-Lp', atom_list=None)

Adds hydrogens to the Structure ‘st’.

Default treatment is suitable for nearly all purposes. Hydrogens are added in standard geometry and no attempt is made to optimize the treatment in order to maximize hydrogen bonds, etc.

Parameters

atom_list

A list of atom indices (or _StructureAtom objects) to add hydrogens to (The default, None, means all atoms).

schrodinger.structutils.build.delete_hydrogens(st)

Deletes hydrogens from the Structure ‘st’.

schrodinger.structutils.build.delete_zobs(st)

Delete all zero-order bonds from the given structure.

schrodinger.structutils.build.delete_bonds_to_atoms(atoms)

Delete all bonds to the requested atoms. Use like:

build.delete_bonds_to_atoms(st.atom) build.delete_bonds_to_atoms(residue.atom) build.delete_bonds_to_atoms(map(st.atom.__getitem__, atom_indices))

Parameters

atoms (iterable of atom objects) – atoms whose bonds should be deleted

schrodinger.structutils.build.delete_bonds(bonds)

Delete the requested bonds. Bonds can be StructureBond or pairs of _StructureAtom.

Parameters

bonds (iterable[StructureBond] or list[(_StructureAtom, _StructureAtom)]) – Bonds to delete

schrodinger.structutils.build.reorder_atoms(st, new_order)

Create a new structure from the provided one, with atoms reordered as specified in the new_order list.

Parameters

new_order (list of ints) – The new_order list must be the same size as the number atoms in the provided structure, and atom indices begin at one.

schrodinger.structutils.build.reorder_protein_atoms_by_sequence(st)

Renumbers structure.Structure atoms by Residue order and returns a new structure object. New structure has atom numbering in sequence order via connectivity (not residue numbering) and allows behavior matching a properly ordered pdb structure.

Parameters

st (structure.Structure) – structure object to reorder

Return type

structure.Structure

Returns

copy of input structure with atoms reordered

schrodinger.structutils.build.reorder_water(st: schrodinger.structure._structure.Structure) schrodinger.structure._structure.Structure

Reorder water molecules so that they always stay at the end of the CT. A modified copy of st will be returned.

schrodinger.structutils.build.desalt_structure(st)

Returns a desalted copy of a specified structure

Parameters

st (schrodinger.structure.Structure) – Structure to be desalted

Returns

Desalted copy of the structure

Return type

schrodinger.structure.Structure

schrodinger.structutils.build.neutralize_structure(st)

Return a copy of the structure with each functional group neutralized.

Attempts to make atoms neutral - it does not attempt to neutralize the overall charge. For instance, zwitterions will be neutralized such that all atoms have a 0 formal charge. Some atoms may not be adjusted.

Parameters

st (schrodinger.structure.Structure) – Structure to be neutralized, hydrogens already present

Returns

Neutralized copy of the structure

Return type

schrodinger.structure.Structure

schrodinger.structutils.build.merge_subunit_sts(sts)

Merge the input structure objects into one CT, while giving each chain a unique name.

Parameters

sts (Iterable of structure.Structure objects.) – Subunit structures

Return type

tuple(structure.Structure, bool)

Returns

a tuple of the merged structure and a boolean indicating whether the renaming went OK (False if could not re-name chains due to running out of available names).

schrodinger.structutils.build.extract_structure(struct, indices, copy_props=False, renumber_map=False)

Return a new structure object which contains the atoms of the struct that appear in the indices list and renumber map if requested.

Parameters
  • indices (list[int]) – Atom indices to extract

  • copy_props (bool) – If True, then the new structure object will get structure-level properties from struct

  • renumber_map (bool) – If True, return a also a renumbering dictionary

Return type

structure.Structure or structure.Structure, dict

Returns

Extracted structure if renumber_map is False. Extracted structure and renumbering dictionary, if renumber_map is True. In renumber_map, keys are atom numbers before extraction, and value for each is the new atom number

schrodinger.structutils.build.remove_alternate_positions(st)

Remove the alternate position of atoms in the structure.

Parameters

st (structure.Structure object) – input structure.

Return type

structure.Structure object

schrodinger.structutils.build.remove_atom_alternate_positions(atom)

Remove the alternate position of atom

Parameters

atom (structure._StructureAtom object) – input atom

schrodinger.structutils.build.adjustImproperDihedral(st, value, atom1, atom2, atom3, atom4)

Adjust an improper dihedral angle (generated, for example, from analyze.improper_dihedral_iterator)

The improper dihedral angle (in degrees) made by atom1, atom2, atom3 and atom4 will be set to value and atom4 and all other atoms attached to that will be moved.

NOTE: To adjust proper dihedrals, use Structure.adjust instead

Parameters
  • st (Structure object) – the structure being modified

  • value (float) – value the internal coordinate will be set to

  • atom1 (int or _StructureAtom) – first atom in the coordinate

  • atom2 (int or _StructureAtom) – second atom in the coordinate

  • atom3 (int or _StructureAtom or None) – third atom in the coordinate (if None, the coordinate is a bond)

  • atom4 (int or _StructureAtom or None) – fourth atom in the coordinate (if None, the coordinate is an angle)

Raises

AtomsInRingError – if specified atoms are within a ring system.