-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathReciprocal_BLAST_startup_script.py
48 lines (41 loc) · 1.27 KB
/
Reciprocal_BLAST_startup_script.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
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python
from subprocess import call
import sys
import getopt
try:
opts, args = getopt.getopt(sys.argv[1:], 'hb:v:n:', ['inputfile=', 'e_value=', 'threads=', 'help'])
except getopt.GetoptError:
usage()
sys.exit(2)
for opt, arg in opts:
if opt in ('-h', '--help'):
usage()
sys.exit(2)
elif opt in ('-b', '--inputfile'):
inputfile_name = arg
elif opt in ('-v', '--value'):
value = arg
elif opt in ('-n', '--threads'):
threads = arg
else:
usage()
sys.exit(2)
with open(inputfile_name, 'r') as inpt:
for line in inpt:
if line == '\n':
pass
else:
line = line.strip()
line_split = line.split('\t')
genome = line_split[0]
sequences = line_split[1]
gff = line_split[2]
query_gff = line_split[3]
query_species = line_split[4]
query_genome = line_split[5]
query = "bash /Reciprocal_BLAST.sh -g %s -s %s -f %s -a %s -b %s -c %s -e %s -n %s" % \
(genome, sequences, gff, query_gff, query_species, query_genome, value, threads)
if gff == query_gff:
pass
else:
call(query, shell=True)