Browse code

added patch to patternMatchR

Genevieve Stein-O'Brien authored on 16/04/2018 19:26:36
Showing 1 changed files

... ...
@@ -64,13 +64,18 @@ patternMatch4Parallel <- function(Ptot, nSets, cnt, minNS=NULL, maxNS=NULL,
64 64
     indx<-which(unlist(lapply(cc$PByClust,function(x) dim(x)[1]>maxNS)))
65 65
     while(length(indx)>0){
66 66
             icc<-corcut(cc$PByClust[[indx[1]]],minNS,2,cluster.method)
67
-            cc$PByClust[[indx[1]]]<-icc[[2]][[1]]
68
-            cc$RtoMeanPattern[[indx[1]]]<-icc[[1]][[1]]
69
-            if(length(icc[[2]])>1){
70
-                cc$PByClust<-append(cc$PByClust,icc[[2]][2])
71
-                cc$RtoMeanPattern<-append(cc$RtoMeanPattern,icc[[1]][2])
72
-            } 
73
-            indx<-which(unlist(lapply(cc$PByClust,function(x) dim(x)[1]>maxNS)))
67
+            if(length(icc[[2]])==0){
68
+              indx<-indx[-1]
69
+              next
70
+            } else{
71
+                cc$PByClust[[indx[1]]]<-icc[[2]][[1]]
72
+                cc$RtoMeanPattern[[indx[1]]]<-icc[[1]][[1]]
73
+                if(length(icc[[2]])>1){
74
+                    cc$PByClust<-append(cc$PByClust,icc[[2]][2])
75
+                    cc$RtoMeanPattern<-append(cc$RtoMeanPattern,icc[[1]][2])
76
+                } 
77
+                indx<-which(unlist(lapply(cc$PByClust,function(x) dim(x)[1]>maxNS)))
78
+            }
74 79
     }
75 80
 
76 81
     #weighted.mean