metrics.py

class src.metrics.metrics.Builder(is_AF=False)

Bases: Bio.PDB.StructureBuilder.StructureBuilder

Subclassing of Bio.PDB.StructureBuilder.StructureBuilder to incorporate metrics.ModRes and metrics.ModStructure into the Bio.PDB hierarchy.

Usage: Pass a Builder instance to the PDBParser as a structure_builder parameter.

Example: >>> parser = PDBParser(QUIET=1, structure_builder=Builder()) >>> s = parser.get_structure(“code”, “1ris.pdb”)

get_structure()

For AlphaFold structures containing floppy N and C terminal, residues are removed until the first residue with a pLDDT (confidence) > 80.

init_residue(resname, field, resseq, icode)

Instantiate residue as src.metrics.metrics.ModRes object. Overrides Bio.PDB.StructureBuilder.init_residue.

init_structure(structure_id)

Instantiate structure object as a metrics.ModStructure object. Overrides Bio.PDB.StructureBuilder.init_structure.

class src.metrics.metrics.ModRes(id, resname, segid)

Bases: Bio.PDB.Residue.Residue

is_buried(threshold=0.25)

Return boolean depending on ratio of residue SASA with respect to literature values in GLYXGLY_ASA.

Parameters

threshold (float) – ratio (0, 1) of residue’s SASA over reference Gly-X-Gly polymer value.

Returns

bool

Raises

AttributeError – if the ModRes.monosara attribute is not set; if ModStructure.calculate_sasa didn’t run.

class src.metrics.metrics.ModStructure(id)

Bases: Bio.PDB.Structure.Structure

Subclass of Bio.PDB.Structure containing new methods and attributes for the estimation of protein physichochemical properties from their PDB coordinates.

aminocount()

Return the amount of positive, negative and hydrophobic residues.

Parameters

self – Structure entity

Returns

Amount of positive, negative and hydrophobic residues in protein.

Return type

tuple

classmethod anglemeasurement(v, u)

Calculate angle between any two vectors v and u, in degrees.

calculate_sasa()

Perform SASA calculation with ShrakeRupley algorithm for the individual chains (monomers). Attach results to residue objects as Residue.monosasa.

Parameters

self – Structure entity

Returns

Solvent accessible surface area (SASA)

Return type

int

dipolemoment()

Calculation of the dipole moment from the dipole vector.

Parameters

self – Structure entity

Returns

Dipole moment

Return type

int

dipolevector()

Return dipole moment calculated from the position of the positive and negative residues. Source for dipolemoment equation: Felder, Prilusky, Silman, Sussman Nucleic Acids Research 2007

Parameters

self – Structure entity

Returns

Dipole vector

Return type

tuple

getlength()

Return length of the protein sequence.

Parameters

self – Structure entity

Returns

Length of sequence

Return type

int

hydrophobicmoment()

Calculate first order hydrophobic moment. Source for hydrophobicmoment equation: Silverman PNAS 2001, eq. 13

Parameters

self – Structure entity

Returns

Hydrophobic momemnt

Return type

int

hydrophobicvector()

Calculate first order hydrophobic moment vector.

Parameters

self – Structure entity

Returns

Hydrophobic vector

Return type

tuple

measure()

Assigns measurement to an attribute.

Parameters

self – Structure entity

molecularweight()

Return molecular weight of the protein sequence.

Parameters

self – Structure entity

Returns

Molecular weight

Return type

int

netcharge()

Return the net charge of the protein from the amount of positive and negative amino acids.

Parameters

self – Structure entity

Returns

Net charge

Return type

int

netchargedensity()

Return net charge density from net charge and total SASA of the residues.

Parameters

self – Structure entity

Returns

Net charge density

Return type

int

save_pdb(outfname)

Save structure as pdb file. Typically used together with trimming.

sequencer()

Return polypeptide sequence from peptides.

Parameters

self – Structure entity

Returns

Amino acid sequence in one letter code

Return type

str

serializer()

Returns a dictionary representing the structure’s physicochemical properties.

Parameters

self – Structure entity

Returns

Dictionary of attributes

Return type

dict

truehydrophobicity()

Calculate total hydrophobicity for residues that are more than 25% exposed to the surface.

Parameters

self – Structure entity

Returns

Hydrophobicity for exposed amino acids

Return type

int