-
Notifications
You must be signed in to change notification settings - Fork 0
/
wrapper_de_conservation.sh
executable file
·134 lines (94 loc) · 3.2 KB
/
wrapper_de_conservation.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
#!/bin/bash
set -e
echo "${@:1}" > Input_Parameters.txt
#Inputs - Species 1
# $1 - File, e.g. PlantA.fa
# $2 - File, e.g. PlantA.gff3
# $3 - String, e.g. ID=gene:
# $4 - Integer, e.g. 500/2000/5000
# $5 - --NoOverlap (if checked)
# $6 - --UseUTR (if checked)
fileA=$1
fileB=$2
FILENAMEA=${fileA##*/} # remove the path and leave only the file name
FILENAMEB=${fileB##*/}
mv ${fileA} /apples/bin/utr_tool/
mv ${fileB} /apples/bin/utr_tool/
cd /apples/bin/utr_tool
./bo_utr.sh $1 $2 $3 $4 $5 $6
# rm /apples/bin/utr_tool/${fileA}
# rm /apples/bin/utr_tool/${fileB}
mv /apples/bin/utr_tool/works/promoters.fa /de-app-work/PlantA.fa
mv /apples/bin/utr_tool/works/promoters.bed /de-app-work/PlantA.bed
mv /apples/bin/utr_tool/works/utr3.bed /de-app-work/PlantA_utr3.bed
mv /apples/bin/utr_tool/works/utr5.bed /de-app-work/PlantA_utr5.bed
rm /apples/bin/utr_tool/works/*
cd /de-app-work
# Make easier for the user to keep track of what input was used
touch "PlantA_FA_"${FILENAMEA}
touch "PlantA_GFF_"${FILENAMEB}
#Inputs - Species 2
# $7 - File, e.g. PlantB.fa
# $8 - File, e.g. PlantB.gff3
# $9 - String, e.g. ID=gene:
# $10 - Integer, e.g. 500/2000/5000
# $11 - --NoOverlap (if checked)
# $12 - --UseUTR (if checked)
fileC=$7
fileD=$8
FILENAMEC=${fileC##*/} # remove the path and leave only the file name
FILENAMED=${fileD##*/}
mv ${fileC} /apples/bin/utr_tool/
mv ${fileD} /apples/bin/utr_tool/
cd /apples/bin/utr_tool
./bo_utr.sh $7 $8 $9 ${10} ${11} ${12}
# rm /apples/bin/utr_tool/${fileC}
# rm /apples/bin/utr_tool/${fileD}
mv /apples/bin/utr_tool/works/promoters.fa /de-app-work/PlantB.fa
mv /apples/bin/utr_tool/works/promoters.bed /de-app-work/PlantB.bed
mv /apples/bin/utr_tool/works/utr3.bed /de-app-work/PlantB_utr3.bed
mv /apples/bin/utr_tool/works/utr5.bed /de-app-work/PlantB_utr5.bed
rm /apples/bin/utr_tool/works/*
cd /de-app-work
# Make easier for the user to keep track of what input was used
touch "PlantB_FA_"${FILENAMEC}
touch "PlantB_GFF_"${FILENAMED}
#Inputs - Conservation
# $13 - File, e.g. rbhSearch_result.txt
# $14 - List, both/pseudo/normal
# $15 - Integer, window length, e.g. 30/[60]/80/100
if [ ! -d /apples/inputs ]; then mkdir /apples/inputs; fi
if [ ! -d /apples/outputs ]; then mkdir /apples/outputs; fi
fileE=${13}
mv ${fileE} /apples/inputs/rbhSearch_result_PlantA_PlantB.txt
cp /de-app-work/*.fa /apples/inputs/
cp /de-app-work/*.bed /apples/inputs/
cd /apples/bin
if [ ! -d /apples/bin/tempfiles ]; then mkdir /apples/bin/tempfiles; fi
ulimit -c 0
case ${14} in
both)
perl conservationSearch_cyverse.pl -w ${15} || true
perl conservationSearch_cyverse.pl -w ${15} -p || true
;;
pseudo)
perl conservationSearch_cyverse.pl -w ${15} -p || true
;;
normal)
perl conservationSearch_cyverse.pl -w ${15} || true
;;
*)
perl conservationSearch_cyverse.pl -w ${15} || true
;;
esac
cp /apples/outputs/* /de-app-work
cd /de-app-work
rename s/PlantA/$( cut -d '.' -f 1 <<< "$fileA" )/ *
rename s/PlantB/$( cut -d '.' -f 1 <<< "$fileC" )/ *
if [ ! -d /de-app-work/utr_outputs ]; then mkdir /de-app-work/utr_outputs; fi
mv /de-app-work/*.fa /de-app-work/utr_outputs/
mv /de-app-work/*.gff3 /de-app-work/utr_outputs/
mv /de-app-work/*.bed /de-app-work/utr_outputs/
df -h
ls /apples/bin/tempfiles
echo "done"