Mercurial > repos > davidvanzessen > report_igg
comparison r_wrapper.sh @ 0:5391c639d6da draft default tip
Uploaded
| author | davidvanzessen |
|---|---|
| date | Thu, 23 Jan 2014 08:19:04 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:5391c639d6da |
|---|---|
| 1 #!/bin/bash | |
| 2 echo $1 | |
| 3 echo $2 | |
| 4 echo $3 | |
| 5 | |
| 6 inputFile=$1 | |
| 7 outputFile=$2 | |
| 8 outputDir=$3 | |
| 9 clonalType=$4 | |
| 10 dir="$(cd "$(dirname "$0")" && pwd)" | |
| 11 mkdir $3 | |
| 12 Rscript --verbose $dir/RScript.r $inputFile $outputDir $outputDir $clonalType 2>&1 | |
| 13 echo "<html>" >> $2 | |
| 14 echo "<img src='VPlot.png'/>" >> $2 | |
| 15 echo "<img src='DPlot.png'/>" >> $2 | |
| 16 echo "<img src='JPlot.png'/>" >> $2 | |
| 17 | |
| 18 samples=`cat $outputDir/samples.txt` | |
| 19 count=1 | |
| 20 echo "<table border='1'><caption><a href='allUnique.tsv'><h3>$clonalType</h3></a></caption>" >> $outputFile | |
| 21 hasReplicateColumn="$(if head -n 1 $inputFile | grep -q 'Replicate'; then echo 'Yes'; else echo 'No'; fi)" | |
| 22 for sample in $samples; do | |
| 23 clonalityScore="$(cat $outputDir/ClonalityScore_$sample.csv)" | |
| 24 echo "<tr><td colspan='3' height='100'></td></tr>" >> $outputFile | |
| 25 echo "<tr><td colspan='3'><h1>$sample</h1></td></tr>" >> $outputFile | |
| 26 | |
| 27 echo "$hasReplicateColumn" | |
| 28 #if its a 'new' merged file with replicate info | |
| 29 if [[ "$hasReplicateColumn" == "Yes" ]] ; then | |
| 30 echo "<tr><td colspan='3'><a href='clonality_$sample.tsv'><h2>Clonality Score: $clonalityScore</h2></a></td></tr>" >> $outputFile | |
| 31 | |
| 32 #replicate,reads,squared | |
| 33 echo "<tr><td colspan='3'><table border='1'><tr><th>Replicate ID</th><th>Number of Reads</th><th>Reads Squared</th></tr>" >> $outputFile | |
| 34 while IFS=, read replicate reads squared | |
| 35 do | |
| 36 | |
| 37 echo "<tr><td><a href='clonality_${sample}_$replicate.tsv'>$replicate</a></td><td>$reads</td><td>$squared</td></tr>" >> $outputFile | |
| 38 done < $outputDir/ReplicateReads_$sample.csv | |
| 39 | |
| 40 #sum of reads and reads squared | |
| 41 while IFS=, read readsSum squaredSum | |
| 42 do | |
| 43 echo "<tr><td>Sum</td><td>$readsSum</td><td>$squaredSum</td></tr>" >> $outputFile | |
| 44 done < $outputDir/ReplicateSumReads_$sample.csv | |
| 45 | |
| 46 echo "</table></td></tr>" >> $outputFile | |
| 47 | |
| 48 #overview | |
| 49 echo "<tr><td colspan='3'><table border='1'><tr><th>Coincidence Type</th><th>Raw Coincidence Freq</th><th>Coincidence Weight</th><th>Coincidences, Weighted</th></tr>" >> $outputFile | |
| 50 while IFS=, read type count weight weightedCount | |
| 51 do | |
| 52 echo "<tr><td>$type</td><td>$count</td><td>$weight</td><td>$weightedCount</td></tr>" >> $outputFile | |
| 53 done < $outputDir/ClonalityOverView_$sample.csv | |
| 54 echo "</table></td></tr>" >> $outputFile | |
| 55 fi | |
| 56 | |
| 57 echo "<tr><td><h2>V-D Heatmap:</h2></td><td><h2>V-J Heatmap:</h2></td><td><h2>D-J Heatmap:</h2></td></tr><tr>" >> $outputFile | |
| 58 mv "$outputDir/HeatmapVD_$sample.png" "$outputDir/VD_$sample.png" | |
| 59 echo "<td><img src='VD_$sample.png'/></td>" >> $outputFile | |
| 60 mv "$outputDir/HeatmapVJ_$sample.png" "$outputDir/VJ_$sample.png" | |
| 61 echo "<td><img src='VJ_$sample.png'/></td>" >> $outputFile | |
| 62 mv "$outputDir/HeatmapDJ_$sample.png" "$outputDir/DJ_$sample.png" | |
| 63 echo "<td><img src='DJ_$sample.png'/></td></tr>" >> $outputFile | |
| 64 count=$((count+1)) | |
| 65 done | |
| 66 echo "</table>" >> $outputFile | |
| 67 | |
| 68 echo "</html>" >> $2 | |
| 69 |
