annotate heatmap_advanced.sh @ 1:603f99d9e776 draft

Version 2.2.1 embedded viewer
author insilico-bob
date Tue, 05 Dec 2017 14:59:26 -0500
parents 8893ea2915cc
children 19382473a76b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
1 #echo "1: " $1
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
2 #echo "2: " $2
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
3 #echo "3: " $3
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
4 #echo "4: " $4
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
5 #echo "5: " $5
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
6 #echo "6: " $6
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
7 #echo "7: " $7
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
8 #echo "8: " $8
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
9 #echo "9: " $9
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
10 #echo "10: " ${10}
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
11 #echo "11: " ${11}
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
12 #echo "12: " ${12}
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
13 #echo "13: " ${13}
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
14 #echo "14: " ${14}
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
15 #echo "15: " ${15}
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
16 #echo "16: " ${16}
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
17 #echo "17: " ${17}
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
18 #echo "18: " ${18}
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
19 #echo "19: " ${19}
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
20 #echo "20: " ${20}
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
21 #echo "21: " ${21}
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
22 #echo "22: " ${22}
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
23 #echo "23: " ${23}
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
24 #echo "23: " ${24}
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
25 #echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20} ${21} ${22} ${23}
0
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
26
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
27 #create temp directory for row and col order and dendro files.
1
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
28 tdir=${12}/$(date +%y%m%d%M%S)
0
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
29 echo $tdir
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
30 mkdir $tdir
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
31 #run R to cluster matrix
1
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
32 output="$(R --slave --vanilla --file=${12}/CHM_Advanced.R --args $4 $5 $6 $7 $8 $9 ${10} $tdir/ROfile.txt $tdir/COfile.txt $tdir/RDfile.txt $tdir/CDfile.txt ${13} ${14} ${15} ${16} 2>&1)"
0
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
33 rc=$?;
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
34 if [ $rc != 0 ]
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
35 then
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
36 echo $output;
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
37 if [ `echo "$output" | grep -c "Inf in foreign function call"` -gt 0 ]
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
38 then
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
39 echo "";
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
40 echo "Note: This error can occur when there is no variation in a row or column. Try a different distance measure or remove rows/columns without variation.";
1
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
41 echo "This error may also be caused when a covariate file has inadvertently been selected as an Input Matrix. Check your Input Matrix entry.";
0
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
42 fi
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
43 exit $rc;
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
44 fi
1
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
45
0
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
46 #there are a variable number of triplicate parameters for classification bars
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
47 count=0
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
48 classifications=''
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
49
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
50 #if row cut was done, add that autogenerated classification
1
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
51 if [ ${13} -gt 1 ]
0
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
52 then
1
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
53 classifications="Class $tdir/ROfile.txt.cut row_categorical color_plot"
0
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
54 fi
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
55
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
56 #if col cut was done, add that autogenerated classification
1
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
57 if [ ${14} -gt 1 ]
0
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
58 then
1
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
59 classifications="$classifications Class $tdir/COfile.txt.cut col_categorical color_plot"
0
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
60 fi
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
61
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
62 #now add the user provided classification files
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
63 for i in "$@"; do
1
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
64 if [ $count -gt 20 ]
0
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
65 then
1
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
66 # echo "class entry: " $i
0
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
67 classifications=$classifications' '$i
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
68 fi
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
69 count=$((count+1))
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
70 done
1
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
71 #echo "classifications: " $classifications
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
72
0
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
73 #call java program to generate NGCHM viewer files.
1
603f99d9e776 Version 2.2.1 embedded viewer
insilico-bob
parents: 0
diff changeset
74 java -jar ${12}/GalaxyMapGen.jar "${1}" "${2}" "${3}" DataLayer1 $4 linear ${15} ${16} $5 $6 $7 $tdir/ROfile.txt $tdir/RDfile.txt "${17}" "${19}" $8 $9 ${10} $tdir/COfile.txt $tdir/CDfile.txt "${18}" "${20}" ${11} "${21}" $classifications
0
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
75 #clean up tempdir
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
76 rm -rf $tdir