Representing Loops

The most simple representation of structural information in ProMod3 is the BackboneList. It provides a way to store the backbone positions of residues. They provide structural manipulations, they can be manipulated and converted from, to, or inserted to a ost.mol.EntityHandle.

from ost import io
from ost import conop
from promod3 import loop

sequence = "AAAAAAAA"

# the backbone gets initially constructed with backbone dihedrals
# typical for helices
bb_list = loop.BackboneList(sequence)

# let's have a look at the set dihedral angles
for i in range(len(bb_list)):
    print("Looking at position %d" % i)
    if i > 0:
        print("phi: %.4f" % bb_list.GetPhiTorsion(i))
    if i < len(bb_list)-1:
        print("psi: %.4f" % bb_list.GetPsiTorsion(i))


# we now use a TorsionSampler to set random dihedral angles
torsion_sampler = loop.LoadTorsionSampler()
idx = torsion_sampler.GetHistogramIndex(conop.ALA, 
                                        conop.ALA, 
                                        conop.ALA)
for i in range(len(bb_list)):
    dihedrals = torsion_sampler.Draw(idx)
    if i > 0:
        bb_list.SetPhiTorsion(i, dihedrals[0])
    if i < len(bb_list)-1:
        bb_list.SetPsiTorsion(i, dihedrals[1])

# let's save down the randomized fragment
io.SavePDB(bb_list.ToEntity(), "randomized_fragment.pdb")

The BackboneList class

class promod3.loop.BackboneList

Container for the positions of the backbone atoms (nitrogen (N), alpha carbon (CA), beta carbon (CB), carbon (C), oxygen (O)), the one letter codes and amino acid types of a segment. This object allows to get, set or modify the atom positions, etc through a set of functions (indexing to access each residue starts at 0). To simplify algorithms, which use this structure, each residue has a CB position defined (i.e. even if it’s a glycine) and we only allow amino acid types belonging to the 20 default amino acids. Note that the omega torsion angle defined here for residue i is the dihedral between CA-C of residue i and N-CA of residue i+1 (this is shifted by 1 residue compared to OST’s GetOmegaTorsion()).

BackboneList()

Creates empty BackboneList

BackboneList(sequence)

Creates a helical BackboneList from given sequence

Parameters:

sequence (str) – Sequence of created BackboneList

Raises:

RuntimeError if sequence contains a one letter code which is not one of the 20 default amino acids.

BackboneList(sequence, dihedral_angles)

Creates a BackboneList from given sequence and dihedral_angles

Parameters:
  • sequence (str) – Sequence of created BackboneList

  • dihedral_angles (list) – List of tuple objects defining the backbone dihedral angles of created BackboneList. Every tuple must either have two or three elements. Two elements are considered to define the phi and psi angles, leading to an idealized omega angle of 180 degrees. In case of three elements, all angles are defined.

Raises:

RuntimeError if sequence contains a one letter code which is not one of the 20 default amino acids or if sequence and dihedral_angles are inconsistent in size.

BackboneList(residues)

Creates a BackboneList with positions and sequence extracted from residues.

Parameters:

residues (list) – List of ost.mol.ResidueHandle objects from which the backbone positions and one letter codes are extracted.

Raises:

RuntimeError if a residue in residues contains a one letter code which is not one of the 20 default amino acids or when there is a residue not providing all required positions.

BackboneList(sequence, residues)

Creates a BackboneList from given sequence and positions extracted from residues.

Parameters:
  • sequence (str) – Sequence of created BackboneList

  • residues (list) – List of ost.mol.ResidueHandle objects from which the backbone positions are extracted.

Raises:

RuntimeError if sequence contains a one letter code which is not one of the 20 default amino acids or if sequence and residues are inconsistent in size or when there is a residue not providing all necessary positions.

ToDensity(padding=10.0, sampling=Vec3(1.0, 1.0, 1.0), resolution=3.0, high_resolution=false)
Returns:

The whole backbone list converted to a density map.

Return type:

ost.img.ImageHandle

Parameters:
  • padding (float) –

  • sampling (Vec3) –

  • resolution (float) –

  • high_resolution (bool) –

ToEntity()
Returns:

The whole backbone list converted to an OST entity.

Return type:

ost.mol.EntityHandle

InsertInto(chain, start_resnum)

Inserts the backbone list into the chain. If the residues corresponding to the BackboneList are already present in the entity, they will be replaced, otherwise they will be added to the entity.

Parameters:
InsertInto(map, resolution=3.0, high_resolution=false)
Parameters:
GetBounds(all_atom=True)
Returns:

Return type:

ost.geom.AlignedCuboid

Parameters:

all_atom (bool) –

GetSequence()
Returns:

The amino acid sequence.

Return type:

str

SetSequence(sequence)
Parameters:

sequence (str) – Set amino acid sequence to this.

Raises:

RuntimeError if sequence contains a one letter code which is not one of the 20 default amino acids or size of sequence does not match.

Extract(from, to)
Returns:

Items with indices from, …, to-1 of this list.

Return type:

BackboneList

ReplaceFragment(sub_fragment, index, superpose_stems)

Replaces a fragment of the BackboneList starting at position index by the sub_fragment.

Parameters:
  • sub_fragment (BackboneList) – The fragment to be inserted

  • index (int) – The position at which the fragment replacement will begin

  • superpose_stems (bool) – If set to false, the function will simply replace the according Backbone objects. If set to True, the n-terminal and c-terminal tails are superposed onto the sub_fragment stems using the positions at index and index + len( sub_fragment )-1.

Raises:

RuntimeError if sub_fragment does not fully fit into actual fragment at specified index

GetN(index)
GetCA(index)
GetCB(index)
GetC(index)
GetO(index)
Returns:

Position of nitrogen / alpha carbon / beta carbon / carbon / oxygen atom for residue at given index.

Return type:

Vec3

Parameters:

index (int) – Residue index.

SetN(index, pos)
SetCA(index, pos)
SetCB(index, pos)
SetC(index, pos)
SetO(index, pos)
Parameters:
  • index (int) – Residue index.

  • pos (Vec3) – Set position of nitrogen / alpha carbon / beta carbon / carbon / oxygen atom to this.

GetOLC(index)
Returns:

One letter code of the residue at given index.

Return type:

char

Parameters:

index (int) – Residue index.

SetOLC(index, olc)
Parameters:
  • index (int) – Residue index.

  • olc (char) – Set one letter code of the residue to this.

GetAA(index)
Returns:

Amino acid type of the residue at given index.

Return type:

ost.conop.AminoAcid

Parameters:

index (int) – Residue index.

SetAA(index, aa)
Parameters:
Raises:

RuntimeError if aa == ost.conop.XXX.

Set(index, n_pos, ca_pos, cb_pos, c_pos, o_pos, olc)
Set(index, n_pos, ca_pos, c_pos, o_pos, olc)
Set(index, res, olc)

Set all backbone informations. This will reconstruct CB positions if needed and set the amino acid type according to the given one letter code.

Parameters:
  • index (int) – Residue index.

  • res (ResidueHandle) – Residue from which to extract backbone atom positions

  • n_pos (Vec3) – Set position of nitrogen atom to this.

  • ca_pos (Vec3) – Set position of alpha carbon atom to this.

  • cb_pos (Vec3) – Set position of beta carbon atom to this.

  • c_pos (Vec3) – Set position of carbon atom to this.

  • o_pos (Vec3) – Set position of oxygen atom to this.

  • olc (char) – Set one letter code of the residue to this.

__len__()
Returns:

Number of residues in this backbone list.

Return type:

int

resize(new_size)
Parameters:

new_size (int) – Resize backbone list to contain this number of residues. If new residues are added, their properties will not be initialized. Existing residues are untouched unless the list is shrinked (in that case extra residues are deleted).

empty()
Returns:

True if the list is empty (i.e. size 0).

Return type:

bool

append(n_pos, ca_pos, cb_pos, c_pos, o_pos, olc)
append(n_pos, ca_pos, c_pos, o_pos, olc)
append(res, olc)

Appends a new residue at the end of the BackboneList. This will reconstruct CB positions if needed and set the amino acid type according to the given one letter code.

Parameters:
  • res (ResidueHandle) – Residue from which to extract backbone atom positions

  • n_pos (Vec3) – Set position of nitrogen atom to this.

  • ca_pos (Vec3) – Set position of alpha carbon atom to this.

  • cb_pos (Vec3) – Set position of beta carbon atom to this.

  • c_pos (Vec3) – Set position of carbon atom to this.

  • o_pos (Vec3) – Set position of oxygen atom to this.

  • olc (char) – Set one letter code of the residue to this.

clear()

Remove all residues from this list.

Copy()

Creates and returns a deep copy of this BackboneList. This can be useful, since Python uses reference assignments.

Return type:

BackboneList

ReconstructCBetaPositions()

Does a simple reconstruction of all CB positions based on the current N, CA and C positions.

ReconstructOxygenPositions(last_psi=-0.78540)

Does a simple reconstruction of all oxygen positions based on the actual N, CA and C positions. The position of the last oxygen depends on the next residue, an additional parameter is therefore required.

Parameters:

last_psi (float) – Psi angle of the last BackboneList residue, the default value corresponds to a typical alpha-helix.

ReconstructCStemOxygen(after_c_stem)

Reconstructs the last oxygen of this backbone list. The oxygen position depends on the residue following the C stem. The position is only reconstructed if the residue handle is valid.

Parameters:

after_c_stem (ost.mol.ResidueHandle) – Residue following the C stem (C stem residue is last element of this backbone list)

ApplyTransform(index, transform)

Applies a transformation to the positions of a single residue.

Parameters:
  • index (int) – Residue index.

  • transform (ost.geom.Mat4) – The transformation

ApplyTransform(from, to, transform)

Applies a transformation to the positions of the residues with indices from, …, to-1 of this list.

Parameters:
  • from (int) – Start index.

  • to (int) – End index (one past last residue to transform).

  • transform (ost.geom.Mat4) – The transformation

ApplyTransform(transform)

Applies a transformation to all positions of this list.

Parameters:

transform (ost.geom.Transform / ost.geom.Mat4) – The transformation

GetTransform(index, res)
GetTransform(index, other, other_index)
Returns:

Minimum RMSD transformation of residue index onto res or residue other_index of other backbone list considering the positions of the N, CA and C atoms.

Return type:

ost.geom.Mat4

Parameters:
GetTransform(other)
Returns:

Get minimum RMSD transformation of CA positions of this backbone list onto CA positions of other backbone list.

Return type:

ost.geom.Mat4

Parameters:

other (BackboneList) – The other backbone list.

SuperposeOnto(other)

Superposes this backbone list onto another one using CA positions.

Parameters:

other (BackboneList) – The other backbone list.

RotateAroundPhiTorsion(index, phi, sequential=False)
RotateAroundPsiTorsion(index, psi, sequential=False)
RotateAroundOmegaTorsion(index, omega, sequential=False)
RotateAroundPhiPsiTorsion(index, phi, psi, sequential=False)
SetAroundPhiTorsion(index, phi, sequential=False)
SetAroundPsiTorsion(index, psi, sequential=False)
SetAroundOmegaTorsion(index, omega, sequential=False)
SetAroundPhiPsiTorsion(index, phi, psi, sequential=False)

Rotates/sets the phi/psi/omega torsion angle of the backbone at position index in the backbone list by/to the given angle(s).

Parameters:
  • index (int) – Residue index.

  • phi (float) – Angle by which to rotate phi torsion.

  • psi (float) – Angle by which to rotate psi torsion.

  • omega (float) – Angle by which to rotate omega torsion.

  • sequential (bool) – If True, the rotation will be propagated to all residues after the one with index. Otherwise, it will be propagated in the direction where it will affect the least number of residues.

GetPhiTorsion(index)
GetPsiTorsion(index)
GetOmegaTorsion(index)
Returns:

The phi/psi/omega torsion angle for residue at given index.

Return type:

float

Parameters:

index (int) – Residue index.

TransOmegaTorsions(thresh=20 / 180 * pi, allow_prepro_cis=True)

Checks whether this backbone list only contains trans omega torsion angles. Usually, you would want this to be the case, but it can fail if you have any unfavorable omega torsion angle in your backbone.

Parameters:
  • thresh (float) – Allowed deviation from ideal trans angle (pi)

  • allow_prepro_cis (bool) – Flag, whether cis-omega torsions should be allowed in case of a subsequent proline.

Returns:

whether bb_list only contains trans-omega torsions.

Return type:

bool

Raises:

RuntimeError if size of this backbone list is smaller than 3.

SetBackrub(index, primary_rot_angle, flanking_rot_angle_one, flanking_rot_angle_two)

Applies a backrub motion [davis2006] at residue defined by index. The first rotation axis is defined by the CA positions from residues at index -1 and index +1. All atoms in between get rotated around this axis by primary_rot_angle. To restore the the hydrogen bond network of the two transformed oxygens, the backrub motion gets completed by two compensatory rotations. The first rotation is around the axis defined by the CA position from residue index-1 and the transformed central CA position with an angle of flanking_rot_angle_one. The second rotation is around the axis from the transformed central CA position to the CA position from residue at position index +1 with an angle of flanking_rot_angle_two.

Parameters:
  • index (int) – Position of central residue of the backrub motion

  • primary_rot_angle (float) – Angle of the first rotation in radians

  • flanking_rot_angle_one (float) – Angle of the first compensatory rotation in radians

  • flanking_rot_angle_two (float) – Angle of the second compensatory rotation in radians

Raises:

RuntimeError if index is smaller 1 or larger size of BackboneList - 2

SetBackrub(index, primary_rot_angle[, scaling=1.0])

Applies the backrub motion described above but calculates the ideal angles for the compensatory rotations in a way, that the new oxygen positions are as close as possible to the original ones. The ideal angles can be scaled down by scaling to make them less extreme.

Parameters:
  • index (int) – Position of central residue of the backrub motion

  • primary_rot_angle (float) – Angle of the first rotation in radians

  • scaling (float) – The ideal angles for the compensatory rotations will be scaled by this value.

Raises:

RuntimeError if index is smaller 1 or larger size of BackboneList - 2

MinCADistance(other)
Returns:

Minimal pairwise CA-distance between this and the other backbone list.

Return type:

float

Parameters:

other (BackboneList) – The other backbone list.

RMSD(other, superposed_rmsd=False)
CARMSD(other, superposed_rmsd=False)
Returns:

RMSD / C-alpha RMSD between this and the other backbone list.

Return type:

float

Parameters:
  • other (BackboneList) – The other backbone list.

  • superposed_rmsd (bool) – Whether to superpose before calculating the RMSD.

Search

Enter search terms or a module, class or function name.

Contents