# Path: alphafold/common/residue_constants.py
# def load_stereo_chemical_props() -> Tuple[Mapping[str, List[Bond]],
#   def make_bond_key(atom1_name, atom2_name):
# def sequence_to_onehot(
#     sequence: str,
#     mapping: Mapping[str, int],
#     map_unknown_to_x: bool = False) -> np.ndarray:
# def _make_standard_atom_mask() -> np.ndarray:
# def chi_angle_atom(atom_index: int) -> np.ndarray:
# def _make_rigid_transformation_4x4(ex, ey, translation):
# def _make_rigid_group_constants():
# def make_atom14_dists_bounds(overlap_tolerance=1.5,
#                              bond_length_tolerance_factor=15):
# HHBLITS_AA_TO_ID = {
#     'A': 0,
#     'B': 2,
#     'C': 1,
#     'D': 2,
#     'E': 3,
#     'F': 4,
#     'G': 5,
#     'H': 6,
#     'I': 7,
#     'J': 20,
#     'K': 8,
#     'L': 9,
#     'M': 10,
#     'N': 11,
#     'O': 20,
#     'P': 12,
#     'Q': 13,
#     'R': 14,
#     'S': 15,
#     'T': 16,
#     'U': 1,
#     'V': 17,
#     'W': 18,
#     'X': 20,
#     'Y': 19,
#     'Z': 3,
#     '-': 21,
# }
# ID_TO_HHBLITS_AA = {
#     0: 'A',
#     1: 'C',  # Also U.
#     2: 'D',  # Also B.
#     3: 'E',  # Also Z.
#     4: 'F',
#     5: 'G',
#     6: 'H',
#     7: 'I',
#     8: 'K',
#     9: 'L',
#     10: 'M',
#     11: 'N',
#     12: 'P',
#     13: 'Q',
#     14: 'R',
#     15: 'S',
#     16: 'T',
#     17: 'V',
#     18: 'W',
#     19: 'Y',
#     20: 'X',  # Includes J and O.
#     21: '-',
# }
# MAP_HHBLITS_AATYPE_TO_OUR_AATYPE = tuple(
#     restypes_with_x_and_gap.index(ID_TO_HHBLITS_AA[i])
#     for i in range(len(restypes_with_x_and_gap)))
# STANDARD_ATOM_MASK = _make_standard_atom_mask()


import enum
import tensorflow.compat.v1 as tf
from typing import Dict, Optional, Sequence, Tuple, Union
from alphafold.common import residue_constants


class FeatureType(enum.Enum):
  ZERO_DIM = 0  # Shape [x]
  ONE_DIM = 1  # Shape [num_res, x]
  TWO_DIM = 2  # Shape [num_res, num_res, x]
  MSA = 3  # Shape [msa_length, num_res, x]


# Placeholder values that will be replaced with their true value at runtime.
NUM_RES = "num residues placeholder"
NUM_SEQ = "length msa placeholder"
NUM_TEMPLATES = "num templates placeholder"
# Sizes of the protein features, NUM_RES and NUM_SEQ are allowed as placeholders
# to be replaced with the number of residues and the number of sequences in the
# multiple sequence alignment, respectively.


FEATURES = {
    #### Static features of a protein sequence ####
    "aatype": (tf.float32, [NUM_RES, 21]),
    "between_segment_residues": (tf.int64, [NUM_RES, 1]),
    "deletion_matrix": (tf.float32, [NUM_SEQ, NUM_RES, 1]),
    "domain_name": (tf.string, [1]),
    "msa": (tf.int64, [NUM_SEQ, NUM_RES, 1]),
    "num_alignments": (tf.int64, [NUM_RES, 1]),
    "residue_index": (tf.int64, [NUM_RES, 1]),
    "seq_length": (tf.int64, [NUM_RES, 1]),
    "sequence": (tf.string, [1]),
    "all_atom_positions": (tf.float32,

# Path: alphafold/common/residue_constants.py
# def load_stereo_chemical_props() -> Tuple[Mapping[str, List[Bond]],
#   def make_bond_key(atom1_name, atom2_name):
# def sequence_to_onehot(
#     sequence: str,
#     mapping: Mapping[str, int],
#     map_unknown_to_x: bool = False) -> np.ndarray:
# def _make_standard_atom_mask() -> np.ndarray:
# def chi_angle_atom(atom_index: int) -> np.ndarray:
# def _make_rigid_transformation_4x4(ex, ey, translation):
# def _make_rigid_group_constants():
# def make_atom14_dists_bounds(overlap_tolerance=1.5,
#                              bond_length_tolerance_factor=15):
# HHBLITS_AA_TO_ID = {
#     'A': 0,
#     'B': 2,
#     'C': 1,
#     'D': 2,
#     'E': 3,
#     'F': 4,
#     'G': 5,
#     'H': 6,
#     'I': 7,
#     'J': 20,
#     'K': 8,
#     'L': 9,
#     'M': 10,
#     'N': 11,
#     'O': 20,
#     'P': 12,
#     'Q': 13,
#     'R': 14,
#     'S': 15,
#     'T': 16,
#     'U': 1,
#     'V': 17,
#     'W': 18,
#     'X': 20,
#     'Y': 19,
#     'Z': 3,
#     '-': 21,
# }
# ID_TO_HHBLITS_AA = {
#     0: 'A',
#     1: 'C',  # Also U.
#     2: 'D',  # Also B.
#     3: 'E',  # Also Z.
#     4: 'F',
#     5: 'G',
#     6: 'H',
#     7: 'I',
#     8: 'K',
#     9: 'L',
#     10: 'M',
#     11: 'N',
#     12: 'P',
#     13: 'Q',
#     14: 'R',
#     15: 'S',
#     16: 'T',
#     17: 'V',
#     18: 'W',
#     19: 'Y',
#     20: 'X',  # Includes J and O.
#     21: '-',
# }
# MAP_HHBLITS_AATYPE_TO_OUR_AATYPE = tuple(
#     restypes_with_x_and_gap.index(ID_TO_HHBLITS_AA[i])
#     for i in range(len(restypes_with_x_and_gap)))
# STANDARD_ATOM_MASK = _make_standard_atom_mask()


# Path: alphafold/model/tf/protein_features.py
import enum
import tensorflow.compat.v1 as tf
from typing import Dict, Optional, Sequence, Tuple, Union
from alphafold.common import residue_constants



class FeatureType(enum.Enum):
  ZERO_DIM = 0  # Shape [x]
  ONE_DIM = 1  # Shape [num_res, x]
  TWO_DIM = 2  # Shape [num_res, num_res, x]
  MSA = 3  # Shape [msa_length, num_res, x]


# Placeholder values that will be replaced with their true value at runtime.
NUM_RES = "num residues placeholder"
NUM_SEQ = "length msa placeholder"
NUM_TEMPLATES = "num templates placeholder"
# Sizes of the protein features, NUM_RES and NUM_SEQ are allowed as placeholders
# to be replaced with the number of residues and the number of sequences in the
# multiple sequence alignment, respectively.


FEATURES = {
    #### Static features of a protein sequence ####
    "aatype": (tf.float32, [NUM_RES, 21]),
    "between_segment_residues": (tf.int64, [NUM_RES, 1]),
    "deletion_matrix": (tf.float32, [NUM_SEQ, NUM_RES, 1]),
    "domain_name": (tf.string, [1]),
    "msa": (tf.int64, [NUM_SEQ, NUM_RES, 1]),
    "num_alignments": (tf.int64, [NUM_RES, 1]),
    "residue_index": (tf.int64, [NUM_RES, 1]),
    "seq_length": (tf.int64, [NUM_RES, 1]),
    "sequence": (tf.string, [1]),
    "all_atom_positions": (tf.float32,

                           [NUM_RES, residue_constants.atom_type_num, 3]),