view heatmap.sh @ 36:11a5827d5559 draft

Uploaded
author insilico-bob
date Tue, 06 Nov 2018 16:29:17 -0500
parents 58437af2d675
children 605ec840a06b
line wrap: on
line source

#echo $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18}

#get tool data and tool install directories
tooldir=$(cut -d';' -f1 <<< ${12})
tooldata=$(cut -d';' -f2 <<< ${12})

#create temp directory for row and col order and dendro files.
tdir=$tooldata/$(date +%y%m%d%M%S)
echo $tdir
mkdir $tdir

#run R to cluster matrix
output="$(R --slave --vanilla --file=$tooldir/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)"
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.";
    echo "This error may also be caused when a covariate file has inadvertently been selected as an Input Matrix.  Check your Input Matrix entry.";
  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 [ ${13} -gt 1 ]
then
  classifications="Class $tdir/ROfile.txt.cut row_categorical"
fi

#if col cut was done, add that autogenerated classification
if [ ${14} -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 16 ]
  then
    classifications=$classifications' '$i
  fi
  count=$((count+1))
done
echo "classifications " $classifications
echo "${11} " ${11}
#call java program to generate NGCHM viewer files.
java -jar $tooldir/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
#clean up tempdir
rm -rf $tdir