annotate heatmap.sh @ 32:16593e40c2cd draft

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