-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmirMachine_submit.sh
164 lines (140 loc) · 4.74 KB
/
mirMachine_submit.sh
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#!/bin/bash
usage()
{
cat << EOF
usage: bash mirMachine_submit.sh -f fasta_file -i input_file [OPTIONS]
Basic parameters
-f | --fasta_file (FASTA file. The reference FASTA file to search for miRNAs
required unless -db provided)
-db | --blast_database (Blast database title. Blast database title
ignored if -g provided)
-i | --input_file (mature miRNA FASTA file Fasta file for known mature miRNA sequences
Required)
-m | --mismatches (default to 1) Number of mismatches for mir_find hits
-n | --number_of_hits (default to 20. Set 0 for
infinite number of hits) Number of hits to eliminate as siRNA in mir_fold
-long (Optional) To assess secondary structure of the suspect list
For sRNA-seq based predictions:
-s | --sRNAseq (Optional) Indicate
-lmax (default to 24)
-lmin (default to 20)
-rpm (default to 10)
-h | --help Brings up this menu
EOF
}
mismatches=1
number_of_hits=20
run="short"
sRNAseq="false"
lmax=24
lmin=20
rpm=10
BASEDIR="${BASH_SOURCE[0]%/mirMachine_submit.sh}"
if [ $# -eq 0 ]; then
usage
exit
fi
while [ "$1" != "" ]; do
case $1 in
-f | --fasta_file )
shift
fasta_file=$1
blast_database=$1"_db"
;;
-db | --blast_database )
shift
blast_database=$1
;;
-i | --input_file )
shift
input_file=$1
;;
-n | --number_of_hits )
shift
if [ $1 -eq 0 ]; then
$1=""
fi
number_of_hits=$1
;;
-m | --mismatches )
shift
mismatches=$1
;;
-long )
run="long"
;;
-s | --sRNAseq )
sRNAseq="true"
mismatches=0
;;
-lmax )
shift
lmax=$1
;;
-lmin )
shift
lmin=$1
;;
-rpm )
shift
rpm=$1
;;
-h | --help ) usage
exit
;;
* ) usage
exit 1
esac
shift
done
if [ -z $blast_database ]; then
echo "Provide either a reference FASTA file (-f, --fasta_file) or a blast database (-db, --blast_database)"
usage
exit
fi
if [ -z $input_file ]; then
echo "Mature miRNA sequences is required, provide it with the flag: -i input_file"
usage
exit
fi
echo "Mature miRNA sequences = ${input_file}"
echo "Number of mismatches = ${mismatches}"
echo "Number of hits allowed = ${number_of_hits}"
if [ -z $fasta_file ]; then
echo "Blast DB = ${blast_database}"
echo "==============================================================================="
echo
else
echo "Reference FASTA file = ${fasta_file}"
echo "Blast DB = ${blast_database}"
echo "==============================================================================="
echo
echo "Running makeblastdb"
echo "==============================================================================="
makeblastdb -dbtype nucl -parse_seqids -in $fasta_file -out $blast_database -title $blast_database
fi
if [ $sRNAseq == "true" ]; then
echo "==============================================================================="
echo "sRNAseq preprocessing..."
echo "==============================================================================="
$BASEDIR/mir_filter_reads.pl $input_file $lmin $lmax $rpm
echo
echo "Running mir_find..."
echo "==============================================================================="
echo $mismatches | $BASEDIR/mir_find.pl $input_file.filtered.fasta $blast_database
echo
echo "Running mir_fold..."
echo "==============================================================================="
echo $number_of_hits | $BASEDIR/mir_fold.pl $input_file.nr.fasta $input_file.filtered.fasta.results.tbl $blast_database $run $sRNAseq
else
echo
echo "Running mir_find..."
echo "==============================================================================="
echo $mismatches | $BASEDIR/mir_find.pl $input_file $blast_database
echo
echo "Running mir_fold..."
echo "==============================================================================="
echo $number_of_hits | $BASEDIR/mir_fold.pl $input_file $input_file.results.tbl $blast_database $run $sRNAseq
fi
echo
echo "All finished!"