comparison report_clonality/RScript.r @ 37:f37e072affc0 draft

Uploaded
author davidvanzessen
date Wed, 19 Apr 2017 08:05:01 -0400
parents 7c33029fd63d
children b6936fb52ab9
comparison
equal deleted inserted replaced
36:edf2d5882b77 37:f37e072affc0
975 write.table(median.aa.l, "AAMedianBySample.txt" , sep="\t",quote=F,na="-",row.names=F,col.names=F) 975 write.table(median.aa.l, "AAMedianBySample.txt" , sep="\t",quote=F,na="-",row.names=F,col.names=F)
976 976
977 977
978 #generate the "Sequences that are present in more than one replicate" dataset 978 #generate the "Sequences that are present in more than one replicate" dataset
979 clonaltype.in.replicates = inputdata 979 clonaltype.in.replicates = inputdata
980 clonaltype.in.replicates = na.omit(clonaltype.in.replicates)
980 clonaltype = unlist(strsplit(clonaltype, ",")) 981 clonaltype = unlist(strsplit(clonaltype, ","))
982
983 clonaltype.in.replicates$clonaltype = do.call(paste, c(clonaltype.in.replicates[c(clonaltype, "Replicate")], sep = ":"))
984
985 clonaltype.in.replicates = clonaltype.in.replicates[!duplicated(clonaltype.in.replicates$clonaltype),]
986
981 clonaltype = clonaltype[-which(clonaltype == "Sample")] 987 clonaltype = clonaltype[-which(clonaltype == "Sample")]
982 988
983 clonaltype.in.replicates$clonaltype = do.call(paste, c(clonaltype.in.replicates[clonaltype], sep = ":")) 989 clonaltype.in.replicates$clonaltype = do.call(paste, c(clonaltype.in.replicates[clonaltype], sep = ":"))
984 clonaltype.in.replicates = clonaltype.in.replicates[,c("clonaltype","Replicate", "ID", "Sequence", "Sample")] 990 clonaltype.in.replicates = clonaltype.in.replicates[,c("clonaltype","Replicate", "ID", "Sequence", "Sample")]
985 991
988 994
989 clonaltype.counts = clonaltype.counts[clonaltype.counts$coincidence > 1,] 995 clonaltype.counts = clonaltype.counts[clonaltype.counts$coincidence > 1,]
990 996
991 clonaltype.in.replicates = clonaltype.in.replicates[clonaltype.in.replicates$clonaltype %in% clonaltype.counts$clonaltype,] 997 clonaltype.in.replicates = clonaltype.in.replicates[clonaltype.in.replicates$clonaltype %in% clonaltype.counts$clonaltype,]
992 clonaltype.in.replicates = merge(clonaltype.in.replicates, clonaltype.counts, by="clonaltype") 998 clonaltype.in.replicates = merge(clonaltype.in.replicates, clonaltype.counts, by="clonaltype")
993 clonaltype.in.replicates = clonaltype.in.replicates[order(clonaltype.in.replicates$clonaltype),c("coincidence","clonaltype", "Sample", "Replicate", "ID", "Sequence")] 999 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")]
1000
994 1001
995 write.table(clonaltype.in.replicates, "clonaltypes_replicates.txt" , sep="\t",quote=F,na="-",row.names=F,col.names=T) 1002 write.table(clonaltype.in.replicates, "clonaltypes_replicates.txt" , sep="\t",quote=F,na="-",row.names=F,col.names=T)
996 1003
997 1004
998 1005