annotate heatmap_advanced.sh @ 0:8893ea2915cc draft

Initial Version of Advanced Heat Map Tool
author insilico-bob
date Tue, 08 Aug 2017 14:01:05 -0400
parents
children 603f99d9e776
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
1 echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19}
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
2
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
3 #run python to validate the input matrix and covariate files (if any)
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
4 #output="$(python ${11}/mda_heatmap_gen.py $@)"
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
5 output=$(python ${11}/mda_heatmap_gen.py "$@")
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
6 rc=$?;
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
7 echo $output;
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
8 if [ $rc != 0 ]
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
9 then
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
10 exit $rc;
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
11 fi
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
12
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
13 #create temp directory for row and col order and dendro files.
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
14 tdir=${11}/$(date +%y%m%d%M%S)
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
15 echo $tdir
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
16 mkdir $tdir
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
17 #run R to cluster matrix
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
18 output="$(R --slave --vanilla --file=${11}/CHM_Advanced.R --args $3 $4 $5 $6 $7 $8 $9 $tdir/ROfile.txt $tdir/COfile.txt $tdir/RDfile.txt $tdir/CDfile.txt ${12} ${13} ${14} ${15} 2>&1)"
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
19 rc=$?;
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
20 if [ $rc != 0 ]
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
21 then
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
22 echo $output;
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
23 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
24 then
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
25 echo "";
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
26 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.";
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
27 fi
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
28 exit $rc;
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
29 fi
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
30
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
31 #there are a variable number of triplicate parameters for classification bars
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
32 count=0
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
33 classifications=''
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
34
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
35 #if row cut was done, add that autogenerated classification
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
36 if [ ${12} -gt 1 ]
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
37 then
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
38 classifications="Class $tdir/ROfile.txt.cut row_categorical"
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
39 fi
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
40
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
41 #if col cut was done, add that autogenerated classification
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
42 if [ ${13} -gt 1 ]
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
43 then
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
44 classifications="$classifications Class $tdir/COfile.txt.cut col_categorical"
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
45 fi
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
46
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
47 #now add the user provided classification files
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
48 for i in "$@"; do
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
49 if [ $count -gt 15 ]
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
50 then
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
51 classifications=$classifications' '$i
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
52 fi
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
53 count=$((count+1))
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
54 done
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
55 #call java program to generate NGCHM viewer files.
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
56 java -jar ${11}/GalaxyMapGen.jar "${1}" "${2}" DataLayer1 $3 linear ${14} ${15} $4 $5 $6 $tdir/ROfile.txt $tdir/RDfile.txt $7 $8 $9 $tdir/COfile.txt $tdir/CDfile.txt ${10} "${16}" $classifications
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
57 #clean up tempdir
8893ea2915cc Initial Version of Advanced Heat Map Tool
insilico-bob
parents:
diff changeset
58 rm -rf $tdir