def test_convert_variant_to_bigquery_row_omit_empty_calls(self): variant, row, header_num_dict = self._get_sample_variant_with_empty_calls() header_fields = vcf_header_util.make_header(header_num_dict) proc_var = processed_variant.ProcessedVariantFactory( header_fields).create_processed_variant(variant) pipeline = TestPipeline(blocking=True) bigquery_rows = ( pipeline | Create([proc_var]) | 'ConvertToRow' >> beam.ParDo(ConvertVariantToRow( self._row_generator, omit_empty_sample_calls=True))) assert_that(bigquery_rows, equal_to([row])) pipeline.run()
def test_convert_variant_to_bigquery_row_allow_incompatible_recoreds(self): variant, row, header_num_dict = ( self._get_sample_variant_with_incompatible_records()) header_fields = vcf_header_util.make_header(header_num_dict) proc_var = processed_variant.ProcessedVariantFactory( header_fields).create_processed_variant(variant) pipeline = TestPipeline(blocking=True) bigquery_rows = ( pipeline | Create([proc_var]) | 'ConvertToRow' >> beam.ParDo( ConvertVariantToRow(self._row_generator, allow_incompatible_records=True))) assert_that(bigquery_rows, equal_to([row])) pipeline.run() self._row_generator = bigquery_row_generator.VariantCallRowGenerator( self._schema_descriptor, self._conflict_resolver)
def test_convert_variant_with_sample_name_to_bigquery_row(self): self._row_generator = bigquery_row_generator.VariantCallRowGenerator( self._schema_descriptor, self._conflict_resolver, include_call_name=True) variant, row, header_num_dict = self._get_sample_variant_with_sample_name( ) header_fields = vcf_header_util.make_header(header_num_dict) proc_var = processed_variant.ProcessedVariantFactory( header_fields).create_processed_variant(variant) pipeline = TestPipeline(blocking=True) bigquery_rows = ( pipeline | Create([proc_var]) | 'ConvertToRow' >> beam.ParDo( ConvertVariantToRow(self._row_generator, omit_empty_sample_calls=True))) assert_that(bigquery_rows, equal_to([row])) pipeline.run()
def test_convert_variant_to_bigquery_row(self): variant_1, row_1, header_num_dict_1 = self._get_sample_variant_1() variant_2, row_2, header_num_dict_2 = self._get_sample_variant_2() variant_3, row_3, header_num_dict_3 = self._get_sample_variant_3() header_num_dict = header_num_dict_1.copy() header_num_dict.update(header_num_dict_2) header_num_dict.update(header_num_dict_3) header_fields = vcf_header_util.make_header(header_num_dict) proc_var_1 = processed_variant.ProcessedVariantFactory( header_fields).create_processed_variant(variant_1) proc_var_2 = processed_variant.ProcessedVariantFactory( header_fields).create_processed_variant(variant_2) proc_var_3 = processed_variant.ProcessedVariantFactory( header_fields).create_processed_variant(variant_3) pipeline = TestPipeline(blocking=True) bigquery_rows = (pipeline | Create([proc_var_1, proc_var_2, proc_var_3]) | 'ConvertToRow' >> beam.ParDo( ConvertVariantToRow(self._row_generator))) assert_that(bigquery_rows, equal_to([row_1, row_2, row_3])) pipeline.run()