Ejemplo n.º 1
0
 def test_reserved_info_field_get_fn(self):
     info = variants_pb2.Variant().info
     values = ['C']
     struct_utils.set_string_field(info, 'AA', values)
     get_fn = vcf_constants.reserved_info_field_get_fn('AA')
     actual = get_fn(info, 'AA')
     self.assertEqual(actual, values[0])
Ejemplo n.º 2
0
 def test_reserved_info_field_get_fn(self):
   info = variants_pb2.Variant().info
   values = ['C']
   struct_utils.set_string_field(info, 'AA', values)
   get_fn = vcf_constants.reserved_info_field_get_fn('AA')
   actual = get_fn(info, 'AA')
   self.assertEqual(actual, values[0])
Ejemplo n.º 3
0
 def test_set_string_field(self, initial_fields, value):
   list_value, num_values = _wrapped_value_and_num(value)
   field_map = _set_protomap_from_dict(initial_fields)
   struct_utils.set_string_field(field_map, 'field', value)
   self.assertIn('field', field_map)
   self.assertLen(field_map['field'].values, num_values)
   self.assertEqual([v.string_value for v in field_map['field'].values],
                    list_value)
Ejemplo n.º 4
0
 def test_get_string_field(self, value, is_single_field, expected):
   key = 'field'
   field_map = _set_protomap_from_dict({})
   struct_utils.set_string_field(field_map, key, value)
   actual = struct_utils.get_string_field(field_map, key, is_single_field)
   self.assertEqual(actual, expected)
Ejemplo n.º 5
0
def set_bam_fname(variant_call, bam_fname):
    """Sets 'BAM_FNAME' field of the VariantCall."""
    return struct_utils.set_string_field(variant_call.info, 'BAM_FNAME',
                                         bam_fname)