diff r_wrapper.sh @ 10:06777331fbd8 draft

Uploaded
author davidvanzessen
date Thu, 15 May 2014 09:27:22 -0400
parents 712f3e9924d5
children 866d22e60e60
line wrap: on
line diff
--- a/r_wrapper.sh	Wed Mar 26 11:55:13 2014 -0400
+++ b/r_wrapper.sh	Thu May 15 09:27:22 2014 -0400
@@ -4,9 +4,16 @@
 outputDir=$3
 outputFile=$3/index.html #$2
 clonalType=$4
+species=$5
+locus=$6
+selection=$7
+useD="false"
+if [[ "$species" == "human" && "$locus" = "igh" ]] ; then
+	useD="true"
+fi
 dir="$(cd "$(dirname "$0")" && pwd)"
 mkdir $3
-Rscript --verbose $dir/RScript.r $inputFile $outputDir $outputDir $clonalType 2>&1
+Rscript --verbose $dir/RScript.r $inputFile $outputDir $outputDir $clonalType $species $locus $selection 2>&1
 cp $dir/tabber.js $outputDir
 cp $dir/style.css $outputDir
 cp $dir/script.js $outputDir
@@ -15,9 +22,13 @@
 cp $dir/asc.gif $outputDir
 cp $dir/desc.gif $outputDir
 cp $dir/bg.gif $outputDir
+samples=`cat $outputDir/samples.txt`
 echo "<html><center><h1><a href='index.html'>Click here for the results</a></h1>Tip: Open it in a new tab (middle mouse button or right mouse button -> 'open in new tab' on the link above)</center></html>" > $2
-echo "<html<head>" >> $outputFile
-echo "<script type='text/javascript' src='jquery-1.11.0.min.js'></script>" >> $outputFile
+echo "<html><head><title>Report on:" >> $outputFile
+for sample in $samples; do
+	echo " $sample" >> $outputFile
+done
+echo "</title><script type='text/javascript' src='jquery-1.11.0.min.js'></script>" >> $outputFile
 echo "<script type='text/javascript' src='tabber.js'></script>" >> $outputFile
 echo "<script type='text/javascript' src='script.js'></script>" >> $outputFile
 echo "<script type='text/javascript' src='jquery.tablesorter.min.js'></script>" >> $outputFile
@@ -26,24 +37,33 @@
 
 echo "<img src='CDR3LengthPlot.png'/><br />" >> $outputFile
 echo "<img src='VFPlot.png'/>" >> $outputFile
-echo "<img src='DFPlot.png'/>" >> $outputFile
+if [[ "$useD" == "true" ]] ; then
+	echo "<img src='DFPlot.png'/>" >> $outputFile
+fi
 echo "<img src='JFPlot.png'/>" >> $outputFile
 echo "<img src='VPlot.png'/>" >> $outputFile
-echo "<img src='DPlot.png'/>" >> $outputFile
+if [[ "$useD" == "true" ]] ; then
+	echo "<img src='DPlot.png'/>" >> $outputFile
+fi
 echo "<img src='JPlot.png'/></div>" >> $outputFile
 
-samples=`cat $outputDir/samples.txt`
 count=1
 echo "<div class='tabbertab' title='Heatmaps'><div class='tabber'>" >> $outputFile
 for sample in $samples; do
 	echo "<div class='tabbertab' title='$sample'><table border='1'><tr>" >> $outputFile
-	echo "<td><img src='HeatmapVD_$sample.png'/></td>" >> $outputFile
+	if [[ "$useD" == "true" ]] ; then
+		echo "<td><img src='HeatmapVD_$sample.png'/></td>" >> $outputFile
+	fi
 	echo "<td><img src='HeatmapVJ_$sample.png'/></td>" >> $outputFile
-	echo "<td><img src='HeatmapDJ_$sample.png'/></td></tr></table></div>" >> $outputFile
+	if [[ "$useD" == "true" ]] ; then
+		echo "<td><img src='HeatmapDJ_$sample.png'/></td>" >> $outputFile
+	fi
+	echo "</tr></table></div>" >> $outputFile
 	count=$((count+1))
 done
 echo "</div></div>" >> $outputFile
 
+#echo "<div class='tabbertab' title='Interactive'><svg class='chart'></svg><script src='http://d3js.org/d3.v3.min.js'></script></div>" >> $outputFile
 
 hasReplicateColumn="$(if head -n 1 $inputFile | grep -q 'Replicate'; then echo 'Yes'; else echo 'No'; fi)"
 echo "$hasReplicateColumn"
@@ -110,17 +130,25 @@
 echo "<tr><td>The dataset used to generate the CDR3 length frequency graph</td><td><a href='CDR3LengthPlot.csv'>Download</a></td></tr>" >> $outputFile
 
 echo "<tr><td>The dataset used to generate the V gene family frequency graph</td><td><a href='VFFrequency.csv'>Download</a></td></tr>" >> $outputFile
-echo "<tr><td>The dataset used to generate the D gene family frequency graph</td><td><a href='DFFrequency.csv'>Download</a></td></tr>" >> $outputFile
+if [[ "$useD" == "true" ]] ; then
+	echo "<tr><td>The dataset used to generate the D gene family frequency graph</td><td><a href='DFFrequency.csv'>Download</a></td></tr>" >> $outputFile
+fi
 echo "<tr><td>The dataset used to generate the J gene family frequency graph</td><td><a href='JFFrequency.csv'>Download</a></td></tr>" >> $outputFile
 
 echo "<tr><td>The dataset used to generate the V gene frequency graph</td><td><a href='VFrequency.csv'>Download</a></td></tr>" >> $outputFile
-echo "<tr><td>The dataset used to generate the D gene frequency graph</td><td><a href='DFrequency.csv'>Download</a></td></tr>" >> $outputFile
+if [[ "$useD" == "true" ]] ; then
+	echo "<tr><td>The dataset used to generate the D gene frequency graph</td><td><a href='DFrequency.csv'>Download</a></td></tr>" >> $outputFile
+fi
 echo "<tr><td>The dataset used to generate the J gene frequency graph</td><td><a href='JFrequency.csv'>Download</a></td></tr>" >> $outputFile
 
 for sample in $samples; do
-	echo "<tr><td>The data used to generate the VD heatmap for $sample.</td><td><a href='HeatmapVD_$sample.csv'>Download</a></td></tr>" >> $outputFile
+	if [[ "$useD" == "true" ]] ; then
+		echo "<tr><td>The data used to generate the VD heatmap for $sample.</td><td><a href='HeatmapVD_$sample.csv'>Download</a></td></tr>" >> $outputFile
+	fi
 	echo "<tr><td>The data used to generate the VJ heatmap for $sample.</td><td><a href='HeatmapVJ_$sample.csv'>Download</a></td></tr>" >> $outputFile
-	echo "<tr><td>The data used to generate the DJ heatmap for $sample.</td><td><a href='HeatmapDJ_$sample.csv'>Download</a></td></tr>" >> $outputFile
+	if [[ "$useD" == "true" ]] ; then
+		echo "<tr><td>The data used to generate the DJ heatmap for $sample.</td><td><a href='HeatmapDJ_$sample.csv'>Download</a></td></tr>" >> $outputFile
+	fi
 done
 
 echo "</table>" >> $outputFile