-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRunBlast.py
35 lines (27 loc) · 909 Bytes
/
RunBlast.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python
# -*- coding: utf-8 -*-:
"""
Copyright:
Copyright Universite of Sherbrooke, departement of biochemistry and
departement of computation.
Date:
September 2019
Description:
This script will run one blastn per file in the query_directory. In our
study it is used to run blastn for pG4r vs rG4 and rG4 vs pG4r.
Usage:
python ~/PATH/RunBlast.py query_directory fasta_target output_Directory
"""
import os
import sys
def do_blast (query_dir, db, outdir):
filelist = os.listdir(query_dir)
for queryfile in filelist:
#~ print str(queryfile)
out = outdir + queryfile.split('.')[0] + '.blastresult.xml'
cmd = "blastn -query " + query_dir + queryfile + " -db " + db +\
" -out "+ out + " -outfmt 5" + " -word_size 11"
#~ print cmd
os.system(cmd)
if __name__ == '__main__':
do_blast(sys.argv[1], sys.argv[2], sys.argv[3])