Beispiel #1
0
    def test_lastal_task_multithreaded(self):
        with TemporaryDirectory() as td:
            with Move(td):
                with TestData('test-protein.fa', td) as prot, \
                     TestData('pom.50.fa', td) as tr, \
                     TemporaryFile(td) as out_single,\
                     TemporaryFile(td) as out_multi:
                        
                    for n_threads in (3,4,5):
                        print(os.listdir(td), file=sys.stderr)

                        db_task = tasks.get_lastdb_task(prot, prot, self.lastdb_cfg)
                        aln_task_single = tasks.get_lastal_task(tr, prot, out_single, 
                                                                self.lastal_cfg, 
                                                                translate=True, 
                                                                cutoff=None)

                        aln_task_multi = tasks.get_lastal_task(tr, prot, out_multi, 
                                                                self.lastal_cfg, 
                                                                translate=True, 
                                                                cutoff=None,
                                                                n_threads=n_threads)
                        run_tasks([db_task, aln_task_single, aln_task_multi], 
                                  ['run'])

                        alns_single = MafParser(out_single).read()
                        alns_multi = MafParser(out_multi).read()

                        self.assertTrue(all(alns_single['E'].sort_values() == \
                                        alns_multi['E'].sort_values()))
Beispiel #2
0
    def test_lastal_task_nucl_x_prot(self):
        with TemporaryDirectory() as td:
            with Move(td):
                with TestData('test-protein.fa', td) as prot, \
                     TestData('test-transcript.fa', td) as tr, \
                     TemporaryFile(td) as out:

                    print(os.listdir(td), file=sys.stderr)
                    db_task = tasks.get_lastdb_task(prot, prot,
                                                    self.lastdb_cfg)
                    aln_task = tasks.get_lastal_task(tr,
                                                     prot,
                                                     out,
                                                     self.lastal_cfg,
                                                     translate=True,
                                                     cutoff=None)
                    run_tasks([db_task, aln_task], ['run'])

                    aln = ''.join(open(out).readlines())
                    print(aln, file=sys.stderr)

                    self.assertIn('SPAC212_RecQ_type_DNA_helicase_PROTEIN',
                                  aln)
                    self.assertIn('SPAC212_RecQ_type_DNA_helicase_TRANSCRIPT',
                                  aln)
                    self.assertIn('lambda',
                                  aln,
                                  msg='lambda missing, wrong LAST version?')
Beispiel #3
0
    def test_lastal_task_multithreaded(self):
        with TemporaryDirectory() as td:
            with Move(td):
                with TestData('test-protein.fa', td) as prot, \
                     TestData('pom.50.fa', td) as tr, \
                     TemporaryFile(td) as out_single,\
                     TemporaryFile(td) as out_multi:

                    for n_threads in (3, 4, 5):
                        print(os.listdir(td), file=sys.stderr)

                        db_task = tasks.get_lastdb_task(
                            prot, prot, self.lastdb_cfg)
                        aln_task_single = tasks.get_lastal_task(
                            tr,
                            prot,
                            out_single,
                            self.lastal_cfg,
                            translate=True,
                            cutoff=None)

                        aln_task_multi = tasks.get_lastal_task(
                            tr,
                            prot,
                            out_multi,
                            self.lastal_cfg,
                            translate=True,
                            cutoff=None,
                            n_threads=n_threads)
                        run_tasks([db_task, aln_task_single, aln_task_multi],
                                  ['run'])

                        alns_single = MafParser(out_single).read()
                        alns_multi = MafParser(out_multi).read()

                        self.assertTrue(all(alns_single['E'].sort_values() == \
                                        alns_multi['E'].sort_values()))
Beispiel #4
0
    def test_lastal_task_uptodate(self):
        with TemporaryDirectory() as td:
            with Move(td):
                with TestData('test-protein.fa', td) as prot, \
                     TemporaryFile(td) as out:
                        
                    print(os.listdir(td), file=sys.stderr)
                    db_task = tasks.get_lastdb_task(prot, prot, self.lastdb_cfg)
                    aln_task = tasks.get_lastal_task(prot, prot, out, False,
                                                     None, 1, self.lastal_cfg)
                    # Run it once
                    run_tasks([db_task, aln_task], ['run'])

                    # Now run again and check the status
                    run_tasks([aln_task], ['run'])
                    status = check_status(aln_task)
                    self.assertEquals(status.status, 'up-to-date')
Beispiel #5
0
    def test_lastal_task_nucl_x_prot(self):
        with TemporaryDirectory() as td:
            with Move(td):
                with TestData('test-protein.fa', td) as prot, \
                     TestData('test-transcript.fa', td) as tr, \
                     TemporaryFile(td) as out:
                        
                    print(os.listdir(td), file=sys.stderr)
                    db_task = tasks.get_lastdb_task(prot, prot, self.lastdb_cfg)
                    aln_task = tasks.get_lastal_task(tr, prot, out, True, None, 1,
                                                     self.lastal_cfg)
                    run_tasks([db_task, aln_task], ['run'])

                    aln = ''.join(open(out).readlines())
                    print(aln, file=sys.stderr)

                    self.assertIn('SPAC212_RecQ_type_DNA_helicase_PROTEIN', 
                                  aln)
                    self.assertIn('SPAC212_RecQ_type_DNA_helicase_TRANSCRIPT',
                                  aln)
                    self.assertIn('lambda', aln, 
                                  msg='lambda missing, wrong LAST version?')
Beispiel #6
0
    def test_lastal_task_prot_x_prot(self):
        with TemporaryDirectory() as td:
            with Move(td):
                with TestData('test-protein.fa', td) as prot, \
                     TemporaryFile(td) as out:
                        
                    print(os.listdir(td), file=sys.stderr)
                    db_task = tasks.get_lastdb_task(prot, prot, self.lastdb_cfg)
                    aln_task = tasks.get_lastal_task(prot, prot, out, False,
                                                     None, 1, self.lastal_cfg)
                    run_tasks([db_task, aln_task], ['run'])

                    aln = ''.join(open(out).readlines())
                    print(aln, file=sys.stderr)

                    self.assertEquals(
                            aln.count('SPAC212_RecQ_type_DNA_helicase_PROTEIN'),
                            2)
                    self.assertIn('EG2=0', aln)
                    self.assertIn('E=0', aln)
                    self.assertIn('lambda', aln, 
                                  msg='lambda missing, wrong LAST version?')
Beispiel #7
0
    def test_lastal_task_prot_x_prot(self):
        with TemporaryDirectory() as td:
            with Move(td):
                with TestData('test-protein.fa', td) as prot, \
                     TemporaryFile(td) as out:
                        
                    print(os.listdir(td), file=sys.stderr)
                    db_task = tasks.get_lastdb_task(prot, prot, self.lastdb_cfg)
                    aln_task = tasks.get_lastal_task(prot, prot, out,
                                                     self.lastal_cfg,
                                                     translate=False,
                                                     cutoff=None)
                    run_tasks([db_task, aln_task], ['run'])

                    aln = ''.join(open(out).readlines())
                    print(aln, file=sys.stderr)

                    self.assertEquals(
                            aln.count('SPAC212_RecQ_type_DNA_helicase_PROTEIN'),
                            2)
                    self.assertIn('EG2=0', aln)
                    self.assertIn('E=0', aln)
                    self.assertIn('lambda', aln, 
                                  msg='lambda missing, wrong LAST version?')