changeset 44:1d8728f3ff37 draft

Uploaded
author davidvanzessen
date Fri, 08 Dec 2017 05:47:33 -0500
parents 2325074a8461
children 942eea8359fe
files report_clonality/RScript.r report_clonality/circos/circos.tar.gz report_clonality/r_wrapper.sh
diffstat 3 files changed, 27 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/report_clonality/RScript.r	Thu Oct 26 09:58:05 2017 -0400
+++ b/report_clonality/RScript.r	Fri Dec 08 05:47:33 2017 -0500
@@ -441,7 +441,7 @@
       ylab("V Genes") +
       theme(panel.background = element_rect(fill = "white", colour="black"),text = element_text(size=15, colour="black"), panel.grid.major = element_line(colour = "gainsboro"))
     
-    png(paste("HeatmapVD_", unique(dat[3])[1,1] , ".png", sep=""), width=150+(15*length(Dchain$v.name)), height=100+(15*length(Vchain$v.name)))
+    png(paste("HeatmapVD_", unique(dat[3])[1,1] , ".png", sep=""), width=200+(15*length(Dchain$v.name)), height=100+(15*length(Vchain$v.name)))
     print(img)
     dev.off()
     
@@ -458,16 +458,11 @@
   VandDCount$relLength = VandDCount$l / VandDCount$max
   check = is.nan(VandDCount$relLength)
   if(any(check)){
-	VandDCount[check,"relLength"] = 0
+	  VandDCount[check,"relLength"] = 0
   }
-  
-  cartegianProductVD = expand.grid(Top.V.Gene = Vchain$v.name, Top.D.Gene = Dchain$v.name)
-  
-  completeVD = merge(VandDCount, cartegianProductVD, by.x=c("Top.V.Gene", "Top.D.Gene"), by.y=c("Top.V.Gene", "Top.D.Gene"), all=TRUE)
- 
-  completeVD = merge(completeVD, revVchain, by.x="Top.V.Gene", by.y="v.name", all.x=TRUE)
- 
-  completeVD = merge(completeVD, Dchain, by.x="Top.D.Gene", by.y="v.name", all.x=TRUE)
+
+  completeVD = merge(VandDCount, revVchain, by.x="Top.V.Gene", by.y="v.name", all=TRUE)
+  completeVD = merge(completeVD, Dchain, by.x="Top.D.Gene", by.y="v.name", all=TRUE)
   
   fltr = is.nan(completeVD$relLength)
   if(all(fltr)){
@@ -494,7 +489,7 @@
     ylab("V Genes") +
     theme(panel.background = element_rect(fill = "white", colour="black"),text = element_text(size=15, colour="black"), panel.grid.major = element_line(colour = "gainsboro"))
   
-  png(paste("HeatmapVJ_", unique(dat[3])[1,1] , ".png", sep=""), width=150+(15*length(Jchain$v.name)), height=100+(15*length(Vchain$v.name)))
+  png(paste("HeatmapVJ_", unique(dat[3])[1,1] , ".png", sep=""), width=200+(15*length(Jchain$v.name)), height=100+(15*length(Vchain$v.name)))
   print(img)
   dev.off()
   
@@ -503,6 +498,8 @@
   write.table(x=acast(dat, Top.V.Gene~Top.J.Gene, value.var="Length"), file=paste("HeatmapVJ_", unique(dat[3])[1,1], ".txt", sep=""), sep="\t",quote=F,row.names=T,col.names=NA)
 }
 
+
+
 VandJCount = data.frame(data.table(PRODF)[, list(Length=.N), by=c("Top.V.Gene", "Top.J.Gene", "Sample")])
 
 VandJCount$l = log(VandJCount$Length)
@@ -515,11 +512,8 @@
 	VandJCount[check,"relLength"] = 0
 }
 
-cartegianProductVJ = expand.grid(Top.V.Gene = Vchain$v.name, Top.J.Gene = Jchain$v.name)
-
-completeVJ = merge(VandJCount, cartegianProductVJ, all.y=TRUE)
-completeVJ = merge(completeVJ, revVchain, by.x="Top.V.Gene", by.y="v.name", all.x=TRUE)
-completeVJ = merge(completeVJ, Jchain, by.x="Top.J.Gene", by.y="v.name", all.x=TRUE)
+completeVJ = merge(VandJCount, revVchain, by.x="Top.V.Gene", by.y="v.name", all=TRUE)
+completeVJ = merge(completeVJ, Jchain, by.x="Top.J.Gene", by.y="v.name", all=TRUE)
 
 fltr = is.nan(completeVJ$relLength)
 if(any(fltr)){
@@ -546,7 +540,7 @@
       ylab("D Genes") +
       theme(panel.background = element_rect(fill = "white", colour="black"),text = element_text(size=15, colour="black"), panel.grid.major = element_line(colour = "gainsboro"))
     
-    png(paste("HeatmapDJ_", unique(dat[3])[1,1] , ".png", sep=""), width=150+(15*length(Jchain$v.name)), height=100+(15*length(Dchain$v.name)))
+    png(paste("HeatmapDJ_", unique(dat[3])[1,1] , ".png", sep=""), width=200+(15*length(Jchain$v.name)), height=100+(15*length(Dchain$v.name)))
     print(img)
     dev.off()
     
@@ -570,9 +564,8 @@
   
   cartegianProductDJ = expand.grid(Top.D.Gene = Dchain$v.name, Top.J.Gene = Jchain$v.name)
   
-  completeDJ = merge(DandJCount, cartegianProductDJ, all.y=TRUE)
-  completeDJ = merge(completeDJ, revDchain, by.x="Top.D.Gene", by.y="v.name", all.x=TRUE)
-  completeDJ = merge(completeDJ, Jchain, by.x="Top.J.Gene", by.y="v.name", all.x=TRUE)
+  completeDJ = merge(DandJCount, revDchain, by.x="Top.D.Gene", by.y="v.name", all=TRUE)
+  completeDJ = merge(completeDJ, Jchain, by.x="Top.J.Gene", by.y="v.name", all=TRUE)
   
   fltr = is.nan(completeDJ$relLength)
   if(any(fltr)){
@@ -995,7 +988,7 @@
 	clonaltype.in.replicates = clonaltype.in.replicates[!(is.na(clonaltype.in.replicates$ID) | is.na(clonaltype.in.replicates$Top.V.Gene) | is.na(clonaltype.in.replicates$Top.J.Gene)),]
 	clonaltype = unlist(strsplit(clonaltype, ","))
 
-	clonaltype.in.replicates$clonaltype = do.call(paste, c(clonaltype.in.replicates[paste_columns], sep = ":"))
+	clonaltype.in.replicates$clonaltype = do.call(paste, c(clonaltype.in.replicates[clonaltype], sep = ":"))
 
 	clonaltype.in.replicates = clonaltype.in.replicates[!duplicated(clonaltype.in.replicates$clonaltype),]
 
Binary file report_clonality/circos/circos.tar.gz has changed
--- a/report_clonality/r_wrapper.sh	Thu Oct 26 09:58:05 2017 -0400
+++ b/report_clonality/r_wrapper.sh	Fri Dec 08 05:47:33 2017 -0500
@@ -81,6 +81,12 @@
 		CIRCOSTOOLS="/home/galaxy/circos/circos-tools-0.22/tools"
 		CIRCOSDIR="/home/galaxy/Anaconda3/bin"
 	fi
+
+	if [ -d "/media/galaxy/data/other_backup/circos/galaxian-circos//bin" ]; then #hopefully temporary fix #or not #really not
+		USECIRCOS="yes"
+		CIRCOSTOOLS="/media/galaxy/data/other_backup/circos/galaxian-circos/tools"
+		CIRCOSDIR="/media/galaxy/data/other_backup/circos/galaxian-circos/bin"
+	fi
 fi
 
 echo "Using Circos: $USECIRCOS"
@@ -94,7 +100,12 @@
 	
 	circos_file="$outputDir/${sample}_VJ_circos.txt"
 	echo -e -n "labels$(cat ${circos_file})" > ${circos_file}
+	echo "Circos tools command:"
+	echo "cat \"${circos_file}\" | $CIRCOSTOOLS/tableviewer/bin/parse-table -configfile $dir/circos/parse-table.conf 2>&1 | $CIRCOSTOOLS/tableviewer/bin/make-conf -dir $outputDir/circos/"
 	cat "${circos_file}" | $CIRCOSTOOLS/tableviewer/bin/parse-table -configfile $dir/circos/parse-table.conf 2>&1 | $CIRCOSTOOLS/tableviewer/bin/make-conf -dir $outputDir/circos/
+	sed -i -- 's%/%:%g' $outputDir/circos/cells.txt
+	echo "Circos command:"
+	echo "$CIRCOSDIR/circos -conf $outputDir/circos/circos.conf 2>&1"
 	$CIRCOSDIR/circos -conf $outputDir/circos/circos.conf 2>&1
 	mv $outputDir/circos/circos.png $outputDir/circosVJ_${sample}.png
 	mv $outputDir/circos/circos.svg $outputDir/circosVJ_${sample}.svg
@@ -104,6 +115,7 @@
 		circos_file="$outputDir/${sample}_VD_circos.txt"
 		echo -e -n "labels$(cat ${circos_file})" > ${circos_file}
 		cat "${circos_file}" | $CIRCOSTOOLS/tableviewer/bin/parse-table -configfile $dir/circos/parse-table.conf 2>&1 | $CIRCOSTOOLS/tableviewer/bin/make-conf -dir $outputDir/circos/
+		sed -i -- 's%/%:%g' $outputDir/circos/cells.txt
 		$CIRCOSDIR/circos -conf $outputDir/circos/circos.conf 2>&1
 		mv $outputDir/circos/circos.png $outputDir/circosVD_${sample}.png
 		mv $outputDir/circos/circos.svg $outputDir/circosVD_${sample}.svg
@@ -111,6 +123,7 @@
 		circos_file="$outputDir/${sample}_DJ_circos.txt"
 		echo -e -n "labels$(cat ${circos_file})" > ${circos_file}
 		cat "${circos_file}" | $CIRCOSTOOLS/tableviewer/bin/parse-table -configfile $dir/circos/parse-table.conf 2>&1 | $CIRCOSTOOLS/tableviewer/bin/make-conf -dir $outputDir/circos/
+		sed -i -- 's%/%:%g' $outputDir/circos/cells.txt
 		$CIRCOSDIR/circos -conf $outputDir/circos/circos.conf 2>&1
 		mv $outputDir/circos/circos.png $outputDir/circosDJ_${sample}.png
 		mv $outputDir/circos/circos.svg $outputDir/circosDJ_${sample}.svg