def blastSeqs(seqsToBlast):
'''
This function uses an input FASTA file with genomic sequences of 16S dRNA and BLASTs each sequence against a local database (found in supportFiles/db/) that contains the 16S dRNA sequences of all the bacterial species in the PATRIC database that have a whole genome sequence available. It output only the top hit to a tab-delimeted text file. The 16S sequences present in the database were provided by Maulik Shukla on the 3rd of November of 2015.
:param seqsToBlast: FASTA file containing the sequences that will be matched to the sequences in the local database. Called in blastn from parameter query.
:param dbase: local database on ../supportFiles/db/16Sdb. Called in blastn from parameter db.
:param tempOutputFile: global variable defined by file on '../tempFiles/blastOutput.txt'. Raw BLAST results are temporarily stored in this file and will be processed in function listTaxId4ModelSEED(). Called in blastn from parameter out.
:returns tempOutputFile
'''
from Bio.Blast.Applications import NcbiblastnCommandline
import os
cherrypy.log('We will blast the sequences in the FASTA file provided, %s, against a local custom database that contains the 16S sequences of the species in the NCBI that have whole genome sequences.' %(seqsToBlast))
dbase = '../supportFiles/db/16Sdb'
'''
@summary: run a local blast of the user's representative OTUs, the output format is tabular, only one match is shown
'''
blastn_cline = NcbiblastnCommandline(cmd='../ncbi-blast-2.2.22+/bin/blastn', query= seqsToBlast, db= dbase, outfmt= 6, out= tempOutputFile, max_target_seqs = 1, num_threads = 5)
cherrypy.log('The BLAST command that will be run is: %s' %blastn_cline)
os.system(str(blastn_cline))
#check if the tempOutputFile file was created. if not, shout out an error.
if os.stat(tempOutputFile).st_size != 0:
cherrypy.log('The %s was created and it is not empty' %tempOutputFile)
else:
cherrypy.log('Something is wrong because the %s appears to be empty' %tempOutputFile)
exit()
评论列表
文章目录