예제 #1
0
    def xtest_remote_blast(self):
        'It does a remote blast search'
        seq_fhand = NamedTemporaryFile()
        fasta = '>seq1\nCTAGTCTAGTCGTAGTCATGGCTGTAGTCTAGTCTACGATTCGTATCAGTTGT'
        fasta += 'GTGACATCGATCATGTTGTATTGTGTACTATACACACACGTAGGTCGACTATCGTAGC\n'
        seq_fhand.write(fasta)
        seq_fhand.flush()
        out_fhand = NamedTemporaryFile()
        do_blast(seq_fhand.name,
                 'nt',
                 program='blastn',
                 out_fpath=out_fhand.name,
                 remote=True)
        assert '</BlastOutput>' in open(out_fhand.name).read()

        # fail if outfmt is not xml
        try:
            params = {'outfmt': 'txt'}
            do_blast(seq_fhand.name,
                     'nt',
                     program='blastn',
                     out_fpath=out_fhand.name,
                     remote=True,
                     params=params)
            self.fail()
        except RuntimeError:
            pass
예제 #2
0
 def test_blast_search(self):
     'It does a blast search'
     db_name = 'arabidopsis_genes'
     seq_fpath = os.path.join(TEST_DATA_DIR, db_name)
     db_dir = TemporaryDir(prefix='blast_dbs_')
     try:
         db_fpath = get_or_create_blastdb(seq_fpath, directory=db_dir.name,
                                           dbtype='nucl')
         query_fhand = NamedTemporaryFile()
         query_fhand.write(open(seq_fpath).read(200))
         query_fhand.flush()
         out_fhand = NamedTemporaryFile()
         do_blast(seq_fpath, db_fpath, program='blastn',
                  out_fpath=out_fhand.name)
         assert '</BlastOutput>' in open(out_fhand.name).read()
     finally:
         db_dir.close()
예제 #3
0
    def test_remote_blast(self):
        'It does a remote blast search'
        seq_fhand = NamedTemporaryFile()
        fasta = '>seq1\nCTAGTCTAGTCGTAGTCATGGCTGTAGTCTAGTCTACGATTCGTATCAGTTGT'
        fasta += 'GTGACATCGATCATGTTGTATTGTGTACTATACACACACGTAGGTCGACTATCGTAGC\n'
        seq_fhand.write(fasta)
        seq_fhand.flush()
        out_fhand = NamedTemporaryFile()
        do_blast(seq_fhand.name, 'nt', program='blastn',
                 out_fpath=out_fhand.name, remote=True)
        assert '</BlastOutput>' in open(out_fhand.name).read()

        # fail if outfmt is not xml
        try:
            do_blast(seq_fhand.name, 'nt', program='blastn',
                out_fpath=out_fhand.name, remote=True, params={'outfmt':'txt'})
            self.fail()
        except RuntimeError:
            pass
예제 #4
0
 def test_blast_search(self):
     'It does a blast search'
     db_name = 'arabidopsis_genes'
     seq_fpath = os.path.join(TEST_DATA_DIR, db_name)
     db_dir = TemporaryDir(prefix='blast_dbs_')
     try:
         db_fpath = get_or_create_blastdb(seq_fpath,
                                          directory=db_dir.name,
                                          dbtype='nucl')
         query_fhand = NamedTemporaryFile()
         query_fhand.write(open(seq_fpath).read(200))
         query_fhand.flush()
         out_fhand = NamedTemporaryFile()
         do_blast(seq_fpath,
                  db_fpath,
                  program='blastn',
                  out_fpath=out_fhand.name)
         assert '</BlastOutput>' in open(out_fhand.name).read()
     finally:
         db_dir.close()