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: Get a truth variant matching variant.
  
  A matching variant is defined here as one that starts at the same position
  on the genome as variant. The best match is then narrowed down by finding
  the variant with a matching alt allele, if it exists, otherwise the first
  matching variant is used regardless of alt alleles. This allows the client
  to make decisions on how to translate a matched between variant and
  truth_variant into a label (e.g. by comparing the alleles).
  
  If multiple variants are detected, this code will attempt to find the best
  match by comparing to `variant`. Note that some simplification of alleles
  are applied first before we compare. For example, 'GAAA->GAA' should be the
  same as 'GA->G'. If no good matches are detected, the logic currently falls
  back to the first element in matches.
  
  Args:
    variant: Our candidate third_party.nucleus.protos.Variant variant.
  
  Returns:
    A tuple of (match_status, truth_variant) where match_status is True if
    we are confident in our truth_variant call or False if not. truth_variant
    is a third_party.nucleus.protos.Variant object of
    the truth variant that matched
    variant, or None if none was found and we aren't confident in being
    hom-ref here, or a synthetic variant with the same position and alleles as
    variant but with a hom-ref genotype.
docstr_tok: ["Get","a","truth","variant","matching","variant",".","A","matching","variant","is","defined","here","as","one","that","starts","at","the","same","position","on","the","genome","as","variant",".","The","best","match","is","then","narrowed","down","by","finding","the","variant","with","a","matching","alt","allele",",","if","it","exists",",","otherwise","the","first","matching","variant","is","used","regardless","of","alt","alleles",".","This","allows","the","client","to","make","decisions","on","how","to","translate","a","matched","between","variant","and","truth_variant","into","a","label","(","e.g",".","by","comparing","the","alleles",")",".","If","multiple","variants","are","detected",",","this","code","will","attempt","to","find","the","best","match","by","comparing","to","`","variant","`",".","Note","that","some","simplification","of","alleles","are","applied","first","before","we","compare",".","For","example",",","'GAAA-",">","GAA","'","should","be","the","same","as","'GA-",">","G","'",".","If","no","good","matches","are","detected",",","the","logic","currently","falls","back","to","the","first","element","in","matches",".","Args",":","variant",":","Our","candidate","third_party.nucleus.protos.Variant","variant",".","Returns",":","A","tuple","of","(","match_status",",","truth_variant",")","where","match_status","is","True","if","we","are","confident","in","our","truth_variant","call","or","False","if","not",".","truth_variant","is","a","third_party.nucleus.protos.Variant","object","of","the","truth","variant","that","matched","variant",",","or","None","if","none","was","found","and","we","are","n't","confident","in","being","hom-ref","here",",","or","a","synthetic","variant","with","the","same","position","and","alleles","as","variant","but","with","a","hom-ref","genotype","."]
code: def _match(self, variant):
      """Get a truth variant matching variant.
  
      A matching variant is defined here as one that starts at the same position
      on the genome as variant. The best match is then narrowed down by finding
      the variant with a matching alt allele, if it exists, otherwise the first
      matching variant is used regardless of alt alleles. This allows the client
      to make decisions on how to translate a matched between variant and
      truth_variant into a label (e.g. by comparing the alleles).
  
      If multiple variants are detected, this code will attempt to find the best
      match by comparing to `variant`. Note that some simplification of alleles
      are applied first before we compare. For example, 'GAAA->GAA' should be the
      same as 'GA->G'. If no good matches are detected, the logic currently falls
      back to the first element in matches.
  
      Args:
        variant: Our candidate third_party.nucleus.protos.Variant variant.
  
      Returns:
        A tuple of (match_status, truth_variant) where match_status is True if
        we are confident in our truth_variant call or False if not. truth_variant
        is a third_party.nucleus.protos.Variant object of
        the truth variant that matched
        variant, or None if none was found and we aren't confident in being
        hom-ref here, or a synthetic variant with the same position and alleles as
        variant but with a hom-ref genotype.
      """
      variant = variant_utils.simplify_variant_alleles(variant)
      matched_variant = self._find_matching_variant_in_reader(variant)
      confident_or_no_constraint = (
          self._confident_regions is None
          or self._confident_regions.variant_overlaps(
              variant, empty_set_return_value=False
          )
      )
      if matched_variant is None and confident_or_no_constraint:
          matched_variant = self._make_synthetic_hom_ref(variant)
      return confident_or_no_constraint, matched_variant
  
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 3 for calling the PositionalVariantLabeler obj's underlying member method code with example usage: obj._match(variant) and returns: confident_or_no_constraint,  matched_variant