deepfold.data.search.templates.build_query_to_hit_index_mapping

deepfold.data.search.templates.build_query_to_hit_index_mapping(original_query_sequence: str, hit_query_sequence: str, hit_sequence: str, indices_hit: Sequence[int], indices_query: Sequence[int]) Dict[int, int][source]

Gets mapping from indices in original query sequence to indices in the hit.

hit_query_sequence and hit_sequence are two aligned sequences containing gap characters. hit_query_sequence contains only the part of the original_query_sequence that matched the hit. When interpreting the indices from the .hhr, we need to correct for this to recover a mapping from original_query_sequence to the hit_sequence.

Parameters:
  • original_query_sequence – String describing the original query sequence.

  • hit_query_sequence – The portion of the original query sequence that is in the .hhr file.

  • hit_sequence – The portion of the matched hit sequence that is in the .hhr file.

  • indices_hit – The indices for each amino acid relative to the hit_sequence.

  • indices_query – The indices for each amino acid relative to the original query sequence.

Returns:

Dictionary with indices in the original_query_sequence as keys

and indices in the hit_sequence as values.

Return type:

index_mapping