mindsponge.data.atom37_to_torsion_angles

mindsponge.data.atom37_to_torsion_angles(aatype: np.ndarray, all_atom_pos: np.ndarray, all_atom_mask: np.ndarray, alt_torsions=False, is_multimer=False)[source]

This function calculates the seven torsion angles of each residue and encodes them in sine and cosine. The order of the seven torsion angles is [pre_omega, phi, psi, chi_1, chi_2, chi_3, chi_4] Here, pre_omega represents the twist angle between a given amino acid and the previous amino acid. The phi represents twist angle between C-CA-N-(C+1), psi represents twist angle between (N-1)-C-CA-N.

Parameters
  • aatype (numpy.array) – Amino acid type with shape \((batch\_size, N_{res})\).

  • all_atom_pos (numpy.array) – Atom37 representation of all atomic coordinates with shape \((batch\_size, N_{res}, 37, 3)\).

  • all_atom_mask (numpy.array) – Atom37 representation of the mask on all atomic coordinates with shape \((batch\_size, N_{res})\).

  • alt_torsions (bool) – Indicates whether to set the sign angle of shielding torsion to zero. Default: False.

  • is_multimer (bool) – It will be True when multimer is used. Default: False

Returns

Dict containing

  • torsion_angles_sin_cos (numpy.array), with shape \((N_{res}, 7, 2)\) where the final 2 dimensions denote sin and cos respectively. If is_multimer is True, the shape will be \((N_{seq}, N_{res}, 7, 2)\) .

  • alt_torsion_angles_sin_cos (numpy.array), same as ‘torsion_angles_sin_cos’, but with the angle shifted by pi for all chi angles affected by the naming ambiguities. shape is \((N_{res}, 7, 2)\). If is_multimer is True, the shape will be \((N_{seq}, N_{res}, 7, 2)\) .

  • torsion_angles_mask (numpy.array), Mask for which chi angles are present. shape is \((N_{res}, 7)\) . If is_multimer is True, the shape will be \((N_{seq}, N_{res}, 7, 2)\) .

Supported Platforms:

Ascend GPU CPU

Examples

>>> import numpy as np
>>> from mindsponge.data.data_transform import atom37_to_torsion_angles
>>> n_res = 16
>>> bs = 1
>>> aatype = np.random.randn(bs, n_res).astype(np.int32)
>>> all_atom_pos = np.random.randn(bs, n_res, 37, 3).astype(np.float32)
>>> all_atom_mask = np.random.randn(bs, n_res, 37).astype(np.float32)
>>> angle_label_feature = atom37_to_torsion_angles(aatype, all_atom_pos, all_atom_mask)
>>> print(angle_label_feature.keys())
dict_keys(['torsion_angles_sin_cos', 'alt_torsion_angles_sin_cos', 'torsion_angles_mask'])