class_docstr: Finds matching "truth" variants using a position-specific labeler.
  
  This is the original variant labeler from DeepVariant used up until v0.5,
  which assigns labels to variant calls by matching the chrom:position of a
  candidate variant with ones in truth, and then if one exists, assigns the
  label based on the genotype of the matched truth variant. This method works
  reasonably well but cannot handle complex representational differences between
  the candidate variants and the truth variants.
class_docstr_tok: ["Finds","matching","``","truth","''","variants","using","a","position-specific","labeler",".","This","is","the","original","variant","labeler","from","DeepVariant","used","up","until","v0.5",",","which","assigns","labels","to","variant","calls","by","matching","the","chrom",":","position","of","a","candidate","variant","with","ones","in","truth",",","and","then","if","one","exists",",","assigns","the","label","based","on","the","genotype","of","the","matched","truth","variant",".","This","method","works","reasonably","well","but","can","not","handle","complex","representational","differences","between","the","candidate","variants","and","the","truth","variants","."]
docstr: Finds a variant in vcf_reader compatible with variant, if one exists.
docstr_tok: ["Finds","a","variant","in","vcf_reader","compatible","with","variant",",","if","one","exists","."]
code: def _find_matching_variant_in_reader(self, variant):
      """Finds a variant in vcf_reader compatible with variant, if one exists."""
      region = variant_utils.variant_position(variant)
      matches = [
          variant_utils.simplify_variant_alleles(truth_variant)
          for truth_variant in self._get_truth_variants(region)
          if variant.start == truth_variant.start
      ]
  
      if not matches:
          return None
  
      best_match = None
      for match in matches:
          if (
              match.alternate_bases == variant.alternate_bases
              and match.reference_bases == variant.reference_bases
          ):
              best_match = match
  
      if best_match is None:
          logging.info(
              (
                  "Multiple matches detected; no good match found. Fall back "
                  "to first. variant: %s: matches: %s"
              ),
              variant,
              matches,
          )
          # TODO: The behavior of falling back to the first match is
          # likely not the best. Think about what to do for different use cases.
          best_match = matches[0]
      return best_match
  
file_path: deepvariant/deepvariant/labeler/positional_labeler.py
imports: from absl import logging
  from third_party.nucleus.protos import variants_pb2
  from third_party.nucleus.util import variant_utils
  from third_party.nucleus.util import variantcall_utils
  from deepvariant.labeler import variant_labeler
label_desc: Use image node_id 5 for calling the PositionalVariantLabeler obj's underlying member method code with example usage: obj._find_matching_variant_in_reader(variant) and returns: best_match, None