Skip to content
Snippets Groups Projects
Commit 4798a781 authored by Francesco Sabatini's avatar Francesco Sabatini
Browse files

Added new argument start.round

parent 69338819
No related branches found
No related tags found
No related merge requests found
...@@ -55,7 +55,8 @@ get.best <- function(x, N){ ...@@ -55,7 +55,8 @@ get.best <- function(x, N){
Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY.bootstrap", Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY.bootstrap",
combinations=c("all", "sequential"), max.inter.t, chunkn, chunk.i, nperm=199, ncores){ combinations=c("all", "sequential"), start.round=NA, max.inter.t,
chunkn, chunk.i, nperm=199, ncores){
if(ncores>1){ if(ncores>1){
require(parallel) require(parallel)
...@@ -72,9 +73,9 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY ...@@ -72,9 +73,9 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY
species <- read_delim(species.path, delim="\t") %>% species <- read_delim(species.path, delim="\t") %>%
as.data.frame() as.data.frame()
traits <- read_delim(traits.path, delim="\t") %>% traits <- read_delim(traits.path, delim="\t") %>%
as.data.frame() %>% as.data.frame() #%>%
### TEMPORARY FOR TESTING! ### TEMPORARY FOR TESTING!
dplyr::select(1:11) #dplyr::select(1:11)
traits <- traits %>% traits <- traits %>%
...@@ -115,8 +116,11 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY ...@@ -115,8 +116,11 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY
if(combinations=="sequential"){ if(combinations=="sequential"){
corXY.ci <- NULL if(!is.na(start.round)){
for(nround in 1:max.inter.t){ print(paste("Load data from previous round=", start.round-1))
load(file = paste(output, "_round_", start.round-1, ".RData", sep=""))
} else {corXY.ci <- NULL}
for(nround in start.round:max.inter.t){
corXY.output <- NULL corXY.output <- NULL
## select combination of traits based on best ## select combination of traits based on best
if(nround==1) { if(nround==1) {
...@@ -211,8 +215,9 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY ...@@ -211,8 +215,9 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY
} else {print(paste("no new best at round=", nround))} } else {print(paste("no new best at round=", nround))}
} }
print(paste("save intermediate results at round", nround)) print(paste("save intermediate results at round", nround))
save(corXY.output, file = paste(output, "_round_",nround, ".RData", sep="")) save(corXY.output, best, traits.sign.alone, corXY.ci, file = paste(output, "_round_",nround, ".RData", sep=""))
} }
} }
if(ncores>1){stopCluster(cl)} if(ncores>1){stopCluster(cl)}
} }
...@@ -65,7 +65,7 @@ parser <- OptionParser( ...@@ -65,7 +65,7 @@ parser <- OptionParser(
epilogue = "use with caution, the awesomeness might slap you in the face!" epilogue = "use with caution, the awesomeness might slap you in the face!"
) )
cli <- parse_args(parser, positional_arguments = 5) cli <- parse_args(parser, positional_arguments = 6)
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# assign a few shortcuts # assign a few shortcuts
...@@ -76,6 +76,7 @@ traits.path <- cli$args[2] ...@@ -76,6 +76,7 @@ traits.path <- cli$args[2]
output <- cli$args[3] output <- cli$args[3]
myfunction <- cli$args[4] myfunction <- cli$args[4]
combinations <- cli$args[5] combinations <- cli$args[5]
start.round <- cli$args[6]
max.inter.t <- cli$options$max.inter.t max.inter.t <- cli$options$max.inter.t
chunkn <- cli$options$chunkn chunkn <- cli$options$chunkn
chunk.i <- cli$options$chunk.i chunk.i <- cli$options$chunk.i
......
...@@ -6,11 +6,12 @@ myfunction <- "get.corXY.bootstrap" ...@@ -6,11 +6,12 @@ myfunction <- "get.corXY.bootstrap"
max.inter.t <- 3 max.inter.t <- 3
chunk.i <- NA chunk.i <- NA
nperm <- 20 nperm <- 20
ncores <- 10 ncores <- 1
chunkn <- 3*ncores chunkn <- 3*ncores
combinations <- "sequential" combinations <- "sequential"
start.round <- 4
source("01b_MesobromionCluster.R") source("01b_MesobromionCluster.R")
#Mesobromion(species.path, traits.path, output, myfunction, max.inter.t, chunkn, chunk.i, nperm) #Mesobromion(species.path, traits.path, output, myfunction, max.inter.t, chunkn, chunk.i, nperm)
Mesobromion(species.path, traits.path, output, myfunction, combinations, max.inter.t, Mesobromion(species.path, traits.path, output, myfunction, combinations, start.round, max.inter.t,
chunkn, chunk.i, nperm, ncores) chunkn, chunk.i, nperm, ncores)
...@@ -29,4 +29,5 @@ Rscript \ ...@@ -29,4 +29,5 @@ Rscript \
/data/splot/HIDDEN/traits.out.10perc.txt \ /data/splot/HIDDEN/traits.out.10perc.txt \
"$output" \ "$output" \
"get.corXY.bootstrap" \ "get.corXY.bootstrap" \
"sequential" "sequential" \
4
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment