def test_genotype_as_alleles_raises_with_bad_inputs(self): with self.assertRaises(Exception): variantutils.genotype_as_alleles(None) with self.assertRaises(Exception): variantutils.genotype_as_alleles(test_utils.make_variant(gt=None)) with self.assertRaises(Exception): variantutils.genotype_type(None)
def compute_filter_fields(variant, min_quality): """Computes the filter fields for this variant. Variant filters are generated based on its quality score value and particular genotype call. Args: variant: Variant to filter. min_quality: Minimum acceptable phred scaled variant detection probability. Returns: Filter field strings to be added to the variant. """ if variantutils.genotype_type( variant) == variantutils.GenotypeType.hom_ref: return [DEEP_VARIANT_REF_FILTER] elif variant.quality < min_quality: return [DEEP_VARIANT_QUAL_FILTER] else: return [DEEP_VARIANT_PASS]
def test_genotype_type_raises_with_bad_args(self): with self.assertRaises(Exception): variantutils.genotype_type(None)
def test_genotype_type(self, variant, expected): self.assertEqual(variantutils.genotype_type(variant), expected)
def _gt_selector(*gt_types): return lambda v: variantutils.genotype_type(v) in gt_types