33
|
1 #echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18}
|
32
|
2
|
2
|
3 #create temp directory for row and col order and dendro files.
|
33
|
4 tdir=${12}/$(date +%y%m%d%M%S)
|
2
|
5 echo $tdir
|
|
6 mkdir $tdir
|
32
|
7
|
2
|
8 #run R to cluster matrix
|
33
|
9 output="$(R --slave --vanilla --file=${12}/CHM.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)"
|
2
|
10 rc=$?;
|
|
11 if [ $rc != 0 ]
|
|
12 then
|
|
13 echo $output;
|
|
14 if [ `echo "$output" | grep -c "Inf in foreign function call"` -gt 0 ]
|
|
15 then
|
|
16 echo "";
|
|
17 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.";
|
33
|
18 echo "This error may also be caused when a covariate file has inadvertently been selected as an Input Matrix. Check your Input Matrix entry.";
|
2
|
19 fi
|
|
20 exit $rc;
|
|
21 fi
|
|
22
|
|
23 #there are a variable number of triplicate parameters for classification bars
|
|
24 count=0
|
|
25 classifications=''
|
|
26
|
|
27 #if row cut was done, add that autogenerated classification
|
33
|
28 if [ ${13} -gt 1 ]
|
2
|
29 then
|
|
30 classifications="Class $tdir/ROfile.txt.cut row_categorical"
|
|
31 fi
|
|
32
|
|
33 #if col cut was done, add that autogenerated classification
|
33
|
34 if [ ${14} -gt 1 ]
|
2
|
35 then
|
|
36 classifications="$classifications Class $tdir/COfile.txt.cut col_categorical"
|
|
37 fi
|
|
38
|
|
39 #now add the user provided classification files
|
|
40 for i in "$@"; do
|
33
|
41 if [ $count -gt 16 ]
|
2
|
42 then
|
|
43 classifications=$classifications' '$i
|
|
44 fi
|
|
45 count=$((count+1))
|
|
46 done
|
33
|
47 echo "classifications " $classifications
|
|
48 echo "${11} " ${11}
|
2
|
49 #call java program to generate NGCHM viewer files.
|
33
|
50 java -jar ${12}/GalaxyMapGen.jar "${1}" "${2}" "${3}" DataLayer1 $4 linear ${15} ${16} $5 $6 $7 $tdir/ROfile.txt $tdir/RDfile.txt $8 $9 ${10} $tdir/COfile.txt $tdir/CDfile.txt ${11} $classifications
|
2
|
51 #clean up tempdir
|
|
52 rm -rf $tdir
|