annotate isoDE2.sh @ 3:4c4d42f3e28e draft

Uploaded
author saharlcc
date Mon, 19 Sep 2016 22:01:22 -0400
parents 581e4c6b483f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
1 #!/bin/bash
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
2
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
3 isoEMDir=/home/projects/isoem2/isoem-workingversion
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
4 toolpath=${isoEMDir}/bin
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
5 isoDEPath=${isoEMDir}/bin
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
6 supportCalcPath=${isoEMDir}/src/calc
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
7 fpkmGeneCommand=""
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
8 fpkmIsoformCommand=""
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
9 tpmGeneCommand=""
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
10 tpmIsoformCommand=""
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
11
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
12
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
13 arg=($*)
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
14 i=0
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
15 while [ $i -lt $# ]
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
16 do
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
17 a=${arg[i]}
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
18 if [ "$a" == "-c1" ]; then
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
19 fpkmGeneCommand="$fpkmGeneCommand -c1"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
20 fpkmIsoformCommand="$fpkmIsoformCommand -c1"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
21 tpmGeneCommand="$tpmGeneCommand -c1"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
22 tpmIsoformCommand="$tpmIsoformCommand -c1"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
23
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
24 ((i++))
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
25 a=${arg[i]}
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
26 rep=1
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
27 while [[ `expr index "$a" "/"` -ne 0 && $i -lt $# ]]
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
28 do
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
29 condition1File=$a
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
30 ${toolpath}/convertToisoDEFormatWithIsoforms $condition1File c1_rep${rep}
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
31
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
32 fpkmGeneCommand="$fpkmGeneCommand c1_rep${rep}_fpkm_G"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
33 fpkmIsoformCommand="$fpkmIsoformCommand c1_rep${rep}_fpkm_I"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
34 tpmGeneCommand="$tpmGeneCommand c1_rep${rep}_tpm_G"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
35 tpmIsoformCommand="$tpmIsoformCommand c1_rep${rep}_tpm_I"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
36 ((rep++))
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
37
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
38 ((i++))
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
39 a=${arg[i]}
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
40 done
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
41 elif [ "$a" == "-c2" ]; then
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
42 fpkmGeneCommand="$fpkmGeneCommand -c2"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
43 fpkmIsoformCommand="$fpkmIsoformCommand -c2"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
44 tpmGeneCommand="$tpmGeneCommand -c2"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
45 tpmIsoformCommand="$tpmIsoformCommand -c2"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
46
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
47 ((i++))
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
48 a=${arg[i]}
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
49 rep=1
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
50 while [[ `expr index "$a" "/"` -ne 0 && $i -lt $# ]]
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
51 do
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
52 condition1File=$a
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
53 #echo $condition1File
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
54 ${toolpath}/convertToisoDEFormatWithIsoforms $condition1File c2_rep${rep}
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
55
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
56 fpkmGeneCommand="$fpkmGeneCommand c2_rep${rep}_fpkm_G"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
57 fpkmIsoformCommand="$fpkmIsoformCommand c2_rep${rep}_fpkm_I"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
58 tpmGeneCommand="$tpmGeneCommand c2_rep${rep}_tpm_G"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
59 tpmIsoformCommand="$tpmIsoformCommand c2_rep${rep}_tpm_I"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
60 ((rep++))
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
61
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
62 ((i++))
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
63 a=${arg[i]}
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
64 done
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
65 elif [ "$a" == "-pval" ]; then
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
66 ((i++))
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
67 pval=${arg[i]}
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
68 ((i++))
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
69
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
70
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
71 elif [ "$a" == "-geneFPKMout" ]; then
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
72 ((i++))
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
73 geneFPKMout_file=${arg[i]}
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
74 ((i++))
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
75
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
76
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
77 elif [ "$a" == "-geneTPMout" ]; then
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
78 ((i++))
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
79 geneTPMout_file=${arg[i]}
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
80 ((i++))
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
81
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
82 elif [ "$a" == "-isoFPKMout" ]; then
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
83 ((i++))
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
84 isoFPKMout_file=${arg[i]}
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
85 ((i++))
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
86
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
87 elif [ "$a" == "-isoTPMout" ]; then
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
88 ((i++))
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
89 isoTPMout_file=${arg[i]}
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
90 ((i++))
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
91 else
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
92
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
93 ((i++))
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
94 fi
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
95
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
96 done
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
97
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
98 support=`java -cp ${supportCalcPath} support 200 200 $pval`
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
99 fpkmGeneCommand="$fpkmGeneCommand -b $support"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
100 fpkmIsoformCommand="$fpkmIsoformCommand -b $support"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
101 tpmGeneCommand="$tpmGeneCommand -b $support"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
102 tpmIsoformCommand="$tpmIsoformCommand -b $support"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
103
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
104 fpkmGeneCommand="$fpkmGeneCommand -dfc 2"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
105 fpkmIsoformCommand="$fpkmIsoformCommand -dfc 2"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
106 tpmGeneCommand="$tpmGeneCommand -dfc 2"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
107 tpmIsoformCommand="$tpmIsoformCommand -dfc 2"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
108
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
109
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
110 #if [ "${out_prefix}" == "$(basename ${out_prefix} )" ]; then
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
111 # pth=`pwd`
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
112 # out_prefix=${pth}/${out_prefix}
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
113 #fi
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
114
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
115
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
116 echo GENE FPKM
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
117 echo moving start
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
118 date
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
119
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
120 mkdir fpkm_G
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
121 cd fpkm_G
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
122 mv ../c*_fpkm_G .
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
123
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
124
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
125 echo isoDE start
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
126 date
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
127
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
128
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
129 ${isoDEPath}/isodecalls $fpkmGeneCommand -out "output.txt"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
130 #awk '{for (f=1; f<=NF; f++) {if (f == NF) printf "%s",$f; else printf "%s\t", $f }; print ""}' Bootstrap_Merge1_DIR/output.txt | sed 1,1d > ${geneFPKMout_file}
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
131
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
132 echo awk command
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
133 date
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
134
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
135
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
136 awk '{if (NR == 1) {print "Gene ID\tConfident log2 FC\t Single run log2 FC\t c1 FPKM\tc2 FPKM";} else {if ($6 == 0 && $7 == 0) {two="NDE";} else {two=$2;} print $1 "\t" two "\t" $5 "\t" $6 "\t" $7}}' Bootstrap_Merge1_DIR/output.txt > ${geneFPKMout_file}
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
137
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
138 cd ..
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
139
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
140
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
141 echo ISOFORM FPKM
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
142
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
143 echo moving start
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
144 date
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
145
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
146 mkdir fpkm_I
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
147 cd fpkm_I
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
148 mv ../c*_fpkm_I .
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
149
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
150
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
151 echo isoDE start
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
152 date
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
153
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
154 ${isoDEPath}/isodecalls $fpkmIsoformCommand -out "output.txt"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
155
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
156 echo awk command
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
157 date
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
158 pwd
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
159 awk '{if (NR == 1) {print "Isoform ID\tConfident log2 FC\t Single run log2 FC\t c1 FPKM\tc2 FPKM";} else {if ($6 == 0 && $7 == 0) {two="NDE";} else {two=$2;} print $1 "\t" two "\t" $5 "\t" $6 "\t" $7}}' Bootstrap_Merge1_DIR/output.txt > ${isoFPKMout_file}
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
160 cd ..
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
161
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
162
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
163 echo ISOFORM TPM
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
164 echo moving start
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
165 date
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
166
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
167 mkdir tpm_G
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
168 cd tpm_G
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
169 mv ../c*_tpm_G .
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
170
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
171 echo isoDE start
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
172 date
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
173
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
174 ${isoDEPath}/isodecalls $tpmGeneCommand -out "output.txt"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
175
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
176 echo awk command
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
177 date
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
178 pwd
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
179 awk '{if (NR == 1) {print "Gene ID\tConfident log2 FC\t Single run log2 FC\t c1 TPM\tc2 TPM";} else {if ($6 == 0 && $7 == 0) {two="NDE";} else {two=$2;} print $1 "\t" two "\t" $5 "\t" $6 "\t" $7}}' Bootstrap_Merge1_DIR/output.txt > ${geneTPMout_file}
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
180 cd ..
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
181
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
182
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
183 echo ISOFORM TPM
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
184 echo moving start
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
185 date
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
186
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
187 mkdir tpm_I
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
188 cd tpm_I
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
189 mv ../c*_tpm_I .
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
190
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
191 echo isoDE start
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
192 date
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
193
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
194 ${isoDEPath}/isodecalls $tpmIsoformCommand -out "output.txt"
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
195
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
196 echo awk command
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
197 date
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
198
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
199 awk '{if (NR == 1) {print "Isoform ID\tConfident log2 FC\t Single run log2 FC\t c1 TPM\tc2 TPM";} else {if ($6 == 0 && $7 == 0) {two="NDE";} else {two=$2;} print $1 "\t" two "\t" $5 "\t" $6 "\t" $7}}' Bootstrap_Merge1_DIR/output.txt > ${isoTPMout_file}
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
200
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
201 cd ..
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
202
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
203
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
204 echo final cleanup
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
205 date
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
206 rm -fr fpkm_G fpkm_I tpm_G cd tpm_I
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
207 echo done
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
208 date
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
209
581e4c6b483f Uploaded
saharlcc
parents:
diff changeset
210