def test_prune_alleles_handles_format_fields(self, alts, to_remove, orig_ad, expected_ad): variant = _create_variant_with_alleles(alts=alts) test_utils.set_list_values(variant.calls[0].info['AD'], orig_ad) actual = postprocess_variants.prune_alleles(variant, to_remove) self.assertEqual([v.int_value for v in actual.calls[0].info['AD'].values], expected_ad)
def test_simplify_alleles(self, alleles, alt_alleles_to_remove, expected): """Test that prune_alleles + simplify_alleles works as expected.""" variant = _create_variant_with_alleles(ref=alleles[0], alts=alleles[1:]) pruned = postprocess_variants.prune_alleles(variant, alt_alleles_to_remove) simplified = postprocess_variants.simplify_alleles(pruned) self.assertEqual(simplified.reference_bases, expected[0]) self.assertEqual(simplified.alternate_bases, expected[1:])
def test_simplify_alleles(self, alleles, start, alt_alleles_to_remove, expected_alleles, expected_end): """Test that prune_alleles + simplify_alleles works as expected.""" variant = _create_variant_with_alleles( ref=alleles[0], alts=alleles[1:], start=start) pruned = postprocess_variants.prune_alleles(variant, alt_alleles_to_remove) simplified = postprocess_variants.simplify_alleles(pruned) self.assertEqual(simplified.reference_bases, expected_alleles[0]) self.assertEqual(simplified.alternate_bases, expected_alleles[1:]) self.assertEqual(simplified.start, start) self.assertEqual(simplified.end, expected_end)
def test_prune_alleles(self, canonical_variant, alt_alleles_to_remove, expected_variant): self.assertEqual( postprocess_variants.prune_alleles( canonical_variant, alt_alleles_to_remove), expected_variant)