# 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/data/tools/utils.py
# def tmpdir_manager(base_dir: Optional[str] = None):
# def timing(msg: str):


from concurrent import futures
from typing import Any, Callable, Mapping, Optional, Sequence
from urllib import request
from absl import logging
from alphafold.data import parsers
from alphafold.data.tools import utils
import glob
import os
import subprocess
      dom_e: Domain e-value criteria for inclusion in tblout.
      num_streamed_chunks: Number of database chunks to stream over.
      streaming_callback: Callback function run after each chunk iteration with
        the iteration number as argument.
    """
    self.binary_path = binary_path
    self.database_path = database_path
    self.num_streamed_chunks = num_streamed_chunks

    if not os.path.exists(self.database_path) and num_streamed_chunks is None:
      logging.error('Could not find Jackhmmer database %s', database_path)
      raise ValueError(f'Could not find Jackhmmer database {database_path}')

    self.n_cpu = n_cpu
    self.n_iter = n_iter
    self.e_value = e_value
    self.z_value = z_value
    self.filter_f1 = filter_f1
    self.filter_f2 = filter_f2
    self.filter_f3 = filter_f3
    self.incdom_e = incdom_e
    self.dom_e = dom_e
    self.get_tblout = get_tblout
    self.streaming_callback = streaming_callback

  def _query_chunk(self,
                   input_fasta_path: str,
                   database_path: str,
                   max_sequences: Optional[int] = None) -> Mapping[str, Any]:
    """Queries the database chunk using Jackhmmer."""

# 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/data/tools/utils.py
# def tmpdir_manager(base_dir: Optional[str] = None):
# def timing(msg: str):


# Path: alphafold/data/tools/jackhmmer.py
from concurrent import futures
from typing import Any, Callable, Mapping, Optional, Sequence
from urllib import request
from absl import logging
from alphafold.data import parsers
from alphafold.data.tools import utils
import glob
import os
import subprocess

      dom_e: Domain e-value criteria for inclusion in tblout.
      num_streamed_chunks: Number of database chunks to stream over.
      streaming_callback: Callback function run after each chunk iteration with
        the iteration number as argument.
    """
    self.binary_path = binary_path
    self.database_path = database_path
    self.num_streamed_chunks = num_streamed_chunks

    if not os.path.exists(self.database_path) and num_streamed_chunks is None:
      logging.error('Could not find Jackhmmer database %s', database_path)
      raise ValueError(f'Could not find Jackhmmer database {database_path}')

    self.n_cpu = n_cpu
    self.n_iter = n_iter
    self.e_value = e_value
    self.z_value = z_value
    self.filter_f1 = filter_f1
    self.filter_f2 = filter_f2
    self.filter_f3 = filter_f3
    self.incdom_e = incdom_e
    self.dom_e = dom_e
    self.get_tblout = get_tblout
    self.streaming_callback = streaming_callback

  def _query_chunk(self,
                   input_fasta_path: str,
                   database_path: str,
                   max_sequences: Optional[int] = None) -> Mapping[str, Any]:
    """Queries the database chunk using Jackhmmer."""

    with utils.tmpdir_manager() as query_tmp_dir: