code: def genotype_ordering_in_likelihoods(variant):
      """Yields (i, j, allele_i, allele_j) for the genotypes ordering in GLs.
  
      https://samtools.github.io/hts-specs/VCFv4.1.pdf
      "If A is the allele in REF and B,C,... are the alleles as ordered in ALT,
      the ordering of genotypes for the likelihoods is given by:
      F(j/k) = (k*(k+1)/2)+j. In other words, for biallelic sites the ordering is:
      AA,AB,BB; for triallelic sites the ordering is: AA,AB,BB,AC,BC,CC, etc."
      The biallelic sites in our case are 0/0, 0/1, 1/1.
      The triallelic sites are 0/0, 0/1, 1/1, 0/2, 1/2, 2/2.
      This wiki page has more information that generalizes ot different ploidy.
      http://genome.sph.umich.edu/wiki/Relationship_between_Ploidy,_Alleles_and_Genotypes
  
      Currently this function only implements for diploid cases.
  
      Args:
        variant: nucleus.genomics.v1.Variant.
  
      Yields:
        allele indices and strings (i, j, allele_i, allele_j) in the correct order.
      """
      alleles = [variant.reference_bases] + list(
          variant.alternate_bases
      )
      for i, j in _genotype_order_in_likelihoods(
          len(variant.alternate_bases), ploidy=2
      ):
          yield i, j, alleles[i], alleles[j]
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import enum
  import itertools
  import six
  from third_party.nucleus.protos import variants_pb2
  from third_party.nucleus.util import ranges
  from third_party.nucleus.util import variantcall_utils
  from third_party.nucleus.util import vcf_constants
label_desc: Use image node_id 34 for calling a global function with example usage: genotype_ordering_in_likelihoods(variant) without return types