Esempio n. 1
0
 def test_write_seqrep_data_to_file(self):
     '''test write_seqrep_data_to_file'''
     finder = data_finder.DataFinder(ini_file, self.pipeline_root)
     tmpfile = 'tmp.data_finder.write_seqrep_data_to_file.out'
     expected_file = os.path.join(data_dir, 'write_seqrep_data_to_file.tsv')
     tmp_expected = 'tmp.data_finder.write_seqrep_data_to_file.expect'
     fix_pipeline_root_in_file(expected_file, tmp_expected,
                               self.pipeline_root)
     finder.write_seqrep_data_to_file(tmpfile)
     self.assertTrue(filecmp.cmp(tmp_expected, tmpfile, shallow=False))
     os.unlink(tmpfile)
     os.unlink(tmp_expected)
Esempio n. 2
0
 def test_write_pipeline_data_to_file_mykrobe_predict_pipeline(self):
     '''test write_pipeline_data_to_file for mykrobe_predict pipeline'''
     finder = data_finder.DataFinder(ini_file, self.pipeline_root)
     tmpfile = 'tmp.data_finder.write_pipeline_data_to_file.mykrobe_predict.out'
     finder.write_pipeline_data_to_file(tmpfile, 'mykrobe_predict')
     expected_file = os.path.join(
         data_dir, 'write_pipeline_data_to_file.mykrobe_predict.tsv')
     tmp_expected = 'tmp.data_finder.write_pipeline_data_to_file.mykrobe_predict.expect'
     fix_pipeline_root_in_file(expected_file, tmp_expected,
                               self.pipeline_root)
     self.assertTrue(filecmp.cmp(tmp_expected, tmpfile, shallow=False))
     os.unlink(tmpfile)
     os.unlink(tmp_expected)
Esempio n. 3
0
 def test_write_pipeline_data_to_file_variant_call_pipeline(self):
     '''test write_pipeline_data_to_file for variant_call pipeline'''
     finder = data_finder.DataFinder(ini_file, self.pipeline_root)
     tmpfile = 'tmp.data_finder.write_pipeline_data_to_file.variant_call.out'
     finder.write_pipeline_data_to_file(tmpfile, 'variant_call')
     expected_file = os.path.join(
         data_dir, 'write_pipeline_data_to_file.variant_call.tsv')
     tmp_expected = 'tmp.data_finder.write_pipeline_data_to_file.variant_call.expect'
     fix_pipeline_root_in_file(expected_file, tmp_expected,
                               self.pipeline_root)
     self.assertTrue(filecmp.cmp(tmp_expected, tmpfile, shallow=False))
     os.unlink(tmpfile)
     os.unlink(tmp_expected)
Esempio n. 4
0
 def test_write_pipeline_data_to_file_variant_call_pipeline(self):
     """test write_pipeline_data_to_file for variant_call pipeline"""
     finder = data_finder.DataFinder(ini_file, self.pipeline_root)
     tmpfile = "tmp.data_finder.write_pipeline_data_to_file.variant_call.out"
     finder.write_pipeline_data_to_file(tmpfile, "variant_call")
     expected_file = os.path.join(
         data_dir, "write_pipeline_data_to_file.variant_call.tsv")
     tmp_expected = "tmp.data_finder.write_pipeline_data_to_file.variant_call.expect"
     fix_pipeline_root_in_file(expected_file, tmp_expected,
                               self.pipeline_root)
     self.assertTrue(filecmp.cmp(tmp_expected, tmpfile, shallow=False))
     os.unlink(tmpfile)
     os.unlink(tmp_expected)
Esempio n. 5
0
 def test_write_pipeline_data_to_file_remove_contam_pipeline(self):
     """test write_pipeline_data_to_file for remove_contam pipeline"""
     finder = data_finder.DataFinder(ini_file, self.pipeline_root)
     tmpfile = "tmp.data_finder.write_pipeline_data_to_file.remove_contam.out"
     expected_file = os.path.join(
         data_dir, "write_pipeline_data_to_file.remove_contam.tsv")
     tmp_expected = (
         "tmp.data_finder.write_pipeline_data_to_file.remove_contam.expect")
     fix_pipeline_root_in_file(expected_file, tmp_expected,
                               self.pipeline_root)
     finder.write_pipeline_data_to_file(tmpfile, "remove_contam")
     self.assertTrue(filecmp.cmp(tmp_expected, tmpfile, shallow=False))
     os.unlink(tmpfile)
     os.unlink(tmp_expected)
Esempio n. 6
0
 def test_write_pipeline_data_to_file_mykrobe_predict_pipeline(self):
     """test write_pipeline_data_to_file for mykrobe_predict pipeline"""
     finder = data_finder.DataFinder(ini_file, self.pipeline_root)
     tmpfile = "tmp.data_finder.write_pipeline_data_to_file.mykrobe_predict.out"
     finder.write_pipeline_data_to_file(tmpfile, "mykrobe_predict")
     expected_file = os.path.join(
         data_dir, "write_pipeline_data_to_file.mykrobe_predict.tsv")
     tmp_expected = (
         "tmp.data_finder.write_pipeline_data_to_file.mykrobe_predict.expect"
     )
     fix_pipeline_root_in_file(expected_file, tmp_expected,
                               self.pipeline_root)
     self.assertTrue(filecmp.cmp(tmp_expected, tmpfile, shallow=False))
     os.unlink(tmpfile)
     os.unlink(tmp_expected)
Esempio n. 7
0
 def test_write_seqrep_data_to_file_dataset_option(self):
     """test write_seqrep_data_to_file limit to one dataset"""
     finder = data_finder.DataFinder(ini_file,
                                     self.pipeline_root,
                                     dataset_name="set2")
     tmpfile = "tmp.data_finder.write_seqrep_data_to_file.set2.out"
     expected_file = os.path.join(data_dir,
                                  "write_seqrep_data_to_file.set2.tsv")
     tmp_expected = "tmp.data_finder.write_seqrep_data_to_file.set2.expect"
     fix_pipeline_root_in_file(expected_file, tmp_expected,
                               self.pipeline_root)
     finder.write_seqrep_data_to_file(tmpfile)
     self.assertTrue(filecmp.cmp(tmp_expected, tmpfile, shallow=False))
     os.unlink(tmpfile)
     os.unlink(tmp_expected)
Esempio n. 8
0
 def test_write_pipeline_data_to_file_remove_contam_pipeline_reference_option(
         self):
     '''test write_pipeline_data_to_file for remove_contam pipeline use reference option'''
     finder = data_finder.DataFinder(ini_file, self.pipeline_root)
     tmpfile = 'tmp.data_finder.write_pipeline_data_to_file.remove_contam.ref.1.out'
     expected_file = os.path.join(
         data_dir, 'write_pipeline_data_to_file.remove_contam.ref.1.tsv')
     tmp_expected = 'tmp.data_finder.write_pipeline_data_to_file.remove_contam.ref.1.expect'
     fix_pipeline_root_in_file(expected_file, tmp_expected,
                               self.pipeline_root)
     finder.write_pipeline_data_to_file(tmpfile,
                                        'remove_contam',
                                        reference_id=1)
     self.assertTrue(filecmp.cmp(tmp_expected, tmpfile, shallow=False))
     os.unlink(tmpfile)
     os.unlink(tmp_expected)
Esempio n. 9
0
 def test_write_pipeline_data_to_file_remove_contam_pipeline_dataset_option(
         self):
     '''test write_pipeline_data_to_file for remove_contam pipeline limit to one dataset'''
     finder = data_finder.DataFinder(ini_file,
                                     self.pipeline_root,
                                     dataset_name='set2')
     tmpfile = 'tmp.data_finder.write_pipeline_data_to_file.remove_contam.set2.out'
     expected_file = os.path.join(
         data_dir, 'write_pipeline_data_to_file.remove_contam.set2.tsv')
     tmp_expected = 'tmp.data_finder.write_pipeline_data_to_file.remove_contam.set2.expect'
     fix_pipeline_root_in_file(expected_file, tmp_expected,
                               self.pipeline_root)
     finder.write_pipeline_data_to_file(tmpfile, 'remove_contam')
     self.assertTrue(filecmp.cmp(tmp_expected, tmpfile, shallow=False))
     os.unlink(tmpfile)
     os.unlink(tmp_expected)
Esempio n. 10
0
def run(options):
    finder = data_finder.DataFinder(
        options.db_config_file,
        options.pipeline_root,
        include_withdrawn=options.include_withdrawn,
        include_internal_ids=options.include_internal_ids,
        dataset_name=options.dataset_name)

    if options.pipeline:
        finder.write_pipeline_data_to_file(
            options.outfile,
            options.pipeline,
            pipeline_version=options.pipeline_version,
            reference_id=options.reference_id)
    else:
        finder.write_seqrep_data_to_file(options.outfile)
Esempio n. 11
0
 def test_write_pipeline_data_to_file_remove_contam_pipeline_with_internal_ids(
         self):
     '''test write_pipeline_data_to_file for remove_contam pipeline with internal ids'''
     finder = data_finder.DataFinder(ini_file,
                                     self.pipeline_root,
                                     include_internal_ids=True)
     tmpfile = 'tmp.data_finder.write_pipeline_data_to_file.remove_contam.with_internal_ids.out'
     expected_file = os.path.join(
         data_dir,
         'write_pipeline_data_to_file.remove_contam.with_internal_ids.tsv')
     tmp_expected = 'tmp.data_finder.write_pipeline_data_to_file.remove_contam.expect'
     fix_pipeline_root_in_file(expected_file, tmp_expected,
                               self.pipeline_root)
     finder.write_pipeline_data_to_file(tmpfile, 'remove_contam')
     self.assertTrue(filecmp.cmp(tmp_expected, tmpfile, shallow=False))
     os.unlink(tmpfile)
     os.unlink(tmp_expected)