changeset 27:dd8518ea23dd draft

Uploaded
author davidvanzessen
date Wed, 25 Feb 2015 09:18:14 -0500
parents f35c127b29b1
children a63ccc36f5a4
files RScript.r
diffstat 1 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/RScript.r	Tue Feb 24 11:19:26 2015 -0500
+++ b/RScript.r	Wed Feb 25 09:18:14 2015 -0500
@@ -268,7 +268,7 @@
   scatterplot_data_columns = c("Clone_Sequence", "Frequency", "normalized_read_count", "V_Segment_Major_Gene", "J_Segment_Major_Gene")
   scatterplot_data = rbind(patient1[,scatterplot_data_columns], patient2[,scatterplot_data_columns], patient3[,scatterplot_data_columns])
   scatterplot_data = scatterplot_data[!duplicated(scatterplot_data$Clone_Sequence),]
-  scatterplot_data$type = factor(x="single", levels=c("In one", "In two", "In three"))
+  scatterplot_data$type = factor(x="In one", levels=c("In one", "In two", "In three", "In multiple"))
   
   res1 = vector()
   res2 = vector()
@@ -349,11 +349,19 @@
       }
     } else { #scatterplot data
       scatterplot_locus_data = scatterplot_data[grepl(V_Segment, scatterplot_data$V_Segment_Major_Gene) & grepl(J_Segment, scatterplot_data$J_Segment_Major_Gene),]
-      scatterplot_locus_data$type = ifelse((scatterplot_locus_data$Clone_Sequence %in% patientMerge12[one_two,]$Clone_Sequence.x) | (scatterplot_locus_data$Clone_Sequence %in% patientMerge13[one_three,]$Clone_Sequence.x) | (scatterplot_locus_data$Clone_Sequence %in% patientMerge23[two_three,]$Clone_Sequence.x), "In two", "In one")
-      #scatterplot_locus_data$type = ifelse(scatterplot_locus_data$type == "In two", ifelse(scatterplot_locus_data$Clone_Sequence %in% patientMerge[all,]$Clone_Sequence.x, "In three", "In two"), "In one")
-      scatterplot_locus_data[(scatterplot_locus_data$Clone_Sequence %in% patientMerge[all,]$Clone_Sequence.x),]$type = "In three"
-      scatterplot_locus_data$type = ifelse(scatterplot_locus_data$type == "In one", "In one", "In multiple")
-      
+      in_two = (scatterplot_locus_data$Clone_Sequence %in% patientMerge12[one_two,]$Clone_Sequence.x) | (scatterplot_locus_data$Clone_Sequence %in% patientMerge13[one_three,]$Clone_Sequence.x) | (scatterplot_locus_data$Clone_Sequence %in% patientMerge23[two_three,]$Clone_Sequence.x)
+      if(sum(in_two) > 0){
+				scatterplot_locus_data[in_two,]$type = "In two"
+      }
+      in_three = (scatterplot_locus_data$Clone_Sequence %in% patientMerge[all,]$Clone_Sequence.x)
+      if(sum(in_three)> 0){
+				scatterplot_locus_data[in_three,]$type = "In three"
+      }
+      not_in_one = scatterplot_locus_data$type != "In one"
+      print(not_in_one)
+      if(sum(not_in_one) > 0){
+				scatterplot_locus_data[not_in_one,]$type = "In multiple"
+      }
       p = NULL
       if(nrow(scatterplot_locus_data) != 0){
         if(on == "normalized_read_count"){