# 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/pipeline.py
# def make_sequence_features(
#     sequence: str, description: str, num_res: int) -> FeatureDict:
# def make_msa_features(msas: Sequence[parsers.Msa]) -> FeatureDict:
# def run_msa_tool(msa_runner, input_fasta_path: str, msa_out_path: str,
#                  msa_format: str, use_precomputed_msas: bool,
#                  max_sto_sequences: Optional[int] = None
#                  ) -> Mapping[str, Any]:
#   def __init__(self,
#                jackhmmer_binary_path: str,
#                hhblits_binary_path: str,
#                uniref90_database_path: str,
#                mgnify_database_path: str,
#                bfd_database_path: Optional[str],
#                uniclust30_database_path: Optional[str],
#                small_bfd_database_path: Optional[str],
#                template_searcher: TemplateSearcher,
#                template_featurizer: templates.TemplateHitFeaturizer,
#                use_small_bfd: bool,
#                mgnify_max_hits: int = 501,
#                uniref_max_hits: int = 10000,
#                use_precomputed_msas: bool = False):
#   def process(self, input_fasta_path: str, msa_output_dir: str) -> FeatureDict:
# class DataPipeline:


import collections
import functools
import string
import numpy as np
import pandas as pd
import scipy.linalg
from typing import Any, Dict, Iterable, List, Sequence
from alphafold.common import residue_constants
from alphafold.data import pipeline
}  # A-Z,0-9
NUM_ACCESSION_ID_MAP = {str(x): x for x in range(10)}                # 0-9

MSA_GAP_IDX = residue_constants.restypes_with_x_and_gap.index('-')
SEQUENCE_GAP_CUTOFF = 0.5
SEQUENCE_SIMILARITY_CUTOFF = 0.9

MSA_PAD_VALUES = {'msa_all_seq': MSA_GAP_IDX,
                  'msa_mask_all_seq': 1,
                  'deletion_matrix_all_seq': 0,
                  'deletion_matrix_int_all_seq': 0,
                  'msa': MSA_GAP_IDX,
                  'msa_mask': 1,
                  'deletion_matrix': 0,
                  'deletion_matrix_int': 0}

MSA_FEATURES = ('msa', 'msa_mask', 'deletion_matrix', 'deletion_matrix_int')
SEQ_FEATURES = ('residue_index', 'aatype', 'all_atom_positions',
                'all_atom_mask', 'seq_mask', 'between_segment_residues',
                'has_alt_locations', 'has_hetatoms', 'asym_id', 'entity_id',
                'sym_id', 'entity_mask', 'deletion_mean',
                'prediction_atom_mask',
                'literature_positions', 'atom_indices_to_group_indices',
                'rigid_group_default_frame')
TEMPLATE_FEATURES = ('template_aatype', 'template_all_atom_positions',
                     'template_all_atom_mask')
CHAIN_FEATURES = ('num_alignments', 'seq_length')


def create_paired_features(

# 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/pipeline.py
# def make_sequence_features(
#     sequence: str, description: str, num_res: int) -> FeatureDict:
# def make_msa_features(msas: Sequence[parsers.Msa]) -> FeatureDict:
# def run_msa_tool(msa_runner, input_fasta_path: str, msa_out_path: str,
#                  msa_format: str, use_precomputed_msas: bool,
#                  max_sto_sequences: Optional[int] = None
#                  ) -> Mapping[str, Any]:
#   def __init__(self,
#                jackhmmer_binary_path: str,
#                hhblits_binary_path: str,
#                uniref90_database_path: str,
#                mgnify_database_path: str,
#                bfd_database_path: Optional[str],
#                uniclust30_database_path: Optional[str],
#                small_bfd_database_path: Optional[str],
#                template_searcher: TemplateSearcher,
#                template_featurizer: templates.TemplateHitFeaturizer,
#                use_small_bfd: bool,
#                mgnify_max_hits: int = 501,
#                uniref_max_hits: int = 10000,
#                use_precomputed_msas: bool = False):
#   def process(self, input_fasta_path: str, msa_output_dir: str) -> FeatureDict:
# class DataPipeline:


# Path: alphafold/data/msa_pairing.py
import collections
import functools
import string
import numpy as np
import pandas as pd
import scipy.linalg
from typing import Any, Dict, Iterable, List, Sequence
from alphafold.common import residue_constants
from alphafold.data import pipeline

}  # A-Z,0-9
NUM_ACCESSION_ID_MAP = {str(x): x for x in range(10)}                # 0-9

MSA_GAP_IDX = residue_constants.restypes_with_x_and_gap.index('-')
SEQUENCE_GAP_CUTOFF = 0.5
SEQUENCE_SIMILARITY_CUTOFF = 0.9

MSA_PAD_VALUES = {'msa_all_seq': MSA_GAP_IDX,
                  'msa_mask_all_seq': 1,
                  'deletion_matrix_all_seq': 0,
                  'deletion_matrix_int_all_seq': 0,
                  'msa': MSA_GAP_IDX,
                  'msa_mask': 1,
                  'deletion_matrix': 0,
                  'deletion_matrix_int': 0}

MSA_FEATURES = ('msa', 'msa_mask', 'deletion_matrix', 'deletion_matrix_int')
SEQ_FEATURES = ('residue_index', 'aatype', 'all_atom_positions',
                'all_atom_mask', 'seq_mask', 'between_segment_residues',
                'has_alt_locations', 'has_hetatoms', 'asym_id', 'entity_id',
                'sym_id', 'entity_mask', 'deletion_mean',
                'prediction_atom_mask',
                'literature_positions', 'atom_indices_to_group_indices',
                'rigid_group_default_frame')
TEMPLATE_FEATURES = ('template_aatype', 'template_all_atom_positions',
                     'template_all_atom_mask')
CHAIN_FEATURES = ('num_alignments', 'seq_length')


def create_paired_features(

    chains: Iterable[pipeline.FeatureDict],