コード例 #1
0
 def test_pre_task_list_pangea(self):
     psample = PangeaSample(
         PANGEA_SAMPLE.uuid,
         None,
         None,
         None,
         None,
         None,
         knex=PANGEA_SAMPLE.knex,
         sample=PANGEA_SAMPLE,
     )
     set_config(PANGEA_ENDPOINT,
                PANGEA_USER,
                PANGEA_PASS,
                name_is_uuid=True)
     tasks = get_task_list_for_sample(psample, 'all', '')
     self.assertEqual(len(tasks), 4)
     fast_detect, covid_genome_coverage, _, _ = tasks
     self.assertTrue(isinstance(fast_detect.reads, PangeaCapTask))
     self.assertTrue(
         isinstance(covid_genome_coverage.bam.reads, PangeaCapTask))
     nonhuman_reads = covid_genome_coverage.bam.reads
     self.assertFalse(
         isinstance(nonhuman_reads.mouse_removed_reads, PangeaCapTask))
     self.assertFalse(
         isinstance(
             nonhuman_reads.mouse_removed_reads.adapter_removed_reads,
             PangeaCapTask))
     self.assertTrue(
         isinstance(
             nonhuman_reads.mouse_removed_reads.adapter_removed_reads.reads,
             PangeaCapTask))
     self.assertIs(
         fast_detect.reads,
         nonhuman_reads.mouse_removed_reads.adapter_removed_reads.reads)
コード例 #2
0
    def test_run_pangea_on_sample_with_work_order(self):
        psample = PangeaSample(
            PANGEA_SAMPLE_2.uuid,
            None,
            None,
            None,
            None,
            None,
            knex=PANGEA_SAMPLE_2.knex,
            sample=PANGEA_SAMPLE_2,
        )

        wop = WorkOrderProto.from_name(PANGEA_SAMPLE_2.knex, WOP_NAME)
        wo = wop.create_work_order_for_sample(PANGEA_SAMPLE_2)
        set_config(PANGEA_ENDPOINT,
                   PANGEA_USER,
                   PANGEA_PASS,
                   name_is_uuid=True,
                   work_order_name=WOP_NAME)
        tasks = get_task_list_for_sample(psample, 'fast')
        tasks = [tasks[1]]  # just basic stats class
        tasks[0].taxa = DummyFastKraken2()
        luigi.build(tasks, local_scheduler=True)
        self.assertTrue(
            PANGEA_SAMPLE_2.analysis_result(
                'cap2::basic_sample_stats').exists())
        jo = wo.get_job_order_by_name('cap2::basic_sample_stats')
        jo.invalidate_cache()
        jo = JobOrder.from_uuid(wo, jo.uuid)
        self.assertTrue(jo.exists())
        self.assertEqual(jo.status, 'success')
コード例 #3
0
 def test_pre_task_list_pangea(self):
     psample = PangeaSample(
         PANGEA_SAMPLE.uuid,
         None,
         None,
         None,
         None,
         None,
         knex=PANGEA_SAMPLE.knex,
         sample=PANGEA_SAMPLE,
     )
     set_config(PANGEA_ENDPOINT,
                PANGEA_USER,
                PANGEA_PASS,
                name_is_uuid=True)
     tasks = get_task_list_for_sample(psample, 'pre')
     self.assertEqual(len(tasks), 1)
     self.assertTrue(isinstance(tasks[0], PangeaCapTask))
     self.assertFalse(isinstance(tasks[0].ec_reads, PangeaCapTask))
     self.assertTrue(
         isinstance(tasks[0].ec_reads.nonhuman_reads, PangeaCapTask))
     self.assertFalse(
         isinstance(tasks[0].ec_reads.nonhuman_reads.mouse_removed_reads,
                    PangeaCapTask))
     self.assertFalse(
         isinstance(
             tasks[0].ec_reads.nonhuman_reads.mouse_removed_reads.
             adapter_removed_reads, PangeaCapTask))
     self.assertTrue(
         isinstance(
             tasks[0].ec_reads.nonhuman_reads.mouse_removed_reads.
             adapter_removed_reads.reads, PangeaCapTask))
コード例 #4
0
 def test_pangea_cap_task_instance(self):
     psample = PangeaSample(
         PANGEA_SAMPLE.uuid,
         None,
         None,
         None,
         None,
         None,
         knex=PANGEA_SAMPLE.knex,
         sample=PANGEA_SAMPLE,
     )
     set_config(PANGEA_ENDPOINT, '', '', name_is_uuid=True)
     pct_type = PangeaCapTask.new_task_type(FastQC)
     pct_instance = pct_type(
         pe1=psample.r1,
         pe2=psample.r2,
         sample_name=psample.name,
         config_filename='',
     )
     self.assertTrue(pct_instance.wrapped_instance)
コード例 #5
0
 def test_run_pangea_on_sample(self):
     psample = PangeaSample(
         PANGEA_SAMPLE.uuid,
         None,
         None,
         None,
         None,
         None,
         knex=PANGEA_SAMPLE.knex,
         sample=PANGEA_SAMPLE,
     )
     set_config(PANGEA_ENDPOINT,
                PANGEA_USER,
                PANGEA_PASS,
                name_is_uuid=True)
     tasks = get_task_list_for_sample(psample, 'fast')
     tasks = [tasks[1]]  # just basic stats class
     tasks[0].taxa = DummyFastKraken2()
     luigi.build(tasks, local_scheduler=True)
     self.assertTrue(
         PANGEA_SAMPLE.analysis_result('cap2::basic_sample_stats').exists())
コード例 #6
0
    def test_pangea_versions(self):
        psample = PangeaSample(
            PANGEA_SAMPLE.uuid,
            None,
            None,
            None,
            None,
            None,
            knex=PANGEA_SAMPLE.knex,
            sample=PANGEA_SAMPLE,
        )
        set_config(PANGEA_ENDPOINT,
                   PANGEA_USER,
                   PANGEA_PASS,
                   name_is_uuid=True)
        wrapped_flag_b = wrap_task(psample,
                                   FlagTaskVersionB,
                                   config_path=TEST_CONFIG,
                                   check_versions=False)
        luigi.build([wrapped_flag_b], local_scheduler=True)
        remove(wrapped_flag_b.flag_filepath)
        self.assertTrue(
            PANGEA_SAMPLE.analysis_result(
                'cap2::test_flag',
                replicate='B df7ebee60a5c',
            ).exists())

        wrapped_downstream = recursively_wrap_task(psample,
                                                   TaskThatReliesOnFlagTask,
                                                   config_path=TEST_CONFIG)
        self.assertIn('B', [
            x[0]
            for x in wrapped_downstream.config.allowed_versions(wrapped_flag_b)
        ])
        luigi.build([wrapped_downstream], local_scheduler=True)
        self.assertEqual(wrapped_downstream.flag.version(), 'B')
        self.assertTrue(
            PANGEA_SAMPLE.analysis_result(
                'cap2::test_task_that_relies_on_flag', ).exists())
コード例 #7
0
 def test_pct_instance_is_pct_and_luigi_task(self):
     psample = PangeaSample(
         PANGEA_SAMPLE.uuid,
         None,
         None,
         None,
         None,
         None,
         knex=PANGEA_SAMPLE.knex,
         sample=PANGEA_SAMPLE,
     )
     set_config(PANGEA_ENDPOINT, '', '', name_is_uuid=True)
     pct_type = PangeaCapTask.new_task_type(FastQC)
     pct_instance = pct_type(
         pe1=psample.r1,
         pe2=psample.r2,
         sample_name=psample.name,
         config_filename='',
     )
     self.assertTrue(isinstance(pct_instance, PangeaCapTask))
     self.assertTrue(isinstance(pct_instance, luigi.Task))
     self.assertTrue(isinstance(pct_instance, pct_type))
コード例 #8
0
    def test_load_task_versions(self):
        psample = PangeaSample(
            PANGEA_SAMPLE.uuid,
            None,
            None,
            None,
            None,
            None,
            knex=PANGEA_SAMPLE.knex,
            sample=PANGEA_SAMPLE,
        )
        set_config(PANGEA_ENDPOINT,
                   PANGEA_USER,
                   PANGEA_PASS,
                   name_is_uuid=True)
        wrapped_flag_b = wrap_task(psample,
                                   FlagTaskVersionB,
                                   config_path=TEST_CONFIG,
                                   check_versions=False)
        luigi.build([wrapped_flag_b], local_scheduler=True)
        remove(wrapped_flag_b.flag_filepath)
        self.assertTrue(
            PANGEA_SAMPLE.analysis_result(
                'cap2::test_flag',
                replicate='B df7ebee60a5c',
            ).exists())

        instance = recursively_wrap_task(psample,
                                         TaskThatReliesOnFlagTask,
                                         config_path=TEST_CONFIG)
        self.assertEqual(instance.flag.version(), 'B')
        ivt = instance.version_tree()
        cvt = TaskThatReliesOnFlagTask.version_tree()
        self.assertNotEqual(ivt, cvt)
        self.assertEqual(instance.version_tree().replace('==B', '==A'),
                         TaskThatReliesOnFlagTask.version_tree())
        self.assertNotEqual(instance.version_hash(),
                            TaskThatReliesOnFlagTask.version_hash())