comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:8893ea2915cc
1 echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19}
2
3 #run python to validate the input matrix and covariate files (if any)
4 #output="$(python ${11}/mda_heatmap_gen.py $@)"
5 output=$(python ${11}/mda_heatmap_gen.py "$@")
6 rc=$?;
7 echo $output;
8 if [ $rc != 0 ]
9 then
10 exit $rc;
11 fi
12
13 #create temp directory for row and col order and dendro files.
14 tdir=${11}/$(date +%y%m%d%M%S)
15 echo $tdir
16 mkdir $tdir
17 #run R to cluster matrix
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)"
19 rc=$?;
20 if [ $rc != 0 ]
21 then
22 echo $output;
23 if [ `echo "$output" | grep -c "Inf in foreign function call"` -gt 0 ]
24 then
25 echo "";
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.";
27 fi
28 exit $rc;
29 fi
30
31 #there are a variable number of triplicate parameters for classification bars
32 count=0
33 classifications=''
34
35 #if row cut was done, add that autogenerated classification
36 if [ ${12} -gt 1 ]
37 then
38 classifications="Class $tdir/ROfile.txt.cut row_categorical"
39 fi
40
41 #if col cut was done, add that autogenerated classification
42 if [ ${13} -gt 1 ]
43 then
44 classifications="$classifications Class $tdir/COfile.txt.cut col_categorical"
45 fi
46
47 #now add the user provided classification files
48 for i in "$@"; do
49 if [ $count -gt 15 ]
50 then
51 classifications=$classifications' '$i
52 fi
53 count=$((count+1))
54 done
55 #call java program to generate NGCHM viewer files.
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
57 #clean up tempdir
58 rm -rf $tdir