changeset 17:da95be204ebc draft

Uploaded
author davidvanzessen
date Wed, 21 Dec 2016 05:57:31 -0500
parents 21ca9391a3b7
children 5d11c9139a55
files complete_immunerepertoire.xml report_clonality/IGH_junctie_analyse.png report_clonality/RScript.r report_clonality/r_wrapper.sh
diffstat 4 files changed, 25 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/complete_immunerepertoire.xml	Tue Dec 20 09:06:51 2016 -0500
+++ b/complete_immunerepertoire.xml	Wed Dec 21 05:57:31 2016 -0500
@@ -103,9 +103,10 @@
 			<option value="no">No</option>
 		</param>
 		
-		<param name="clonality_method" type="select" label="Old clonality algorithm or the newer R package">
-			<option value="old">Old</option>
-			<option value="boyd">R Package (needs 3 replicate minimum)</option>
+		<param name="clonality_method" type="select" label="Shared clonal types / clonality">
+			<option value="none">Do not determine overlap (only 1 replicate present)</option>
+			<option value="old">Determine the number of sequences that share the same clonal type between the replicates</option>
+			<option value="boyd">Determine the clonality of the donor (minimal 3 replicates)</option>
 		</param>
 	</inputs>
 	<outputs>
Binary file report_clonality/IGH_junctie_analyse.png has changed
--- a/report_clonality/RScript.r	Tue Dec 20 09:06:51 2016 -0500
+++ b/report_clonality/RScript.r	Wed Dec 21 05:57:31 2016 -0500
@@ -594,7 +594,10 @@
         res = merge(res, clone_table, by="paste", all=T)
       }
       
-      res[is.na(res)] = 0      
+      res[is.na(res)] = 0
+      
+      write.table(res, file=paste("raw_clonality_", sample_id, ".csv", sep=""), sep=",",quote=F,row.names=F,col.names=F)
+      
       infer.result = infer.clonality(as.matrix(res[,2:ncol(res)]))
       
       #print(infer.result)
@@ -607,7 +610,7 @@
       colnames(coincidence.table) = c("Coincidence Type",  "Raw Coincidence Freq")
       write.table(coincidence.table, file=paste("lymphclon_coincidences_", sample_id, ".csv", sep=""), sep=",",quote=F,row.names=F,col.names=T)
     }
-  } else {
+  } else if(clonality_method == "old") {
     clonalFreq = data.frame(data.table(clonalityFrame)[, list(Type=.N), by=c("Sample", "clonaltype")])
     
     #write files for every coincidence group of >1
--- a/report_clonality/r_wrapper.sh	Tue Dec 20 09:06:51 2016 -0500
+++ b/report_clonality/r_wrapper.sh	Wed Dec 21 05:57:31 2016 -0500
@@ -32,6 +32,7 @@
 cp $dir/script.js $outputDir
 cp $dir/jquery-1.11.0.min.js $outputDir
 cp $dir/pure-min.css $outputDir
+cp $dir/IGH_junctie_analyse.png $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)<br />" > $2
@@ -182,18 +183,26 @@
 hasReplicateColumn="$(if head -n 1 $inputFile | grep -q 'Replicate'; then echo 'Yes'; else echo 'No'; fi)"
 echo "$hasReplicateColumn"
 #if its a 'new' merged file with replicate info
-if [[ "$hasReplicateColumn" == "Yes" ]] ; then
-	echo "<div class='tabbertab' title='Clonality'><div class='tabber'>" >> $outputFile
+if [[ "$hasReplicateColumn" == "Yes" && "${clonality_method}" != "none" ]] ; then
+	if [[ "${clonality_method}" == "boyd" ]] ; then
+		echo "<div class='tabbertab' title='Clonality'><div class='tabber'>" >> $outputFile
+	else
+		echo "<div class='tabbertab' title='Shared Clonal Types'><div class='tabber'>" >> $outputFile
+	fi
+	
 	for sample in $samples; do
 		echo "${clonality_method}"
 		if [[ "${clonality_method}" == "old" ]] ; then
 			echo "in old"
 			clonalityScore="$(cat $outputDir/ClonalityScore_$sample.csv)"
 			echo "<div class='tabbertab' title='$sample'><table class='pure-table pure-table-striped'>" >> $outputFile
-			echo "<thead><tr><th colspan='4'>Clonality Score: $clonalityScore</th></tr></thead>" >> $outputFile
+			
+			if [[ "${clonality_method}" == "boyd" ]] ; then
+				echo "<thead><tr><th colspan='2'>Clonality Score: $clonalityScore</th></tr></thead>" >> $outputFile
+			fi
 
 			#replicate,reads,squared
-			echo "<tr><td>Replicate ID</td><td>Number of Reads</td></tr>" >> $outputFile
+			echo "<tr><td>Replicate ID</td><td>Number of Sequences</td></tr>" >> $outputFile
 			while IFS=, read replicate reads squared
 			do
 				echo "<tr><td>$replicate</td><td>$reads</td></tr>" >> $outputFile
@@ -206,7 +215,7 @@
 			done < $outputDir/ReplicateSumReads_$sample.csv
 			
 			#overview
-			echo "<tr><td>Coincidence Type</td><td>Raw Coincidence Freq</td></tr>" >> $outputFile
+			echo "<tr><td>Number of replicates containing the coincidence</td><td>Number of sequences shared between replicates</td></tr>" >> $outputFile
 			while IFS=, read type count weight weightedCount
 			do
 				if [[ "$type" -eq "1" ]]; then
@@ -238,6 +247,8 @@
 #if [[ "$hasJunctionData" == "Yes" ]] ; then
 if [ -a "$outputDir/junctionAnalysisProd_mean.csv" ] ; then
 	echo "<div class='tabbertab' title='Junction Analysis'>" >> $outputFile
+	echo "<img src='IGH_junctie_analyse.png' />" >> $outputFile
+	
 	echo "<table class='pure-table pure-table-striped' id='junction_table'> <caption>Productive mean</caption><thead><tr><th>Sample</th><th>count</th><th>V.DEL</th><th>P1</th><th>N1</th><th>P2</th><th>DEL.D</th><th>D.DEL</th><th>P3</th><th>N2</th><th>P4</th><th>DEL.J</th><th>Total.Del</th><th>Total.N</th><th>Total.P</th><th>Median.CDR3</th><thead></tr><tbody>" >> $outputFile
 	while IFS=, read Sample unique VDEL P1 N1 P2 DELD DDEL P3 N2 P4 DELJ TotalDel TotalN TotalP median
 	do