# 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/data/parsers.py
# class Msa:
# class TemplateHit:
# class HitMetadata:
#   def __post_init__(self):
#   def __len__(self):
#   def truncate(self, max_seqs: int):
# def parse_fasta(fasta_string: str) -> Tuple[Sequence[str], Sequence[str]]:
# def parse_stockholm(stockholm_string: str) -> Msa:
# def parse_a3m(a3m_string: str) -> Msa:
# def _convert_sto_seq_to_a3m(
#     query_non_gaps: Sequence[bool], sto_seq: str) -> Iterable[str]:
# def convert_stockholm_to_a3m(stockholm_format: str,
#                              max_sequences: Optional[int] = None,
#                              remove_first_row_gaps: bool = True) -> str:
# def _keep_line(line: str, seqnames: Set[str]) -> bool:
# def truncate_stockholm_msa(stockholm_msa_path: str, max_sequences: int) -> str:
# def remove_empty_columns_from_stockholm_msa(stockholm_msa: str) -> str:
# def deduplicate_stockholm_msa(stockholm_msa: str) -> str:
# def _get_hhr_line_regex_groups(
#     regex_pattern: str, line: str) -> Sequence[Optional[str]]:
# def _update_hhr_residue_indices_list(
#     sequence: str, start_index: int, indices_list: List[int]):
# def _parse_hhr_hit(detailed_lines: Sequence[str]) -> TemplateHit:
# def parse_hhr(hhr_string: str) -> Sequence[TemplateHit]:
# def parse_e_values_from_tblout(tblout: str) -> Dict[str, float]:
# def _get_indices(sequence: str, start: int) -> List[int]:
# def _parse_hmmsearch_description(description: str) -> HitMetadata:
# def parse_hmmsearch_a3m(query_sequence: str,
#                         a3m_string: str,
#                         skip_first: bool = True) -> Sequence[TemplateHit]:


import enum
import json
import numpy as np
from typing import Any, Mapping, Optional, Sequence, Tuple
from alphafold.common import residue_constants
from alphafold.data import parsers
from matplotlib import pyplot as plt
          max_length=max_length)
      sequences.append(input_sequence)

  if len(sequences) == 1:
    print('Using the single-chain model.')
    return sequences, ModelType.MONOMER

  elif len(sequences) > 1:
    total_multimer_length = sum([len(seq) for seq in sequences])
    if total_multimer_length > max_multimer_length:
      raise ValueError(f'The total length of multimer sequences is too long: '
                       f'{total_multimer_length}, while the maximum is '
                       f'{max_multimer_length}. Please use the full AlphaFold '
                       f'system for long multimers.')
    elif total_multimer_length > 1536:
      print('WARNING: The accuracy of the system has not been fully validated '
            'above 1536 residues, and you may experience long running times or '
            f'run out of memory for your complex with {total_multimer_length} '
            'residues.')
    print(f'Using the multimer model with {len(sequences)} sequences.')
    return sequences, ModelType.MULTIMER

  else:
    raise ValueError('No input amino acid sequence provided, please provide at '
                     'least one sequence.')


def merge_chunked_msa(
    results: Sequence[Mapping[str, Any]],
    max_hits: Optional[int] = None

# 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/data/parsers.py
# class Msa:
# class TemplateHit:
# class HitMetadata:
#   def __post_init__(self):
#   def __len__(self):
#   def truncate(self, max_seqs: int):
# def parse_fasta(fasta_string: str) -> Tuple[Sequence[str], Sequence[str]]:
# def parse_stockholm(stockholm_string: str) -> Msa:
# def parse_a3m(a3m_string: str) -> Msa:
# def _convert_sto_seq_to_a3m(
#     query_non_gaps: Sequence[bool], sto_seq: str) -> Iterable[str]:
# def convert_stockholm_to_a3m(stockholm_format: str,
#                              max_sequences: Optional[int] = None,
#                              remove_first_row_gaps: bool = True) -> str:
# def _keep_line(line: str, seqnames: Set[str]) -> bool:
# def truncate_stockholm_msa(stockholm_msa_path: str, max_sequences: int) -> str:
# def remove_empty_columns_from_stockholm_msa(stockholm_msa: str) -> str:
# def deduplicate_stockholm_msa(stockholm_msa: str) -> str:
# def _get_hhr_line_regex_groups(
#     regex_pattern: str, line: str) -> Sequence[Optional[str]]:
# def _update_hhr_residue_indices_list(
#     sequence: str, start_index: int, indices_list: List[int]):
# def _parse_hhr_hit(detailed_lines: Sequence[str]) -> TemplateHit:
# def parse_hhr(hhr_string: str) -> Sequence[TemplateHit]:
# def parse_e_values_from_tblout(tblout: str) -> Dict[str, float]:
# def _get_indices(sequence: str, start: int) -> List[int]:
# def _parse_hmmsearch_description(description: str) -> HitMetadata:
# def parse_hmmsearch_a3m(query_sequence: str,
#                         a3m_string: str,
#                         skip_first: bool = True) -> Sequence[TemplateHit]:


# Path: alphafold/notebooks/notebook_utils.py
import enum
import json
import numpy as np
from typing import Any, Mapping, Optional, Sequence, Tuple
from alphafold.common import residue_constants
from alphafold.data import parsers
from matplotlib import pyplot as plt

          max_length=max_length)
      sequences.append(input_sequence)

  if len(sequences) == 1:
    print('Using the single-chain model.')
    return sequences, ModelType.MONOMER

  elif len(sequences) > 1:
    total_multimer_length = sum([len(seq) for seq in sequences])
    if total_multimer_length > max_multimer_length:
      raise ValueError(f'The total length of multimer sequences is too long: '
                       f'{total_multimer_length}, while the maximum is '
                       f'{max_multimer_length}. Please use the full AlphaFold '
                       f'system for long multimers.')
    elif total_multimer_length > 1536:
      print('WARNING: The accuracy of the system has not been fully validated '
            'above 1536 residues, and you may experience long running times or '
            f'run out of memory for your complex with {total_multimer_length} '
            'residues.')
    print(f'Using the multimer model with {len(sequences)} sequences.')
    return sequences, ModelType.MULTIMER

  else:
    raise ValueError('No input amino acid sequence provided, please provide at '
                     'least one sequence.')


def merge_chunked_msa(
    results: Sequence[Mapping[str, Any]],
    max_hits: Optional[int] = None

    ) -> parsers.Msa: