deeprank2.molstruct submodules

deeprank2.molstruct.aminoacid

class deeprank2.molstruct.aminoacid.Polarity(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

One-hot encoding of the amino acid polarity.

NONPOLAR = 0
POLAR = 1
NEGATIVE = 2
POSITIVE = 3
property onehot: numpy.typing.NDArray
class deeprank2.molstruct.aminoacid.AminoAcid(name: str, three_letter_code: str, one_letter_code: str, charge: int, polarity: Polarity, size: int, mass: float, pI: float, hydrogen_bond_donors: int, hydrogen_bond_acceptors: int, index: int)[source]

Bases: object

An amino acid represents the type of Residue in a PDBStructure.

Parameters
  • name – Full name of the amino acid.

  • three_letter_code – Three-letter code of the amino acid (as in PDB).

  • one_letter_code – One-letter of the amino acid (as in fasta).

  • charge – Charge of the amino acid.

  • polarity – The polarity of the amino acid.

  • size – The number of non-hydrogen atoms in the side chain.

  • mass – Average residue mass (i.e. mass of amino acid - H20) in Daltons.

  • pI – Isolectric point; pH at which the molecule has no net electric charge.

  • hydrogen_bond_donors – Number of hydrogen bond donors.

  • hydrogen_bond_acceptors – Number of hydrogen bond acceptors.

  • index – The rank of the amino acid, used for computing one-hot encoding.

property name: str
property three_letter_code: str
property one_letter_code: str
property charge: int
property polarity: Polarity
property size: int
property mass: float
property pI: float
property hydrogen_bond_donors: int
property hydrogen_bond_acceptors: int
property onehot: numpy.typing.NDArray
property index: int

deeprank2.molstruct.atom

class deeprank2.molstruct.atom.AtomicElement(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

One-hot encoding of the atomic element (or atom type).

C = 1
O = 2
N = 3
S = 4
P = 5
H = 6
property onehot: numpy.array
class deeprank2.molstruct.atom.Atom(residue: Residue, name: str, element: AtomicElement, position: NDArray, occupancy: float)[source]

Bases: object

One atom in a PDBStructure.

Parameters
  • residue – The residue that this atom belongs to.

  • name – Pdb atom name.

  • element – The chemical element.

  • position – Pdb position xyz of this atom.

  • occupancy – Pdb occupancy value. This represents the proportion of structures where the atom is detected at a given position. Sometimes a single atom can be detected at multiple positions. In that case separate structures exist where sum(occupancy) == 1. Note that only the highest occupancy atom is used by deeprank2 (see tools.pdb._add_atom_to_residue).

change_altloc(alternative_atom: Atom) None[source]

Replace the atom’s location by another atom’s location.

property name: str
property element: AtomicElement
property occupancy: float
property position: NDArray
property residue: Residue

deeprank2.molstruct.pair

class deeprank2.molstruct.pair.Pair(item1: Any, item2: Any)[source]

Bases: object

A hashable, comparable object for any set of two inputs where order doesn’t matter.

Parameters
  • item1 – The pair’s first object, must be convertable to string.

  • item2 – The pair’s second object, must be convertable to string.

class deeprank2.molstruct.pair.Contact(item1: Any, item2: Any)[source]

Bases: Pair, ABC

Parent class to bind ResidueContact and AtomicContact objects.

class deeprank2.molstruct.pair.ResidueContact(residue1: Residue, residue2: Residue)[source]

Bases: Contact

A contact between two residues from a structure.

property residue1: Residue
property residue2: Residue
class deeprank2.molstruct.pair.AtomicContact(atom1: Atom, atom2: Atom)[source]

Bases: Contact

A contact between two atoms from a structure.

property atom1: Atom
property atom2: Atom

deeprank2.molstruct.residue

class deeprank2.molstruct.residue.Residue(chain: Chain, number: int, amino_acid: AminoAcid | None = None, insertion_code: str | None = None)[source]

Bases: object

One protein residue in a PDBStructure.

A Residue is the basic building block of proteins and protein complex, here represented by PDBStructures. Each Residue is of a certain AminoAcid type and consists of multiple `Atom`s.

Parameters
  • chain – The chain that this residue belongs to.

  • number – the residue number

  • amino_acid – The residue’s amino acid (if it’s part of a protein). Defaults to None.

  • insertion_code – The pdb insertion code, if any. Defaults to None.

get_pssm() PssmRow[source]

Load pssm info linked to the residue.

property number: int
property chain: Chain
property amino_acid: AminoAcid
property atoms: list[Atom]
property number_string: str

Contains both the number and the insertion code (if any).

property insertion_code: str
add_atom(atom: Atom) None[source]
property position: numpy.array
get_center() NDArray[source]

Find the center position of a Residue.

Center position is found as follows: 1. find beta carbon 2. if no beta carbon is found: find alpha carbon 3. if no alpha carbon is found: take the mean of the atom positions

class deeprank2.molstruct.residue.SingleResidueVariant(residue: Residue, variant_amino_acid: AminoAcid)[source]

Bases: object

A single residue mutation of a PDBStrcture.

Parameters
  • residue – the Residue object from the PDBStructure that is mutated.

  • variant_amino_acid – the amino acid that the Residue is mutated into.

property residue: Residue
property variant_amino_acid: AminoAcid
property wildtype_amino_acid: AminoAcid

deeprank2.molstruct.structure

class deeprank2.molstruct.structure.PDBStructure(id_: str | None = None)[source]

Bases: object

A proitein or protein complex structure.

A PDBStructure can contain one or multiple Chains, i.e. separate molecular entities (individual proteins). One PDBStructure consists of a number of Residue`s, each of which is of a particular `AminoAcid type and in turn consists of a number of `Atom`s.

Parameters

id – An unique identifier for this structure, can be the pdb accession code. Defaults to None.

has_chain(chain_id: str) bool[source]
get_chain(chain_id: str) Chain[source]
add_chain(chain: Chain) None[source]
property chains: list[deeprank2.molstruct.structure.Chain]
get_atoms() list[Atom][source]

List all atoms in the structure.

property id: str
class deeprank2.molstruct.structure.Chain(model: PDBStructure, id_: str | None)[source]

Bases: object

One chain of a PDBStructure.

Args: model: The model that this chain is part of. id_: The pdb identifier of this chain.

property model: PDBStructure
property pssm: PssmRow
add_residue(residue: Residue) None[source]
has_residue(residue_number: int, insertion_code: str | None = None) bool[source]
get_residue(residue_number: int, insertion_code: str | None = None) Residue[source]
property id: str
property residues: list[Residue]
get_atoms() list[Atom][source]

Shortcut to list all atoms in this chain.