示例#1
0
 def test_haploid_allele_indices_for_genotype_likelihood_index(self):
   for aix in six.moves.xrange(20):
     allele_indices = (aix,)
     ix = variant_utils.genotype_likelihood_index(allele_indices)
     actual = variant_utils.allele_indices_for_genotype_likelihood_index(
         ix, ploidy=1)
     self.assertEqual(actual, aix)
示例#2
0
 def test_haploid_allele_indices_for_genotype_likelihood_index(self):
   for aix in xrange(20):
     allele_indices = (aix,)
     ix = variant_utils.genotype_likelihood_index(allele_indices)
     actual = variant_utils.allele_indices_for_genotype_likelihood_index(
         ix, ploidy=1)
     self.assertEqual(actual, aix)
示例#3
0
 def test_diploid_allele_indices_for_genotype_likelihood_index(self):
   for aix in range(20):
     for bix in range(20):
       allele_indices = (aix, bix)
       expected = tuple(sorted(allele_indices))
       ix = variant_utils.genotype_likelihood_index(allele_indices)
       actual = variant_utils.allele_indices_for_genotype_likelihood_index(
           ix, ploidy=2)
       self.assertEqual(actual, expected)
示例#4
0
 def test_diploid_allele_indices_for_genotype_likelihood_index(self):
   for aix in xrange(20):
     for bix in xrange(20):
       allele_indices = (aix, bix)
       expected = tuple(sorted(allele_indices))
       ix = variant_utils.genotype_likelihood_index(allele_indices)
       actual = variant_utils.allele_indices_for_genotype_likelihood_index(
           ix, ploidy=2)
       self.assertEqual(actual, expected)
示例#5
0
 def test_unsupported_allele_indices_for_genotype_likelihood_index(
     self, ploidy):
   with self.assertRaisesRegexp(NotImplementedError,
                                'only supported for haploid and diploid'):
     variant_utils.allele_indices_for_genotype_likelihood_index(0, ploidy)
示例#6
0
 def most_likely_allele_indices(self):
   """Returns allele indices for the genotype with the largest likelihood."""
   ix = np.argmax(self.scaled_likelihoods())
   return variant_utils.allele_indices_for_genotype_likelihood_index(
       ix, ploidy=2)
示例#7
0
 def test_unsupported_allele_indices_for_genotype_likelihood_index(
     self, ploidy):
   with self.assertRaisesRegexp(NotImplementedError,
                                'only supported for haploid and diploid'):
     variant_utils.allele_indices_for_genotype_likelihood_index(0, ploidy)