diff RScript.r @ 51:8f5ab5290c88 draft

Uploaded
author davidvanzessen
date Tue, 10 Dec 2013 07:21:31 -0500
parents 3da85f1a7f42
children 907e2a756f85
line wrap: on
line diff
--- a/RScript.r	Mon Dec 09 05:46:53 2013 -0500
+++ b/RScript.r	Tue Dec 10 07:21:31 2013 -0500
@@ -38,6 +38,9 @@
 test$VDJCDR3 = do.call(paste, c(test[unlist(strsplit(clonalType, ","))], sep = ":"))
 
 PROD = test[test$VDJ.Frame != "In-frame with stop codon" & test$VDJ.Frame != "Out-of-frame" & test$CDR3.Found.How != "NOT_FOUND" , ]
+if("Functionality" %in% colnames(test)) {
+	PROD = test[test$Functionality == "productive" | test$Functionality == "productive (see comment)", ]
+}
 
 NONPROD = test[test$VDJ.Frame == "In-frame with stop codon" | test$VDJ.Frame == "Out-of-frame" | test$CDR3.Found.How == "NOT_FOUND" , ]
 
@@ -90,7 +93,7 @@
 
 setwd(outDir)
 
-write.table(PRODF, "allUnique.tsv", sep="\t",quote=F,row.names=T,col.names=T)
+write.table(PRODF, "allUnique.tsv", sep="\t",quote=F,row.names=F,col.names=T)
 
 pV = ggplot(PRODFV)
 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))
@@ -233,17 +236,17 @@
 	clonalityFrame = PROD
 	clonalityFrame$ReplicateConcat = do.call(paste, c(clonalityFrame[c("VDJCDR3", "Sample", "Replicate")], sep = ":"))
 	clonalityFrame = clonalityFrame[!duplicated(clonalityFrame$ReplicateConcat), ]
-	write.table(clonalityFrame, "clonalityComplete.tsv", sep="\t",quote=F,row.names=T,col.names=T)
+	write.table(clonalityFrame, "clonalityComplete.tsv", sep="\t",quote=F,row.names=F,col.names=T)
 
 	ClonalitySampleReplicatePrint <- function(dat){
-	    write.table(dat, paste("clonality_", unique(dat$Sample) , "_", unique(dat$Replicate), ".tsv", sep=""), sep="\t",quote=F,row.names=T,col.names=T)
+	    write.table(dat, paste("clonality_", unique(dat$Sample) , "_", unique(dat$Replicate), ".tsv", sep=""), sep="\t",quote=F,row.names=F,col.names=T)
 	}
 
     clonalityFrameSplit = split(clonalityFrame, f=clonalityFrame[,c("Sample", "Replicate")])
     lapply(clonalityFrameSplit, FUN=ClonalitySampleReplicatePrint)
 
     ClonalitySamplePrint <- function(dat){
-	    write.table(dat, paste("clonality_", unique(dat$Sample) , ".tsv", sep=""), sep="\t",quote=F,row.names=T,col.names=T)
+	    write.table(dat, paste("clonality_", unique(dat$Sample) , ".tsv", sep=""), sep="\t",quote=F,row.names=F,col.names=T)
 	}
 
     clonalityFrameSplit = split(clonalityFrame, f=clonalityFrame[,"Sample"])