Esempio n. 1
0
 def _assign_single(self,blast,db_file,best):
     self.logger.info("\n# [BASTA STATUS] Assigning taxonomies ...")
     (tax_lookup, map_lookup) = self._get_lookups(db_file)
     taxa = []
     nofo_map = []
     out_fh = open(self.output, "w")
     for seq_hits in futils.hit_gen(blast,self.alen,self.evalue,self.identity,self.config,self.num):
         for seq in seq_hits:
             self._get_tax_list(seq_hits[seq],map_lookup,tax_lookup,taxa,nofo_map)
     lca = self._getLCS([x for x in taxa if x])
     if self.info_file:
         self._print_info(taxa,"Sequence")
     self._print(out_fh,"Sequence",lca,best,taxa)
     return lca
Esempio n. 2
0
 def _assign_sequence(self,blast,db_file,best):
     self.logger.info("\n# [BASTA STATUS] Assigning taxonomies ...")
     (tax_lookup, map_lookup) = self._get_lookups(db_file)
     nofo_map = []
     out_fh = open(self.output,"w")
     print(self.info_file)
     for seq_hits in futils.hit_gen(blast,self.alen,self.evalue,self.identity,self.config,self.num):
         for seq in seq_hits:
             taxa = []
             self._get_tax_list(seq_hits[seq],map_lookup,tax_lookup,taxa,nofo_map)
             lca = self._getLCS(taxa)
             if self.info_file:
                 self._print_info(taxa,seq)
             self._print(out_fh,seq,lca,best,taxa)
     out_fh.close()