diff report_clonality/RScript.r @ 18:5d11c9139a55 draft

Uploaded
author davidvanzessen
date Wed, 21 Dec 2016 11:53:03 -0500
parents da95be204ebc
children 9185c3dfc679
line wrap: on
line diff
--- a/report_clonality/RScript.r	Wed Dec 21 05:57:31 2016 -0500
+++ b/report_clonality/RScript.r	Wed Dec 21 11:53:03 2016 -0500
@@ -159,7 +159,7 @@
 
 #write the complete dataset that is left over, will be the input if 'none' for clonaltype and 'no' for filterproductive
 write.table(PRODF, "allUnique.txt", sep="\t",quote=F,row.names=F,col.names=T)
-write.table(PRODF, "allUnique.csv", sep=",",quote=F,row.names=F,col.names=T)
+#write.table(PRODF, "allUnique.csv", sep=",",quote=F,row.names=F,col.names=T)
 write.table(UNPROD, "allUnproductive.csv", sep=",",quote=F,row.names=F,col.names=T)
 
 #write the samples to a file
@@ -297,7 +297,7 @@
 pV = pV + geom_bar( aes( x=factor(reorder(Top.V.Gene, chr.orderV)), y=relFreq, fill=Sample), stat='identity', position="dodge") + theme(axis.text.x = element_text(angle = 90, hjust = 1))
 pV = pV + xlab("Summary of V gene") + ylab("Frequency") + ggtitle("Relative frequency of V gene usage") + scale_fill_manual(values=sample.colors)
 pV = pV + theme(panel.background = element_rect(fill = "white", colour="black"),text = element_text(size=15, colour="black"), axis.text.x = element_text(angle = 45, hjust = 1), panel.grid.major.y = element_line(colour = "black"), panel.grid.major.x = element_blank())
-write.table(x=PRODFV, file="VFrequency.csv", sep=",",quote=F,row.names=F,col.names=T)
+write.table(x=PRODFV, file="VFrequency.txt", sep="\t",quote=F,row.names=F,col.names=T)
 
 png("VPlot.png",width = 1280, height = 720)
 pV
@@ -308,7 +308,7 @@
   pD = pD + geom_bar( aes( x=factor(reorder(Top.D.Gene, chr.orderD)), y=relFreq, fill=Sample), stat='identity', position="dodge") + theme(axis.text.x = element_text(angle = 90, hjust = 1))
   pD = pD + xlab("Summary of D gene") + ylab("Frequency") + ggtitle("Relative frequency of D gene usage") + scale_fill_manual(values=sample.colors)
   pD = pD + theme(panel.background = element_rect(fill = "white", colour="black"),text = element_text(size=15, colour="black"), axis.text.x = element_text(angle = 45, hjust = 1), panel.grid.major.y = element_line(colour = "black"), panel.grid.major.x = element_blank())
-  write.table(x=PRODFD, file="DFrequency.csv", sep=",",quote=F,row.names=F,col.names=T)
+  write.table(x=PRODFD, file="DFrequency.txt", sep="\t",quote=F,row.names=F,col.names=T)
   
   png("DPlot.png",width = 800, height = 600)
   print(pD)
@@ -319,7 +319,7 @@
 pJ = pJ + geom_bar( aes( x=factor(reorder(Top.J.Gene, chr.orderJ)), y=relFreq, fill=Sample), stat='identity', position="dodge") + theme(axis.text.x = element_text(angle = 90, hjust = 1))
 pJ = pJ + xlab("Summary of J gene") + ylab("Frequency") + ggtitle("Relative frequency of J gene usage") + scale_fill_manual(values=sample.colors)
 pJ = pJ + theme(panel.background = element_rect(fill = "white", colour="black"),text = element_text(size=15, colour="black"), axis.text.x = element_text(angle = 45, hjust = 1), panel.grid.major.y = element_line(colour = "black"), panel.grid.major.x = element_blank())
-write.table(x=PRODFJ, file="JFrequency.csv", sep=",",quote=F,row.names=F,col.names=T)
+write.table(x=PRODFJ, file="JFrequency.txt", sep="\t",quote=F,row.names=F,col.names=T)
 
 png("JPlot.png",width = 800, height = 600)
 pJ
@@ -344,7 +344,7 @@
 png("VFPlot.png")
 VPlot
 dev.off();
-write.table(x=VGenes, file="VFFrequency.csv", sep=",",quote=F,row.names=F,col.names=T)
+write.table(x=VGenes, file="VFFrequency.txt", sep="\t",quote=F,row.names=F,col.names=T)
 
 if(useD){
   DGenes = PRODF[,c("Sample", "Top.D.Gene")]
@@ -362,7 +362,7 @@
   png("DFPlot.png")
   print(DPlot)
   dev.off();
-  write.table(x=DGenes, file="DFFrequency.csv", sep=",",quote=F,row.names=F,col.names=T)
+  write.table(x=DGenes, file="DFFrequency.txt", sep="\t",quote=F,row.names=F,col.names=T)
 }
 
 # ---------------------- Plotting the cdr3 length ----------------------
@@ -579,7 +579,7 @@
 if("Replicate" %in% colnames(inputdata)) #can only calculate clonality score when replicate information is available
 {
   print("Report Clonality - Clonality")
-  write.table(clonalityFrame, "clonalityComplete.csv", sep=",",quote=F,row.names=F,col.names=T)
+  write.table(clonalityFrame, "clonalityComplete.txt", sep="\t",quote=F,row.names=F,col.names=T)
   if(clonality_method == "boyd"){
     samples = split(clonalityFrame, clonalityFrame$Sample, drop=T)
    
@@ -871,7 +871,7 @@
 png("AAComposition.png",width = 1280, height = 720)
 AAfreqplot
 dev.off()
-write.table(AAfreq, "AAComposition.csv" , sep=",",quote=F,na="-",row.names=F,col.names=T)
+write.table(AAfreq, "AAComposition.txt" , sep="\t",quote=F,na="-",row.names=F,col.names=T)
 
 # ---------------------- AA median CDR3 length ----------------------