changeset 37:f37e072affc0 draft

Uploaded
author davidvanzessen
date Wed, 19 Apr 2017 08:05:01 -0400
parents edf2d5882b77
children b6936fb52ab9
files report_clonality/RScript.r
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/report_clonality/RScript.r	Tue Mar 28 08:57:05 2017 -0400
+++ b/report_clonality/RScript.r	Wed Apr 19 08:05:01 2017 -0400
@@ -977,7 +977,13 @@
 
 #generate the "Sequences that are present in more than one replicate" dataset
 clonaltype.in.replicates = inputdata
+clonaltype.in.replicates = na.omit(clonaltype.in.replicates)
 clonaltype = unlist(strsplit(clonaltype, ","))
+
+clonaltype.in.replicates$clonaltype = do.call(paste, c(clonaltype.in.replicates[c(clonaltype, "Replicate")], sep = ":"))
+
+clonaltype.in.replicates = clonaltype.in.replicates[!duplicated(clonaltype.in.replicates$clonaltype),]
+
 clonaltype = clonaltype[-which(clonaltype == "Sample")]
 
 clonaltype.in.replicates$clonaltype = do.call(paste, c(clonaltype.in.replicates[clonaltype], sep = ":"))
@@ -990,7 +996,8 @@
 
 clonaltype.in.replicates = clonaltype.in.replicates[clonaltype.in.replicates$clonaltype %in% clonaltype.counts$clonaltype,]
 clonaltype.in.replicates = merge(clonaltype.in.replicates, clonaltype.counts, by="clonaltype")
-clonaltype.in.replicates = clonaltype.in.replicates[order(clonaltype.in.replicates$clonaltype),c("coincidence","clonaltype", "Sample", "Replicate", "ID", "Sequence")]
+clonaltype.in.replicates = clonaltype.in.replicates[order(-clonaltype.in.replicates$coincidence, clonaltype.in.replicates$clonaltype, clonaltype.in.replicates$Replicate),c("coincidence","clonaltype", "Sample", "Replicate", "ID", "Sequence")]
+
 
 write.table(clonaltype.in.replicates, "clonaltypes_replicates.txt" , sep="\t",quote=F,na="-",row.names=F,col.names=T)