openfold.utils.all_atom_multimer

Ops for all atom representations.

Functions

atom14_to_atom37(atom14_data, aatype)

Convert atom14 to atom37 representation.

atom37_to_atom14(aatype, all_atom_pos, ...)

Convert Atom37 positions to Atom14 positions.

atom37_to_frames(aatype, all_atom_positions, ...)

Computes the frames for the up to 8 rigid groups for each residue.

compute_chi_angles(positions, mask, aatype)

Computes the chi angles given all atom positions and the amino acid type.

extreme_ca_ca_distance_violations(positions, ...)

Counts residues whose Ca is a large distance from its neighbor.

frames_and_literature_positions_to_atom14_pos(...)

Put atom literature positions (atom14 encoding) in each rigid group.

get_alt_atom14(aatype, positions, mask)

Get alternative atom14 positions.

get_chi_atom_indices(device)

Returns atom indices needed to compute chi angles for all residue types.

get_rc_tensor(rc_np, aatype)

make_backbone_affine(positions, mask, aatype)

make_transform_from_reference(a_xyz, b_xyz, ...)

Returns rotation and translation matrices to convert from reference.

squared_difference(x, y)

torsion_angles_to_frames(aatype, ...)

Compute rigid group frames from torsion angles.

atom14_to_atom37(atom14_data, aatype)

Convert atom14 to atom37 representation.

Parameters:
Return type:

Tuple

atom37_to_atom14(aatype, all_atom_pos, all_atom_mask)

Convert Atom37 positions to Atom14 positions.

atom37_to_frames(aatype, all_atom_positions, all_atom_mask)

Computes the frames for the up to 8 rigid groups for each residue.

Parameters:
Return type:

Dict[str, Tensor]

compute_chi_angles(positions, mask, aatype)

Computes the chi angles given all atom positions and the amino acid type.

Parameters:
  • positions (Vec3Array) – A Vec3Array of shape [num_res, rc.atom_type_num], with positions of atoms needed to calculate chi angles. Supports up to 1 batch dimension.

  • mask (Tensor) – An optional tensor of shape [num_res, rc.atom_type_num] that masks which atom positions are set for each residue. If given, then the chi mask will be set to 1 for a chi angle only if the amino acid has that chi angle and all the chi atoms needed to calculate that chi angle are set. If not given (set to None), the chi mask will be set to 1 for a chi angle if the amino acid has that chi angle and whether the actual atoms needed to calculate it were set will be ignored.

  • aatype (Tensor) – A tensor of shape [num_res] with amino acid type integer code (0 to 21). Supports up to 1 batch dimension.

Returns:

A tuple of tensors (chi_angles, mask), where both have shape [num_res, 4]. The mask masks out unused chi angles for amino acid types that have less than 4 chi angles. If atom_positions_mask is set, the chi mask will also mask out uncomputable chi angles.

extreme_ca_ca_distance_violations(positions, mask, residue_index, max_angstrom_tolerance=1.5, eps=1e-06)

Counts residues whose Ca is a large distance from its neighbor.

Parameters:
Return type:

Tensor

frames_and_literature_positions_to_atom14_pos(aatype, all_frames_to_global)

Put atom literature positions (atom14 encoding) in each rigid group.

Parameters:
Return type:

Vec3Array

get_alt_atom14(aatype, positions, mask)

Get alternative atom14 positions.

Parameters:

positions (Tensor)

get_chi_atom_indices(device)

Returns atom indices needed to compute chi angles for all residue types.

Returns:

A tensor of shape [residue_types=21, chis=4, atoms=4]. The residue types are in the order specified in rc.restypes + unknown residue type at the end. For chi angles which are not defined on the residue, the positions indices are by default set to 0.

Parameters:

device (device)

get_rc_tensor(rc_np, aatype)
make_backbone_affine(positions, mask, aatype)
Parameters:
Return type:

Tuple[Rigid3Array, Tensor]

make_transform_from_reference(a_xyz, b_xyz, c_xyz)

Returns rotation and translation matrices to convert from reference.

Note that this method does not take care of symmetries. If you provide the coordinates in the non-standard way, the A atom will end up in the negative y-axis rather than in the positive y-axis. You need to take care of such cases in your code.

Parameters:
Returns:

A Rigid3Array which, when applied to coordinates in a canonicalized reference frame, will give coordinates approximately equal the original coordinates (in the global frame).

Return type:

Rigid3Array

squared_difference(x, y)
torsion_angles_to_frames(aatype, backb_to_global, torsion_angles_sin_cos)

Compute rigid group frames from torsion angles.

Parameters:
Return type:

Rigid3Array