parameters: (gl_index, ploidy=2)
docstring: Returns a tuple of allele_indices corresponding to the given GL index.
  
    This is the inverse function to `genotype_likelihood_index`.
  
    Args:
      gl_index: int. The index within a genotype likelihood array for which to
        determine the associated alleles.
      ploidy: int. The ploidy of the result.
  
    Returns:
      A tuple of `ploidy` ints representing the allele indices at this GL index.
  
    Raises:
      NotImplementedError: The requested allele indices are more than diploid.
docstring_summary: Returns a tuple of allele_indices corresponding to the given GL index.
docstring_tokens: Returns a tuple of allele_indices corresponding to the given GL index .
function: def allele_indices_for_genotype_likelihood_index(gl_index, ploidy=2):
    """Returns a tuple of allele_indices corresponding to the given GL index.
  
    This is the inverse function to `genotype_likelihood_index`.
  
    Args:
      gl_index: int. The index within a genotype likelihood array for which to
        determine the associated alleles.
      ploidy: int. The ploidy of the result.
  
    Returns:
      A tuple of `ploidy` ints representing the allele indices at this GL index.
  
    Raises:
      NotImplementedError: The requested allele indices are more than diploid.
    """
    if ploidy == 1:
      return gl_index
    elif ploidy == 2:
      # TODO(cym): Implement using algorithm described at
      # https://genome.sph.umich.edu/wiki/Relationship_between_Ploidy,_Alleles_and_Genotypes
      # rather than creating all genotypes explicitly.
      num_alts = 1
      while genotype_likelihood_index([num_alts, num_alts]) < gl_index:
        num_alts += 1
      genotypes = list(_genotype_order_in_likelihoods(num_alts, ploidy=ploidy))
      return genotypes[gl_index]
    else:
      raise NotImplementedError(
          'Allele calculations only supported for haploid and diploid.')
function_tokens: def allele_indices_for_genotype_likelihood_index ( gl_index , ploidy = 2 ) : if ploidy == 1 : return gl_index elif ploidy == 2 : # TODO(cym): Implement using algorithm described at # https://genome.sph.umich.edu/wiki/Relationship_between_Ploidy,_Alleles_and_Genotypes # rather than creating all genotypes explicitly. num_alts = 1 while genotype_likelihood_index ( [ num_alts , num_alts ] ) < gl_index : num_alts += 1 genotypes = list ( _genotype_order_in_likelihoods ( num_alts , ploidy = ploidy ) ) return genotypes [ gl_index ] else : raise NotImplementedError ( 'Allele calculations only supported for haploid and diploid.' )