Ejemplo n.º 1
0
 def test_alt_blast_param(self):
     """qiime_blast_seqs: alt blast params give alt results"""
     # Fewer blast hits with stricter e-value
     inseqs = MinimalFastaParser(self.inseqs1)
     actual = qiime_blast_seqs(inseqs,blast_db=self.blast_db,params={'-e':'1e-4'})
     # NOTE: A BUG (?) IN THE BlastResult OR THE PARSER RESULTS IN AN EXTRA
     # BLAST RESULT IN THE DICT (actual HERE) WITH KEY ''
     
     self.assertTrue('s2_like_seq' in actual)
     self.assertFalse('s100' in actual)
Ejemplo n.º 2
0
    def test_w_refseqs_fp(self):
        """qiime_blast_seqs functions refseqs_fp
        """
        inseqs = MinimalFastaParser(self.inseqs1)
        actual = qiime_blast_seqs(inseqs, refseqs_fp=self.refseqs1_fp)
        self.assertEqual(len(actual), 5)

        # couple of sanity checks against command line blast
        self.assertEqual(actual['s2_like_seq'][0][0]['SUBJECT ID'], 's2')
        self.assertEqual(actual['s105'][0][2]['SUBJECT ID'], 's1')
Ejemplo n.º 3
0
 def test_w_refseqs_fp(self):
     """qiime_blast_seqs functions refseqs_fp
     """
     inseqs = MinimalFastaParser(self.inseqs1)
     actual = qiime_blast_seqs(inseqs,refseqs_fp=self.refseqs1_fp)
     self.assertEqual(len(actual),5)
     
     # couple of sanity checks against command line blast
     self.assertEqual(actual['s2_like_seq'][0][0]['SUBJECT ID'],'s2')
     self.assertEqual(actual['s105'][0][2]['SUBJECT ID'],'s1')
Ejemplo n.º 4
0
    def test_w_preexising_blastdb(self):
        """qiime_blast_seqs functions with pre-existing blast_db
        """
        # pre-existing blast db
        inseqs = MinimalFastaParser(self.inseqs1)
        actual = qiime_blast_seqs(inseqs, blast_db=self.blast_db)
        self.assertEqual(len(actual), 5)

        # couple of sanity checks against command line blast
        self.assertEqual(actual['s2_like_seq'][0][0]['SUBJECT ID'], 's2')
        self.assertEqual(actual['s105'][0][2]['SUBJECT ID'], 's1')
Ejemplo n.º 5
0
 def test_w_preexising_blastdb(self):
     """qiime_blast_seqs functions with pre-existing blast_db
     """        
     # pre-existing blast db
     inseqs = MinimalFastaParser(self.inseqs1)
     actual = qiime_blast_seqs(inseqs,blast_db=self.blast_db)
     self.assertEqual(len(actual),5)
     
     # couple of sanity checks against command line blast
     self.assertEqual(actual['s2_like_seq'][0][0]['SUBJECT ID'],'s2')
     self.assertEqual(actual['s105'][0][2]['SUBJECT ID'],'s1')
Ejemplo n.º 6
0
    def test_alt_blast_param(self):
        """qiime_blast_seqs: alt blast params give alt results"""
        # Fewer blast hits with stricter e-value
        inseqs = MinimalFastaParser(self.inseqs1)
        actual = qiime_blast_seqs(inseqs,
                                  blast_db=self.blast_db,
                                  params={'-e': '1e-4'})
        # NOTE: A BUG (?) IN THE BlastResult OR THE PARSER RESULTS IN AN EXTRA
        # BLAST RESULT IN THE DICT (actual HERE) WITH KEY ''

        self.assertTrue('s2_like_seq' in actual)
        self.assertFalse('s100' in actual)
Ejemplo n.º 7
0
    def test_w_alt_seqs_per_blast_run(self):
        """qiime_blast_seqs: functions with alt seqs_per_blast_run
        """
        for i in range(1, 20):
            inseqs = MinimalFastaParser(self.inseqs1)
            actual = qiime_blast_seqs(\
             inseqs,blast_db=self.blast_db,seqs_per_blast_run=i)
            self.assertEqual(len(actual), 5)

            # couple of sanity checks against command line blast
            self.assertEqual(actual['s2_like_seq'][0][0]['SUBJECT ID'], 's2')
            self.assertEqual(actual['s105'][0][2]['SUBJECT ID'], 's1')
Ejemplo n.º 8
0
 def test_w_alt_seqs_per_blast_run(self):
     """qiime_blast_seqs: functions with alt seqs_per_blast_run
     """
     for i in range(1,20):
         inseqs = MinimalFastaParser(self.inseqs1)
         actual = qiime_blast_seqs(\
          inseqs,blast_db=self.blast_db,seqs_per_blast_run=i)
         self.assertEqual(len(actual),5)
 
         # couple of sanity checks against command line blast
         self.assertEqual(actual['s2_like_seq'][0][0]['SUBJECT ID'],'s2')
         self.assertEqual(actual['s105'][0][2]['SUBJECT ID'],'s1')
Ejemplo n.º 9
0
def main():
    option_parser, options, args = parse_command_line_parameters(**script_info)

    blast_results = qiime_blast_seqs(
        seqs=parse_fasta(open(options.input_fasta_fp)),
        refseqs_fp=options.refseqs_fp,
        seqs_per_blast_run=options.num_seqs_per_blast_run)

    for query_id, blast_result in blast_results.items():
        first_blast_result = blast_result[0][0]
        print '%s: %s %s %s' % (query_id, first_blast_result['SUBJECT ID'],
                                first_blast_result['E-VALUE'],
                                first_blast_result['% IDENTITY'])
Ejemplo n.º 10
0
def main():
    option_parser, options, args = parse_command_line_parameters(**script_info)
    
    blast_results = qiime_blast_seqs(\
     seqs=MinimalFastaParser(open(options.input_fasta_fp)),\
     refseqs_fp=options.refseqs_fp,\
     seqs_per_blast_run=options.num_seqs_per_blast_run)
     
    for query_id, blast_result in blast_results.items():
        first_blast_result = blast_result[0][0]
        print '%s: %s %s %s' % (\
         query_id,
         first_blast_result['SUBJECT ID'],
         first_blast_result['E-VALUE'],
         first_blast_result['% IDENTITY'])
Ejemplo n.º 11
0
def main():
    option_parser, options, args = parse_command_line_parameters(**script_info)

    blast_results = qiime_blast_seqs(
        seqs=parse_fasta(open(options.input_fasta_fp)),
        refseqs_fp=options.refseqs_fp,
        seqs_per_blast_run=options.num_seqs_per_blast_run,
    )

    for query_id, blast_result in blast_results.items():
        first_blast_result = blast_result[0][0]
        print "%s: %s %s %s %s %s" % (
            query_id,
            first_blast_result["SUBJECT ID"],
            first_blast_result["E-VALUE"],
            first_blast_result["% IDENTITY"],
            # Start and end coordinates required to identify match orientation
            first_blast_result["S. START"],
            first_blast_result["S. END"],
        )