def setUp(self): self._variant_generator = bigquery_vcf_data_converter.VariantGenerator( ) self._schema_descriptor = bigquery_schema_descriptor.SchemaDescriptor( _get_table_schema()) self._conflict_resolver = ( vcf_field_conflict_resolver.FieldConflictResolver()) self._row_generator = bigquery_vcf_data_converter.BigQueryRowGenerator( self._schema_descriptor, self._conflict_resolver)
def __init__(self, annotation_id_to_annotation_names=None): # type: (Dict[str, List[str]]) -> None """Initializes a `BigQueryToVariant` object. Args: annotation_id_to_annotation_names: A map where the key is the annotation id (e.g., `CSQ`) and the value is a list of annotation names (e.g., ['Consequence', 'IMPACT', 'SYMBOL']). The annotation str (e.g., 'A|upstream_gene_variant|MODIFIER|PSMF1|||||') is reconstructed in the same order as the annotation names. """ self._variant_generator = bigquery_vcf_data_converter.VariantGenerator( annotation_id_to_annotation_names)
def test_get_variant_info_annotation(self): variant_generator = bigquery_vcf_data_converter.VariantGenerator( {'CSQ': ['allele', 'Consequence', 'AF', 'IMPACT']}) row = { unicode(ColumnKeyConstants.ALTERNATE_BASES): [{ unicode(ColumnKeyConstants.ALTERNATE_BASES_ALT): u'G', unicode('CSQ'): [{ u'allele': 'G', u'Consequence': u'upstream_gene_variant', u'AF': u'', u'IMPACT': u'MODIFIER' }, { u'allele': 'G', u'Consequence': u'upstream_gene_variant', u'AF': u'0.1', u'IMPACT': u'' }] }, { unicode(ColumnKeyConstants.ALTERNATE_BASES_ALT): u'T', unicode('CSQ'): [{ u'allele': 'T', u'Consequence': u'', u'AF': u'', u'IMPACT': u'MODIFIER' }, { u'allele': 'T', u'Consequence': u'upstream_gene_variant', u'AF': u'0.6', u'IMPACT': u'' }] }, { unicode(ColumnKeyConstants.ALTERNATE_BASES_ALT): u'TT', unicode('CSQ'): [] }] } expected_variant_info = { 'CSQ': [ 'G|upstream_gene_variant||MODIFIER', 'G|upstream_gene_variant|0.1|', 'T|||MODIFIER', 'T|upstream_gene_variant|0.6|' ] } self.assertEqual(expected_variant_info, variant_generator._get_variant_info(row))
def setUp(self): self._variant_generator = bigquery_vcf_data_converter.VariantGenerator( )