openfold.np.residue_constants

Constants used in AlphaFold.

Classes

Bond(atom1_name, atom2_name, length, stddev)

BondAngle(atom1_name, atom2_name, atom3name, ...)

Functions

aatype_to_str_sequence(aatype)

chi_angle_atom(atom_index)

Define chi-angle rigid groups via one-hot representations.

load_stereo_chemical_props()

Load stereo_chemical_props.txt into a nice structure.

make_atom14_dists_bounds([...])

compute upper and lower bounds for bonds to assess violations.

sequence_to_onehot(sequence, mapping[, ...])

Maps the given sequence into a one-hot encoded matrix.

class Bond(atom1_name, atom2_name, length, stddev)

Bases: tuple

atom1_name

Alias for field number 0

atom2_name

Alias for field number 1

length

Alias for field number 2

stddev

Alias for field number 3

class BondAngle(atom1_name, atom2_name, atom3name, angle_rad, stddev)

Bases: tuple

angle_rad

Alias for field number 3

atom1_name

Alias for field number 0

atom2_name

Alias for field number 1

atom3name

Alias for field number 2

stddev

Alias for field number 4

aatype_to_str_sequence(aatype)
chi_angle_atom(atom_index)

Define chi-angle rigid groups via one-hot representations.

Parameters:

atom_index (int)

Return type:

ndarray

load_stereo_chemical_props()

Load stereo_chemical_props.txt into a nice structure.

Load literature values for bond lengths and bond angles and translate bond angles into the length of the opposite edge of the triangle (“residue_virtual_bonds”).

Returns:

Dict that maps resname -> list of Bond tuples residue_virtual_bonds: Dict that maps resname -> list of Bond tuples residue_bond_angles: Dict that maps resname -> list of BondAngle tuples

Return type:

residue_bonds

make_atom14_dists_bounds(overlap_tolerance=1.5, bond_length_tolerance_factor=15)

compute upper and lower bounds for bonds to assess violations.

sequence_to_onehot(sequence, mapping, map_unknown_to_x=False)

Maps the given sequence into a one-hot encoded matrix.

Parameters:
  • sequence (str) – An amino acid sequence.

  • mapping (Mapping[str, int]) – A dictionary mapping amino acids to integers.

  • map_unknown_to_x (bool) – If True, any amino acid that is not in the mapping will be mapped to the unknown amino acid ‘X’. If the mapping doesn’t contain amino acid ‘X’, an error will be thrown. If False, any amino acid not in the mapping will throw an error.

Returns:

A numpy array of shape (seq_len, num_unique_aas) with one-hot encoding of the sequence.

Raises:

ValueError – If the mapping doesn’t contain values from 0 to num_unique_aas - 1 without any gaps.

Return type:

ndarray