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' >> ParDo(ConvertToBigQueryTableRow(
           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 = self._get_sample_variant_with_incompatible_records()
     header_fields = vcf_header_io.VcfHeader()
     proc_var = processed_variant.ProcessedVariantFactory(
         header_fields).create_processed_variant(variant)
     pipeline = TestPipeline(blocking=True)
     bigquery_rows = (
         pipeline
         | Create([proc_var])
         | 'ConvertToRow' >> ParDo(
             ConvertToBigQueryTableRow(self._row_generator,
                                       allow_incompatible_records=True)))
     assert_that(bigquery_rows, equal_to([row]))
     pipeline.run()
 def test_convert_variant_to_bigquery_row(self):
     variant_1, row_1 = self._get_sample_variant_1()
     variant_2, row_2 = self._get_sample_variant_2()
     variant_3, row_3 = self._get_sample_variant_3()
     header_fields = vcf_header_io.VcfHeader()
     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' >> ParDo(
                          ConvertToBigQueryTableRow(self._row_generator)))
     assert_that(bigquery_rows, equal_to([row_1, row_2, row_3]))
     pipeline.run()
Пример #4
0
 def test_convert_variant_to_bigquery_row(self):
     variant_1, row_1 = self._get_sample_variant_1()
     variant_2, row_2 = self._get_sample_variant_2()
     variant_3, row_3 = self._get_sample_variant_3()
     header_fields = vcf_header_parser.HeaderFields({}, {})
     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()
     bigquery_rows = (
         pipeline
         | Create([proc_var_1, proc_var_2, proc_var_3])
         | 'ConvertToRow' >> ParDo(
             ConvertToBigQueryTableRow(
                 mock_bigquery_schema_descriptor.MockSchemaDescriptor())))
     assert_that(bigquery_rows, equal_to([row_1, row_2, row_3]))
     pipeline.run()