def test_set_format(self, field_name, value, reader, expected): if reader is not None: reader = mock.Mock() reader.field_access_cache.format_field_set_fn.return_value = ( struct_utils.set_string_field) call = variants_pb2.VariantCall() variantcall_utils.set_format(call, field_name, value, reader) actual = call.info[field_name].values self._assert_struct_lists_equal(actual, expected)
def test_get_format(self, field_name, reader, expected): if reader is not None: reader = mock.Mock() reader.field_access_cache.format_field_get_fn.return_value = ( functools.partial(struct_utils.get_string_field, is_single_field=True)) call = variants_pb2.VariantCall() variantcall_utils.set_format(call, 'GP', [.1, .2, .7]) variantcall_utils.set_format(call, 'AD', [55, 3]) variantcall_utils.set_format(call, 'DP', 58) variantcall_utils.set_format(call, 'GL', [-1, -3, -5.5]) variantcall_utils.set_format(call, 'GT', [0, 1]) variantcall_utils.set_format(call, 'FT', ['LowQual']) actual = variantcall_utils.get_format(call, field_name, vcf_object=reader) self.assertEqual(actual, expected)