Mercurial > repos > siwaa > redelac
changeset 0:e8b0d1d0797d draft default tip
"planemo upload for repository https://forgemia.inra.fr/quaysofthestics/sticsquays/-/tree/master/tools commit 34d462246915d2d24868042deeda35a01985d2aa"
author | siwaa |
---|---|
date | Tue, 21 Feb 2023 19:03:38 +0000 |
parents | |
children | |
files | parallelSticsRRotation-10.0.xml parallelSticsRRotation.R |
diffstat | 2 files changed, 115 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/parallelSticsRRotation-10.0.xml Tue Feb 21 19:03:38 2023 +0000 @@ -0,0 +1,50 @@ +<tool id="parallelSticsRRotation-10.0.0" name="parallelsticsrrotation-10.0.0" version="1.0.0"> + <description>to run rotation paralelly [Stics-10.0.0]</description> + <requirements> + <container type="singularity">docker://registry.forgemia.inra.fr/quaysofthestics/sticsquays/rstudio_stics:10.0.0</container> + </requirements> + <command detect_errors="aggressive"> + <![CDATA[ + cp -r /home/rstudio/JavaSTICS-1.5.1-STICS-10.0.0/JavaSTICS-1.5.1-STICS-10.0.0 . && + unzip ${WorkSpace} -d TMP && + mkdir WS && + mv TMP/* WS/txt_files && + cp ${RotationPlan} WS/rotationPlan.xlsx && + mkdir config && + Rscript --verbose $__tool_directory__/parallelSticsRRotation.R && + zip -r WS WS && + cp WS.zip ${SimulatedWorkspace} && + cp results.RData ${SimulationResults} + ]]> + </command> + <inputs> + <param name="WorkSpace" type="data" format="zip" label="Select a stics Workspace(zip file)"/> + <param name="RotationPlan" type="data" format="xlsx" label="Select a plan (xlsx)"/> + </inputs> + <outputs> + <data format="zip" name="SimulatedWorkspace" + label="Stics simulated Workspace"> + </data> + <data format="rdata" name="SimulationResults" + label="Stics simulations results"> + </data> + </outputs> + <tests> + </tests> + <help> +*The usage of this tool is restricted to the user of the stics_authorized group.* + +*To be granted, apply to the Project Stics Team and then request to SIWAA* + +Documentation +------------- +A tool to simulate stics rotation paralelly + +Credits +------- +- Wrapped Tool Author: https://www6.paca.inrae.fr/stics_eng/About-us/Project-Stics-Team +- Stics Site: https://www6.paca.inra.fr/stics_eng +- Galaxy Tool Maintainer: Patrick Chabrier patrick.chabrier@inrae.fr +- Copyright: INRAE + </help> +</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/parallelSticsRRotation.R Tue Feb 21 19:03:38 2023 +0000 @@ -0,0 +1,65 @@ +library(SticsRFiles) +library(SticsOnR) +library(parallel) +library(doParallel) +library(readxl) + +workspace <- paste0(getwd(), "/WS") +javastics_path <- paste0(getwd(), "/JavaSTICS-1.5.1-STICS-10.0.0") + +# copy of the var.mod and rap.mod into the config folder +file.copy(from = file.path(workspace, "var.mod"), to = "config/var.mod", overwrite = TRUE) +file.copy(from = file.path(workspace, "rap.mod"), to = "config/rap.mod", overwrite = TRUE) + +txt_path <- paste0(getwd(), "/WS/txt_files") +dir.create(txt_path,recursive = T) + +print("==================================") + +print(paste0("Cores=", detectCores())) +print(paste0("javastics=", javastics_path)) +print(paste0("ws=", workspace)) +print(paste0("out_dir=", txt_path)) + +print("==================================") + + +# List of successive USMs +successive_usms_file <- ("rotationPlan.xlsx") +successive_usms_tab <- read_excel(path = file.path(workspace, successive_usms_file), sheet = "usms") + +no_cores <- detectCores() - 1 +cl <- makeCluster(no_cores) +registerDoParallel(cl) + +result <- foreach(i=1:nrow(successive_usms_tab), + .packages = c("SticsRFiles", "SticsOnR") ) %dopar% { + + nusms <- as.numeric(successive_usms_tab[i,2]) + + vec <- as.character(successive_usms_tab[i,c(3:(2+nusms))]) + + list_successive_usms <- list(vec) + + sim_options <- stics_wrapper_options(javastics = javastics_path, + stics_exe = paste0(javastics_path,"/bin/stics_modulo"), + workspace = txt_path, + verbose = TRUE, + successive = list_successive_usms) + list_usms <- vec + + stics_wrapper(model_options = sim_options, situation = list_usms) + } + +stopCluster(cl) + +for (i in 1:nrow(successive_usms_tab)) { #i=1 + if (i == 1) { + simPCP <- result[[i]] + } else { + simPCP$sim_list <- c(simPCP$sim_list, result[[i]]$sim_list) + } + +} + +save(simPCP, file = "results.RData") \ No newline at end of file