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