def test_transform_to_gvcf_add_allele(self, prior_alts, prior_gls, prior_vaf): variant = _create_variant( ref_name='chr1', start=10, ref_base='A', alt_bases=prior_alts, qual=40, filter_field='PASS', genotype=[0, 1], gq=None, likelihoods=prior_gls) prior_vaf_values = [struct_pb2.Value(number_value=v) for v in prior_vaf] variant.calls[0].info['VAF'].values.extend(prior_vaf_values) expected = _create_variant( ref_name='chr1', start=10, ref_base='A', alt_bases=prior_alts + [vcf_constants.GVCF_ALT_ALLELE], qual=40, filter_field='PASS', genotype=[0, 1], gq=None, likelihoods=prior_gls + ([postprocess_variants._GVCF_ALT_ALLELE_GL] * (len(prior_alts) + 2))) expected.calls[0].info['VAF'].values.extend( prior_vaf_values + [struct_pb2.Value(number_value=0)]) actual = postprocess_variants._transform_to_gvcf_record(variant) self.assertEqual(actual, expected)
def test_transform_to_gvcf_add_allele(self, prior_alts, prior_gls, prior_vaf): variant = _create_variant( ref_name='chr1', start=10, ref_base='A', alt_bases=prior_alts, qual=40, filter_field='PASS', genotype=[0, 1], gq=None, likelihoods=prior_gls) prior_vaf_values = [struct_pb2.Value(number_value=v) for v in prior_vaf] variant.calls[0].info['VAF'].values.extend(prior_vaf_values) expected = _create_variant( ref_name='chr1', start=10, ref_base='A', alt_bases=prior_alts + [vcf_constants.GVCF_ALT_ALLELE], qual=40, filter_field='PASS', genotype=[0, 1], gq=None, likelihoods=prior_gls + ([postprocess_variants._GVCF_ALT_ALLELE_GL] * (len(prior_alts) + 2))) expected.calls[0].info['VAF'].values.extend( prior_vaf_values + [struct_pb2.Value(number_value=0)]) actual = postprocess_variants._transform_to_gvcf_record(variant) self.assertEqual(actual, expected)
def test_transform_to_gvcf_no_allele_addition(self, alts, gls, vaf): variant = _create_variant(ref_name='chr1', start=10, ref_base='A', alt_bases=alts, qual=40, filter_field='PASS', genotype=[0, 1], gq=None, likelihoods=gls) vaf_values = [struct_pb2.Value(number_value=v) for v in vaf] variant.calls[0].info['VAF'].values.extend(vaf_values) expected = variants_pb2.Variant() expected.CopyFrom(variant) actual = postprocess_variants._transform_to_gvcf_record(variant) self.assertEqual(actual, expected)
def test_transform_to_gvcf_no_allele_addition(self, alts, gls, vaf): variant = _create_variant( ref_name='chr1', start=10, ref_base='A', alt_bases=alts, qual=40, filter_field='PASS', genotype=[0, 1], gq=None, likelihoods=gls) vaf_values = [struct_pb2.Value(number_value=v) for v in vaf] variant.calls[0].info['VAF'].values.extend(vaf_values) expected = variants_pb2.Variant() expected.CopyFrom(variant) actual = postprocess_variants._transform_to_gvcf_record(variant) self.assertEqual(actual, expected)