Rotamer Library¶
With angles and bonds being rather rigid, the conformation of an amino acid
sidechain can completely be described in terms of dihedral angles. Preferred
combinations of such dihedral angles are a result of steric properties and
can be gathered in rotamer libraries. Different libraries exist in the field
and their main difference is, whether the provided sidechain conformations
are dependent on their backbone or not. ProMod3 provides you with a
BBDepRotamerLib
organizing rotamers for the different aminoacids
in equidistant phi/psi bins, as well as a simple RotamerLib
.
Both libraries are containers for RotamerLibEntry
and are optimized
for fast writing/loading from/to disk. Once initialized, the library is in a
dynamic mode where rotamers can be added.
No rotamers can be read at this stage. As soon as
all required rotamers are added, the library can be made static. This is the
mode you can get the rotamers out of it or dump it to disk.
The Non Backbone Dependent Rotamer Library¶
- class promod3.sidechain.RotamerLib¶
Non backbone dependent rotamer library
- static Load(filename)¶
- static LoadPortable(filename)¶
Loads raw binary file generated with
Save()
(optimized for fast reading) / portable file generated withSavePortable()
(slower but less machine-dependent).
- Save(filename)¶
- SavePortable(filename)¶
Saves a raw / portable binary representation. Use portable files for distribution and convert locally to raw files. See here for details.
- Parameters:
filename (
str
) – Path to the file where it will be saved.
- AddRotamer(id, rotamer)¶
- Parameters:
id (
RotamerID
) – Identity of rotamer to be addedrotamer (
RotamerLibEntry
) – the rotamer to be added
- Raises:
RuntimeError
if the library is already static
- QueryLib(id)¶
The query function follows following strategies in case of special id requests.
if id = HSD (d-protonated HIS) try to find HSD, fallback to HIS in case of failure
if id = HSE (e-protonated HIS) try to find HSE, fallback to HIS in case of failure
if id = CYH (“free” CYS) try to find CYH, fallback to CYS in case of failure
if id = CYD (“disulfid” CYS) try to find CYD, fallback to CYS in case of failure
if id = CPR (cis-PRO) try to find CPR, fallback to PRO in case of failure
if id = TPR (trans-PRO) try to find TPR, fallback to PRO in case of failure
- Parameters:
id (
RotamerID
) – Identity of rotamer of interest- Returns:
list
ofRotamerLibEntry
of nonzero probability sorted by their probability- Raises:
RuntimeError
if no entries for id can be found
- MakeStatic()¶
Once all rotamers are added, the library can be made static to become readable and ready for io.
The Backbone Dependent Rotamer Library¶
- class promod3.sidechain.BBDepRotamerLib(phi_bins, psi_bins)¶
Backbone dependent rotamer library
- Parameters:
- static Load(filename)¶
- static LoadPortable(filename)¶
Loads raw binary file generated with
Save()
(optimized for fast reading) / portable file generated withSavePortable()
(slower but less machine-dependent).
- Save(filename)¶
- SavePortable(filename)¶
Saves a raw / portable binary representation. Use portable files for distribution and convert locally to raw files. See here for details.
- Parameters:
filename (
str
) – Path to the file where it will be saved.- Raises:
RuntimeError
if file cannot be opened.
- AddRotamer(id, r1, r2, r3, r4, phi_bin, psi_bin, rotamer)¶
- Parameters:
id (
RotamerID
) – Identity of rotamer to be addedr1 (
int
) – Configuration of chi1r2 (
int
) – Configuration of chi2r3 (
int
) – Configuration of chi3r4 (
int
) – Configuration of chi4phi_bin (
int
) – Phi backbone dihedral descriptionpsi_bin (
int
) – Psi backbone dihedral descriptionrotamer (
RotamerLibEntry
) – the rotamer to be added
- Raises:
RuntimeError
if an invalid backbone angle bin is given or when the library is already static.
- QueryLib(id, phi, psi)¶
The returned rotamers are either directly returned in the form as they are added to the library or can be interpolated. In the first option, phi and psi simply get transformed to the according bin using following formalism: bin = round((angle + pi)/bin_size). In case of interpolation, the chi angles of rotameric dihedral angles and the according standard deviations of the rotamers get bilinearly interpolated using the corresponding rotamers with same configuration from the neighbouring bins. No interplation is applied to non-rotameric dihedral angles (chi2 in ASP, ASN, HIS, PHE, TRP, TYR; chi3 in GLU, GLN). This behaviour can be controlled with
SetInterpolate()
. The query function follows following strategies in case of special id requests.if id = HSD (d-protonated HIS) try to find HSD, fallback to HIS in case of failure
if id = HSE (e-protonated HIS) try to find HSE, fallback to HIS in case of failure
if id = CYH (“free” CYS) try to find CYH, fallback to CYS in case of failure
if id = CYD (“disulfid” CYS) try to find CYD, fallback to CYS in case of failure
if id = CPR (cis-PRO) try to find CPR, fallback to PRO in case of failure
if id = TPR (trans-PRO) try to find TPR, fallback to PRO in case of failure
- Parameters:
- Returns:
list
ofRotamerLibEntry
of nonzero probability for given phi/psi pair sorted by their probability- Raises:
RuntimeError
if no entries for id can be found
- MakeStatic()¶
Once all rotamers are added, the library can be made static to become readable and ready for io. Several things get checked during this process
For every phi/psi bin combination of a particular
RotamerID
, the same number of rotamers must have been addedAll configuration combinations of the added rotamers in one phi/psi bin of a particular
RotamerID
must be uniqueThe configuration combinations of a particular
RotamerID
must be consistent across all phi/psi bins
- Raises:
RuntimeError
if one of the points above is not fulfilled
- SetInterpolate(interpolate)¶
- Parameters:
interpolate (
bool
) – Controls behaviour whenQueryLib()
gets called
The Library Entry Type¶
The entries for the rotamer libraries provide a basic container for rotamer dihedral angles and their corresponding standard deviations. They can be constructed by directly providing the values, but also by some static convenience functions. For analytical purposes they provide some comparison functionalities.
- class promod3.sidechain.RotamerLibEntry¶
- class promod3.sidechain.RotamerLibEntry(p, chi1, chi2, chi3, chi4, sig1, sig2, sig3, sig4)¶
- Parameters:
p (
float
) – Probability of rotamerchi1 (
float
) – Chi1 dihedral in range [-pi,pi[chi2 (
float
) – Chi2 dihedral in range [-pi,pi[chi3 (
float
) – Chi3 dihedral in range [-pi,pi[chi4 (
float
) – Chi4 dihedral in range [-pi,pi[sig1 (
float
) – Standard deviation for Chi1 dihedralsig2 (
float
) – Standard deviation for Chi2 dihedralsig3 (
float
) – Standard deviation for Chi3 dihedralsig4 (
float
) – Standard deviation for Chi4 dihedral
Attributes:
- probability¶
probability of rotamer
- chi1¶
Chi1 dihedral in range [-pi,pi[, NaN if not defined
- chi2¶
Chi2 dihedral in range [-pi,pi[, NaN if not defined
- chi3¶
Chi3 dihedral in range [-pi,pi[, NaN if not defined
- chi4¶
Chi4 dihedral in range [-pi,pi[, NaN if not defined
- sig1¶
Standard deviation of Chi1 Dihedral, NaN if not defined
- sig2¶
Standard deviation of Chi2 Dihedral, NaN if not defined
- sig3¶
Standard deviation of Chi3 Dihedral, NaN if not defined
- sig4¶
Standard deviation of Chi4 Dihedral, NaN if not defined
- static FromResidue(res)¶
Creates a
RotamerLibEntry
from the given res. The function tries to automatically identify theRotamerID
based on the residue name. The probability and standard deviations are set to 0.0, all not required chi angles with their corresponding standard deviations to NaN.- Parameters:
res (
ost.mol.ResidueHandle
) – Source of dihedral angles- Returns:
- Raises:
RuntimeError
if residue name cannot be translated toRotamerID
or when not all required atoms are present in res.
- static FromResidue(res, id)¶
Creates a
RotamerLibEntry
from the given res. The probability gets set to zero and the standard deviations to 0. All not required chi angles with their corresponding standard deviations are NaN.- Parameters:
res (
ost.mol.ResidueHandle
) – Source of dihedral anglesid (
RotamerID
) – The identity of the returnedRotamerLibEntry
- Returns:
- Raises:
RuntimeError
if not all required atoms are present in res.
- IsSimilar(other, thresh)¶
Compares two RotamerLibEntries for their similarity in dihedral angles. The function goes from chi1 to chi4 and checks one after the other for similarity. The function doesn’t know the identity of the entries and can therefore not specifically treat symmetric rotamers (TYR,PHE,ASP,GLU) or rotamers with ambiguous naming in general.
- Parameters:
other (
RotamerLibEntry
) – The Entry you want to compare withthresh (
float
) – The max difference between two dihedrals to be considered similar
- Returns:
bool
Whether the two entries have the same amount of defined chi angles (not NaN) and whether they are within the specified threshold.
- IsSimilar(other, thresh, id)¶
Compares two RotamerLibEntries for their similarity in dihedral angles. The function goes from chi1 to chi4 and checks one after the other for similarity. Sidechains with ambigous naming that are symmetric (TYR,PHE,ASP,GLU) get treated specifically. E.g. in case of aspartate, the chi2 is checked for its actual value, but also for its flipped state.
- Parameters:
other (
RotamerLibEntry
) – The Entry you want to compare withthresh (
float
) – The max difference between two dihedrals to be considered similarid (
RotamerID
) – Identity of the entries to be compared
- Returns:
bool
Whether the two entries have the same amount of defined chi angles (not NaN) and whether they are within the specified threshold.
- SimilarDihedral(other, dihedral_idx, thresh)¶
Compares a specific dihedral angle. The function doesn’t know the identity of the entries and can therefore not specifically treat symmetric rotamers (TYR,PHE,ASP,GLU) or rotamers with ambiguous naming in general.
- Parameters:
other (
RotamerLibEntry
) – The Entry you want to compare withdihedral_idx (
int
) – Index of the dihedral to be checked (0 for chi1, 3 for chi4)thresh (
float
) – The max difference between two dihedrals to be considered similar
- Returns:
bool
Whether both dihedrals are defined (not NaN) and within the specified threshold
- SimilarDihedral(other, dihedral_idx, thresh, id)¶
Compares a specific dihedral angle. Symmetric sidechains with ambigous naming (TYR,PHE,ASP,GLU) get treated specifically. E.g. in case of aspartate, the chi2 is checked for its actual value, but also for its flipped state.
- Parameters:
other (
RotamerLibEntry
) – The Entry you want to compare withdihedral_idx (
int
) – Index of the dihedral to be checked (0 for chi1, 3 for chi4)thresh (
float
) – The max difference between two dihedrals to be considered similarid (
RotamerID
) – Identity of the entries to be compared
- Returns:
bool
Whether both dihedrals are defined (not NaN) and within the specified threshold
Rotamer Configurations¶
In rotamers, one distinguishes between rotameric and non-rotameric sidechain dihedral angles. The rotameric ones are around SP3-SP3 hybridized bonds and typically have three distinct configurations (trans, gauche-, gauche+). The non-rotameric ones behave differently. ProMod3 offers some functionality to estimate those configurations.
- class promod3.sidechain.DihedralConfiguration¶
Enumerates the possible sidechain dihedral configurations
TRANS - Trans configuration (120 < angle < -120)
GAUCHE_PLUS - Gauche+ configuration (0 < angle < 120)
GAUCHE_MINUS - Gauce- configuration (-120 < angle < 0)
NON_ROTAMERIC - Dihedral without SP3-SP3 bond
INVALID - Invalid configuration, e.g. chi3 of ALA (doesnt exist…)
- promod3.sidechain.GetRotamericConfiguration(angle)¶
Evaluates the angle according to the ranges specified for
DihedralConfiguration
.- Parameters:
angle (
float
) – Angle to be evaluated- Returns:
TRANS, GAUCHE_PLUS or GAUCHE_MINUS. INVALID if angle is NaN.
- promod3.sidechain.GetDihedralConfiguration(entry, id, dihedral_idx)¶
Estimates configuration of a sidechain dihedral angle in a specific
RotamerLibEntry
with the knowledge of its identity. This allows to also return NON_ROTAMERIC (e.g. chi2 for ASN).- Parameters:
entry (
RotamerLibEntry
) – Sidechain dihedral angle comes from hereid (
RotamerID
) – Identity of rotamerdihedral_idx (
int
) – Specifies angle (0 => chi1, …, 3 => chi4)
- Returns:
Result of
GetRotamericConfiguration()
if specified angle is Rotameric, NON_ROTAMERIC if specified angle is valid and non rotameric, INVALID otherwise.