graphein.protein.tensor

Data and Batch Objects

Data and Batch Objects for working proteins in PyTorch Geometric

class graphein.protein.tensor.data.Protein(atom_list: List[str] = ['N', 'CA', 'C', 'O', 'CB', 'OG', 'CG', 'CD1', 'CD2', 'CE1', 'CE2', 'CZ', 'OD1', 'ND2', 'CG1', 'CG2', 'CD', 'CE', 'NZ', 'OD2', 'OE1', 'NE2', 'OE2', 'OH', 'NE', 'NH1', 'NH2', 'OG1', 'SD', 'ND1', 'SG', 'NE1', 'CE3', 'CZ2', 'CZ3', 'CH2', 'OXT'], fill_value: float = 1e-05, **kwargs)[source]

“A data object describing a homogeneous graph. Protein inherits from torch_geometric.data.Data and implements structural-biology specific methods in addition. Data and Protein objects can be directly converted between using Protein().from_data() and Protein().to_data(). Think of Protein as an equivalent to Data but with some protein-specific trimmings.

The data object can hold node-level, link-level and graph-level attributes. In general, Data tries to mimic the behaviour of a regular Python dictionary. In addition, it provides useful functionality for analyzing graph structures, and provides basic PyTorch tensor functionalities. See here for the accompanying tutorial.

There are several ways to instantiate a Protein:

import graphein.protein.tensor as gpt

# From a PDB code
protein = gpt.Protein()
protein.from_pdb_code("4hhb", chain_selection="ABCD")

# From a PDB file
protein = gpt.Protein()
protein.from_pdb_file("4hhb.pdb", chain_selection="ABCD")


# From a BioPandas DataFrame
p = PandasPdb().fetch_pdb("4hhb")
df = p.df["ATOM"]
protein = gpt.Protein().from_dataframe(df)

# From a PyG Data object
data = gpt.io.protein_to_pyg(
    pdb_code="4hhb", # Can alternatively pass a path or a uniprot ID (for AF2) with path=... and uniprot_id=...
    chain_selection="ABCD", # Select all 4 chains
    deprotonate=True, # Deprotonate the structure
    keep_insertions=False, # Remove insertions
    keep_hets=[], # Remove HETATMs
    model_index=1, # Select the first model
    # Can select a subset of atoms with atom_types=...
    )
protein = gpt.Protein().from_data(data)

The advantage is that it provides access to many protein-specific methods such as:

import graphein.protein.tensor as gpt

protein = gpt.Protein()
protein.from_pdb_code("4hhb", chain_selection="ABCD")

protein.dihedrals() # Backbone dihedral angles
protein.sidechain_torsion() # Sidechain Torsion Angles
protein.c_alpha() # Gets Ca coordinates
protein.plot_structure() # Plots the 3D structure using plotly
protein.idealize_backbone() # Idealizes the backbone geometry

and many more!

__init__(atom_list: List[str] = ['N', 'CA', 'C', 'O', 'CB', 'OG', 'CG', 'CD1', 'CD2', 'CE1', 'CE2', 'CZ', 'OD1', 'ND2', 'CG1', 'CG2', 'CD', 'CE', 'NZ', 'OD2', 'OE1', 'NE2', 'OE2', 'OH', 'NE', 'NH1', 'NH2', 'OG1', 'SD', 'ND1', 'SG', 'NE1', 'CE3', 'CZ2', 'CZ3', 'CH2', 'OXT'], fill_value: float = 1e-05, **kwargs) → None[source]

See also

graphein.protein.tensor.types.AtomTensor graphein.protein.resi_atom.PROTEIN_ATOMS

Parameters:
  • atom_list (List[str]) – List of atoms to include in the AtomTensor.

  • fill_value (float) – Value to fill in for missing values in the AtomTensor.

  • kwargs – Additional keyword arguments to store as attributes.

align_to(other: Protein, ca_only: bool = True, return_transformed: bool = True, cache: str | None = None) → Tensor | Tuple[Tensor, Tensor][source]

Aligns the Protein to another (other) tensor using the Kabsch algorithm.

alpha(cache: str | None = None, rad: bool = True, embed: bool = True) → Tensor[source]

Computes alpha virtual angle.

Parameters:

cache (Optional[str]) – If provided, the result will be cached in the Protein under the provided string as the attribute name. Default is None, (not stored).

alpha_carbon(cache: str | None = None) → CoordTensor[source]

Returns the alpha carbon coordinates of the protein as a tensor of shape Length x 3.

Parameters:

cache (Optional[str]) – If provided, the result will be cached in the Protein object with the provided string as the attribute name. Default is None (not stored).

Returns:

Alpha carbon coordinates

Return type:

graphein.protein.tensor.types.CoordTensor

apply_structural_noise(x: AtomTensor | CoordTensor | None = None, magnitude: float = 0.1, gaussian: bool = True, return_transformed: bool = True, cache: str | None = None) → AtomTensor | CoordTensor[source]

Applies noise to the structure of the protein.

Parameters:
  • x – Coordinates to apply noise to, defaults to None. If None (default), self.coords is used.

  • cache – If provided, the result will be cached in the Protein under the provided string as the attribute name. Default is None, (not stored).

backbone(cache: str | None = None) → BackboneTensor[source]

Returns the backbone coordinates of the protein as a tensor of shape Length x 4 x 3 ([N, Ca, C, O]).

Parameters:

cache (Optional[str]) – If provided, the result will be cached in the Protein object with the provided string as the attribute name. Default is None (not stored).

Returns:

Backbone coordinates [Length x 4 x 3]

Return type:

graphein.protein.tensor.types.BackboneTensor

backbone_frames(cache: str | None = None) → Tuple[BackboneFrameTensor, CoordTensor][source]

Computes backbone rotation frames from an idealised residue.

Parameters:

cache (Optional[str]) – If provided, the result will be cached in the Protein object with the provided string as the attribute name. Default is None (not stored).

Returns:

_description_

Return type:

Tuple[BackboneFrameTensor, CoordTensor]

dihedrals(rad: bool = True, embed: bool = True, cache: str | None = None) → DihedralTensor[source]
edge_distances(x: CoordTensor, edge_index: EdgeTensor, p: float = 2, cache: str | None = None) → Tensor[source]

Computes the edges distances between nodes.

Parameters:
  • x – Node positions

  • edge_index – Edge indices

  • p – The norm degree. Can be negative. Default: 2.``

Returns:

Edge distances

Return type:

torch.Tensor

edges(edge_type: str = 'knn_10', x: Tensor | None = None, cache: str | None = None, **kwargs) → EdgeTensor[source]

Computes edges for a protein as specified by the edge_type argument. If x is not provided, the edges are calculated based on Alpha Carbon positions by default.

See also

graphein.protein.tensor.edges.compute_edges() graphein.protein.tensor.edges.radius_edges() graphein.protein.tensor.edges.knn_edges()

Parameters:
  • edge_type (str) – Str denoting type of edges in form {edgetype}_{value}. E.g. "knn_8" for KNN with k=8, "eps_6" for radius graph with r=6.

  • x (Optional[torch.Tensor]) – Node feature/position matrix used to calculate edges. If None (default), the alpha carbon trace is used.

  • cache (Optional[str]) – String to set edges as a Protein attribute. If None (default), edges are not saved.

from_data(data: Data) → Protein[source]

Instantiate a Protein object from a PyTorch Geometric Data object.

Example:

>>> import graphein.protein.tensor as gpt

>>> data = gpt.io.protein_to_pyg(
    ... pdb_code="4hhb", # Can alternatively pass a path or a uniprot ID (for AF2) with path=... and uniprot_id=...
    ... chain_selection="ABCD", # Select all 4 chains
    ... deprotonate=True, # Deprotonate the structure
    ... keep_insertions=False, # Remove insertions
    ... keep_hets=[], # Remove HETATMs
    ... model_index=1, # Select the first model
    ... # Can select a subset of atoms with atom_types=...
    ... )

>>> protein = gpt.Protein()
>>> protein = protein.from_data(data)
>>> print(protein)
Parameters:

data (Data) – PyTorch Geometric Data object

Returns:

Protein object containing the same keys and values

Return type:

Protein

from_dataframe(df: DataFrame, id: str | None = None, atoms_to_keep: List[str] = ['N', 'CA', 'C', 'O', 'CB', 'OG', 'CG', 'CD1', 'CD2', 'CE1', 'CE2', 'CZ', 'OD1', 'ND2', 'CG1', 'CG2', 'CD', 'CE', 'NZ', 'OD2', 'OE1', 'NE2', 'OE2', 'OH', 'NE', 'NH1', 'NH2', 'OG1', 'SD', 'ND1', 'SG', 'NE1', 'CE3', 'CZ2', 'CZ3', 'CH2', 'OXT'], node_labels: Tensor | None = None, graph_labels: Tensor | None = None) → Protein[source]

Instantiate a Protein object from a Pandas DataFrame.

import graphein.protein.tensor as gpt
from biopandas.pdb import PandasPdb

p = PandasPdb().fetch_pdb("4hhb")
df = p.df["ATOM"]

protein = gpt.Protein()
protein = protein.from_dataframe(
    df,
    atoms_to_keep=["N", "CA", "C", "O", "CB"]
    id="test_structure",
    node_labels=torch.ones(100, 1),
    graph_labels=torch.tensor(42)
    )
Parameters:
  • df (pd.DataFrame) – Protein structure DataFrame

  • atoms_to_keep (List[str]) – List of atom names to preserve. See graphein.protein.resi_atoms.PROTEIN_ATOMS

Returns:

``Protein` object populated with attributes.

Return type:

Protein

full_atom_coords(cache: str | None = None) → CoordTensor[source]

Gets the full atom coordinates of the protein. Returns tensor of shape [Length x 3].

Parameters:

cache (Optional[str], optional) – Whether or not to store the coordinates as an attribute, defaults to None (note stored).

Returns:

Tensor of atom positions.

Return type:

CoordTensor

has_complete_backbone() → bool[source]

Checks if a Protein as all backbone atoms present.

Returns:

Boolean indicating whether or not the Protein has a complete backbone.

Return type:

bool

idealize_backbone(x: AtomTensor | BackboneTensor | None = None, lr: float = 0.001, n_iter: int = 100, inplace: bool = False, cache: str | None = None) → AtomTensor[source]

Computes idealised backbone coordinates.

Parameters:
  • lr (float, optional) – Learning rate to use for optimisation, defaults to 1e-3

  • n_iter (int, optional) – Number of optimisation steps, defaults to 100

  • inplace (bool, optional) – Whether or not to optimise the backbone inplace, defaults to False.

Returns:

Idealised backbone coordinates

Return type:

AtomTensor

is_complete() → bool[source]

Checks if a Protein as all the requisite atoms present.

Returns:

Boolean indicating whether or not the Protein has a complete structure.

Return type:

bool

kappa(cache: str | None = None, rad: bool = True, embed: bool = True) → Tensor[source]

Computes kappa virtual angle.

Param:

cache: If provided, the result will be cached in the Protein under the provided string as the attribute name. Default is None, (not stored).

plot_distance_matrix(x: CoordTensor | None = None) → Figure[source]

Plots a distance matrix. If x is not provided, it plots the alpha carbon contact map.

Parameters:

x – Coordinates to plot, defaults to None. If None, the alpha carbon coordinates are used.

plot_structure(atoms: List[str] = ['N', 'CA', 'C', 'O'], lines: bool = True) → Figure[source]

Plots a 3D structure of the protein in Plotly. This can be logged to WandB.

save(out_path: str)[source]

Save a Protein object to disk in tensor format.

Parameters:

out_path (str) – Path to save Protein to.

sidechain_torsion(cache: str | None = None) → TorsionTensor[source]

Computes sidechain torsion angles.

Param:

cache: If provided, the result will be cached in the Protein under the provided string as the attribute name. Default is None , (not stored).

to_data() → Data[source]

Convert a Protein object to PyTorch Geometric Data object.

import graphein.protein.tensor as gpt
protein = gpt.Protein().from_pdb_code(pdb_code="3eiy")

type(protein) # Protein

pyg_data = protein.to_data()
type(pyg_data) # torch_geometric.data.Data
Returns:

Data object containing the same keys and values

Return type:

Data

to_dataframe(x: AtomTensor | BackboneTensor | None = None, cache: str | None = None, **kwargs) → DataFrame | PandasPdb[source]

Compute a Pandas DataFrame from a Protein object.

Parameters:
Returns:

DataFrame of protein structure.

Return type:

Union[pd.DataFrame, PandasPdb]

to_pdb(out_path: str | None = None, x: AtomTensor | BackboneTensor | None = None, gz: bool = False, **kwargs)[source]

Write a Protein object to a PDB file.

import graphein.protein.tensor as gpt
protein = gpt.Protein().from_pdb_code(pdb_code="3eiy")

protein.to_pdb(out_path="3eiy.pdb")

# Write only backbone
protein.to_pdb(x=protein.backbone(), out_path="3eiy_backbone.pdb")
Parameters:
  • x (Optional[Union[AtomTensor, BackboneTensor]], optional) – AtomTensor, defaults to None (uses Protein.coords)

  • out_path (Optional[str], optional) – Path to output file, defaults to None ({Protein.id}.pdb)

  • gz (bool, optional) – Whether or not to gzip the output, defaults to False

  • kwargs – Additional arguments to pass to graphein.protein.tensor.io.to_pdb()

class graphein.protein.tensor.data.ProteinBatch(*args: Any, **kwargs: Any)[source]
__init__(fill_value: float = 1e-05, atom_list: List[str] = ['N', 'CA', 'C', 'O', 'CB', 'OG', 'CG', 'CD1', 'CD2', 'CE1', 'CE2', 'CZ', 'OD1', 'ND2', 'CG1', 'CG2', 'CD', 'CE', 'NZ', 'OD2', 'OE1', 'NE2', 'OE2', 'OH', 'NE', 'NH1', 'NH2', 'OG1', 'SD', 'ND1', 'SG', 'NE1', 'CE3', 'CZ2', 'CZ3', 'CH2', 'OXT']) → None[source]
alpha_carbon(cache: str | None = None) → CoordTensor[source]

Returns the alpha carbon coordinates of the protein as a tensor of shape Length x 3.

See also

graphein.protein.tensor.representation.alpha_carbon()

Parameters:

cache (Optional[str]) – If provided, the result will be cached in the Protein object with the provided string as the attribute name. Default is None (not stored).

Returns:

Alpha carbon coordinates

Return type:

graphein.protein.tensor.types.CoordTensor

apply_structural_noise(x: AtomTensor | CoordTensor | None = None, magnitude: float = 0.1, gaussian: bool = True, return_transformed: bool = True, cache: str | None = None) → AtomTensor | CoordTensor[source]

Applies noise to the structure of the proteins in the batch.

Parameters:
  • x – Coordinates to apply noise to, defaults to None. If None (default), self.coords is used.

  • cache – If provided, the result will be cached in the ProteinBatch under the provided string as the attribute name. Default is None, (not stored).

apply_to(func: Callable[[Protein], Any], idx: int) → Any[source]

Applies a function func to the Protein at index idx in the batch. Returns the result of func.

..code-block:

from graphein.protein.tensor.plot import plot_structure

def single_plot(protein: gpt.Protein()):
return plot_structure(protein.coords, lines=False)

plot = batch.apply_to(single_plot, 2)

See also

graphein.protein.tensor.data.ProteinBatch.apply()

Parameters:
  • func (Callable[["Protein"], Any]) – Function to apply to each Protein in the batch.

  • idx (int) – Idx of Protein in the batch to apple the func to.

Returns:

Output of func

Return type:

Any

backbone(cache: str | None = None) → BackboneTensor[source]

See also

graphein.protein.tensor.geometry.get_backbone()

Parameters:

cache (Optional[str]) – If provided, the result will be cached in the Protein object with the provided string as the attribute name. Default is None (not stored).

Returns:

Backbone coordinates [Length x 4 x 3]

Return type:

graphein.protein.tensor.types.BackboneTensor

backbone_frames(cache: str | None = None) → Tuple[BackboneFrameTensor, CoordTensor][source]

Computes backbone rotation frames from an idealised residue.

Parameters:

cache (Optional[str]) – If provided, the result will be cached in the Protein object with the provided string as the attribute name. Default is None (not stored).

Returns:

_description_

Return type:

Tuple[BackboneFrameTensor, CoordTensor]

edge_distances(x: CoordTensor, edge_index: EdgeTensor, p: float = 2, cache: str | None = None) → Tensor[source]

Computes the edges distances between nodes.

Parameters:
  • x – Node positions

  • edge_index – Edge indices

  • p – The norm degree. Can be negative. Default: 2.``

Returns:

Edge distances

Return type:

torch.Tensor

edges(edge_type: str = 'knn_10', x: Tensor | None = None, cache: str | None = None, **kwargs) → EdgeTensor[source]

Computes edges for a batch of proteins as specified by the edge_type argument. If x is not provided, the edges are calculated based on Alpha Carbon positions by default.

See also

graphein.protein.tensor.edges.compute_edges() graphein.protein.tensor.edges.radius_edges() graphein.protein.tensor.edges.knn_edges()

Parameters:
  • edge_type (str) – Str denoting type of edges in form {edgetype}_{value}. E.g. "knn_8" for KNN with k=8, "eps_6" for radius graph with r=6.

  • x (Optional[torch.Tensor]) – Node feature/position matrix used to calculate edges. If None (default), the alpha carbon trace is used.

  • cache (Optional[str]) – String to set edges as a Protein attribute. If None (default), edges are not saved.

get_protein(idx: int) → Protein[source]

Returns the ``idx``th protein in the batch.

has_complete_backbone() → bool[source]

Returns True if the protein has a complete backbone, else False

See also

graphein.protein.tensor.data.ProteinBatch.is_complete()

graphein.protein.tensor.testing.has_complete_backbone()

protein_apply(func: Callable[[Protein], Any], rebatch: bool = False) → ProteinBatch | List[Any][source]

Applies a function func to each Protein in the batch and returns the result as a list of Proteins or a new ProteinBatch.

import graphein.protein.tensor as gpt
from graphein.protein.tensor.plot import plot_structure

batch = gpt.data.ProteinBatch().from_pdb_codes(
    pdb_codes=["3eiy", "4hhb", "1a0q"]
    )

def single_plot(protein: gpt.Protein()):
    return plot_structure(protein.coords, lines=False)

plots = batch.protein_apply(single_plot)
plots[2]

Note

If the function requires multiple arguments, use functools.partial

Parameters:
  • func (Callable[["Protein"], Any]) – Function to apply to each Protein in the batch.

  • rebatch – If True the Protein``s will be rebatched into a new ``ProteinBatch. Else, a list of the output of func will be returned,

Returns:

List of results from applying func to each Protein in the batch.

Return type:

Union[“ProteinBatch”, List[Any]]

save(out_path: str)[source]

Save a ProteinBatch object to disk in tensor format.

Parameters:

out_path (str) – Path to save Protein to.

to_batch() → Batch[source]

Returns the ProteinBatch as a torch_geometric.data.Batch object.

to_protein_list() → List[Protein][source]

Unbatch to a list of Proteins.

import graphein.protein.tensor as gpt

batch = gpt.data.ProteinBatch().from_pdb_codes(pdb_codes=["3eiy", "4hhb", "1a0q"])
proteins = batch.to_protein_list() # List[Protein]
Returns:

List of Proteins

Return type:

List[“Protein”]

graphein.protein.tensor.data.get_random_batch(num_proteins: int = 8) → ProteinBatch[source]

Utility/testing function to get a random batch of proteins.

graphein.protein.tensor.data.get_random_protein() → Protein[source]

Utility/testing function to get a random proteins.

graphein.protein.tensor.data.to_protein(path: str | None = None, pdb_code: str | None = None, uniprot_id: str | None = None, chain_selection: str = 'all', deprotonate: bool = True, keep_insertions: bool = False, keep_hets: List[str] = [], model_index: int = 1, atom_types: List[str] = ['N', 'CA', 'C', 'O', 'CB', 'OG', 'CG', 'CD1', 'CD2', 'CE1', 'CE2', 'CZ', 'OD1', 'ND2', 'CG1', 'CG2', 'CD', 'CE', 'NZ', 'OD2', 'OE1', 'NE2', 'OE2', 'OH', 'NE', 'NH1', 'NH2', 'OG1', 'SD', 'ND1', 'SG', 'NE1', 'CE3', 'CZ2', 'CZ3', 'CH2', 'OXT']) → Protein[source]

Parses a protein (from either: a PDB code, PDB file or a UniProt ID (via AF2 database) to a Graphein Protein object.

import graphein.protein.tensor as gpt


# From PDB code
gpt.data.to_protein(pdb_code="3eiy", ...)

# From PDB Path
gpt.io.to_protein(path="3eiy.pdb", ...)

# From UniProt ID
gpt.io.to_protein(uniprot_id="Q5VSL9", ...)
Parameters:
  • path – Path to PDB or MMTF file. Default is None.

  • pdb_code – PDB accesion code. Default is None.

  • uniprot_id – UniProt ID. Default is None.

  • chain_selection – Selection of chains to include (e.g. "ABC") or "all". Default is "all".

  • deprotonate – Whether or not to remove Hydrogens. Default is True.

  • keep_insertions – Whether or not to keep insertions.

  • keep_hets – List of heteroatoms to include. E.g. ["HOH"].

  • model_index – Index of model in models containing multiple structures.

  • atom_types – List of atom types to select. Default is: graphein.protein.resi_atoms.PROTEIN_ATOMS

Returns:

Data object with attributes: x (AtomTensor), residues (list of 3-letter residue codes), id (ID of protein), residue_id (E.g. "A:SER:1"), residue_type (torch.Tensor), chains (torch.Tensor).

Return type:

Protein

graphein.protein.tensor.data.to_protein_mp(paths: str | None = None, pdb_codes: str | None = None, uniprot_ids: str | None = None, chain_selections: List[str] | None = None, deprotonate: bool = True, keep_insertions: bool = False, keep_hets: List[str] = [], model_index: int = 1, atom_types: List[str] = ['N', 'CA', 'C', 'O', 'CB', 'OG', 'CG', 'CD1', 'CD2', 'CE1', 'CE2', 'CZ', 'OD1', 'ND2', 'CG1', 'CG2', 'CD', 'CE', 'NZ', 'OD2', 'OE1', 'NE2', 'OE2', 'OH', 'NE', 'NH1', 'NH2', 'OG1', 'SD', 'ND1', 'SG', 'NE1', 'CE3', 'CZ2', 'CZ3', 'CH2', 'OXT'], num_cores: int = 16) → List[Protein][source]

Parallelised parsing of a list of proteins (from either: PDB codes, PDB files or UniProt IDs (via AF2 database) to a Graphein Protein object using multiprocessing.

import graphein.protein.tensor as gpt

# From PDB codes
gpt.data.to_protein_mp(pdb_codes=["3eiy", "4hhb", ..., num_cores=8])

# From PDB Paths
gpt.io.to_protein_mp(paths=["3eiy.pdb", "4hhb.pdb", ...])

# From UniProt IDs
gpt.io.to_protein_mp(uniprot_ids=["Q5VSL9", ...])
Parameters:
  • paths – Path to PDB or MMTF files. Default is None.

  • pdb_codes – PDB accesion code. Default is None.

  • uniprot_ids – UniProt ID. Default is None.

  • chain_selections – Selection of chains to include (e.g. "ABC") or "all". Default is "all".

  • deprotonate – Whether or not to remove Hydrogens. Default is True.

  • keep_insertions – Whether or not to keep insertions.

  • keep_hets – List of heteroatoms to include. E.g. ["HOH"].

  • model_index – Index of model in models containing multiple structures.

  • atom_types – List of atom types to select. Default is: graphein.protein.resi_atoms.PROTEIN_ATOMS

  • num_cores – Number of cores to use for multiprocessing.

Returns:

Data object with attributes: x (AtomTensor), residues (list of 3-letter residue codes), id (ID of protein), residue_id (E.g. "A:SER:1"), residue_type (torch.Tensor), chains (torch.Tensor).

Return type:

List[Protein]

I/O

Utilities for parsing proteins into and out of tensors.

graphein.protein.tensor.io.get_protein_length(df: DataFrame, insertions: bool = True) → int[source]

Return the number of unique amino acids in the protein.

Note for future development: this function may return incorrect results on raw PDB files containing insertions/altlocs. This should not be the case for proteins processed by the Graphein pre-processing workflow. Caveat emptor.

Parameters:
  • df (pd.DataFrame) – Protein DataFrame to get length of.

  • insertions (bool) – Whether or not to include insertions in the length. Defaults to True.

Returns:

Number of unique residues.

Return type:

int

graphein.protein.tensor.io.protein_df_to_chain_tensor(df: DataFrame, chains_to_keep: List[str] | None = None, insertions: bool = True, one_hot: bool = False, dtype: dtype = torch.int64, device: device = device(type='cpu'), per_atom: bool = False) → Tensor[source]

Returns a tensor of chain IDs for a protein structure.

Parameters:
  • df (pd.DataFrame) – DataFrame of protein structure. Must have a column called "chain_id" (and insertion if the insertions=True).

  • chains_to_keep (Optional[List[str]], optional) – List of chains to retain, defaults to None (all chains).

  • insertions (bool, optional) – Whether or not to keep insertions, defaults to True

  • one_hot (bool, optional) – Whether or not to return a one-hot encoded tensor (L x num_chains). If False an integer tensor is returned. Defaults to False.

Returns:

One hot encoded or integer tensor indicating chain membership for each residue.

Return type:

torch.Tensor

graphein.protein.tensor.io.protein_df_to_tensor(df: DataFrame, atoms_to_keep: List[str] = ['N', 'CA', 'C', 'O', 'CB', 'OG', 'CG', 'CD1', 'CD2', 'CE1', 'CE2', 'CZ', 'OD1', 'ND2', 'CG1', 'CG2', 'CD', 'CE', 'NZ', 'OD2', 'OE1', 'NE2', 'OE2', 'OH', 'NE', 'NH1', 'NH2', 'OG1', 'SD', 'ND1', 'SG', 'NE1', 'CE3', 'CZ2', 'CZ3', 'CH2', 'OXT'], insertions: bool = True, fill_value: float = 1e-05) → AtomTensor[source]

Transforms a DataFrame of a protein structure into a Length x Num_Atoms (default 37) x 3 tensor.

Parameters:
  • df (pd.DataFrame) – DataFrame of protein structure.

  • atoms_to_keep (List[str]) – List of atom types to retain in the tensor. Defaults to PROTEIN_ATOMS

  • insertions (bool) – Whether or not to keep insertions. Defaults to True.

  • fill_value (float) – Value to fill missing entries with. Defaults to 1e-5.

Returns:

Length x Num_Atoms (default 37) x 3 tensor.

Return type:

graphein.protein.tensor.types.AtomTensor

graphein.protein.tensor.io.protein_to_pyg(path: str | PathLike | None = None, pdb_code: str | None = None, uniprot_id: str | None = None, df: DataFrame | None = None, chain_selection: str | List[str] = 'all', deprotonate: bool = True, keep_insertions: bool = True, keep_hets: List[str] = [], model_index: int = 1, atom_types: List[str] = ['N', 'CA', 'C', 'O', 'CB', 'OG', 'CG', 'CD1', 'CD2', 'CE1', 'CE2', 'CZ', 'OD1', 'ND2', 'CG1', 'CG2', 'CD', 'CE', 'NZ', 'OD2', 'OE1', 'NE2', 'OE2', 'OH', 'NE', 'NH1', 'NH2', 'OG1', 'SD', 'ND1', 'SG', 'NE1', 'CE3', 'CZ2', 'CZ3', 'CH2', 'OXT'], remove_nonstandard: bool = True, store_het: bool = False, store_bfactor: bool = False, fill_value_coords: float = 1e-05) → Data[source]

Parses a protein (from either: a PDB code, PDB file or a UniProt ID (via AF2 database) to a PyTorch Geometric Data object.

import graphein.protein.tensor as gpt

# From PDB code
gpt.io.protein_to_pyg(pdb_code="3eiy")

# From PDB Path
gpt.io.protein_to_pyg(path="3eiy.pdb")

# From MMTF Path
gpt.io.protein_to_pyg(path="3eiy.mmtf")

# From UniProt ID
gpt.io.protein_to_pyg(uniprot_id="Q5VSL9")
Parameters:
  • path (Union[str, os.PathLike]) – Path to PDB or MMTF file. Default is None.

  • pdb_code (str) – PDB accesion code. Default is None.

  • uniprot_id (str) – UniProt ID. Default is None.

  • chain_selection (Union[str, List[str]]) – Selection of chains to include (e.g. ["A", "C", "AB"]) or "all". Default is "all".

  • deprotonate (bool) – Whether or not to remove Hydrogens. Default is True.

  • keep_insertions (bool) – Whether or not to keep insertions. Default is True.

  • keep_hets (List[str]) – List of heteroatoms to include. E.g. ["HOH"].

  • model_index (int) – Index of model in models containing multiple structures.

  • atom_types (List[str]) – List of atom types to select. Default is: graphein.protein.resi_atoms.PROTEIN_ATOMS

  • remove_nonstandard (bool) – Whether or not to remove non-standard residues. Default is True.

  • store_het (bool) – Whether or not to store heteroatoms in the Data object. Default is False.

  • store_bfactor (bool) – Whether or not to store bfactors in the Data object. Default is ``False.

  • fill_value_coords (float) – Fill value to use for positions in atom37 representation that are not filled. Defaults to 1e-5

Returns:

Data object with attributes: x (AtomTensor), residues (list of 3-letter residue codes), id (ID of protein), residue_id (E.g. "A:SER:1"), residue_type (torch.Tensor), chains (torch.Tensor).

Return type:

torch_geometric.data.Data

graphein.protein.tensor.io.to_dataframe(x: AtomTensor, fill_value: float = 1e-05, residue_types: List[str] | None = None, chains: List[str | int] | Tensor | None = None, insertions: List[str | float] | None = None, b_factors: List[float] | Tensor | None = None, occupancy: List[float] | Tensor | None = None, charge: List[int] | None = None, alt_loc: List[str | int] | None = None, segment_id: List[str | int] | None = None, biopandas: bool = False) → DataFrame | PandasPdb[source]

Converts an AtomTensor to a DataFrame.

AtomTensors are not a full specification of a structure so missing values can be manually provided as arguments - otherwise default values are used.

import graphein.protein.tensor as gpt

protein = gpt.Protein().from_pdb_code("3eiy")
to_dataframe(protein.coords)
Parameters:
  • x (AtomTensor) – AtomTensor to convert (Shape: num residues x 37 x 3).

  • fill_value – Fill value used to denote missing atoms in the

AtomTensor, defaults to 1e-5. :type fill_value: float, optional :param residue_types: List of three-letter residue IDs (length: num residues

), defaults to None (inferred from AtomTensor; this may break for incomplete structures with missing atoms.)

Parameters:
  • chains (Optional[Union[List[Union[str, int]], torch.Tensor]], optional) – List or tensor of chain IDs, defaults to None ("A" for all residues).

  • insertions (Optional[List[Union[str, float]]], optional) – List of insertion codes, defaults to None ("").

  • b_factors (Optional[List[Union[str, float]]], optional) – List or tensor of b factors (length: num residues), defaults to None (""). If b_factors is of length/shape number of residues (as opposed to number of atoms) it is automatically unravelled to the correct length.

  • occupancy (Optional[List[Union[str, float]]], optional) – List or tensor of occupancy values (length: num residues), defaults to None (1.0).

  • charge (Optional[List[int]], optional) – List or or tensor of atom charges, defaults to None ("0").

  • alt_loc (Optional[List[Union[str, int]]], optional) – List or tensor of alt_loc codes, defaults to None ("")

  • segment_id (Optional[List[Union[str, int]]], optional) – List or tensor of segment IDs, defaults to None ("").

  • biopandas (bool, optional) – Whether to return a pd.DataFrame or BioPandas PandasPdb object, defaults to False (pd.DataFrame).

Returns:

DataFrame or PandasPdb object.

Return type:

Union[pd.DataFrame, PandasPdb]

graphein.protein.tensor.io.to_pdb(x: AtomTensor, out_path: str, gz: bool = False, **kwargs)[source]

Writes an AtomTensor to a PDB file.

See also

graphein.protein.tensor.types.AtomTensor graphein.protein.tensor.to_dataframe()

Parameters:
  • x (AtomTensor) – AtomTensor describing protein structure to write.

  • out_path (str) – Path to output pdb file.

  • gz (bool, optional) – Whether to gzip out the output, defaults to False.

  • kwargs – Keyword args for graphein.protein.tensor.to_dataframe()

Representation

Utility functions for converting between representations of protein structures.

graphein.protein.tensor.representation.coarsen_sidechain(x: AtomTensor, backbone_indices: List[int] = [0, 1, 2, 3], aggregation: str = 'mean') → CoordTensor[source]

Returns tensor of sidechain centroids: (L x 3

Parameters:
  • x (graphein.protein.tensor.AtomTensor) – Tensor of atom positions of shape (N_residues, N_atoms (default=37), 3)

  • backbone_indices (List[int]) – List of indices in dimension 1 of the AtomTensor that correspond to backbone atoms (N, Ca, C, O). Defaults to [0, 1, 2, 3].

  • aggregation (str) – Aggregation method to use. Defaults to "mean".

Returns:

Tensor of sidechain centroids of shape (N_residues, 3)

Return type:

graphein.protein.tensor.CoordTensor

Raises:

NotImplementedError – If aggregation method is not implemented.

graphein.protein.tensor.representation.get_backbone(x: AtomTensor, backbone_indices: List[int] = [0, 1, 2, 3]) → BackboneTensor[source]

Returns tensor of backbone atoms: (L x 4 x 3)

Parameters:
  • x (AtomTensor) – AtomTensor to extract backbone from

  • backbone_indices – List of indices of [N, Ca, C, O] atoms (in order).

Returns:

Tensor of backbone atoms.

Return type:

BackboneTensor

graphein.protein.tensor.representation.get_backbone_frames(x: AtomTensor | BackboneTensor, bb_indices: List[int] = [0, 1, 2, 4]) → Tuple[BackboneFrameTensor, CoordTensor][source]

Return the backbone frames from the atom tensor (tuple of rotation matrices and alpha carbon positions).

Note

bb_indices should be in the order [N, Ca, C, Cb]

Parameters:

x (Union[AtomTensor, BackboneTensor]) – Structure to get backbone rotation frames for

Returns:

Tuple of RotationMatrices and Translations

graphein.protein.tensor.representation.get_c_alpha(x: AtomTensor, index: int = 1) → CoordTensor[source]

Returns tensor of C-alpha atoms: (L x 3)

Parameters:

See also

get_backbone()

graphein.protein.tensor.representation.get_full_atom_coords(atom_tensor: AtomTensor, fill_value: float = 1e-05) → Tuple[CoordTensor, Tensor, Tensor][source]

Converts an AtomTensor to a full atom representation.

Return tuple of coords (N_atoms x 3), residue_index (N_atoms), atom_type (N_atoms x [0-36])

Parameters:
  • atom_tensor (graphein.protein.tensor.AtomTensor) – AtomTensor of shape (N_residues, N_atoms (default is 37), 3)

  • fill_value – Value used to fill missing values. Defaults to 1e-5.

Returns:

Tuple of coords, residue_index, atom_type

Return type:

Tuple[CoordTensor, torch.Tensor, torch.Tensor]

Geometry

Geometry Utils

Utilities for manipulating protein geometry.

graphein.protein.tensor.geometry.apply_structural_noise(x: AtomTensor | CoordTensor, magnitude: float = 0.1, gaussian: bool = True, return_transformed: bool = True) → AtomTensor | CoordTensor[source]

Generates random noise and adds it to the input tensor.

Parameters:
  • x – Input tensor

  • magnitude – Magnitude of the noise

  • gaussian – If True, noise is sampled from a Gaussian distribution. If False, noise is sampled from a uniform distribution. Default is True (gaussian).

  • return_transformed – If True, returns the transformed (noised) tensor. If False, returns the noise tensor. Default is True.

Returns:

Noised tensor or noise tensor

graphein.protein.tensor.geometry.center_protein(x: AtomTensor | CoordTensor, ca_only: bool = True, fill_value=1e-05) → AtomTensor | CoordTensor[source]

Centers a protein in the coordinate system at the origin.

See also

get_center()

Parameters:
  • x – Point Cloud to Center. Torch tensor of shape (Length , 3) or (Length, num atoms, 3).

  • ca_only (bool) – If True, only the C-alpha atoms will be used to compute the center. Only relevant with AtomTensor inputs. Default is False.

  • fill_value (float) – Value used to denote missing atoms. Default is 1e-5.

Returns:

Centered Point Cloud of same shape as input.

Return type:

Union[graphein.protein.tensor.types.AtomTensor, graphein.protein.tensor.types.CoordTensor]

graphein.protein.tensor.geometry.get_center(x: AtomTensor | CoordTensor, ca_only: bool = True, fill_value: float = 1e-05) → CoordTensor[source]

Returns the center of a protein.

See also

center_protein()

Parameters:
  • x – Point Cloud to Center. Torch tensor of shape (Length , 3) or (Length, num atoms, 3).

  • ca_only (bool) – If True, only the C-alpha atoms will be used to compute the center. Only relevant with AtomTensor inputs. Default is False.

  • fill_value (float) – Value used to denote missing atoms. Default is )``1e-5)``.

Returns:

Torch tensor of shape (N,D) – Center of Point Cloud

Return type:

Union[graphein.protein.tensor.types.AtomTensor, graphein.protein.tensor.types.CoordTensor]

graphein.protein.tensor.geometry.idealize_backbone(x: AtomTensor | BackboneTensor, lr: float = 0.001, n_iter: int = 100, inplace: bool = False) → BackboneTensor[source]

Idealizes a protein backbone to more closely resemble idealised geometry.

Adaptation of an implementation by Sergey Ovchinnikov: https://github.com/sokrypton/tf_proteins/blob/master/coord_to_dihedrals_tools.ipynb

Parameters:
  • x (Union[AtomTensor, BackboneTensor]) – Tensor representing the backbone (can include sidechain atoms but these are not used).

  • lr (float, optional) – Learning rate to use with the optimiser (Adam), defaults to 1e-3.

  • n_iter (int, optional) – Number of optimisation steps to make, defaults to 100.

Returns:

BackboneTensor with idealised geometry.

Return type:

BackboneTensor

graphein.protein.tensor.geometry.kabsch(A: AtomTensor | CoordTensor, B: AtomTensor | CoordTensor, ca_only: bool = True, residue_wise: bool = False, fill_value: float = 1e-05, return_transformed: bool = True, allow_reflections: bool = False) → CoordTensor | Tuple[BackboneFrameTensor, Tensor] | Tuple[RotationMatrix, Tensor][source]

Computes registration between two (2D or 3D) point clouds with known correspondences using Kabsch algorithm.

Registration occurs in the zero centered coordinate system, and then must be transported back.

Note

Based on implementation by Guillaume Bouvier (@bougui505): https://gist.github.com/bougui505/e392a371f5bab095a3673ea6f4976cc8

Parameters:
  • A – Torch tensor of shape (N,D) – Point Cloud to Align (source)

  • B – Torch tensor of shape (N,D) – Reference Point Cloud (target)

  • ca_only – Whether to use only C-alpha atoms for alignment, defaults to True. If False, all atoms are used.

  • fill_value – Value to fill in for missing atoms, defaults to 1e-5. Only relevant if ca_only=False.

Returns:

Torch tensor of shape (N,D) – Aligned Point Cloud or Optimal rotation and translation. Rotation matrix is of shape (D,D) and for multiplication from the right.

Return type:

Union[graphein.protein.tensor.types.CoordTensor, Tuple[torch.Tensor, torch.Tensor]]

graphein.protein.tensor.geometry.matrix_to_quaternion(matrix: RotationMatrixTensor) → QuaternionTensor[source]

Convert rotations given as rotation matrices to quaternions. :param matrix: Rotation matrices as tensor of shape (..., 3, 3).

Returns:

quaternions with real part first, as tensor of shape (..., 4).

graphein.protein.tensor.geometry.quaternion_to_matrix(quaternions: QuaternionTensor) → RotationMatrixTensor[source]

Convert rotations given as quaternions to rotation matrices.

Parameters:

quaternions – quaternions with real part first, as tensor of shape (..., 4).

Returns:

Rotation matrices as tensor of shape (..., 3, 3).

Angles

Utilities for computing various protein angles.

graphein.protein.tensor.angles.alpha(x: AtomTensor | CoordTensor, batch: Tensor | None = None, sparse: bool = True, rad: bool = True, ca_idx: int = 1, embed: bool = True) → Tensor[source]

Computes virtual bond dihedral angle defined by four Ca atoms of residues i-1, i, i+1, i+2. The first angle and last two angles are zero padded.

See also

graphein.protein.tensor.angles.kappa() graphein.protein.tensor.angles.dihedrals()

Parameters:
  • x (Union[AtomTensor, CoordTensor]) – Tensor of atomic positions or tensor of CA positions.

  • batch (Optional[torch.Tensor], optional) – Tensor of batch indices, defaults to None.

  • sparse (bool, optional) – Whether or not to return the output in sparse or dense format , defaults to True.

  • rad (bool, optional) – _description_, defaults to True.

  • ca_idx (int, optional) – If x is an AtomTensor, this argument specifies the index of the CA atoms in dimension 1, defaults to 1.

  • embed (bool, optional) – Whether or not to embed the angles on the unit circle, defaults to True.

Returns:

Tensor of dihedral angles

Return type:

torch.Tensor

graphein.protein.tensor.angles.angle_to_unit_circle(x: Tensor) → Tensor[source]

Encodes an angle in radians to a unit circle.

I.e. returns a tensor or the form: [cos(x1), sin(x1), cos(x2), sin(x2), ...].

Parameters:

x (torch.Tensor) – Tensor of angles in radians.

Returns:

Tensor of angles encoded on a unit circle.

Return type:

torch.Tensor

graphein.protein.tensor.angles.dihedrals_to_rad(x_dihedrals: DihedralTensor, concat: bool = False) → DihedralTensor | Tuple[Tensor, Tensor, Tensor][source]

Converts dihedrals to radians.

Parameters:
  • x_dihedrals (DihedralTensor) – Dihedral tensor of shape (L, 6).

  • concat (bool, optional) – Whether to concatenate the angles into a single tensor, or to return a tuple of tensors (phi, psi, omega), defaults to False.

Returns:

Dihedral tensor of shape (L, 3) or a tuple of tensors

Return type:

Union[DihedralTensor, Tuple[torch.Tensor, torch.Tensor, torch.Tensor]]

graphein.protein.tensor.angles.get_backbone_bond_angles(x: AtomTensor) → Tensor[source]
Compute the bond angles between backbone atoms:

[C-N-Ca, N-Ca-C, Ca-C,N].

Parameters:

x (AtomTensor) – Tensor of atomic positions.

Returns:

Tensor of backbone bond angles [L x 3].

Return type:

torch.Tensor

graphein.protein.tensor.angles.get_backbone_bond_lengths(x: AtomTensor) → Tensor[source]

Compute the bond lengths between backbone atoms.

Returns the a tensor of shape (N, 3) where N is the number of residues in protein. Dimension 1 contains the bond lengths between Ca and C, C and N, and N and Ca.

Parameters:

x (AtomTensor) – Tensor of atomic positions.

Returns:

Tensor of backbone bond lengths.

Return type:

torch.Tensor

graphein.protein.tensor.angles.kappa(x: AtomTensor | CoordTensor, batch: Tensor | None = None, rad: bool = True, sparse: bool = True, ca_idx: int = 1, embed: bool = False) → Tensor[source]

Computes virtual bond angle (bend angle) defined by three Ca atoms of residues i-2, i and i+2. The first and last two angles are zero padded.

See also

graphein.protein.tensor.angles.alpha() graphein.protein.tensor.angles.dihedrals()

Parameters:
  • x (Union[AtomTensor, CoordTensor]) – Tensor of atomic positions or tensor of CA positions.

  • ca_idx (int, optional) – If x is an AtomTensor, this is the index of the CA atoms in dimension 1, defaults to 1

Returns:

Tensor of bend angles

Return type:

torch.Tensor

graphein.protein.tensor.angles.sidechain_torsion(coords: AtomTensor, res_types: List[str], rad: bool = True, embed: bool = False, return_mask: bool = False) → TorsionTensor | Tuple[TorsionTensor, Tensor][source]

Computes sidechain torsion angles for a protein.

Atom groups used to define each chi angle are specified in graphein.protein.resi_atoms.CHI_ANGLES_ATOMS.

Parameters:
  • coords (AtomTensor) – Tensor of shape (L, N, 3) where L is the number of residues, N is the number of atoms per residue (Default is 37; problems may occur with differing selections).

  • res_types (List[str]) – List of three-letter residue types.

  • rad (bool, optional) – If True, returns angles in radians, else in degrees. Defaults to True.

  • return_mask (bool, optional) – _description_, defaults to False

Returns:

_description_

Return type:

Union[TorsionTensor, Tuple[TorsionTensor, torch.Tensor]]

graphein.protein.tensor.angles.to_ang(a: CoordTensor, b: CoordTensor, c: CoordTensor) → Tensor[source]

Compute the angle between vectors ab and bc.

Parameters:
Returns:

Angle between vectors ab and bc in radians.

Return type:

torch.Tensor

graphein.protein.tensor.angles.torsion_to_rad(x_torsion: TorsionTensor, concat: bool = True) → TorsionTensor | Tuple[Tensor, Tensor, Tensor, Tensor][source]

Converts sidechain torsions in (sin(chi1), sin(chi1), cos(chi2), sin(chi2), ...) format to radians.

Parameters:
  • x_torsion (graphein.protein.tensor.types.TorsionTensor) – Torsion tensor of shape (L, 8).

  • concat (bool) – Whether to concatenate the torsions into a single tensor. If False, this function returns a tuple of tensors for chi1-4 , defaults to True.

Returns:

Torsion tensor of shape (L, 4) if concat=True, otherwise a tuple of tensors for chi1-4 in radians.

Return type:

Union[graphein.protein.tensor.types.TorsionTensor, Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]]

Reconstruction

Utilities for reconstructing protein structures.

graphein.protein.tensor.reconstruction.dist_mat_to_coords(d: Tensor, k: int = 3) → CoordTensor[source]

Computes a set of coordinates that satisfy the (valid) Euclidean distance matrix d.

See: https://math.stackexchange.com/questions/156161/finding-the-coordinates-of-points-from-distance-matrix

Parameters:
  • d (torch.Tensor) – Valid euclidean distance matrix

  • k (int, optional) – Number of dimensions of coordinate output, defaults to 3.

Returns:

Set of coordinates that satisfy the distance matrix d.

Return type:

graphein.protein.tensor.types.CoordTensor

graphein.protein.tensor.reconstruction.get_ideal_backbone_coords(n: int = 1, ca_center: bool = True, device: device = 'cpu') → Tensor[source]

Get idealized backbone (N, CA, C, CB) coordinates.

Adapted from the IgFold Implementation (which is under the John’s Hopkins License): https://github.com/Graylab/IgFold/blob/main/igfold/utils/coordinates.py

Parameters:

center – if True the reference residue is centered on CA, otherwise, the center of mass is used. Defaults to True.

Returns:

Idealized backbone coordinates

Return type:

torch.Tensor

graphein.protein.tensor.reconstruction.place_fourth_atom(a_coord: Tensor, b_coord: Tensor, c_coord: Tensor, length: Tensor, planar: Tensor, dihedral: Tensor) → Tensor[source]

Given 3 coords + a length + a planar angle + a dihedral angle, compute a fourth coord

Adapted from the IgFold Implementation (which is under the John’s Hopkins License): https://github.com/Graylab/IgFold/blob/main/igfold/utils/coordinates.py

Parameters:
Returns:

Fourth coordinate

Return type:

torch.Tensor

graphein.protein.tensor.reconstruction.place_o_coords(coords: AtomTensor) → AtomTensor[source]

Adapted from the IgFold Implementation (which is under the John’s Hopkins License): https://github.com/Graylab/IgFold/blob/main/igfold/utils/coordinates.py

Parameters:

coords (_type_) – _description_

Returns:

_description_

Return type:

_type_

pNERF

pNeRF algorithm for parallelized conversion from torsion (dihedral) angles to Cartesian coordinates implemented with PyTorch.

Reference implementation in tensorflow by Mohammed AlQuraishi:

https://github.com/aqlaboratory/pnerf/blob/master/pnerf.py

Paper (preprint) by Mohammed AlQuraishi:

https://www.biorxiv.org/content/early/2018/08/06/385450

PyTorch implementation modifield from the implementation by Felix Opolka:

https://github.com/FelixOpolka/pnerf-pytorch

graphein.protein.tensor.pnerf.dihedral_to_point_fixed(dihedral: Tensor, bond_lengths: ndarray = array([1.458, 1.523, 1.32], dtype=float32), bond_angles: ndarray = array([2.124, 1.941, 2.028], dtype=float32)) → Tensor[source]

Takes triplets of dihedral angles (phi, psi, omega) and returns 3D points ready for use in reconstruction of coordinates. Bond lengths and angles are based on idealized averages.

Parameters:

dihedral – [NUM_STEPS, BATCH_SIZE, NUM_DIHEDRALS]

Returns:

Tensor containing points of the protein’s backbone atoms. Shape [NUM_STEPS x NUM_DIHEDRALS, BATCH_SIZE, NUM_DIMENSIONS]

graphein.protein.tensor.pnerf.dihedral_to_point_variable(dihedral: Tensor, bond_lengths: Tensor, bond_angles: Tensor) → Tensor[source]

Takes triplets of dihedral angles (phi, psi, omega) and returns 3D points ready for use in reconstruction of coordinates. Bond lengths and angles are based on idealized averages.

Parameters:

dihedral – [NUM_STEPS, BATCH_SIZE, NUM_DIHEDRALS]

Returns:

Tensor containing points of the protein’s backbone atoms. Shape [NUM_STEPS x NUM_DIHEDRALS, BATCH_SIZE, NUM_DIMENSIONS]

graphein.protein.tensor.pnerf.point_to_coordinate(points: Tensor, num_fragments: int = 6) → CoordTensor[source]

Takes points from dihedral_to_point and sequentially converts them into coordinates of a 3D structure.

Reconstruction is done in parallel by independently reconstructing num_fragments and the reconstituting the chain at the end in reverse order. The core reconstruction algorithm is NeRF, based on DOI: 10.1002/jcc.20237 by Parsons et al. 2005. The parallelized version is described in https://www.biorxiv.org/content/early/2018/08/06/385450.

Parameters:
  • points – Tensor containing points as returned by dihedral_to_point. Shape [NUM_STEPS x NUM_DIHEDRALS, BATCH_SIZE, NUM_DIMENSIONS]

  • num_fragments – Number of fragments in which the sequence is split to perform parallel computation.

Returns:

Tensor containing correctly transformed atom coordinates. Shape [NUM_STEPS x NUM_DIHEDRALS, BATCH_SIZE, NUM_DIMENSIONS]

graphein.protein.tensor.pnerf.reconstruct_dihedrals(dihedrals: DihedralTensor, ground_truth: AtomTensor) → AtomTensor[source]

Reconstructs backbone from dihedral using bond lengths and angles from ground truth.

graphein.protein.tensor.pnerf.sn_nerf(a: Tensor, b: Tensor, c: Tensor, l_cd: Tensor, theta: Tensor, chi: Tensor, l_bc: Tensor)[source]

Return coordinates for point d given previous points & parameters. Optimized NeRF. This function has been optimized from the original nerf to be about 20% faster. It contains fewer normalization steps and total calculations than the original formulation. See https://doi.org/10.1002/jcc.20237 for details.

Parameters:
  • a (torch.float32 tensor) – (3 x 1) tensor describing point a.

  • b (torch.float32 tensor) – (3 x 1) tensor describing point b.

  • c (torch.float32 tensor) – (3 x 1) tensor describing point c.

  • l_cd (torch.float32 tensor) – (1) tensor describing the length between points c & d.

  • theta (torch.float32 tensor) – (1) tensor describing angle between points b, c, and d.

  • chi (torch.float32 tensor) – (1) tensor describing dihedral angle between points a, b, c, and d.

  • l_bc (torch.float32 tensor) –

    1. tensor describing length between points b and c.

Raises:

ValueError – Raises ValueError when value of theta is not in [-pi, pi].

Returns:

(3 x 1) tensor describing coordinates of point c after placement using points a, b, c, and several parameters.

Return type:

torch.float32 tensor

Sequence

Utilities for working with protein sequences.

graphein.protein.tensor.sequence.get_atom_indices(invert: bool = False) → Dict[str, Tuple[int, ...]] | Dict[Tuple[int, ...], str][source]

Generates a dictionary mapping residue types to atom indices.

Parameters:

invert (bool, optional) – If True, inverts the dictionary so that the keys are the atom indices and the values are the residue types, defaults to False

Returns:

Dictionary mapping residue types to atom indices or vice versa

Return type:

Union[Dict[str, Tuple[int, …]], Dict[Tuple[int, …], str]]

graphein.protein.tensor.sequence.get_residue_id(df: DataFrame, insertions: bool = True, unique: bool = True) → List[str][source]

Returns a list of residue IDs from a DataFrame of a protein structure.

Residue IDs are of the form: [chain_id:residue_name:residue_number] or [chain_id:residue_name:residue_number:insertion_code]` if ``insertions=True

E.g.

["A:SER:1", "A:GLY:2", ...] or ["A:SER:1:A", "A:GLY:2:", ...]

Parameters:
  • df (pd.DataFrame) – DataFrame of protein structure to extract residue IDs from.

  • insertions – Whether or not to include insertion codes in the residue ID.

  • unique (bool, optional) – Whether or not to return only unique residue IDs. If False, it returns a (repeated) ID for each atom in the protein. If True we return the unique set of residue IDs. Default is True.

Returns:

List of residue IDs.

Return type:

List[str]

graphein.protein.tensor.sequence.get_sequence(df: DataFrame, chains: str | List[str] = 'all', insertions: bool = False, list_of_three: bool = False, three_to_one_map: str | None = None, per_atom: bool = False) → str | List[str][source]

Retrieves the amino acid sequence from a DataFrame of a protein structure.

Parameters:
  • df (pd.DataFrame) – DataFrame of protein structure.

  • chains (Optional[List[str]], optional) – List of chains to retain, defaults to None (all chains).

  • insertions (bool, optional) – Whether or not to keep insertions, defaults to False

  • list_of_three (bool, optional) – Whether or not to return a list of three letter codes. If False, returns the sequence as a one-letter code string. Defaults to False.

Returns:

Amino acid sequence; either as list of three-letter codes (["ALA", "GLY", "TRP"...]; list_of_three=True) or string (AGW..; list_of_three=False).

Return type:

Union[str, List[str]]

graphein.protein.tensor.sequence.infer_residue_types(x: AtomTensor, fill_value: float = 1e-05, return_sequence: bool = True) → str | List[str][source]

Infers residue types from atom tensor based on non-filled residues.

Note

This function is not robust to structures with missing atoms.

Parameters:
  • x (AtomTensor) – Tensor of shape (N, Num Atoms, 3) where N is the number of residues in the protein, Num Atoms is the number of atoms selected (default is 37, see: graphein.protein.resi_atoms.ATOM_NUMBERING)

  • fill_value (float, optional) – Fill value used to denote the absence of an atom in x , defaults to 1e-5.

  • return_sequence (bool, optional) – If True, returns the sequence. If False, returns a list of three-letter residue codes, defaults to True.

Returns:

Sequence or list of three-letter residue codes

Return type:

Union[str, List[str]]

graphein.protein.tensor.sequence.residue_type_tensor(df: DataFrame, vocabulary: List[str] = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Y', 'Z'], three_to_one_mapping: Dict[str, str] = {'3HP': 'X', '4HP': 'X', '5HP': 'Q', 'ABA': 'A', 'ACE': 'X', 'AIB': 'A', 'ALA': 'A', 'ARG': 'R', 'ASN': 'N', 'ASP': 'D', 'ASX': 'B', 'AYA': 'A', 'BMT': 'T', 'BOC': 'X', 'CBX': 'X', 'CEA': 'C', 'CGU': 'E', 'CME': 'C', 'CRO': 'TYG', 'CSD': 'C', 'CSO': 'C', 'CSS': 'C', 'CSW': 'C', 'CSX': 'C', 'CXM': 'M', 'CYS': 'C', 'CYX': 'C', 'DAL': 'A', 'DAR': 'R', 'DCY': 'C', 'DGL': 'E', 'DGN': 'Q', 'DHI': 'H', 'DIL': 'I', 'DIV': 'V', 'DLE': 'L', 'DLY': 'K', 'DPN': 'F', 'DPR': 'P', 'DSG': 'N', 'DSN': 'S', 'DSP': 'D', 'DTH': 'T', 'DTR': 'W', 'DTY': 'Y', 'DVA': 'V', 'FME': 'M', 'FOR': 'X', 'GLN': 'Q', 'GLU': 'E', 'GLX': 'Z', 'GLY': 'G', 'HID': 'H', 'HIE': 'H', 'HIP': 'H', 'HIS': 'H', 'HYP': 'P', 'ILE': 'I', 'IVA': 'X', 'KCX': 'K', 'LEU': 'L', 'LLP': 'K', 'LYS': 'K', 'MET': 'M', 'MLE': 'L', 'MSE': 'M', 'MVA': 'V', 'NH2': 'X', 'NLE': 'L', 'NLW': 'L', 'OCS': 'C', 'ORN': 'A', 'PCA': 'Q', 'PHE': 'F', 'PRO': 'P', 'PSW': 'U', 'PTR': 'Y', 'PVL': 'X', 'PYL': 'O', 'SAR': 'G', 'SEC': 'U', 'SEP': 'S', 'SER': 'S', 'STY': 'Y', 'THR': 'T', 'TPO': 'T', 'TPQ': 'Y', 'TRP': 'W', 'TYR': 'Y', 'TYS': 'Y', 'UNK': 'X', 'VAL': 'V'}, one_hot: bool = False, insertions: bool = False, dtype: dtype = torch.int64, device: device = device(type='cpu'), per_atom: bool = False) → Tensor[source]

Returns a tensor of the residue types in a protein structure.

Parameters:
  • df (pd.DataFrame) – DataFrame of protein structure.

  • vocabulary (List[str], optional) – List of allowable residue types, defaults to graphein.protein.resi_atoms.STANDARD_AMINO_ACIDS

  • three_to_one_mapping (Dict[str, str], optional) – Mapping from three letter to codes to one letter amino acid codes, defaults to graphein.protein.resi_atoms.RESI_THREE_TO_1

  • one_hot (bool, optional) – Whether to return a tensor of integers denoting residue type or whether to one-hot encode residue types, defaults to False.

  • insertions (bool, optional) – Whether or not to include insertions, defaults to False.

  • dtype (torch.dtype, optional) – torch.dtype of tensor, defaults to torch.long

  • device (torch.device, optional) – Device to create tensor on, defaults to torch.device("cpu")

Returns:

Tensor of residue types.

Return type:

torch.Tensor

Plotting

graphein.protein.tensor.plot

Plotting utilities for protein tensors.

Plotting utilities for protein tensors.

All plots are produced with Plotly and so are loggable to Weights and Biases.

graphein.protein.tensor.plot.plot_dihedrals(dihedrals: DihedralTensor, to_rad: bool = True) → Figure[source]

Plots a heatmap of dihedral angles.

Parameters:
  • dihedrals (graphein.protein.tensor.DihedralTensor) – Tensor of Dihedral Angles

  • to_rad (bool, optional) – Whether or not to convert to radians, defaults to True

Returns:

Plotly figure of dihedral angles (px.imshow)

Return type:

go.Figure

graphein.protein.tensor.plot.plot_distance_matrix(x: CoordTensor | AtomTensor, **kwargs: Dict[str, Any]) → Figure[source]

Computes and plots a distance matrix of a CoordTensor or AtomTensor.

Parameters:

x (Union[CoordTensor, AtomTensor]) – Tensor of structure to plot

Returns:

Plotly figure of distance matrix (px.imshow)

Return type:

go.Figure

graphein.protein.tensor.plot.plot_structure(x: CoordTensor | AtomTensor, atoms: List[str] = ['N', 'CA', 'C', 'O', 'CB'], lines: bool = True, residue_ids: List[str] | None = None) → Figure[source]

Plots a protein structure in 3D.

Parameters:
  • x (Union[CoordTensor, AtomTensor]) – Coordinates of the protein. Either an AtomTensor (Length x Num Atom Types x 3) or a CoordTensor (Length x 3).

  • atoms (List[str], optional) – List of atoms to include in the plot, defaults to ["N", "CA", "C", "O", "CB"].

  • lines (bool, optional) – Whether or not to join points with lines, defaults to True.

Returns:

Figure object

Return type:

go.Figure

Types

Types for graphein.protein.tensor.

Graphein provides many types for commonly used tensors of specific shapes.

class graphein.protein.tensor.types.AtomTensor

torch.float[-1, 37, 3]

Tensor of atom coordinates. The first dimension is the length of the protein, the second the number of canonical atom types. The last dimension contains the x,y,z positions.

alias of Float[Tensor, 'residues 37 3']

class graphein.protein.tensor.types.BackboneFrameTensor

torch.float[-1, 3, 3]

Tensor of backbone frames as rotation matrices. The first dimension is the length of the protein, the second and third dimensions specify a rotation matrix relative to an idealised residue.

alias of Float[Tensor, 'residues 3 3']

class graphein.protein.tensor.types.BackboneTensor

torch.float[-1, 4, 3]

Tensor of backbone atomic coordinates. The first dimension is the length of the protein (or batch), the second dimension corresponds to [N, Ca, C, O] atoms and the last dimension contains the x,y,z coordinates.

See also

:ref:`graphein.protein.tensor.types.AtomTensor

alias of Float[Tensor, 'residues 4 3']

class graphein.protein.tensor.types.CoordTensor

torch.float[-1, 3]

Tensor of coordinates. The first dimension is the length of the protein (or batch of proteins), the last dimension contains the x,y,z positions.

alias of Float[Tensor, 'nodes 3']

class graphein.protein.tensor.types.DihedralTensor

Union[torch.float[-1, 3], torch.float[-1, 6]]

Tensor of backbone dihedral angles (phi, psi, omega). Either in degrees/radians or embedded on the unit sphere [cos(phi), sin(phi), cos(psi), sin(psi), ...]

See also

:meth:graphein.protein.tensor.angles.dihedrals, :meth:graphein.protein.tensor.angles.dihedrals_to_rad :meth:graphein.protein.tensor.plot.plot_dihedrals

alias of Float[Tensor, 'residues 3'] | Float[Tensor, 'residues 6']

class graphein.protein.tensor.types.PositionTensor

Union[:ref:`graphein.protein.tensor.types.AtomTensor, :ref:`graphein.protein.tensor.types.CoordTensor]

Union of AtomTensor and CoordTensor.

alias of AtomTensor | CoordTensor

class graphein.protein.tensor.types.QuaternionTensor

torch.float[-1, 4]

Tensor of quaternions. The first dimension is the length of the protein (or batch), the second dimension is the quaternion.

alias of Float[Tensor, 'nodes 4']

class graphein.protein.tensor.types.ResidueFrameTensor

torch.float[-1, 3, 3]

alias of Float[Tensor, '3 3']

class graphein.protein.tensor.types.ResidueTensor

torch.float[37, 3]

Tensor of atom coordinates for a residue. Each index in dimension one corresponds to an atom (See: graphein.protein.resi_atoms.ATOM_NUMBERING). The last dimension contains the x,y,z positions. Missing atoms are denoted by a fill value (default = 1e-5).

alias of Float[Tensor, '37 3']

class graphein.protein.tensor.types.RotationMatrix

Union[RotationMatrix3D, RotationMatrix2D]

Specifies a rotation matrix in either 2D or 3D.

See also

RotationMatrix2D RotationMatrix3D RotationTensor

alias of RotationMatrix2D | RotationMatrix3D

class graphein.protein.tensor.types.RotationMatrix2D

torch.float[2, 2]

Specifies a 2D rotation matrix.

See also

RotationMatrix3D RotationMatrix RotationTensor

alias of Float[Tensor, '2 2']

class graphein.protein.tensor.types.RotationMatrix3D

torch.float[3, 3]

Specifies a 3D rotation matrix.

See also

RotationMatrix2D RotationMatrix RotationTensor

alias of Float[Tensor, '3 3']

class graphein.protein.tensor.types.TorsionTensor

Union[torch.float[-1, 4], torch.float[-1, 8]]

Tensor of sidechain torsion angles [chi1, chi2, chi3, chi4]. Either in degrees/radians or embedded on the unit sphere: [cos(chi1), sin(chi1), cos(chi2), sin(chi2), ...].

See also

:meth:graphein.protein.tensor.angles.sidechain_torsions, :meth:graphein.protein.tensor.angles.torsions_to_rad

alias of Float[Tensor, 'residues 4'] | Float[Tensor, 'residues 8']

Testing

Utilities for sanity checking protein tensors.

graphein.protein.tensor.testing.has_complete_backbone(x: AtomTensor | BackboneTensor, fill_value: float = 1e-05, backbone_indices: List[int] = [0, 1, 2, 3]) → bool[source]

Checks a protein coordinate tensor (L x Num Atoms (default 37) x 3) for a complete backbone assignment.

If fill_value entries are found in the backbone_indices (dim 1) then the backbone is not considered complete and we return False. If no entries with the fill_value are found, we return True.

Parameters:
  • x (graphein.protein.tensor.types.AtomTensor) – Atom Tensor to check backbone completeness.

  • fill_value (Float) – Fill value used in the AtomTensor. Default is 1e-5.

  • backbone_indices (List[int].) – List of indices in dimension 1 of the AtomTensor to be checked. Defaults to [0, 1, 2, 3] for [N, Ca, C, O] in the default assignment.

Returns:

Boolean indicating whether the backbone is complete.

Return type:

bool

graphein.protein.tensor.testing.has_complete_residue(x: ResidueTensor, residue_type: str, fill_value: float = 1e-05) → bool[source]

Checks whether a residue has all of the requisite atoms.

Parameters:
  • x (torch.Tensor) – Tensor of shape 37 x 3 of atom coordinates.

  • residue_type (str) – 1 or 3-letter code of residue type.

  • fill_value (float, optional) – Fill value used to denote the absence of an atom, defaults to 1e-5.

Returns:

Boolean indicating whether the residue has all of the requisite atoms.

Return type:

bool

graphein.protein.tensor.testing.has_nan(x: Tensor) → bool[source]

Checks a tensor for NaN values.

Parameters:

x (torch.Tensor) – Tensor to check for NaN values

Returns:

Boolean indicating whether the tensor contains NaN values.

Return type:

bool

graphein.protein.tensor.testing.is_complete_structure(x: AtomTensor, residues: List[str] | str, fill_value: float = 1e-05) → bool[source]

Checks whether a protein structure has all of the requisite atoms.

Parameters:
  • x (graphein.protein.tensor.types.AtomTensor) – AtomTensor to check for completeness.

  • residues (Union[List[str], str]) – List of 1 or 3-letter codes of residue types.

  • fill_value (float, optional) – Fill value used to denote the absence of an atom, defaults to 1e-5.

Returns:

Boolean indicating whether the structure has all of the requisite atoms.

Return type:

bool

graphein.protein.tensor.testing.random_atom_tensor(length: int = 64) → AtomTensor[source]

Returns a random tensor of shape length x 37 x 3.

Parameters:

length (int, optional) – Length of random protein, defaults to 64

Returns:

Random tensor of shape length x 37 x 3

Return type:

AtomTensor

graphein.protein.tensor.testing.random_coord_tensor(length: int = 64) → CoordTensor[source]

Returns a random tensor of shape length x 3.

Parameters:

length (int, optional) – Length of random coordinates, defaults to 64

Returns:

Random tensor of shape length x 3

Return type:

CoordTensor

Constants

Author: Eric J. Ma, Arian Jamasb Purpose: This is a set of utility variables and functions that can be used across the Graphein project.

These include various collections of standard & non-standard/modified amino acids and their names, identifiers and properties.

We also include mappings of covalent radii and bond lengths for the amino acids used in assembling atomic protein graphs.

graphein.protein.resi_atoms.AA_RING_ATOMS: Dict[str, List[str]] = {'HIS': ['CG', 'CD', 'CE', 'ND', 'NE', 'CD2', 'ND1', 'CE1', 'NE2'], 'PHE': ['CG', 'CD', 'CE', 'CZ', 'CD1', 'CD2', 'CE1', 'CE2'], 'TRP': ['CD2', 'CE2', 'CE3', 'CZ2', 'CZ3', 'CH2'], 'TYR': ['CG', 'CD', 'CE', 'CZ', 'CD1', 'CD2', 'CE1', 'CE2']}

Dictionary mapping amino acid 3-letter codes to lists of atoms that are part of rings.

graphein.protein.resi_atoms.AMINO_ACIDS: List[str] = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']

Vocabulary of amino acids with one-letter codes. Includes fuzzy standard amino acids: "B" denotes "ASX" which corresponds to "ASP" ("D") or "ASN" ("N"), "J" denotes "XLE" which corresponds to "LEU" ("L") or "ILE" ("I"), and "Z" denotes "GLX" which corresponds to``”GLU”`` ("E") or "GLN" ("Q"). "X" denotes unknown ("UNK" or sometimes "XAA").

graphein.protein.resi_atoms.AROMATIC_RESIS: List[str] = ['PHE', 'TRP', 'HIS', 'TYR']

List of aromatic residues.

graphein.protein.resi_atoms.ATOMIC_MASSES: Dict[str, float] = {'C': 12.0107, 'H': 1.00794, 'N': 14.0067, 'O': 15.9994, 'P': 30.9738, 'S': 32.065}

Dictionary of atomic masses for standard protein elements.

graphein.protein.resi_atoms.ATOM_NUMBERING: Dict[str, int] = {'C': 2, 'CA': 1, 'CB': 4, 'CD': 16, 'CD1': 7, 'CD2': 8, 'CE': 17, 'CE1': 9, 'CE2': 10, 'CE3': 32, 'CG': 6, 'CG1': 14, 'CG2': 15, 'CH2': 35, 'CZ': 11, 'CZ2': 33, 'CZ3': 34, 'N': 0, 'ND1': 29, 'ND2': 13, 'NE': 24, 'NE1': 31, 'NE2': 21, 'NH1': 25, 'NH2': 26, 'NZ': 18, 'O': 3, 'OD1': 12, 'OD2': 19, 'OE1': 20, 'OE2': 22, 'OG': 5, 'OG1': 27, 'OH': 23, 'OXT': 36, 'SD': 28, 'SG': 30}

Default ordering of atoms in (dimension 1 of) a protein structure tensor.

graphein.protein.resi_atoms.ATOM_NUMBERING_MODIFIED: Dict[str, int] = {'C': 2, 'CA': 1, 'CB': 4, 'CD': 16, 'CD1': 7, 'CD2': 8, 'CE': 17, 'CE1': 9, 'CE2': 10, 'CE3': 32, 'CG': 6, 'CG1': 14, 'CG2': 15, 'CH2': 35, 'CZ': 11, 'CZ2': 33, 'CZ3': 34, 'N': 0, 'ND1': 29, 'ND2': 13, 'NE': 24, 'NE1': 31, 'NE2': 21, 'NH1': 25, 'NH2': 26, 'NZ': 18, 'O': 3, 'OD1': 12, 'OD2': 19, 'OE1': 20, 'OE2': 22, 'OG': 5, 'OG1': 27, 'OH': 23, 'OXT': 36, 'SD': 28, 'SE': 37, 'SG': 30}

Default Ordering of atoms (including non-standard residues) in (dimension 1 of) a protein structure tensor.

graphein.protein.resi_atoms.BACKBONE_ATOMS: List[str] = ['N', 'CA', 'C', 'O']

Atoms present in Amino Acid Backbones.

graphein.protein.resi_atoms.BASE_AMINO_ACIDS: List[str] = ['A', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'Y']

Vocabulary of 20 standard amino acids.

graphein.protein.resi_atoms.BB_BUILD_INFO: Dict[str, Dict[str, float]] = {'BONDANGS': {'ca-c-o': 2.0944, 'ca-c-oh': 2.0944}, 'BONDLENS': {'c-n': 1.379, 'c-o': 1.229, 'c-oh': 1.364, 'ca-c': 1.498, 'n-ca': 1.442}, 'BONDTORSIONS': {'n-ca-c-n': -0.785398163}}

Dictionary containing bond lengths and angles for building protein backbones.

Sourced from SideChainNet: https://github.com/jonathanking/sidechainnet/blob/master/sidechainnet/structure/build_info.py

graphein.protein.resi_atoms.BOND_LENGTHS: Dict[str, Dict[str, float]] = {'As-N': {'i_d': 1.835, 'i_s': 1.86, 'w_sd': 1.845}, 'As-O': {'i_d': 1.66, 'i_s': 1.71, 'w_sd': 1.68}, 'As-S': {'i_d': 2.08, 'i_s': 2.28, 'w_sd': 2.15}, 'C-C': {'i_d': 1.31, 'i_s': 1.49, 'i_t': 1.18, 'w_dt': 1.21, 'w_sd': 1.38}, 'C-N': {'i_d': 1.32, 'i_s': 1.42, 'i_t': 1.14, 'w_dt': 1.2, 'w_sd': 1.34}, 'C-O': {'i_d': 1.22, 'i_s': 1.41, 'w_sd': 1.28}, 'C-S': {'i_d': 1.68, 'i_s': 1.78, 'w_sd': 1.7}, 'C-Te': {'i_d': 1.8, 'i_s': 2.2, 'w_sd': 2.1}, 'N-N': {'i_d': 1.22, 'i_s': 1.4, 'w_sd': 1.32}, 'N-O': {'i_d': 1.22, 'i_s': 1.39, 'w_sd': 1.25}, 'N-P': {'i_d': 1.59, 'i_s': 1.69, 'w_sd': 1.62}, 'N-S': {'i_d': 1.54, 'i_s': 1.66, 'w_sd': 1.58}, 'N-Se': {'i_d': 1.79, 'i_s': 1.83, 'w_sd': 1.8}, 'O-P': {'i_d': 1.48, 'i_s': 1.6, 'w_sd': 1.52}, 'O-S': {'i_d': 1.45, 'i_s': 1.58, 'w_sd': 1.54}, 'P-P': {'i_d': 2.04, 'i_s': 2.23, 'w_sd': 2.06}}

Dictionary containing idealised single, double and triple bond lengths (i_s, i_d, i_t) and watersheds (w_sd, w_dt), below which a bond is probably double/triple (e.g. triple < double < single). All lengths are in Angstroms.

Taken from:

Automatic Assignment of Chemical Connectivity to Organic Molecules in the Cambridge Structural Database Jon C. Baber and Edward E. Hodgkin* J. Chem. Inf. Comput. Sci. 1992, 32. 401-406

graphein.protein.resi_atoms.BOND_ORDERS: Dict = {'As-N': [1, 2], 'As-O': [1, 2], 'As-S': [1, 2], 'C-C': [1, 2, 3], 'C-N': [1, 2, 3], 'C-O': [1, 2], 'C-S': [1, 2], 'C-Te': [1, 2], 'N-N': [1, 2], 'N-O': [1, 2], 'N-P': [1, 2], 'N-S': [1, 2], 'N-Se': [1, 2], 'O-P': [1, 2], 'O-S': [1, 2], 'P-P': [1, 2]}

Dictionary of allowable bond orders for each covalent bond type.

Taken from:

Automatic Assignment of Chemical Connectivity to Organic Molecules in the Cambridge Structural Database Jon C. Baber and Edward E. Hodgkin* J. Chem. Inf. Comput. Sci. 1992, 32. 401-406

graphein.protein.resi_atoms.BOND_TYPES: List[str] = ['hydrophobic', 'disulfide', 'hbond', 'ionic', 'aromatic', 'aromatic_sulphur', 'cation_pi', 'backbone', 'delaunay', 'vdw', 'vdw_clash', 'salt_bridge', 'proximal', 'bb_carbonyl_carbonyl']

List of supported bond types.

graphein.protein.resi_atoms.CARBOHYDRATE_CODES: List[str] = ['BGC', 'BMA', 'FUC', 'GAL', 'GLA', 'GLC', 'MAN', 'NAG', 'NGA', 'SIA', 'XYS']

Three letter codes of commonly found carbohydrates in protein structures.

See http://ligand-expo.rcsb.org/ and https://www.globalphasing.com/buster/manual/maketnt/manual/lib_val/library_validation.html

graphein.protein.resi_atoms.CARBOHYDRATE_CODE_NAME_MAPPING: Dict[str, str] = {'BGC': 'D-GLUCOSE', 'BMA': 'D-MANNOSE', 'FUC': 'FUCOSE', 'GAL': 'D-GALACTOSE', 'GLA': 'D-GALACTOSE', 'GLC': 'D-GLUCOSE', 'MAN': 'D-MANNOSE', 'NAG': 'N-ACETYL-D-GLUCOSAMINE', 'NGA': 'N-ACETYL-D-GALACTOSAMINE', 'SIA': 'O-SIALIC_ACID', 'XYS': 'D-XYLOPYRANOSE'}

Mapping of 3-letter PDB ligand accession codes for common carbohydrates to their full names.

See http://ligand-expo.rcsb.org/ and https://www.globalphasing.com/buster/manual/maketnt/manual/lib_val/library_validation.html

graphein.protein.resi_atoms.CARBOHYDRATE_NAMES: List[str] = ['D-GALACTOSE', 'D-GLUCOSE', 'D-MANNOSE', 'D-XYLOPYRANOSE', 'FUCOSE', 'N-ACETYL-D-GALACTOSAMINE', 'N-ACETYL-D-GLUCOSAMINE', 'O-SIALIC_ACID']

Names of commonly found carbohydrates in protein structures.

See http://ligand-expo.rcsb.org/ and https://www.globalphasing.com/buster/manual/maketnt/manual/lib_val/library_validation.html

graphein.protein.resi_atoms.CATION_PI_RESIS: List[str] = ['LYS', 'ARG', 'PHE', 'TYR', 'TRP']

List of residues involved in cation-pi interactions.

graphein.protein.resi_atoms.CATION_RESIS: List[str] = ['LYS', 'ARG']

List of cationic residues.

graphein.protein.resi_atoms.CHI_ANGLES_ATOMS: Dict[str, List[List[str]]] = {'ALA': [], 'ARG': [['N', 'CA', 'CB', 'CG'], ['CA', 'CB', 'CG', 'CD'], ['CB', 'CG', 'CD', 'NE'], ['CG', 'CD', 'NE', 'CZ']], 'ASN': [['N', 'CA', 'CB', 'CG'], ['CA', 'CB', 'CG', 'OD1']], 'ASP': [['N', 'CA', 'CB', 'CG'], ['CA', 'CB', 'CG', 'OD1']], 'CYS': [['N', 'CA', 'CB', 'SG']], 'GLN': [['N', 'CA', 'CB', 'CG'], ['CA', 'CB', 'CG', 'CD'], ['CB', 'CG', 'CD', 'OE1']], 'GLU': [['N', 'CA', 'CB', 'CG'], ['CA', 'CB', 'CG', 'CD'], ['CB', 'CG', 'CD', 'OE1']], 'GLY': [], 'HIS': [['N', 'CA', 'CB', 'CG'], ['CA', 'CB', 'CG', 'ND1']], 'ILE': [['N', 'CA', 'CB', 'CG1'], ['CA', 'CB', 'CG1', 'CD1']], 'LEU': [['N', 'CA', 'CB', 'CG'], ['CA', 'CB', 'CG', 'CD1']], 'LYS': [['N', 'CA', 'CB', 'CG'], ['CA', 'CB', 'CG', 'CD'], ['CB', 'CG', 'CD', 'CE'], ['CG', 'CD', 'CE', 'NZ']], 'MET': [['N', 'CA', 'CB', 'CG'], ['CA', 'CB', 'CG', 'SD'], ['CB', 'CG', 'SD', 'CE']], 'PHE': [['N', 'CA', 'CB', 'CG'], ['CA', 'CB', 'CG', 'CD1']], 'PRO': [['N', 'CA', 'CB', 'CG'], ['CA', 'CB', 'CG', 'CD']], 'SEC': [['N', 'CA', 'CB', 'SE']], 'SER': [['N', 'CA', 'CB', 'OG']], 'THR': [['N', 'CA', 'CB', 'OG1']], 'TRP': [['N', 'CA', 'CB', 'CG'], ['CA', 'CB', 'CG', 'CD1']], 'TYR': [['N', 'CA', 'CB', 'CG'], ['CA', 'CB', 'CG', 'CD1']], 'UNK': [], 'VAL': [['N', 'CA', 'CB', 'CG1']]}

Dictionary containing mapping of atoms to the chi angle used to compute them.

The first nested list is chi1, the second chi2, etc.

For residues with no chi angles (GLY, ALA), the list is empty.

graphein.protein.resi_atoms.COFACTOR_CODES: List[str] = ['ADP', 'AMP', 'ATP', 'CMP', 'COA', 'FAD', 'FMN', 'NAP', 'NDP']

Three letter codes of cofactors commonly found in PDB structures.

See: http://ligand-expo.rcsb.org/ and https://www.globalphasing.com/buster/manual/maketnt/manual/lib_val/library_validation.html

graphein.protein.resi_atoms.COFACTOR_CODE_NAME_MAPPING: Dict[str, str] = {'ADP': 'ADP', 'AMP': 'AMP', 'ATP': 'ATP', 'CMP': 'cAMP', 'COA': 'COENZYME_A', 'FAD': 'FAD', 'FMN': 'FLAVIN_MONONUCLEOTIDE', 'NAP': 'NADP', 'NDP': 'NADPH'}

Mapping between 3-letter PDB ligand codes and cofactor names.

See http://ligand-expo.rcsb.org/ and https://www.globalphasing.com/buster/manual/maketnt/manual/lib_val/library_validation.html

graphein.protein.resi_atoms.COFACTOR_NAMES: List[str] = ['ADP', 'AMP', 'ATP', 'cAMP', 'COENZYME_A', 'FAD', 'FLAVIN_MONONUCLEOTIDE', 'NADP', 'NADPH']

Names of cofactors commonly found in PDB structures.

See: http://ligand-expo.rcsb.org/ and https://www.globalphasing.com/buster/manual/maketnt/manual/lib_val/library_validation.html

graphein.protein.resi_atoms.COVALENT_RADII: Dict[str, float] = {'Cdb': 0.67, 'Cres': 0.72, 'Csb': 0.77, 'Hsb': 0.37, 'Ndb': 0.62, 'Nres': 0.66, 'Nsb': 0.7, 'Odb': 0.6, 'Ores': 0.635, 'Osb': 0.67, 'Ssb': 1.04}

Covalent radii for OpenSCAD output. Adding Ores between Osb and Odb for Asp and Glu, Nres between Nsb and Ndb for Arg, as PDB does not specify

Covalent radii from:

Heyrovska, Raji : ‘Atomic Structures of all the Twenty Essential Amino Acids and a Tripeptide, with Bond Lengths as Sums of Atomic Covalent Radii’

Paper: https://arxiv.org/pdf/0804.2488.pdf

graphein.protein.resi_atoms.DEFAULT_BOND_STATE: Dict[str, str] = {'1HD2': 'Hsb', '1HH1': 'Hsb', '1HH2': 'Hsb', '2HD2': 'Hsb', '2HH1': 'Hsb', '2HH2': 'Hsb', 'C': 'Cdb', 'CA': 'Csb', 'CB': 'Csb', 'H': 'Hsb', 'HE': 'Hsb', 'HG': 'Hsb', 'HG1': 'Hsb', 'HH': 'Hsb', 'HZ1': 'Hsb', 'HZ2': 'Hsb', 'HZ3': 'Hsb', 'N': 'Nsb', 'O': 'Odb', 'OXT': 'Osb'}

Assignment of atom classes to atomic radii.

Covalent radii from:

Heyrovska, Raji : ‘Atomic Structures of all the Twenty Essential Amino Acids and a Tripeptide, with Bond Lengths as Sums of Atomic Covalent Radii’

Paper: https://arxiv.org/pdf/0804.2488.pdf

graphein.protein.resi_atoms.DISULFIDE_ATOMS: List[str] = ['SG']

List of atoms capable of forming disulphide bonds.

graphein.protein.resi_atoms.DISULFIDE_RESIS: List[str] = ['CYS']

Residues capable of forming disulfide bonds.

graphein.protein.resi_atoms.ELEMENT_SYMBOL_MAP: Dict[str, str] = {'C': 'C', 'CA': 'C', 'CB': 'C', 'CD': 'C', 'CD1': 'C', 'CD2': 'C', 'CE': 'C', 'CE1': 'C', 'CE2': 'C', 'CE3': 'C', 'CG': 'C', 'CG1': 'C', 'CG2': 'C', 'CH2': 'C', 'CZ': 'C', 'CZ2': 'C', 'CZ3': 'C', 'N': 'N', 'ND1': 'N', 'ND2': 'N', 'NE': 'N', 'NE1': 'N', 'NE2': 'N', 'NH1': 'N', 'NH2': 'N', 'NZ': 'N', 'O': 'O', 'OD1': 'O', 'OD2': 'O', 'OE1': 'O', 'OE2': 'O', 'OG': 'O', 'OG1': 'O', 'OH': 'O', 'OXT': 'O', 'SD': 'S', 'SG': 'S'}

Maps PDB atom names to the element symbols.

graphein.protein.resi_atoms.GRANTHAM_CHEMICAL_DISTANCE_MATRIX: Dict[str, float] = {'AA': 0.0, 'AC': 0.112, 'AD': 0.819, 'AE': 0.827, 'AF': 0.54, 'AG': 0.208, 'AH': 0.696, 'AI': 0.407, 'AK': 0.891, 'AL': 0.406, 'AM': 0.379, 'AN': 0.318, 'AP': 0.191, 'AQ': 0.372, 'AR': 1.0, 'AS': 0.094, 'AT': 0.22, 'AV': 0.273, 'AW': 0.739, 'AY': 0.552, 'CA': 0.114, 'CC': 0.0, 'CD': 0.847, 'CE': 0.838, 'CF': 0.437, 'CG': 0.32, 'CH': 0.66, 'CI': 0.304, 'CK': 0.887, 'CL': 0.301, 'CM': 0.277, 'CN': 0.324, 'CP': 0.157, 'CQ': 0.341, 'CR': 1.0, 'CS': 0.176, 'CT': 0.233, 'CV': 0.167, 'CW': 0.639, 'CY': 0.457, 'DA': 0.729, 'DC': 0.742, 'DD': 0.0, 'DE': 0.124, 'DF': 0.924, 'DG': 0.697, 'DH': 0.435, 'DI': 0.847, 'DK': 0.249, 'DL': 0.841, 'DM': 0.819, 'DN': 0.56, 'DP': 0.657, 'DQ': 0.584, 'DR': 0.295, 'DS': 0.667, 'DT': 0.649, 'DV': 0.797, 'DW': 1.0, 'DY': 0.836, 'EA': 0.79, 'EC': 0.788, 'ED': 0.133, 'EE': 0.0, 'EF': 0.932, 'EG': 0.779, 'EH': 0.406, 'EI': 0.86, 'EK': 0.143, 'EL': 0.854, 'EM': 0.83, 'EN': 0.599, 'EP': 0.688, 'EQ': 0.598, 'ER': 0.234, 'ES': 0.726, 'ET': 0.682, 'EV': 0.824, 'EW': 1.0, 'EY': 0.837, 'FA': 0.508, 'FC': 0.405, 'FD': 0.977, 'FE': 0.918, 'FF': 0.0, 'FG': 0.69, 'FH': 0.663, 'FI': 0.128, 'FK': 0.903, 'FL': 0.131, 'FM': 0.169, 'FN': 0.541, 'FP': 0.42, 'FQ': 0.459, 'FR': 1.0, 'FS': 0.548, 'FT': 0.499, 'FV': 0.252, 'FW': 0.207, 'FY': 0.179, 'GA': 0.206, 'GC': 0.312, 'GD': 0.776, 'GE': 0.807, 'GF': 0.727, 'GG': 0.0, 'GH': 0.769, 'GI': 0.592, 'GK': 0.894, 'GL': 0.591, 'GM': 0.557, 'GN': 0.381, 'GP': 0.323, 'GQ': 0.467, 'GR': 1.0, 'GS': 0.158, 'GT': 0.272, 'GV': 0.464, 'GW': 0.923, 'GY': 0.728, 'HA': 0.896, 'HC': 0.836, 'HD': 0.629, 'HE': 0.547, 'HF': 0.907, 'HG': 1.0, 'HH': 0.0, 'HI': 0.848, 'HK': 0.566, 'HL': 0.842, 'HM': 0.825, 'HN': 0.754, 'HP': 0.777, 'HQ': 0.716, 'HR': 0.697, 'HS': 0.865, 'HT': 0.834, 'HV': 0.831, 'HW': 0.981, 'HY': 0.821, 'IA': 0.403, 'IC': 0.296, 'ID': 0.942, 'IE': 0.891, 'IF': 0.134, 'IG': 0.592, 'IH': 0.652, 'II': 0.0, 'IK': 0.892, 'IL': 0.013, 'IM': 0.057, 'IN': 0.457, 'IP': 0.311, 'IQ': 0.383, 'IR': 1.0, 'IS': 0.443, 'IT': 0.396, 'IV': 0.133, 'IW': 0.339, 'IY': 0.213, 'KA': 0.889, 'KC': 0.871, 'KD': 0.279, 'KE': 0.149, 'KF': 0.957, 'KG': 0.9, 'KH': 0.438, 'KI': 0.899, 'KK': 0.0, 'KL': 0.892, 'KM': 0.871, 'KN': 0.667, 'KP': 0.757, 'KQ': 0.639, 'KR': 0.154, 'KS': 0.825, 'KT': 0.759, 'KV': 0.882, 'KW': 1.0, 'KY': 0.848, 'LA': 0.405, 'LC': 0.296, 'LD': 0.944, 'LE': 0.892, 'LF': 0.139, 'LG': 0.596, 'LH': 0.653, 'LI': 0.013, 'LK': 0.893, 'LL': 0.0, 'LM': 0.062, 'LN': 0.452, 'LP': 0.309, 'LQ': 0.376, 'LR': 1.0, 'LS': 0.443, 'LT': 0.397, 'LV': 0.133, 'LW': 0.341, 'LY': 0.205, 'MA': 0.383, 'MC': 0.276, 'MD': 0.932, 'ME': 0.879, 'MF': 0.182, 'MG': 0.569, 'MH': 0.648, 'MI': 0.058, 'MK': 0.884, 'ML': 0.062, 'MM': 0.0, 'MN': 0.447, 'MP': 0.285, 'MQ': 0.372, 'MR': 1.0, 'MS': 0.417, 'MT': 0.358, 'MV': 0.12, 'MW': 0.391, 'MY': 0.255, 'NA': 0.424, 'NC': 0.425, 'ND': 0.838, 'NE': 0.835, 'NF': 0.766, 'NG': 0.512, 'NH': 0.78, 'NI': 0.615, 'NK': 0.891, 'NL': 0.603, 'NM': 0.588, 'NN': 0.0, 'NP': 0.266, 'NQ': 0.175, 'NR': 1.0, 'NS': 0.361, 'NT': 0.368, 'NV': 0.503, 'NW': 0.945, 'NY': 0.641, 'PA': 0.22, 'PC': 0.179, 'PD': 0.852, 'PE': 0.831, 'PF': 0.515, 'PG': 0.376, 'PH': 0.696, 'PI': 0.363, 'PK': 0.875, 'PL': 0.357, 'PM': 0.326, 'PN': 0.231, 'PP': 0.0, 'PQ': 0.228, 'PR': 1.0, 'PS': 0.196, 'PT': 0.161, 'PV': 0.244, 'PW': 0.72, 'PY': 0.481, 'QA': 0.512, 'QC': 0.462, 'QD': 0.903, 'QE': 0.861, 'QF': 0.671, 'QG': 0.648, 'QH': 0.765, 'QI': 0.532, 'QK': 0.881, 'QL': 0.518, 'QM': 0.505, 'QN': 0.181, 'QP': 0.272, 'QQ': 0.0, 'QR': 1.0, 'QS': 0.461, 'QT': 0.389, 'QV': 0.464, 'QW': 0.831, 'QY': 0.522, 'RA': 0.919, 'RC': 0.905, 'RD': 0.305, 'RE': 0.225, 'RF': 0.977, 'RG': 0.928, 'RH': 0.498, 'RI': 0.929, 'RK': 0.141, 'RL': 0.92, 'RM': 0.908, 'RN': 0.69, 'RP': 0.796, 'RQ': 0.668, 'RR': 0.0, 'RS': 0.86, 'RT': 0.808, 'RV': 0.914, 'RW': 1.0, 'RY': 0.859, 'SA': 0.1, 'SC': 0.185, 'SD': 0.801, 'SE': 0.812, 'SF': 0.622, 'SG': 0.17, 'SH': 0.718, 'SI': 0.478, 'SK': 0.883, 'SL': 0.474, 'SM': 0.44, 'SN': 0.289, 'SP': 0.181, 'SQ': 0.358, 'SR': 1.0, 'SS': 0.0, 'ST': 0.174, 'SV': 0.342, 'SW': 0.827, 'SY': 0.615, 'TA': 0.251, 'TC': 0.261, 'TD': 0.83, 'TE': 0.812, 'TF': 0.604, 'TG': 0.312, 'TH': 0.737, 'TI': 0.455, 'TK': 0.866, 'TL': 0.453, 'TM': 0.403, 'TN': 0.315, 'TP': 0.159, 'TQ': 0.322, 'TR': 1.0, 'TS': 0.185, 'TT': 0.0, 'TV': 0.345, 'TW': 0.816, 'TY': 0.596, 'VA': 0.275, 'VC': 0.165, 'VD': 0.9, 'VE': 0.867, 'VF': 0.269, 'VG': 0.471, 'VH': 0.649, 'VI': 0.135, 'VK': 0.889, 'VL': 0.134, 'VM': 0.12, 'VN': 0.38, 'VP': 0.212, 'VQ': 0.339, 'VR': 1.0, 'VS': 0.322, 'VT': 0.305, 'VV': 0.0, 'VW': 0.472, 'VY': 0.31, 'WA': 0.658, 'WC': 0.56, 'WD': 1.0, 'WE': 0.931, 'WF': 0.196, 'WG': 0.829, 'WH': 0.678, 'WI': 0.305, 'WK': 0.892, 'WL': 0.304, 'WM': 0.344, 'WN': 0.631, 'WP': 0.555, 'WQ': 0.538, 'WR': 0.968, 'WS': 0.689, 'WT': 0.638, 'WV': 0.418, 'WW': 0.0, 'WY': 0.204, 'YA': 0.587, 'YC': 0.478, 'YD': 1.0, 'YE': 0.932, 'YF': 0.202, 'YG': 0.782, 'YH': 0.678, 'YI': 0.23, 'YK': 0.904, 'YL': 0.219, 'YM': 0.268, 'YN': 0.512, 'YP': 0.444, 'YQ': 0.404, 'YR': 0.995, 'YS': 0.612, 'YT': 0.557, 'YV': 0.328, 'YW': 0.244, 'YY': 0.0}

//github.com/MartinThoma/propy3

Amino Acid Difference Formula to Help Explain Protein Evolution R. Grantham Science Vol 185, Issue 4154 06 September 1974

Paper: https://science.sciencemag.org/content/185/4154/862/tab-pdf

Type:

Grantham Chemical Distance Matrix. Taken from ProPy3 https

graphein.protein.resi_atoms.HYDROGEN_BOND_ACCEPTORS: Dict[str, Dict[str, int]] = {'ASN': {'OD1': 2}, 'ASP': {'OD1': 2, 'OD2': 2}, 'GLN': {'OE1': 2}, 'GLU': {'OE1': 2, 'OE2': 2}, 'HIS': {'ND1': 1, 'NE2': 1}, 'SER': {'OG': 2}, 'THR': {'OG1': 2}, 'TYR': {'OH': 1}}

Number of hydrogen bonds that an acceptor atom can accept, if more than one.

9 amino acids (alanine, cysteine, glycine, isoleucine, leucine, methionine, phenylalanine, proline, valine) have no hydrogen donor or acceptor atoms in their side chains.

https://www.imgt.org/IMGTeducation/Aide-memoire/_UK/aminoacids/charge/

graphein.protein.resi_atoms.HYDROGEN_BOND_DONORS: Dict[str, Dict[str, int]] = {'ARG': {'NE': 1, 'NH1': 2, 'NH2': 2}, 'ASN': {'ND2': 2}, 'GLN': {'NE2': 2}, 'HIS': {'ND1': 2, 'NE2': 2}, 'LYS': {'NZ': 3}, 'SER': {'OG': 1}, 'THR': {'OG1': 1}, 'TRP': {'NE1': 1}, 'TYR': {'OH': 1}}

Number of hydrogen bonds that a donor atom can donate, if more than one.

9 amino acids (alanine, cysteine, glycine, isoleucine, leucine, methionine, phenylalanine, proline, valine) have no hydrogen donor or acceptor atoms in their side chains.

https://www.imgt.org/IMGTeducation/Aide-memoire/_UK/aminoacids/charge/

graphein.protein.resi_atoms.HYDROPHOBIC_RESIS: List[str] = ['ALA', 'ILE', 'LEU', 'MET', 'PHE', 'PRO', 'TRP', 'TYR', 'VAL']

List of residues that are considered to be hydrophobic.

graphein.protein.resi_atoms.IDEAL_BB_BOND_ANGLES: List[float] = [2.124, 1.941, 2.028]

Idealised backbone bond angles. [C-N-Ca, N-Ca-C, Ca-C-N].

See also

:ref:`graphein.protein.tensor.geometry.idealize_backbone

graphein.protein.resi_atoms.IDEAL_BB_BOND_LENGTHS: List[float] = [1.523, 1.329, 1.458]

Idealised backbone bond lengths. [Ca-C, C-N, N-Ca].

See also

:ref:`graphein.protein.tensor.geometry.idealize_backbone

graphein.protein.resi_atoms.IONIC_RESIS: List[str] = ['ARG', 'LYS', 'HIS', 'ASP', 'GLU']

Residues capable of forming ionic interactions.

graphein.protein.resi_atoms.ISOELECTRIC_POINTS: Dict[str, float] = {'ALA': 6.11, 'ARG': 10.76, 'ASN': 10.76, 'ASP': 2.98, 'ASX': 6.87, 'CYS': 5.02, 'GLN': 5.65, 'GLU': 3.08, 'GLX': 4.35, 'GLY': 6.06, 'HIS': 7.64, 'ILE': 6.04, 'LEU': 6.04, 'LYS': 9.74, 'MET': 5.74, 'PHE': 5.91, 'PRO': 6.3, 'SER': 5.68, 'THR': 5.6, 'TRP': 5.88, 'TYR': 5.63, 'UNK': 7.0, 'VAL': 6.02}

Dictionary of isoelectric points for standard amino acids. For "UNK" residues, neutral (pH 7.0) is assigned. For "ASX" and "GLX" the average of their constituents ("D" and "N", and "E" and "Q", respectively) is assigned.

graphein.protein.resi_atoms.ISOELECTRIC_POINTS_STD = {'ALA': array([[-0.0986554]]), 'ARG': array([[2.33811019]]), 'ASN': array([[2.33811019]]), 'ASP': array([[-1.73888686]]), 'ASX': array([[0.29961166]]), 'CYS': array([[-0.66985422]]), 'GLN': array([[-0.33971178]]), 'GLU': array([[-1.6864833]]), 'GLX': array([[-1.02095808]]), 'GLY': array([[-0.12485718]]), 'HIS': array([[0.70311909]]), 'ILE': array([[-0.13533789]]), 'LEU': array([[-0.13533789]]), 'LYS': array([[1.80359387]]), 'MET': array([[-0.29254858]]), 'PHE': array([[-0.20346252]]), 'PRO': array([[0.00091137]]), 'SER': array([[-0.32399071]]), 'THR': array([[-0.36591356]]), 'TRP': array([[-0.21918359]]), 'TYR': array([[-0.35019249]]), 'UNK': array([[0.36773629]]), 'VAL': array([[-0.1458186]])}

Standardized (sklearn.StandardScaler) isoelectric points for standard amino acids.

See ISOELECTRIC_POINTS for details.

graphein.protein.resi_atoms.MAX_NEIGHBOURS: Dict[str, int] = {'B': 3, 'Br': 1, 'C': 4, 'F': 1, 'H': 1, 'I': 3, 'O': 2}

Maximum number of neighbours an atom can have.

Taken from: https://www.daylight.com/meetings/mug01/Sayle/m4xbondage.html

graphein.protein.resi_atoms.MOLECULAR_WEIGHTS: Dict[str, float] = {'ALA': 89.0935, 'ARG': 174.2017, 'ASN': 132.1184, 'ASP': 133.1032, 'ASX': 132.6108, 'CYS': 121.159, 'GLN': 146.1451, 'GLU': 147.1299, 'GLX': 146.6375, 'GLY': 75.0669, 'HIS': 155.1552, 'ILE': 131.1736, 'LEU': 131.1736, 'LYS': 146.1882, 'MET': 149.2124, 'PHE': 165.19, 'PRO': 115.131, 'SER': 105.093, 'THR': 119.1197, 'TRP': 204.2262, 'TYR': 181.1894, 'UNK': 137.1484, 'VAL': 117.1469}

Mapping of 3-letter amino acid names to molecular weights. UNK is used for unknown residues and takes the mean of known weights. For "ASX" and "GLX" the average of their constituents ("D" and "N", and "E" and "Q", respectively) is assigned.

graphein.protein.resi_atoms.MOLECULAR_WEIGHTS_STD = {'ALA': array([[-1.70781298]]), 'ARG': array([[1.31682834]]), 'ASN': array([[-0.17876066]]), 'ASP': array([[-0.14376208]]), 'ASX': array([[-0.16126137]]), 'CYS': array([[-0.56824433]]), 'GLN': array([[0.31973109]]), 'GLU': array([[0.35472968]]), 'GLX': array([[0.33723039]]), 'GLY': array([[-2.20630119]]), 'HIS': array([[0.63993903]]), 'ILE': array([[-0.2123377]]), 'LEU': array([[-0.2123377]]), 'LYS': array([[0.32126282]]), 'MET': array([[0.42873918]]), 'PHE': array([[0.99656354]]), 'PRO': array([[-0.78247208]]), 'SER': array([[-1.13921032]]), 'THR': array([[-0.64071856]]), 'TRP': array([[2.38386234]]), 'TYR': array([[1.56516265]]), 'UNK': array([[-6.18065682e-07]]), 'VAL': array([[-0.71082946]])}

Standardized (sklearn.StandardScaler) molecular weights for standard amino acids.

See MOLECULAR_WEIGHTS for details.

graphein.protein.resi_atoms.NEG_AA: List[str] = ['GLU', 'ASP']

Negatively charged amino acids.

graphein.protein.resi_atoms.NON_STANDARD_AMINO_ACIDS: List[str] = ['O', 'U']

Non-standard amino acids with one-letter codes.

graphein.protein.resi_atoms.NON_STANDARD_AMINO_ACID_MAPPING_1_TO_3 = {'E': 'CGU', 'H': 'HIP', 'O': 'PYL', 'U': 'SEC'}

Mapping of 1-letter non-standard amino acids codes to their three-letter form.

See: http://ligand-expo.rcsb.org/

graphein.protein.resi_atoms.NON_STANDARD_AMINO_ACID_MAPPING_3_TO_1: Dict[str, str] = {'CGU': 'E', 'HID': 'H', 'HIE': 'H', 'HIP': 'H', 'PYL': 'O', 'SEC': 'U'}

Mapping of 3-letter non-standard amino acids codes to their one-letter form.

See: http://ligand-expo.rcsb.org/

graphein.protein.resi_atoms.NON_STANDARD_RESIS_NAME: List[str] = ['3-SULFINOALANINE', '4-HYDROXYPROLINE', '4-METHYL-4-[(E)-2-BUTENYL]-4,N-METHYL-THREONINE', '5-HYDROXYPROLINE', 'ACETYL_GROUP', 'ALPHA-AMINOBUTYRIC_ACID', 'ALPHA-AMINOISOBUTYRIC_ACID', 'AMINO_GROUP', 'CARBOXY_GROUP', 'CYSTEINE-S-DIOXIDE', 'CYSTEINESULFONIC_ACID', 'D-ALANINE', 'D-ARGININE', 'D-ASPARAGINE', 'D-ASPARTATE', 'D-CYSTEINE', 'DECARBOXY(PARAHYDROXYBENZYLIDENE-IMIDAZOLIDINONE)THREONINE', 'D-GLUTAMATE', 'D-GLUTAMINE', 'D-HISTIDINE', 'D-ISOLEUCINE', 'D-ISOVALINE', 'D-LEUCINE', 'D-LYSINE', 'D-PHENYLALANINE', 'D-PROLINE', 'D-SERINE', 'D-THREONINE', 'D-TRYPTOPHANE', 'D-TYROSINE', 'D-VALINE', 'FORMYL_GROUP', 'GAMMA-CARBOXY-GLUTAMIC_ACID', 'ISOVALERIC_ACID', 'LYSINE_NZ-CARBOXYLIC_ACID', "LYSINE-PYRIDOXAL-5'-PHOSPHATE", 'N-CARBOXYMETHIONINE', 'N-FORMYLMETHIONINE', 'N-METHYLLEUCINE', 'N-METHYLVALINE', 'NORLEUCINE', 'O-PHOSPHOTYROSINE', 'ORNITHINE', 'PHOSPHOSERINE', 'PHOSPHOTHREONINE', 'PYROGLUTAMIC_ACID', 'PYRUVOYL_GROUP', 'SARCOSINE', 'S-HYDROXY-CYSTEINE', 'S-HYDROXYCYSTEINE', 'S-MERCAPTOCYSTEINE', 'S-OXY_CYSTEINE', 'S,S-(2-HYDROXYETHYL)THIOCYSTEINE', 'SULFONATED_TYROSINE', 'TERT-BUTYLOXYCARBONYL_GROUP', 'TOPO-QUINONE', 'TYROSINE-O-SULPHONIC_ACID']

//www.globalphasing.com/buster/manual/maketnt/manual/lib_val/library_validation.html PYL (pyrolysine) and SEC are added

Type:

Non-standard residue info taken from

Type:

https

graphein.protein.resi_atoms.NON_STANDARD_RESIS_PARENT: Dict[str, str] = {'5HP': 'GLU', 'ABA': 'ALA', 'ACE': '-', 'AIB': 'ALA', 'AYA': 'ALA', 'BMT': 'THR', 'BOC': '-', 'CBX': '-', 'CEA': 'CYS', 'CGU': 'GLU', 'CME': 'CYS', 'CRO': 'CRO', 'CSD': 'CYS', 'CSO': 'CYS', 'CSS': 'CYS', 'CSW': 'CYS', 'CSX': 'CYS', 'CXM': 'MET', 'DAL': 'ALA', 'DAR': 'ARG', 'DCY': 'CYS', 'DGL': 'GLU', 'DGN': 'GLN', 'DHI': 'HIS', 'DIL': 'ILE', 'DIV': 'VAL', 'DLE': 'LEU', 'DLY': 'LYS', 'DPN': 'PHE', 'DPR': 'PRO', 'DSG': 'ASN', 'DSN': 'SER', 'DSP': 'ASP', 'DTH': 'THR', 'DTR': 'DTR', 'DTY': 'TYR', 'DVA': 'VAL', 'FME': 'MET', 'FOR': '-', 'HYP': 'PRO', 'IVA': '-', 'KCX': 'LYS', 'LLP': 'LYS', 'MLE': 'LEU', 'MVA': 'VAL', 'NH2': '-', 'NLE': 'LEU', 'NLW': 'LEU', 'OCS': 'CYS', 'ORN': 'ALA', 'PCA': 'GLU', 'PSW': 'SEC', 'PTR': 'TYR', 'PVL': '-', 'PYL': 'LYS', 'SAR': 'GLY', 'SEC': 'CYS', 'SEP': 'SER', 'STY': 'TYR', 'TPO': 'THR', 'TPQ': 'PHE', 'TYS': 'TYR'}

Mapping of 3-letter non-standard/modified residues to their 3-letter parent residue names.

graphein.protein.resi_atoms.NON_STANDARD_RESI_NAMES: List[str] = ['5HP', 'ABA', 'ACE', 'AIB', 'AYA', 'BMT', 'BOC', 'CBX', 'CEA', 'CGU', 'CME', 'CRO', 'CSD', 'CSO', 'CSS', 'CSW', 'CSX', 'CXM', 'DAL', 'DAR', 'DCY', 'DGL', 'DGN', 'DHI', 'DIL', 'DIV', 'DLE', 'DLY', 'DPN', 'DPR', 'DSG', 'DSN', 'DSP', 'DTH', 'DTR', 'DTY', 'DVA', 'FME', 'FOR', 'HID', 'HIE', 'HIP', 'HYP', 'IVA', 'KCX', 'LLP', 'MLE', 'MVA', 'NH2', 'NLE', 'NLW', 'OCS', 'ORN', 'PCA', 'PSW', 'PTR', 'PVL', 'PYL', 'SAR', 'SEC', 'SEP', 'STY', 'TPO', 'TPQ', 'TYS']

List of non-standard residue 3-letter names.

Collected from: https://www.globalphasing.com/buster/manual/maketnt/manual/lib_val/library_validation.html

graphein.protein.resi_atoms.PI_RESIS: List[str] = ['PHE', 'TYR', 'TRP']

List of residues involved in pi interactions.

graphein.protein.resi_atoms.POS_AA: List[str] = ['HIS', 'LYS', 'ARG']

Positively charged amino acids.

graphein.protein.resi_atoms.PROTEIN_ATOMS: List[str] = ['N', 'CA', 'C', 'O', 'CB', 'OG', 'CG', 'CD1', 'CD2', 'CE1', 'CE2', 'CZ', 'OD1', 'ND2', 'CG1', 'CG2', 'CD', 'CE', 'NZ', 'OD2', 'OE1', 'NE2', 'OE2', 'OH', 'NE', 'NH1', 'NH2', 'OG1', 'SD', 'ND1', 'SG', 'NE1', 'CE3', 'CZ2', 'CZ3', 'CH2', 'OXT']

List of standard atom types present in protein structures.

graphein.protein.resi_atoms.RESIDUE_ATOM_BOND_STATE: Dict[str, Dict[str, str]] = {'ARG': {'CD': 'Csb', 'CG': 'Csb', 'CZ': 'Cdb', 'NE': 'Nsb', 'NH1': 'Nres', 'NH2': 'Nres'}, 'ASN': {'CG': 'Csb', 'ND2': 'Ndb', 'OD1': 'Odb'}, 'ASP': {'CG': 'Csb', 'OD1': 'Ores', 'OD2': 'Ores'}, 'CYS': {'SG': 'Ssb'}, 'GLN': {'CD': 'Csb', 'CG': 'Csb', 'NE2': 'Ndb', 'OE1': 'Odb'}, 'GLU': {'CD': 'Csb', 'CG': 'Csb', 'OE1': 'Ores', 'OE2': 'Ores'}, 'HIS': {'CD2': 'Cdb', 'CE1': 'Cdb', 'CG': 'Cdb', 'ND1': 'Nsb', 'NE2': 'Ndb'}, 'ILE': {'CD1': 'Csb', 'CG1': 'Csb', 'CG2': 'Csb'}, 'LEU': {'CD1': 'Csb', 'CD2': 'Csb', 'CG': 'Csb'}, 'LYS': {'CD': 'Csb', 'CE': 'Csb', 'CG': 'Csb', 'NZ': 'Nsb'}, 'MET': {'CE': 'Csb', 'CG': 'Csb', 'SD': 'Ssb'}, 'PHE': {'CD1': 'Cres', 'CD2': 'Cres', 'CE1': 'Cdb', 'CE2': 'Cdb', 'CG': 'Cdb', 'CZ': 'Cres'}, 'PRO': {'CD': 'Csb', 'CG': 'Csb'}, 'SER': {'OG': 'Osb'}, 'THR': {'CG2': 'Csb', 'OG1': 'Osb'}, 'TRP': {'CD1': 'Cdb', 'CD2': 'Cres', 'CE2': 'Cdb', 'CE3': 'Cdb', 'CG': 'Cdb', 'CH2': 'Cdb', 'CZ2': 'Cres', 'CZ3': 'Cres', 'NE1': 'Nsb'}, 'TYR': {'CD1': 'Cres', 'CD2': 'Cres', 'CE1': 'Cdb', 'CE2': 'Cdb', 'CG': 'Cdb', 'CZ': 'Cres', 'OH': 'Osb'}, 'VAL': {'CG1': 'Csb', 'CG2': 'Csb'}, 'XXX': {'C': 'Cdb', 'CA': 'Csb', 'CB': 'Csb', 'H': 'Hsb', 'N': 'Nsb', 'O': 'Odb', 'OXT': 'Osb'}}

Assignment of consituent atom classes with each standard residue to atomic radii.

Covalent radii from:

Heyrovska, Raji : ‘Atomic Structures of all the Twenty Essential Amino Acids and a Tripeptide, with Bond Lengths as Sums of Atomic Covalent Radii’

Paper: https://arxiv.org/pdf/0804.2488.pdf

graphein.protein.resi_atoms.RESI_NAMES: List[str] = ['5HP', 'ABA', 'ACE', 'AIB', 'AYA', 'ALA', 'ARG', 'ASN', 'ASP', 'ASX', 'BMT', 'BOC', 'CBX', 'CEA', 'CGU', 'CME', 'CRO', 'CSD', 'CSO', 'CSS', 'CSW', 'CSX', 'CXM', 'CYS', 'DAL', 'DAR', 'DCY', 'DGL', 'DGN', 'DHI', 'DIL', 'DIV', 'DLE', 'DLY', 'DPN', 'DPR', 'DSG', 'DSN', 'DSP', 'DTH', 'DTR', 'DTY', 'DVA', 'FME', 'FOR', 'GLN', 'GLU', 'GLX', 'GLY', 'HID', 'HIE', 'HIP', 'HIS', 'HYP', 'ILE', 'IVA', 'KCX', 'LEU', 'LLP', 'LYS', 'MET', 'MLE', 'MSE', 'MVA', 'NH2', 'NLE', 'NLW', 'OCS', 'ORN', 'PCA', 'PHE', 'PRO', 'PSW', 'PTR', 'PVL', 'PYL', 'SAR', 'SEC', 'SEP', 'SER', 'STY', 'THR', 'TPO', 'TPQ', 'TRP', 'TYR', 'TYS', 'UNK', 'VAL']

3-letter residue names for all amino acids. Non-standard/modified amino acids are mapped to their parent amino acid. Includes "UNK" to denote unknown residues.

graphein.protein.resi_atoms.RESI_THREE_TO_1: Dict[str, str] = {'3HP': 'X', '4HP': 'X', '5HP': 'Q', 'ABA': 'A', 'ACE': 'X', 'AIB': 'A', 'ALA': 'A', 'ARG': 'R', 'ASN': 'N', 'ASP': 'D', 'ASX': 'B', 'AYA': 'A', 'BMT': 'T', 'BOC': 'X', 'CBX': 'X', 'CEA': 'C', 'CGU': 'E', 'CME': 'C', 'CRO': 'TYG', 'CSD': 'C', 'CSO': 'C', 'CSS': 'C', 'CSW': 'C', 'CSX': 'C', 'CXM': 'M', 'CYS': 'C', 'CYX': 'C', 'DAL': 'A', 'DAR': 'R', 'DCY': 'C', 'DGL': 'E', 'DGN': 'Q', 'DHI': 'H', 'DIL': 'I', 'DIV': 'V', 'DLE': 'L', 'DLY': 'K', 'DPN': 'F', 'DPR': 'P', 'DSG': 'N', 'DSN': 'S', 'DSP': 'D', 'DTH': 'T', 'DTR': 'W', 'DTY': 'Y', 'DVA': 'V', 'FME': 'M', 'FOR': 'X', 'GLN': 'Q', 'GLU': 'E', 'GLX': 'Z', 'GLY': 'G', 'HID': 'H', 'HIE': 'H', 'HIP': 'H', 'HIS': 'H', 'HYP': 'P', 'ILE': 'I', 'IVA': 'X', 'KCX': 'K', 'LEU': 'L', 'LLP': 'K', 'LYS': 'K', 'MET': 'M', 'MLE': 'L', 'MSE': 'M', 'MVA': 'V', 'NH2': 'X', 'NLE': 'L', 'NLW': 'L', 'OCS': 'C', 'ORN': 'A', 'PCA': 'Q', 'PHE': 'F', 'PRO': 'P', 'PSW': 'U', 'PTR': 'Y', 'PVL': 'X', 'PYL': 'O', 'SAR': 'G', 'SEC': 'U', 'SEP': 'S', 'SER': 'S', 'STY': 'Y', 'THR': 'T', 'TPO': 'T', 'TPQ': 'Y', 'TRP': 'W', 'TYR': 'Y', 'TYS': 'Y', 'UNK': 'X', 'VAL': 'V'}

Mapping of 3-letter residue names to 1-letter residue names. Non-standard/modified amino acids are mapped to their parent amino acid. Includes "UNK" to denote unknown residues.

graphein.protein.resi_atoms.RING_NORMAL_ATOMS: Dict[str, List[str]] = {'PHE': ['CG', 'CE1', 'CE2'], 'TRP': ['CD2', 'CZ2', 'CZ3'], 'TYR': ['CG', 'CE1', 'CE2']}

Dictionary of atoms used to compute ring normals for each residue.

graphein.protein.resi_atoms.SALT_BRIDGE_ANIONS: List[str] = ['ASP', 'GLU']

List of anionic residues that can form salt bridges.

graphein.protein.resi_atoms.SALT_BRIDGE_ATOMS: List[str] = ['OD1', 'OD2', 'OE1', 'OE2', 'NZ', 'NH1', 'NH2']

List of atoms that can form salt bridges.

graphein.protein.resi_atoms.SALT_BRIDGE_CATIONS: List[str] = ['LYS', 'ARG']

List of cationic residues that can form salt bridges.

graphein.protein.resi_atoms.SALT_BRIDGE_RESIDUES: List[str] = ['ASP', 'GLU', 'LYS', 'ARG']

List of residues that can form salt bridges.

graphein.protein.resi_atoms.SCHNEIDER_WREDE_DISTMAT: Dict[str, float] = {'AA': 0.0, 'AC': 0.112, 'AD': 0.819, 'AE': 0.827, 'AF': 0.54, 'AG': 0.208, 'AH': 0.696, 'AI': 0.407, 'AK': 0.891, 'AL': 0.406, 'AM': 0.379, 'AN': 0.318, 'AP': 0.191, 'AQ': 0.372, 'AR': 1.0, 'AS': 0.094, 'AT': 0.22, 'AV': 0.273, 'AW': 0.739, 'AY': 0.552, 'CA': 0.114, 'CC': 0.0, 'CD': 0.847, 'CE': 0.838, 'CF': 0.437, 'CG': 0.32, 'CH': 0.66, 'CI': 0.304, 'CK': 0.887, 'CL': 0.301, 'CM': 0.277, 'CN': 0.324, 'CP': 0.157, 'CQ': 0.341, 'CR': 1.0, 'CS': 0.176, 'CT': 0.233, 'CV': 0.167, 'CW': 0.639, 'CY': 0.457, 'DA': 0.729, 'DC': 0.742, 'DD': 0.0, 'DE': 0.124, 'DF': 0.924, 'DG': 0.697, 'DH': 0.435, 'DI': 0.847, 'DK': 0.249, 'DL': 0.841, 'DM': 0.819, 'DN': 0.56, 'DP': 0.657, 'DQ': 0.584, 'DR': 0.295, 'DS': 0.667, 'DT': 0.649, 'DV': 0.797, 'DW': 1.0, 'DY': 0.836, 'EA': 0.79, 'EC': 0.788, 'ED': 0.133, 'EE': 0.0, 'EF': 0.932, 'EG': 0.779, 'EH': 0.406, 'EI': 0.86, 'EK': 0.143, 'EL': 0.854, 'EM': 0.83, 'EN': 0.599, 'EP': 0.688, 'EQ': 0.598, 'ER': 0.234, 'ES': 0.726, 'ET': 0.682, 'EV': 0.824, 'EW': 1.0, 'EY': 0.837, 'FA': 0.508, 'FC': 0.405, 'FD': 0.977, 'FE': 0.918, 'FF': 0.0, 'FG': 0.69, 'FH': 0.663, 'FI': 0.128, 'FK': 0.903, 'FL': 0.131, 'FM': 0.169, 'FN': 0.541, 'FP': 0.42, 'FQ': 0.459, 'FR': 1.0, 'FS': 0.548, 'FT': 0.499, 'FV': 0.252, 'FW': 0.207, 'FY': 0.179, 'GA': 0.206, 'GC': 0.312, 'GD': 0.776, 'GE': 0.807, 'GF': 0.727, 'GG': 0.0, 'GH': 0.769, 'GI': 0.592, 'GK': 0.894, 'GL': 0.591, 'GM': 0.557, 'GN': 0.381, 'GP': 0.323, 'GQ': 0.467, 'GR': 1.0, 'GS': 0.158, 'GT': 0.272, 'GV': 0.464, 'GW': 0.923, 'GY': 0.728, 'HA': 0.896, 'HC': 0.836, 'HD': 0.629, 'HE': 0.547, 'HF': 0.907, 'HG': 1.0, 'HH': 0.0, 'HI': 0.848, 'HK': 0.566, 'HL': 0.842, 'HM': 0.825, 'HN': 0.754, 'HP': 0.777, 'HQ': 0.716, 'HR': 0.697, 'HS': 0.865, 'HT': 0.834, 'HV': 0.831, 'HW': 0.981, 'HY': 0.821, 'IA': 0.403, 'IC': 0.296, 'ID': 0.942, 'IE': 0.891, 'IF': 0.134, 'IG': 0.592, 'IH': 0.652, 'II': 0.0, 'IK': 0.892, 'IL': 0.013, 'IM': 0.057, 'IN': 0.457, 'IP': 0.311, 'IQ': 0.383, 'IR': 1.0, 'IS': 0.443, 'IT': 0.396, 'IV': 0.133, 'IW': 0.339, 'IY': 0.213, 'KA': 0.889, 'KC': 0.871, 'KD': 0.279, 'KE': 0.149, 'KF': 0.957, 'KG': 0.9, 'KH': 0.438, 'KI': 0.899, 'KK': 0.0, 'KL': 0.892, 'KM': 0.871, 'KN': 0.667, 'KP': 0.757, 'KQ': 0.639, 'KR': 0.154, 'KS': 0.825, 'KT': 0.759, 'KV': 0.882, 'KW': 1.0, 'KY': 0.848, 'LA': 0.405, 'LC': 0.296, 'LD': 0.944, 'LE': 0.892, 'LF': 0.139, 'LG': 0.596, 'LH': 0.653, 'LI': 0.013, 'LK': 0.893, 'LL': 0.0, 'LM': 0.062, 'LN': 0.452, 'LP': 0.309, 'LQ': 0.376, 'LR': 1.0, 'LS': 0.443, 'LT': 0.397, 'LV': 0.133, 'LW': 0.341, 'LY': 0.205, 'MA': 0.383, 'MC': 0.276, 'MD': 0.932, 'ME': 0.879, 'MF': 0.182, 'MG': 0.569, 'MH': 0.648, 'MI': 0.058, 'MK': 0.884, 'ML': 0.062, 'MM': 0.0, 'MN': 0.447, 'MP': 0.285, 'MQ': 0.372, 'MR': 1.0, 'MS': 0.417, 'MT': 0.358, 'MV': 0.12, 'MW': 0.391, 'MY': 0.255, 'NA': 0.424, 'NC': 0.425, 'ND': 0.838, 'NE': 0.835, 'NF': 0.766, 'NG': 0.512, 'NH': 0.78, 'NI': 0.615, 'NK': 0.891, 'NL': 0.603, 'NM': 0.588, 'NN': 0.0, 'NP': 0.266, 'NQ': 0.175, 'NR': 1.0, 'NS': 0.361, 'NT': 0.368, 'NV': 0.503, 'NW': 0.945, 'NY': 0.641, 'PA': 0.22, 'PC': 0.179, 'PD': 0.852, 'PE': 0.831, 'PF': 0.515, 'PG': 0.376, 'PH': 0.696, 'PI': 0.363, 'PK': 0.875, 'PL': 0.357, 'PM': 0.326, 'PN': 0.231, 'PP': 0.0, 'PQ': 0.228, 'PR': 1.0, 'PS': 0.196, 'PT': 0.161, 'PV': 0.244, 'PW': 0.72, 'PY': 0.481, 'QA': 0.512, 'QC': 0.462, 'QD': 0.903, 'QE': 0.861, 'QF': 0.671, 'QG': 0.648, 'QH': 0.765, 'QI': 0.532, 'QK': 0.881, 'QL': 0.518, 'QM': 0.505, 'QN': 0.181, 'QP': 0.272, 'QQ': 0.0, 'QR': 1.0, 'QS': 0.461, 'QT': 0.389, 'QV': 0.464, 'QW': 0.831, 'QY': 0.522, 'RA': 0.919, 'RC': 0.905, 'RD': 0.305, 'RE': 0.225, 'RF': 0.977, 'RG': 0.928, 'RH': 0.498, 'RI': 0.929, 'RK': 0.141, 'RL': 0.92, 'RM': 0.908, 'RN': 0.69, 'RP': 0.796, 'RQ': 0.668, 'RR': 0.0, 'RS': 0.86, 'RT': 0.808, 'RV': 0.914, 'RW': 1.0, 'RY': 0.859, 'SA': 0.1, 'SC': 0.185, 'SD': 0.801, 'SE': 0.812, 'SF': 0.622, 'SG': 0.17, 'SH': 0.718, 'SI': 0.478, 'SK': 0.883, 'SL': 0.474, 'SM': 0.44, 'SN': 0.289, 'SP': 0.181, 'SQ': 0.358, 'SR': 1.0, 'SS': 0.0, 'ST': 0.174, 'SV': 0.342, 'SW': 0.827, 'SY': 0.615, 'TA': 0.251, 'TC': 0.261, 'TD': 0.83, 'TE': 0.812, 'TF': 0.604, 'TG': 0.312, 'TH': 0.737, 'TI': 0.455, 'TK': 0.866, 'TL': 0.453, 'TM': 0.403, 'TN': 0.315, 'TP': 0.159, 'TQ': 0.322, 'TR': 1.0, 'TS': 0.185, 'TT': 0.0, 'TV': 0.345, 'TW': 0.816, 'TY': 0.596, 'VA': 0.275, 'VC': 0.165, 'VD': 0.9, 'VE': 0.867, 'VF': 0.269, 'VG': 0.471, 'VH': 0.649, 'VI': 0.135, 'VK': 0.889, 'VL': 0.134, 'VM': 0.12, 'VN': 0.38, 'VP': 0.212, 'VQ': 0.339, 'VR': 1.0, 'VS': 0.322, 'VT': 0.305, 'VV': 0.0, 'VW': 0.472, 'VY': 0.31, 'WA': 0.658, 'WC': 0.56, 'WD': 1.0, 'WE': 0.931, 'WF': 0.196, 'WG': 0.829, 'WH': 0.678, 'WI': 0.305, 'WK': 0.892, 'WL': 0.304, 'WM': 0.344, 'WN': 0.631, 'WP': 0.555, 'WQ': 0.538, 'WR': 0.968, 'WS': 0.689, 'WT': 0.638, 'WV': 0.418, 'WW': 0.0, 'WY': 0.204, 'YA': 0.587, 'YC': 0.478, 'YD': 1.0, 'YE': 0.932, 'YF': 0.202, 'YG': 0.782, 'YH': 0.678, 'YI': 0.23, 'YK': 0.904, 'YL': 0.219, 'YM': 0.268, 'YN': 0.512, 'YP': 0.444, 'YQ': 0.404, 'YR': 0.995, 'YS': 0.612, 'YT': 0.557, 'YV': 0.328, 'YW': 0.244, 'YY': 0.0}

//github.com/MartinThoma/propy3.

Paper

The rational design of amino acid sequences by artificial neural networks and simulated molecular evolution: de novo design of an idealized leader peptidase cleavage site Biophysical Journal Volume 66, Issue 2, Part 1, February 1994, Pages 335-344 G.Schneider, P.Wrede

Type:

Scheider-Wrede Physicochemical Distance Matrix taken from ProPy3 https

graphein.protein.resi_atoms.SC_BUILD_INFO: Dict[str, Dict[str, List[str | float]]] = {'ALA': {'angles-names': ['N-CA-CB'], 'angles-types': ['N -CX-CT'], 'angles-vals': [1.9146261894377796], 'atom-names': ['CB'], 'bonds-names': ['CA-CB'], 'bonds-types': ['CX-CT'], 'bonds-vals': [1.526], 'torsion-names': ['C-N-CA-CB'], 'torsion-types': ['C -N -CX-CT'], 'torsion-vals': ['p']}, 'ARG': {'angles-names': ['N-CA-CB', 'CA-CB-CG', 'CB-CG-CD', 'CG-CD-NE', 'CD-NE-CZ', 'NE-CZ-NH1', 'NE-CZ-NH2'], 'angles-types': ['N -CX-C8', 'CX-C8-C8', 'C8-C8-C8', 'C8-C8-N2', 'C8-N2-CA', 'N2-CA-N2', 'N2-CA-N2'], 'angles-vals': [1.9146261894377796, 1.911135530933791, 1.911135530933791, 1.9408061282176945, 2.150245638457014, 2.0943951023931953, 2.0943951023931953], 'atom-names': ['CB', 'CG', 'CD', 'NE', 'CZ', 'NH1', 'NH2'], 'bonds-names': ['CA-CB', 'CB-CG', 'CG-CD', 'CD-NE', 'NE-CZ', 'CZ-NH1', 'CZ-NH2'], 'bonds-types': ['CX-C8', 'C8-C8', 'C8-C8', 'C8-N2', 'N2-CA', 'CA-N2', 'CA-N2'], 'bonds-vals': [1.526, 1.526, 1.526, 1.463, 1.34, 1.34, 1.34], 'torsion-names': ['C-N-CA-CB', 'N-CA-CB-CG', 'CA-CB-CG-CD', 'CB-CG-CD-NE', 'CG-CD-NE-CZ', 'CD-NE-CZ-NH1', 'CD-NE-CZ-NH2'], 'torsion-types': ['C -N -CX-C8', 'N -CX-C8-C8', 'CX-C8-C8-C8', 'C8-C8-C8-N2', 'C8-C8-N2-CA', 'C8-N2-CA-N2', 'C8-N2-CA-N2'], 'torsion-vals': ['p', 'p', 'p', 'p', 'p', 'p', 'i']}, 'ASN': {'angles-names': ['N-CA-CB', 'CA-CB-CG', 'CB-CG-OD1', 'CB-CG-ND2'], 'angles-types': ['N -CX-2C', 'CX-2C-C ', '2C-C -O ', '2C-C -N '], 'angles-vals': [1.9146261894377796, 1.9390607989657, 2.101376419401173, 2.035053907825388], 'atom-names': ['CB', 'CG', 'OD1', 'ND2'], 'bonds-names': ['CA-CB', 'CB-CG', 'CG-OD1', 'CG-ND2'], 'bonds-types': ['CX-2C', '2C-C ', 'C -O ', 'C -N '], 'bonds-vals': [1.526, 1.522, 1.229, 1.335], 'torsion-names': ['C-N-CA-CB', 'N-CA-CB-CG', 'CA-CB-CG-OD1', 'CA-CB-CG-ND2'], 'torsion-types': ['C -N -CX-2C', 'N -CX-2C-C ', 'CX-2C-C -O ', 'CX-2C-C -N '], 'torsion-vals': ['p', 'p', 'p', 'i']}, 'ASP': {'angles-names': ['N-CA-CB', 'CA-CB-CG', 'CB-CG-OD1', 'CB-CG-OD2'], 'angles-types': ['N -CX-2C', 'CX-2C-CO', '2C-CO-O2', '2C-CO-O2'], 'angles-vals': [1.9146261894377796, 1.9390607989657, 2.0420352248333655, 2.0420352248333655], 'atom-names': ['CB', 'CG', 'OD1', 'OD2'], 'bonds-names': ['CA-CB', 'CB-CG', 'CG-OD1', 'CG-OD2'], 'bonds-types': ['CX-2C', '2C-CO', 'CO-O2', 'CO-O2'], 'bonds-vals': [1.526, 1.522, 1.25, 1.25], 'torsion-names': ['C-N-CA-CB', 'N-CA-CB-CG', 'CA-CB-CG-OD1', 'CA-CB-CG-OD2'], 'torsion-types': ['C -N -CX-2C', 'N -CX-2C-CO', 'CX-2C-CO-O2', 'CX-2C-CO-O2'], 'torsion-vals': ['p', 'p', 'p', 'i']}, 'CYS': {'angles-names': ['N-CA-CB', 'CA-CB-SG'], 'angles-types': ['N -CX-2C', 'CX-2C-SH'], 'angles-vals': [1.9146261894377796, 1.8954275676658419], 'atom-names': ['CB', 'SG'], 'bonds-names': ['CA-CB', 'CB-SG'], 'bonds-types': ['CX-2C', '2C-SH'], 'bonds-vals': [1.526, 1.81], 'torsion-names': ['C-N-CA-CB', 'N-CA-CB-SG'], 'torsion-types': ['C -N -CX-2C', 'N -CX-2C-SH'], 'torsion-vals': ['p', 'p']}, 'GLN': {'angles-names': ['N-CA-CB', 'CA-CB-CG', 'CB-CG-CD', 'CG-CD-OE1', 'CG-CD-NE2'], 'angles-types': ['N -CX-2C', 'CX-2C-2C', '2C-2C-C ', '2C-C -O ', '2C-C -N '], 'angles-vals': [1.9146261894377796, 1.911135530933791, 1.9390607989657, 2.101376419401173, 2.035053907825388], 'atom-names': ['CB', 'CG', 'CD', 'OE1', 'NE2'], 'bonds-names': ['CA-CB', 'CB-CG', 'CG-CD', 'CD-OE1', 'CD-NE2'], 'bonds-types': ['CX-2C', '2C-2C', '2C-C ', 'C -O ', 'C -N '], 'bonds-vals': [1.526, 1.526, 1.522, 1.229, 1.335], 'torsion-names': ['C-N-CA-CB', 'N-CA-CB-CG', 'CA-CB-CG-CD', 'CB-CG-CD-OE1', 'CB-CG-CD-NE2'], 'torsion-types': ['C -N -CX-2C', 'N -CX-2C-2C', 'CX-2C-2C-C ', '2C-2C-C -O ', '2C-2C-C -N '], 'torsion-vals': ['p', 'p', 'p', 'p', 'i']}, 'GLU': {'angles-names': ['N-CA-CB', 'CA-CB-CG', 'CB-CG-CD', 'CG-CD-OE1', 'CG-CD-OE2'], 'angles-types': ['N -CX-2C', 'CX-2C-2C', '2C-2C-CO', '2C-CO-O2', '2C-CO-O2'], 'angles-vals': [1.9146261894377796, 1.911135530933791, 1.9390607989657, 2.0420352248333655, 2.0420352248333655], 'atom-names': ['CB', 'CG', 'CD', 'OE1', 'OE2'], 'bonds-names': ['CA-CB', 'CB-CG', 'CG-CD', 'CD-OE1', 'CD-OE2'], 'bonds-types': ['CX-2C', '2C-2C', '2C-CO', 'CO-O2', 'CO-O2'], 'bonds-vals': [1.526, 1.526, 1.522, 1.25, 1.25], 'torsion-names': ['C-N-CA-CB', 'N-CA-CB-CG', 'CA-CB-CG-CD', 'CB-CG-CD-OE1', 'CB-CG-CD-OE2'], 'torsion-types': ['C -N -CX-2C', 'N -CX-2C-2C', 'CX-2C-2C-CO', '2C-2C-CO-O2', '2C-2C-CO-O2'], 'torsion-vals': ['p', 'p', 'p', 'p', 'i']}, 'GLY': {'angles-names': [], 'angles-types': [], 'angles-vals': [], 'atom-names': [], 'bonds-names': [], 'bonds-types': [], 'bonds-vals': [], 'torsion-names': [], 'torsion-types': [], 'torsion-vals': []}, 'HIS': {'angles-names': ['N-CA-CB', 'CA-CB-CG', 'CB-CG-ND1', 'CG-ND1-CE1', 'ND1-CE1-NE2', 'CE1-NE2-CD2'], 'angles-types': ['N -CX-CT', 'CX-CT-CC', 'CT-CC-NA', 'CC-NA-CR', 'NA-CR-NB', 'CR-NB-CV'], 'angles-vals': [1.9146261894377796, 1.9739673840055867, 2.0943951023931953, 1.8849555921538759, 1.8849555921538759, 1.8849555921538759], 'atom-names': ['CB', 'CG', 'ND1', 'CE1', 'NE2', 'CD2'], 'bonds-names': ['CA-CB', 'CB-CG', 'CG-ND1', 'ND1-CE1', 'CE1-NE2', 'NE2-CD2'], 'bonds-types': ['CX-CT', 'CT-CC', 'CC-NA', 'NA-CR', 'CR-NB', 'NB-CV'], 'bonds-vals': [1.526, 1.504, 1.385, 1.343, 1.335, 1.394], 'torsion-names': ['C-N-CA-CB', 'N-CA-CB-CG', 'CA-CB-CG-ND1', 'CB-CG-ND1-CE1', 'CG-ND1-CE1-NE2', 'ND1-CE1-NE2-CD2'], 'torsion-types': ['C -N -CX-CT', 'N -CX-CT-CC', 'CX-CT-CC-NA', 'CT-CC-NA-CR', 'CC-NA-CR-NB', 'NA-CR-NB-CV'], 'torsion-vals': ['p', 'p', 'p', 3.141592653589793, 0.0, 0.0]}, 'ILE': {'angles-names': ['N-CA-CB', 'CA-CB-CG1', 'CB-CG1-CD1', 'CA-CB-CG2'], 'angles-types': ['N -CX-3C', 'CX-3C-2C', '3C-2C-CT', 'CX-3C-CT'], 'angles-vals': [1.9146261894377796, 1.911135530933791, 1.911135530933791, 1.911135530933791], 'atom-names': ['CB', 'CG1', 'CD1', 'CG2'], 'bonds-names': ['CA-CB', 'CB-CG1', 'CG1-CD1', 'CB-CG2'], 'bonds-types': ['CX-3C', '3C-2C', '2C-CT', '3C-CT'], 'bonds-vals': [1.526, 1.526, 1.526, 1.526], 'torsion-names': ['C-N-CA-CB', 'N-CA-CB-CG1', 'CA-CB-CG1-CD1', 'N-CA-CB-CG2'], 'torsion-types': ['C -N -CX-3C', 'N -CX-3C-2C', 'CX-3C-2C-CT', 'N -CX-3C-CT'], 'torsion-vals': ['p', 'p', 'p', 'p']}, 'LEU': {'angles-names': ['N-CA-CB', 'CA-CB-CG', 'CB-CG-CD1', 'CB-CG-CD2'], 'angles-types': ['N -CX-2C', 'CX-2C-3C', '2C-3C-CT', '2C-3C-CT'], 'angles-vals': [1.9146261894377796, 1.911135530933791, 1.911135530933791, 1.911135530933791], 'atom-names': ['CB', 'CG', 'CD1', 'CD2'], 'bonds-names': ['CA-CB', 'CB-CG', 'CG-CD1', 'CG-CD2'], 'bonds-types': ['CX-2C', '2C-3C', '3C-CT', '3C-CT'], 'bonds-vals': [1.526, 1.526, 1.526, 1.526], 'torsion-names': ['C-N-CA-CB', 'N-CA-CB-CG', 'CA-CB-CG-CD1', 'CA-CB-CG-CD2'], 'torsion-types': ['C -N -CX-2C', 'N -CX-2C-3C', 'CX-2C-3C-CT', 'CX-2C-3C-CT'], 'torsion-vals': ['p', 'p', 'p', 'p']}, 'LYS': {'angles-names': ['N-CA-CB', 'CA-CB-CG', 'CB-CG-CD', 'CG-CD-CE', 'CD-CE-NZ'], 'angles-types': ['N -CX-C8', 'CX-C8-C8', 'C8-C8-C8', 'C8-C8-C8', 'C8-C8-N3'], 'angles-vals': [1.9146261894377796, 1.911135530933791, 1.911135530933791, 1.911135530933791, 1.9408061282176945], 'atom-names': ['CB', 'CG', 'CD', 'CE', 'NZ'], 'bonds-names': ['CA-CB', 'CB-CG', 'CG-CD', 'CD-CE', 'CE-NZ'], 'bonds-types': ['CX-C8', 'C8-C8', 'C8-C8', 'C8-C8', 'C8-N3'], 'bonds-vals': [1.526, 1.526, 1.526, 1.526, 1.471], 'torsion-names': ['C-N-CA-CB', 'N-CA-CB-CG', 'CA-CB-CG-CD', 'CB-CG-CD-CE', 'CG-CD-CE-NZ'], 'torsion-types': ['C -N -CX-C8', 'N -CX-C8-C8', 'CX-C8-C8-C8', 'C8-C8-C8-C8', 'C8-C8-C8-N3'], 'torsion-vals': ['p', 'p', 'p', 'p', 'p']}, 'MET': {'angles-names': ['N-CA-CB', 'CA-CB-CG', 'CB-CG-SD', 'CG-SD-CE'], 'angles-types': ['N -CX-2C', 'CX-2C-2C', '2C-2C-S ', '2C-S -CT'], 'angles-vals': [1.9146261894377796, 1.911135530933791, 2.0018926520374962, 1.726130630222392], 'atom-names': ['CB', 'CG', 'SD', 'CE'], 'bonds-names': ['CA-CB', 'CB-CG', 'CG-SD', 'SD-CE'], 'bonds-types': ['CX-2C', '2C-2C', '2C-S ', 'S -CT'], 'bonds-vals': [1.526, 1.526, 1.81, 1.81], 'torsion-names': ['C-N-CA-CB', 'N-CA-CB-CG', 'CA-CB-CG-SD', 'CB-CG-SD-CE'], 'torsion-types': ['C -N -CX-2C', 'N -CX-2C-2C', 'CX-2C-2C-S ', '2C-2C-S -CT'], 'torsion-vals': ['p', 'p', 'p', 'p']}, 'PHE': {'angles-names': ['N-CA-CB', 'CA-CB-CG', 'CB-CG-CD1', 'CG-CD1-CE1', 'CD1-CE1-CZ', 'CE1-CZ-CE2', 'CZ-CE2-CD2'], 'angles-types': ['N -CX-CT', 'CX-CT-CA', 'CT-CA-CA', 'CA-CA-CA', 'CA-CA-CA', 'CA-CA-CA', 'CA-CA-CA'], 'angles-vals': [1.9146261894377796, 1.9896753472735358, 2.0943951023931953, 2.0943951023931953, 2.0943951023931953, 2.0943951023931953, 2.0943951023931953], 'atom-names': ['CB', 'CG', 'CD1', 'CE1', 'CZ', 'CE2', 'CD2'], 'bonds-names': ['CA-CB', 'CB-CG', 'CG-CD1', 'CD1-CE1', 'CE1-CZ', 'CZ-CE2', 'CE2-CD2'], 'bonds-types': ['CX-CT', 'CT-CA', 'CA-CA', 'CA-CA', 'CA-CA', 'CA-CA', 'CA-CA'], 'bonds-vals': [1.526, 1.51, 1.4, 1.4, 1.4, 1.4, 1.4], 'torsion-names': ['C-N-CA-CB', 'N-CA-CB-CG', 'CA-CB-CG-CD1', 'CB-CG-CD1-CE1', 'CG-CD1-CE1-CZ', 'CD1-CE1-CZ-CE2', 'CE1-CZ-CE2-CD2'], 'torsion-types': ['C -N -CX-CT', 'N -CX-CT-CA', 'CX-CT-CA-CA', 'CT-CA-CA-CA', 'CA-CA-CA-CA', 'CA-CA-CA-CA', 'CA-CA-CA-CA'], 'torsion-vals': ['p', 'p', 'p', 3.141592653589793, 0.0, 0.0, 0.0]}, 'PRO': {'angles-names': ['N-CA-CB', 'CA-CB-CG', 'CB-CG-CD'], 'angles-types': ['N -CX-CT', 'CX-CT-CT', 'CT-CT-CT'], 'angles-vals': [1.9146261894377796, 1.911135530933791, 1.911135530933791], 'atom-names': ['CB', 'CG', 'CD'], 'bonds-names': ['CA-CB', 'CB-CG', 'CG-CD'], 'bonds-types': ['CX-CT', 'CT-CT', 'CT-CT'], 'bonds-vals': [1.526, 1.526, 1.526], 'torsion-names': ['C-N-CA-CB', 'N-CA-CB-CG', 'CA-CB-CG-CD'], 'torsion-types': ['C -N -CX-CT', 'N -CX-CT-CT', 'CX-CT-CT-CT'], 'torsion-vals': ['p', 'p', 'p']}, 'SER': {'angles-names': ['N-CA-CB', 'CA-CB-OG'], 'angles-types': ['N -CX-2C', 'CX-2C-OH'], 'angles-vals': [1.9146261894377796, 1.911135530933791], 'atom-names': ['CB', 'OG'], 'bonds-names': ['CA-CB', 'CB-OG'], 'bonds-types': ['CX-2C', '2C-OH'], 'bonds-vals': [1.526, 1.41], 'torsion-names': ['C-N-CA-CB', 'N-CA-CB-OG'], 'torsion-types': ['C -N -CX-2C', 'N -CX-2C-OH'], 'torsion-vals': ['p', 'p']}, 'THR': {'angles-names': ['N-CA-CB', 'CA-CB-OG1', 'CA-CB-CG2'], 'angles-types': ['N -CX-3C', 'CX-3C-OH', 'CX-3C-CT'], 'angles-vals': [1.9146261894377796, 1.911135530933791, 1.911135530933791], 'atom-names': ['CB', 'OG1', 'CG2'], 'bonds-names': ['CA-CB', 'CB-OG1', 'CB-CG2'], 'bonds-types': ['CX-3C', '3C-OH', '3C-CT'], 'bonds-vals': [1.526, 1.41, 1.526], 'torsion-names': ['C-N-CA-CB', 'N-CA-CB-OG1', 'N-CA-CB-CG2'], 'torsion-types': ['C -N -CX-3C', 'N -CX-3C-OH', 'N -CX-3C-CT'], 'torsion-vals': ['p', 'p', 'p']}, 'TRP': {'angles-names': ['N-CA-CB', 'CA-CB-CG', 'CB-CG-CD1', 'CG-CD1-NE1', 'CD1-NE1-CE2', 'NE1-CE2-CZ2', 'CE2-CZ2-CH2', 'CZ2-CH2-CZ3', 'CH2-CZ3-CE3', 'CZ3-CE3-CD2'], 'angles-types': ['N -CX-CT', 'CX-CT-C*', 'CT-C*-CW', 'C*-CW-NA', 'CW-NA-CN', 'NA-CN-CA', 'CN-CA-CA', 'CA-CA-CA', 'CA-CA-CA', 'CA-CA-CB'], 'angles-vals': [1.9146261894377796, 2.0176006153054447, 2.181661564992912, 1.8971728969178363, 1.9477874452256716, 2.3177972466484698, 2.0943951023931953, 2.0943951023931953, 2.0943951023931953, 2.0943951023931953], 'atom-names': ['CB', 'CG', 'CD1', 'NE1', 'CE2', 'CZ2', 'CH2', 'CZ3', 'CE3', 'CD2'], 'bonds-names': ['CA-CB', 'CB-CG', 'CG-CD1', 'CD1-NE1', 'NE1-CE2', 'CE2-CZ2', 'CZ2-CH2', 'CH2-CZ3', 'CZ3-CE3', 'CE3-CD2'], 'bonds-types': ['CX-CT', 'CT-C*', 'C*-CW', 'CW-NA', 'NA-CN', 'CN-CA', 'CA-CA', 'CA-CA', 'CA-CA', 'CA-CB'], 'bonds-vals': [1.526, 1.495, 1.352, 1.381, 1.38, 1.4, 1.4, 1.4, 1.4, 1.404], 'torsion-names': ['C-N-CA-CB', 'N-CA-CB-CG', 'CA-CB-CG-CD1', 'CB-CG-CD1-NE1', 'CG-CD1-NE1-CE2', 'CD1-NE1-CE2-CZ2', 'NE1-CE2-CZ2-CH2', 'CE2-CZ2-CH2-CZ3', 'CZ2-CH2-CZ3-CE3', 'CH2-CZ3-CE3-CD2'], 'torsion-types': ['C -N -CX-CT', 'N -CX-CT-C*', 'CX-CT-C*-CW', 'CT-C*-CW-NA', 'C*-CW-NA-CN', 'CW-NA-CN-CA', 'NA-CN-CA-CA', 'CN-CA-CA-CA', 'CA-CA-CA-CA', 'CA-CA-CA-CB'], 'torsion-vals': ['p', 'p', 'p', 3.141592653589793, 0.0, 3.141592653589793, 3.141592653589793, 0.0, 0.0, 0.0]}, 'TYR': {'angles-names': ['N-CA-CB', 'CA-CB-CG', 'CB-CG-CD1', 'CG-CD1-CE1', 'CD1-CE1-CZ', 'CE1-CZ-OH', 'CE1-CZ-CE2', 'CZ-CE2-CD2'], 'angles-types': ['N -CX-CT', 'CX-CT-CA', 'CT-CA-CA', 'CA-CA-CA', 'CA-CA-C ', 'CA-C -OH', 'CA-C -CA', 'C -CA-CA'], 'angles-vals': [1.9146261894377796, 1.9896753472735358, 2.0943951023931953, 2.0943951023931953, 2.0943951023931953, 2.0943951023931953, 2.0943951023931953, 2.0943951023931953], 'atom-names': ['CB', 'CG', 'CD1', 'CE1', 'CZ', 'OH', 'CE2', 'CD2'], 'bonds-names': ['CA-CB', 'CB-CG', 'CG-CD1', 'CD1-CE1', 'CE1-CZ', 'CZ-OH', 'CZ-CE2', 'CE2-CD2'], 'bonds-types': ['CX-CT', 'CT-CA', 'CA-CA', 'CA-CA', 'CA-C ', 'C -OH', 'C -CA', 'CA-CA'], 'bonds-vals': [1.526, 1.51, 1.4, 1.4, 1.409, 1.364, 1.409, 1.4], 'torsion-names': ['C-N-CA-CB', 'N-CA-CB-CG', 'CA-CB-CG-CD1', 'CB-CG-CD1-CE1', 'CG-CD1-CE1-CZ', 'CD1-CE1-CZ-OH', 'CD1-CE1-CZ-CE2', 'CE1-CZ-CE2-CD2'], 'torsion-types': ['C -N -CX-CT', 'N -CX-CT-CA', 'CX-CT-CA-CA', 'CT-CA-CA-CA', 'CA-CA-CA-C ', 'CA-CA-C -OH', 'CA-CA-C -CA', 'CA-C -CA-CA'], 'torsion-vals': ['p', 'p', 'p', 3.141592653589793, 0.0, 3.141592653589793, 0.0, 0.0]}, 'VAL': {'angles-names': ['N-CA-CB', 'CA-CB-CG1', 'CA-CB-CG2'], 'angles-types': ['N -CX-3C', 'CX-3C-CT', 'CX-3C-CT'], 'angles-vals': [1.9146261894377796, 1.911135530933791, 1.911135530933791], 'atom-names': ['CB', 'CG1', 'CG2'], 'bonds-names': ['CA-CB', 'CB-CG1', 'CB-CG2'], 'bonds-types': ['CX-3C', '3C-CT', '3C-CT'], 'bonds-vals': [1.526, 1.526, 1.526], 'torsion-names': ['C-N-CA-CB', 'N-CA-CB-CG1', 'N-CA-CB-CG2'], 'torsion-types': ['C -N -CX-3C', 'N -CX-3C-CT', 'N -CX-3C-CT'], 'torsion-vals': ['p', 'p', 'p']}}

Dictionary containing bond lengths and angles for sidechains.

Sourced from SideChainNet: https://github.com/jonathanking/sidechainnet/blob/master/sidechainnet/structure/build_info.py

graphein.protein.resi_atoms.STANDARD_AMINO_ACIDS: List[str] = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Y', 'Z']

Vocabulary of amino acids with one-letter codes. Includes fuzzy standard amino acids: "B" denotes "ASX" which corresponds to "ASP" ("D") or "ASN" ("N") and "Z" denotes "GLX" which corresponds to "GLU" ("E") or "GLN" ("Q").

graphein.protein.resi_atoms.STANDARD_AMINO_ACID_MAPPING_1_TO_3 = {'A': 'ALA', 'C': 'CYS', 'D': 'ASP', 'E': 'GLU', 'F': 'PHE', 'G': 'GLY', 'H': 'HIS', 'I': 'ILE', 'K': 'LYS', 'L': 'LEU', 'M': 'MET', 'N': 'ASN', 'O': 'PYL', 'P': 'PRO', 'Q': 'GLN', 'R': 'ARG', 'S': 'SER', 'T': 'THR', 'U': 'SEC', 'V': 'VAL', 'W': 'TRP', 'X': 'UNK', 'Y': 'TYR'}

Mapping of 1-letter standard amino acids codes to their three-letter form.

graphein.protein.resi_atoms.STANDARD_AMINO_ACID_MAPPING_3_TO_1: Dict[str, str] = {'ALA': 'A', 'ARG': 'R', 'ASN': 'N', 'ASP': 'D', 'CYS': 'C', 'GLN': 'Q', 'GLU': 'E', 'GLY': 'G', 'HIS': 'H', 'ILE': 'I', 'LEU': 'L', 'LYS': 'K', 'MET': 'M', 'PHE': 'F', 'PRO': 'P', 'PYL': 'O', 'SEC': 'U', 'SER': 'S', 'THR': 'T', 'TRP': 'W', 'TYR': 'Y', 'UNK': 'X', 'VAL': 'V'}

Mapping of 3-letter standard amino acids codes to their one-letter form.

graphein.protein.resi_atoms.STANDARD_RESIDUE_ATOMS: Dict[str, List[str]] = {'ALA': ['N', 'CA', 'C', 'O', 'CB'], 'ARG': ['N', 'CA', 'C', 'O', 'CB', 'CG', 'CD', 'NE', 'CZ', 'NH1', 'NH2'], 'ASN': ['N', 'CA', 'C', 'O', 'CB', 'CG', 'OD1', 'ND2'], 'ASP': ['N', 'CA', 'C', 'O', 'CB', 'CG', 'OD1', 'OD2'], 'CYS': ['N', 'CA', 'C', 'O', 'CB', 'SG'], 'GLN': ['N', 'CA', 'C', 'O', 'CB', 'CG', 'CD', 'OE1', 'NE2'], 'GLU': ['N', 'CA', 'C', 'O', 'CB', 'CG', 'CD', 'OE1', 'OE2'], 'GLY': ['N', 'CA', 'C', 'O'], 'HIS': ['N', 'CA', 'C', 'O', 'CB', 'CG', 'ND1', 'CD2', 'CE1', 'NE2'], 'ILE': ['N', 'CA', 'C', 'O', 'CB', 'CG1', 'CG2', 'CD1'], 'LEU': ['N', 'CA', 'C', 'O', 'CB', 'CG', 'CD1', 'CD2'], 'LYS': ['N', 'CA', 'C', 'O', 'CB', 'CG', 'CD', 'CE', 'NZ'], 'MET': ['N', 'CA', 'C', 'O', 'CB', 'CG', 'SD', 'CE'], 'PHE': ['N', 'CA', 'C', 'O', 'CB', 'CG', 'CD1', 'CD2', 'CE1', 'CE2', 'CZ'], 'PRO': ['N', 'CA', 'C', 'O', 'CB', 'CG', 'CD'], 'SER': ['N', 'CA', 'C', 'O', 'CB', 'OG'], 'THR': ['N', 'CA', 'C', 'O', 'CB', 'OG1', 'CG2'], 'TRP': ['N', 'CA', 'C', 'O', 'CB', 'CG', 'CD1', 'CD2', 'NE1', 'CE2', 'CE3', 'CZ2', 'CZ3', 'CH2'], 'TYR': ['N', 'CA', 'C', 'O', 'CB', 'CG', 'CD1', 'CD2', 'CE1', 'CE2', 'CZ', 'OH'], 'VAL': ['N', 'CA', 'C', 'O', 'CB', 'CG1', 'CG2']}

Dictionary mapping standard amino acid residues to their constituent atoms.

graphein.protein.resi_atoms.STANDARD_RESI_NAMES: List[str] = ['ALA', 'ARG', 'ASN', 'ASP', 'ASX', 'CYS', 'GLN', 'GLU', 'GLX', 'GLY', 'HIS', 'ILE', 'LEU', 'LYS', 'MET', 'PHE', 'PRO', 'SER', 'THR', 'TRP', 'TYR', 'UNK', 'VAL']

List of standard residue 3-letter names. Includes "UNK" for unknown residues. "ASX" denotes "ASP" or "ASN" and "GLX" denotes "GLU" or "GLN".

graphein.protein.resi_atoms.SULPHUR_RESIS: List[str] = ['MET', 'CYS']

Residues containing sulphur atoms.

graphein.protein.resi_atoms.VDW_RADII: Dict[str, float] = {'C': 1.7, 'Cl': 1.75, 'Cu': 1.4, 'F': 1.47, 'H': 1.2, 'N': 1.55, 'O': 1.52, 'P': 1.8, 'S': 1.8}

van der Waals radii of the most common atoms. Taken from:

> Bondi, A. (1964). “van der Waals Volumes and Radii”. > J. Phys. Chem. 68 (3): 441–451.

https://pubs.acs.org/doi/10.1021/j100785a001