Ejemplo n.º 1
0
 def test_blast_record_set(self):
     # prepare database
     seqfile_ops.write_fasta(self.db_file, self.db_records)
     db_records_list = seqfile_ops.load_multifasta(self.db_file)
     index = 0
     for record in db_records_list:
         self.assertEqual(record.id,self.db_records[index].id)
         self.assertEqual(str(record.seq),str(self.db_records[index].seq))
         index +=1
     # make database
     self.dbfile_path, db_report = blasting.make_blastDB(self.temp_dir,
                                                         self.db_name,
                                                         self.db_file,
                                                         'nucl')
     self.assertIs(db_report['status'], 0)
     self.assertEquals(db_report['message'], 'database exists')
     # run local blast batch (with multiple queries)
     matches_multi = blasting.blast_record_set(self.dbfile_path,
                                               self.multi_records,
                                               self.prefs)
     self.assertIs(len(matches_multi), 3)
     index = 0
     for record in self.multi_records:
         self.assertEqual(matches_multi[record.id][0]['contig_id'],
                          self.multi_records[index].id)
         self.assertEqual(matches_multi[record
         .id][0]['details']['match_p100'], 100) 
         index +=1
Ejemplo n.º 2
0
 def run_blast(self, blast_run):
     query_segs = blast_run.query.query_segs
     blast_prefs = blast_run.parameters
     matches_dict = blast_record_set(self.name, query_segs, blast_prefs)
     self.match_sets.append({"run_id": blast_run.run_id, "matches": matches_dict})