From c098845175ffcdb68c3820c7cea1e5ecc05134e4 Mon Sep 17 00:00:00 2001
From: Francesco Sabatini <francesco.sabatini@idiv.de>
Date: Wed, 29 Apr 2020 01:02:03 +0200
Subject: [PATCH] Fixed bug upper lower

---
 01b_MesobromionCluster.R | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/01b_MesobromionCluster.R b/01b_MesobromionCluster.R
index 77a6cf8..2a73aff 100644
--- a/01b_MesobromionCluster.R
+++ b/01b_MesobromionCluster.R
@@ -75,7 +75,7 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY
   traits <- read_delim(traits.path, delim="\t") %>%
 		as.data.frame() #%>% 
 ### TEMPORARY FOR TESTING!
-    #dplyr::select(1:11)
+    #dplyr::select(1:6)
   
   
   traits <- traits %>% 
@@ -127,6 +127,10 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY
         allcomb.t <- lapply(1:ncol(traits), function(x){return(x)})
         nall <- length(allcomb.t)
         }  else {
+          best.row <- corXY.ci %>% 
+            filter(Trait.comb==best) 
+          upper <- best.row$q975
+          lower <- best.row$q025
           best.split <- as.numeric(unlist(strsplit(best, "_")))
           max.inter.t <- nround-length(best.split)
           #n.traits <- ncol(traits)
@@ -148,11 +152,12 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY
       
       ## Divide in chunks if requested
 #      if(chunkn>1){
-#        print(paste("nround", nround, "--- divide in", chunkn, "chunks"))
+#        print(paste("nround", nround, "--- divide in", chunkn, "chunks and run on chunk n=", chunk.i))
 #        indices <- 1:length(allcomb.t)
 #        chunks <- split(indices, sort(indices%%chunkn))
-#      }  else {chunks <- list(1:length(allcomb.t))}
-#      #names.t <- unlist(lapply(allcomb.t, paste, collapse="_"))
+#        allcomb.t <- allcomb.t[chunks[[chunk.i]] ]
+#      }  
+      #names.t <- unlist(lapply(allcomb.t, paste, collapse="_"))
       
       ## start main foreach loop
       print(paste("Start main loop - round", nround))
-- 
GitLab