def test_makes_copy_of_inputs(self): alt_alleles = ['A', 'B'] removes = {'B'} remapper = postprocess_variants.AlleleRemapper(alt_alleles, removes) del alt_alleles[0] removes -= {'B'} self.assertEqual(remapper.original_alts, ['A', 'B']) self.assertEqual(remapper.alleles_to_remove, {'B'})
def test_basic(self, alt_alleles, remove, keep_index_expected): remapper = postprocess_variants.AlleleRemapper(alt_alleles, remove) self.assertEqual(remapper.original_alts, alt_alleles) self.assertEqual(remapper.alleles_to_remove, set(remove)) self.assertEqual(keep_index_expected, [remapper.keep_index(i) for i in range(len(alt_alleles))]) # When our i is 1 for the first alt allele, we expect that we will get back # our keep_index_expected but also that keep_index(i==0) is True for the # reference allele. self.assertEqual([True] + keep_index_expected, [ remapper.keep_index(i, ref_is_zero=True) for i in range(len(alt_alleles) + 1) ])