diff --git a/01b_MesobromionCluster.R b/01b_MesobromionCluster.R index 042a5f6195fb21ce57cf0441d293ab3851afd319..8b0798049143cea91d99c48cfa8ea53c0dc31686 100644 --- a/01b_MesobromionCluster.R +++ b/01b_MesobromionCluster.R @@ -72,9 +72,9 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY species <- read_delim(species.path, delim="\t") %>% as.data.frame() traits <- read_delim(traits.path, delim="\t") %>% - as.data.frame()# %>% + as.data.frame() %>% ### TEMPORARY FOR TESTING! -# dplyr::select(1:11) + dplyr::select(1:11) traits <- traits %>% @@ -115,8 +115,9 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY if(combinations=="sequential"){ - corXY.output <- NULL + corXY.ci <- NULL for(nround in 1:max.inter.t){ + corXY.output <- NULL ## select combination of traits based on best if(nround==1) { allcomb.t <- lapply(1:ncol(traits), function(x){return(x)}) @@ -167,7 +168,8 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY #save(corXY.output, file = paste(output, "_", nround, ".RData", sep="")) print(paste("Summarize after round", nround, "and find best, significant trait combos")) - corXY.ci <- get.ci(corXY.output) + corXY.ci <- corXY.ci %>% + bind_rows(get.ci(corXY.output)) ##get best or new best if(nround==1) { traits.sign.alone <- corXY.ci %>% @@ -208,9 +210,9 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY print(paste("new best at round=", nround, "is trait combination", best)) } else {print(paste("no new best at round=", nround))} } - } - save(corXY.output, file = paste(output, ".RData", sep="")) - + print(paste("save intermediate results at round", nround)) + save(corXY.output, file = paste(output, "_round_",nround, ".RData", sep="")) + } } if(ncores>1){stopCluster(cl)} } diff --git a/session.R b/session.R index 9f8962ae448b200dd671fed33868d809e8e88514..722702fd477ded05c28e90b2e0e283835eaa50b7 100644 --- a/session.R +++ b/session.R @@ -1,13 +1,13 @@ species.path <- "_data/Mesobromion/species.out.10perc.txt" traits.path <- "_data/Mesobromion/traits.out.10perc.txt" -output <- "test" +output <- "test99" myfunction <- "get.corXY.bootstrap" -max.inter.t <- 4 -chunkn <- 1 +max.inter.t <- 3 chunk.i <- NA -nperm <- 25 +nperm <- 20 ncores <- 10 +chunkn <- 3*ncores combinations <- "sequential" source("01b_MesobromionCluster.R")