forked from phageParser/phageParser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBLAST_loop.py
More file actions
20 lines (14 loc) · 935 Bytes
/
Copy pathBLAST_loop.py
File metadata and controls
20 lines (14 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# This script BLASTs all the files in /spacers against a downloaded copy of the phage database.
from Bio.Blast.Applications import NcbiblastnCommandline
#help(NcbiblastnCommandline)
import os
#change this directory as needed. Note that local blast may experience issues if you're not working in the blast directory (here NCBI/blast-2.2.30+)
directory = "C:/Users/madeleine/Documents/NCBI/phageParser/data"
for fn in os.listdir("%s/spacers" %directory):
query1 = "%s/spacers/%s" %(directory,fn)
ext = fn.index('.')
outfile1 = fn.replace(fn[ext+1:],("txt"))
outfile = "%s/phages/%s" %(directory,outfile1)
# These parameters are more or less the same as the ones on PhagesDB.org
blastn_obj = NcbiblastnCommandline(query=query1, db="phagedb", evalue=10, num_descriptions = 100, num_alignments = 100, dust = "no", task = "blastn",reward = 1, penalty = -3, out = outfile)
stdout, stderr = blastn_obj()