comparison r_wrapper.sh @ 10:06777331fbd8 draft

Uploaded
author davidvanzessen
date Thu, 15 May 2014 09:27:22 -0400
parents 712f3e9924d5
children 866d22e60e60
comparison
equal deleted inserted replaced
9:712f3e9924d5 10:06777331fbd8
2 2
3 inputFile=$1 3 inputFile=$1
4 outputDir=$3 4 outputDir=$3
5 outputFile=$3/index.html #$2 5 outputFile=$3/index.html #$2
6 clonalType=$4 6 clonalType=$4
7 species=$5
8 locus=$6
9 selection=$7
10 useD="false"
11 if [[ "$species" == "human" && "$locus" = "igh" ]] ; then
12 useD="true"
13 fi
7 dir="$(cd "$(dirname "$0")" && pwd)" 14 dir="$(cd "$(dirname "$0")" && pwd)"
8 mkdir $3 15 mkdir $3
9 Rscript --verbose $dir/RScript.r $inputFile $outputDir $outputDir $clonalType 2>&1 16 Rscript --verbose $dir/RScript.r $inputFile $outputDir $outputDir $clonalType $species $locus $selection 2>&1
10 cp $dir/tabber.js $outputDir 17 cp $dir/tabber.js $outputDir
11 cp $dir/style.css $outputDir 18 cp $dir/style.css $outputDir
12 cp $dir/script.js $outputDir 19 cp $dir/script.js $outputDir
13 cp $dir/jquery-1.11.0.min.js $outputDir 20 cp $dir/jquery-1.11.0.min.js $outputDir
14 cp $dir/jquery.tablesorter.min.js $outputDir 21 cp $dir/jquery.tablesorter.min.js $outputDir
15 cp $dir/asc.gif $outputDir 22 cp $dir/asc.gif $outputDir
16 cp $dir/desc.gif $outputDir 23 cp $dir/desc.gif $outputDir
17 cp $dir/bg.gif $outputDir 24 cp $dir/bg.gif $outputDir
25 samples=`cat $outputDir/samples.txt`
18 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 26 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
19 echo "<html<head>" >> $outputFile 27 echo "<html><head><title>Report on:" >> $outputFile
20 echo "<script type='text/javascript' src='jquery-1.11.0.min.js'></script>" >> $outputFile 28 for sample in $samples; do
29 echo " $sample" >> $outputFile
30 done
31 echo "</title><script type='text/javascript' src='jquery-1.11.0.min.js'></script>" >> $outputFile
21 echo "<script type='text/javascript' src='tabber.js'></script>" >> $outputFile 32 echo "<script type='text/javascript' src='tabber.js'></script>" >> $outputFile
22 echo "<script type='text/javascript' src='script.js'></script>" >> $outputFile 33 echo "<script type='text/javascript' src='script.js'></script>" >> $outputFile
23 echo "<script type='text/javascript' src='jquery.tablesorter.min.js'></script>" >> $outputFile 34 echo "<script type='text/javascript' src='jquery.tablesorter.min.js'></script>" >> $outputFile
24 echo "<link rel='stylesheet' type='text/css' href='style.css'></head>" >> $outputFile 35 echo "<link rel='stylesheet' type='text/css' href='style.css'></head>" >> $outputFile
25 echo "<div class='tabber'><div class='tabbertab' title='Gene frequencies'>" >> $outputFile 36 echo "<div class='tabber'><div class='tabbertab' title='Gene frequencies'>" >> $outputFile
26 37
27 echo "<img src='CDR3LengthPlot.png'/><br />" >> $outputFile 38 echo "<img src='CDR3LengthPlot.png'/><br />" >> $outputFile
28 echo "<img src='VFPlot.png'/>" >> $outputFile 39 echo "<img src='VFPlot.png'/>" >> $outputFile
29 echo "<img src='DFPlot.png'/>" >> $outputFile 40 if [[ "$useD" == "true" ]] ; then
41 echo "<img src='DFPlot.png'/>" >> $outputFile
42 fi
30 echo "<img src='JFPlot.png'/>" >> $outputFile 43 echo "<img src='JFPlot.png'/>" >> $outputFile
31 echo "<img src='VPlot.png'/>" >> $outputFile 44 echo "<img src='VPlot.png'/>" >> $outputFile
32 echo "<img src='DPlot.png'/>" >> $outputFile 45 if [[ "$useD" == "true" ]] ; then
46 echo "<img src='DPlot.png'/>" >> $outputFile
47 fi
33 echo "<img src='JPlot.png'/></div>" >> $outputFile 48 echo "<img src='JPlot.png'/></div>" >> $outputFile
34 49
35 samples=`cat $outputDir/samples.txt`
36 count=1 50 count=1
37 echo "<div class='tabbertab' title='Heatmaps'><div class='tabber'>" >> $outputFile 51 echo "<div class='tabbertab' title='Heatmaps'><div class='tabber'>" >> $outputFile
38 for sample in $samples; do 52 for sample in $samples; do
39 echo "<div class='tabbertab' title='$sample'><table border='1'><tr>" >> $outputFile 53 echo "<div class='tabbertab' title='$sample'><table border='1'><tr>" >> $outputFile
40 echo "<td><img src='HeatmapVD_$sample.png'/></td>" >> $outputFile 54 if [[ "$useD" == "true" ]] ; then
55 echo "<td><img src='HeatmapVD_$sample.png'/></td>" >> $outputFile
56 fi
41 echo "<td><img src='HeatmapVJ_$sample.png'/></td>" >> $outputFile 57 echo "<td><img src='HeatmapVJ_$sample.png'/></td>" >> $outputFile
42 echo "<td><img src='HeatmapDJ_$sample.png'/></td></tr></table></div>" >> $outputFile 58 if [[ "$useD" == "true" ]] ; then
59 echo "<td><img src='HeatmapDJ_$sample.png'/></td>" >> $outputFile
60 fi
61 echo "</tr></table></div>" >> $outputFile
43 count=$((count+1)) 62 count=$((count+1))
44 done 63 done
45 echo "</div></div>" >> $outputFile 64 echo "</div></div>" >> $outputFile
46 65
66 #echo "<div class='tabbertab' title='Interactive'><svg class='chart'></svg><script src='http://d3js.org/d3.v3.min.js'></script></div>" >> $outputFile
47 67
48 hasReplicateColumn="$(if head -n 1 $inputFile | grep -q 'Replicate'; then echo 'Yes'; else echo 'No'; fi)" 68 hasReplicateColumn="$(if head -n 1 $inputFile | grep -q 'Replicate'; then echo 'Yes'; else echo 'No'; fi)"
49 echo "$hasReplicateColumn" 69 echo "$hasReplicateColumn"
50 #if its a 'new' merged file with replicate info 70 #if its a 'new' merged file with replicate info
51 if [[ "$hasReplicateColumn" == "Yes" ]] ; then 71 if [[ "$hasReplicateColumn" == "Yes" ]] ; then
108 echo "<tr><td>The dataset used to calculate clonality score (Unique based on clonaltype, $clonalType)</td><td><a href='clonalityComplete.csv'>Download</a></td></tr>" >> $outputFile 128 echo "<tr><td>The dataset used to calculate clonality score (Unique based on clonaltype, $clonalType)</td><td><a href='clonalityComplete.csv'>Download</a></td></tr>" >> $outputFile
109 129
110 echo "<tr><td>The dataset used to generate the CDR3 length frequency graph</td><td><a href='CDR3LengthPlot.csv'>Download</a></td></tr>" >> $outputFile 130 echo "<tr><td>The dataset used to generate the CDR3 length frequency graph</td><td><a href='CDR3LengthPlot.csv'>Download</a></td></tr>" >> $outputFile
111 131
112 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 132 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
113 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 133 if [[ "$useD" == "true" ]] ; then
134 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
135 fi
114 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 136 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
115 137
116 echo "<tr><td>The dataset used to generate the V gene frequency graph</td><td><a href='VFrequency.csv'>Download</a></td></tr>" >> $outputFile 138 echo "<tr><td>The dataset used to generate the V gene frequency graph</td><td><a href='VFrequency.csv'>Download</a></td></tr>" >> $outputFile
117 echo "<tr><td>The dataset used to generate the D gene frequency graph</td><td><a href='DFrequency.csv'>Download</a></td></tr>" >> $outputFile 139 if [[ "$useD" == "true" ]] ; then
140 echo "<tr><td>The dataset used to generate the D gene frequency graph</td><td><a href='DFrequency.csv'>Download</a></td></tr>" >> $outputFile
141 fi
118 echo "<tr><td>The dataset used to generate the J gene frequency graph</td><td><a href='JFrequency.csv'>Download</a></td></tr>" >> $outputFile 142 echo "<tr><td>The dataset used to generate the J gene frequency graph</td><td><a href='JFrequency.csv'>Download</a></td></tr>" >> $outputFile
119 143
120 for sample in $samples; do 144 for sample in $samples; do
121 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 145 if [[ "$useD" == "true" ]] ; then
146 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
147 fi
122 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 148 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
123 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 149 if [[ "$useD" == "true" ]] ; then
150 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
151 fi
124 done 152 done
125 153
126 echo "</table>" >> $outputFile 154 echo "</table>" >> $outputFile
127 echo "</div></html>" >> $outputFile 155 echo "</div></html>" >> $outputFile