Example #1
0
    def test_cmscan_task_multithreaded(self):
        with TemporaryDirectory() as td:
            with Move(td):
                with TestData('rnaseP-bsu.fa', td) as transcript, \
                     TestData('rnaseP-eubact.c.cm', td) as cm, \
                     TemporaryFile(td) as out_single,\
                     TemporaryFile(td) as out_multi:

                    for n_threads in (2,3,4,5):
                            
                        db_task = tasks.get_cmpress_task(cm, self.cmpress_cfg)
                        aln_task_single = tasks.get_cmscan_task(transcript, out_single, 
                                                                cm, 1.0, 1,
                                                                self.cmscan_cfg)
                        aln_task_multi = tasks.get_cmscan_task(transcript, out_multi, 
                                                                cm, 1.0,
                                                                n_threads,
                                                                self.cmscan_cfg)
                        run_tasks([db_task, aln_task_single], ['run'])
                        run_task(aln_task_multi)

                        alns_single = pd.concat(cmscan_to_df_iter(out_single))
                        alns_multi = pd.concat(cmscan_to_df_iter(out_multi))

                        self.assertTrue(all(alns_single['e_value'].sort_values() == \
                                            alns_multi['e_value'].sort_values()))
Example #2
0
    def test_cmscan_task_multithreaded(self):
        with TemporaryDirectory() as td:
            with Move(td):
                with TestData('rnaseP-bsu.fa', td) as transcript, \
                     TestData('rnaseP-eubact.c.cm', td) as cm, \
                     TemporaryFile(td) as out_single,\
                     TemporaryFile(td) as out_multi:

                    for n_threads in (2, 3, 4, 5):

                        db_task = tasks.get_cmpress_task(cm, self.cmpress_cfg)
                        aln_task_single = tasks.get_cmscan_task(
                            transcript, out_single, cm, 1.0, 1,
                            self.cmscan_cfg)
                        aln_task_multi = tasks.get_cmscan_task(
                            transcript, out_multi, cm, 1.0, n_threads,
                            self.cmscan_cfg)
                        run_tasks([db_task, aln_task_single], ['run'])
                        run_task(aln_task_multi)

                        alns_single = pd.concat(cmscan_to_df_iter(out_single))
                        alns_multi = pd.concat(cmscan_to_df_iter(out_multi))

                        self.assertTrue(all(alns_single['e_value'].sort_values() == \
                                            alns_multi['e_value'].sort_values()))
Example #3
0
    def test_cmscan_task(self):
        with TemporaryDirectory() as td:
            with Move(td):
                with TestData('test-transcript.fa', td) as transcript, \
                     TestData('test-covariance-model.cm', td) as cm, \
                     TemporaryFile(td) as out:
                        
                    db_task = tasks.get_cmpress_task(cm, self.cmpress_cfg)
                    aln_task = tasks.get_cmscan_task(transcript, out, cm, 1.0, 1,
                                                      self.cmscan_cfg)
                    run_tasks([db_task, aln_task], ['run'])
                    print(os.listdir(td), file=sys.stderr)
                    aln = ''.join(open(out).readlines())
                    print(aln, file=sys.stderr)

                    # TODO: better correctness check
                    self.assertEquals(aln.count('accession'), 2)
                    self.assertIn('E-value', aln)
Example #4
0
    def test_cmscan_task(self):
        with TemporaryDirectory() as td:
            with Move(td):
                with TestData('test-transcript.fa', td) as transcript, \
                     TestData('test-covariance-model.cm', td) as cm, \
                     TemporaryFile(td) as out:
                        
                    db_task = tasks.get_cmpress_task(cm, self.cmpress_cfg)
                    aln_task = tasks.get_cmscan_task(transcript, out, cm, 1.0, 1,
                                                      self.cmscan_cfg)
                    run_tasks([db_task, aln_task], ['run'])
                    print(os.listdir(td), file=sys.stderr)
                    aln = ''.join(open(out).readlines())
                    print(aln, file=sys.stderr)

                    # TODO: better correctness check
                    self.assertEquals(aln.count('accession'), 2)
                    self.assertIn('E-value', aln)