diff report_clonality/RScript.r @ 15:02efa5764a0a draft

Uploaded
author davidvanzessen
date Tue, 20 Dec 2016 08:36:12 -0500
parents 15961ca8d9ce
children da95be204ebc
line wrap: on
line diff
--- a/report_clonality/RScript.r	Tue Dec 20 06:26:44 2016 -0500
+++ b/report_clonality/RScript.r	Tue Dec 20 08:36:12 2016 -0500
@@ -374,7 +374,7 @@
 CDR3Length = merge(CDR3Length, TotalPerSample, by="Sample")
 CDR3Length$Frequency = CDR3Length$Count * 100 / CDR3Length$total
 CDR3LengthPlot = ggplot(CDR3Length)
-CDR3LengthPlot = CDR3LengthPlot + geom_bar(aes( x = CDR3.Length, y = Frequency, fill = Sample), stat='identity', position='dodge' ) + theme(axis.text.x = element_text(angle = 90, hjust = 1)) + 
+CDR3LengthPlot = CDR3LengthPlot + geom_bar(aes( x = factor(reorder(CDR3.Length, as.numeric(CDR3.Length))), y = Frequency, fill = Sample), stat='identity', position='dodge' ) + theme(axis.text.x = element_text(angle = 90, hjust = 1)) + 
   ggtitle("Length distribution of CDR3") + 
   xlab("CDR3 Length") + 
   ylab("Percentage of sequences") +