# HG changeset patch # User insilico-bob # Date 1485442393 18000 # Node ID e2b3920e20c18a859c58b64f1dc7ad9dd1a0febd # Parent aca930d68814f7779b9b3718d24a941e689b6f01 Uploaded diff -r aca930d68814 -r e2b3920e20c1 heatmap.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/heatmap.sh Thu Jan 26 09:53:13 2017 -0500 @@ -0,0 +1,47 @@ +echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} +#create temp directory for row and col order and dendro files. +tdir=${11}/$(date +%y%m%d%M%S) +echo $tdir +mkdir $tdir +#run R to cluster matrix +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)" +rc=$?; +if [ $rc != 0 ] +then + echo $output; + if [ `echo "$output" | grep -c "Inf in foreign function call"` -gt 0 ] + then + echo ""; + 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."; + fi + exit $rc; +fi + +#there are a variable number of triplicate parameters for classification bars +count=0 +classifications='' + +#if row cut was done, add that autogenerated classification +if [ ${12} -gt 1 ] +then + classifications="Class $tdir/ROfile.txt.cut row_categorical" +fi + +#if col cut was done, add that autogenerated classification +if [ ${13} -gt 1 ] +then + classifications="$classifications Class $tdir/COfile.txt.cut col_categorical" +fi + +#now add the user provided classification files +for i in "$@"; do + if [ $count -gt 14 ] + then + classifications=$classifications' '$i + fi + count=$((count+1)) +done +#call java program to generate NGCHM viewer files. +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 +#clean up tempdir +rm -rf $tdir