-
Notifications
You must be signed in to change notification settings - Fork 4
/
startup_script.py
77 lines (60 loc) · 2.49 KB
/
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env python
from subprocess import call
import sys
from Bio import SeqIO
import re
import getopt
try:
opts, args = getopt.getopt(sys.argv[1:], 'hb:i:v:n:', ['inputfile=', 'inputfolder=', '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 ('-i', '--inputfolder'):
inputfolder_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')
subject = line_split[0]
subject = inputfolder_name + "/" + subject
lincRNA = line_split[1]
lincRNA = inputfolder_name + "/" + lincRNA
query_spp = line_split[2]
subject_spp = line_split[3]
try:
try:
subject_gff = line_split[4]
subject_gff = inputfolder_name + "/" + subject_gff
known_lincRNAs = line_split[5]
known_lincRNAs = inputfolder_name + "/" + known_lincRNAs
if subject_gff != '':
query = "bash /Building_Families.sh -g %s -l %s -q %s -s %s -f %s -k %s -e %s -n %s" % \
(subject, lincRNA, query_spp, subject_spp, subject_gff, known_lincRNAs, value, threads)
else:
query = 'bash /Building_Families.sh -g %s -l %s -q %s -s %s -k %s -e %s -n %s' % \
(subject, lincRNA, query_spp, subject_spp, known_lincRNAs, value, threads)
except IndexError:
subject_gff = line_split[4]
subject_gff = inputfolder_name + "/" + subject_gff
query = 'bash /Building_Families.sh -g %s -l %s -q %s -s %s -f %s -e %s -n %s' % \
(subject, lincRNA, query_spp, subject_spp, subject_gff, value, threads)
except IndexError:
query = 'bash /Building_Families.sh -g %s -l %s -q %s -s %s -e %s -n %s' % \
(subject, lincRNA, query_spp, subject_spp, value, threads)
call(query, shell=True)