changeset 2:ea8e91473dc8 draft

"planemo upload for repository https://forgemia.inra.fr/redelac/redelac-toolbox/-/tree/4c3e6dc71284e3eecf1cfa8402aaf12dc49c1ee4/tools/REDELACSticsSimulator commit 4c3e6dc71284e3eecf1cfa8402aaf12dc49c1ee4-dirty"
author siwaa
date Fri, 23 Jun 2023 10:17:27 +0000
parents be10e3fb6e64
children f262814e48a3
files parallelSticsRRotation-10.0.xml parallelSticsRRotation.R redelacSticsSimulator.R redelacSticsSimulator.xml stics_modulo version.txt
diffstat 6 files changed, 137 insertions(+), 134 deletions(-) [+]
line wrap: on
line diff
--- a/parallelSticsRRotation-10.0.xml	Mon Jun 12 16:22:04 2023 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-<tool id="redelacSticsSimulator" name="redelacSticsSimulator" version="1.0.0">
-  <description>to run sequences 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 . &&
-	     rm JavaSTICS-1.5.1-STICS-10.0.0/bin/stics_modulo &&
-             cp $__tool_directory__/stics_modulo JavaSTICS-1.5.1-STICS-10.0.0/bin &&
-	     unzip ${WorkSpace} -d TMP &&
-             export WSname=\$(ls TMP) &&
-	     mv TMP/* JavaSTICS-1.5.1-STICS-10.0.0/WS &&
-	     cp ${SuccessionPlan} JavaSTICS-1.5.1-STICS-10.0.0/WS/successionPlan.csv &&
-	     cd JavaSTICS-1.5.1-STICS-10.0.0 &&
-	     Rscript --verbose $__tool_directory__/parallelSticsRRotation.R &&
-             mv WS \$WSname &&
-	     zip -r \$WSname \$WSname &&
-	     cp \$WSname.zip ${SimulatedWorkspace} &&
-	     cp results.RData ${SimulationResults}
-     ]]>
-  </command>
-  <inputs>
-    <param name="WorkSpace" type="data" format="zip" label="Select a stics Workspace(zip file)"/>
-    <param name="SuccessionPlan" type="data" format="csv" label="Select a plan of succession (csv)"/>
-  </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>
--- a/parallelSticsRRotation.R	Mon Jun 12 16:22:04 2023 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-library(SticsRFiles)
-library(SticsOnR)
-library(parallel)
-library(doParallel)
-library(readxl)
-
-workspace <- paste0(getwd(), "/WS")
-javastics_path <- getwd()
-default_config_path <- paste0(javastics_path, "/config")
-
-# copy of the var.mod and rap.mod into the config folder
-# generalizing maybe should be inside a config folder
-
-#file.copy(from = file.path(workspace, "var.mod"),
-#          to = file.path(default_config_path, "var.mod"),
-#	  overwrite = TRUE)
-#file.copy(from = file.path(workspace, "rap.mod"),
-#          to = file.path(default_config_path, "rap.mod"),
-#	  overwrite = TRUE)
-
-txt_path <- paste0(getwd(), "/WS/txt_files")
-#dir.create(txt_path,recursive = T)
-
-#gen_usms_xml2txt(javastics = javastics_path,
-#                 workspace = workspace,
-#		 out_dir = txt_path,
-#		 check = FALSE)
-
-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 <- ("successionPlan.csv")
-successive_usms_tab <- read.csv(file = file.path(workspace, successive_usms_file), sep =";")
-
-no_cores <- detectCores() - 1  
-no_cores <- 10  
-cl <- makeCluster(no_cores)  
-registerDoParallel(cl)
-
-result <- foreach(i=1:nrow(successive_usms_tab),
-                  .packages = c("SticsRFiles", "SticsOnR") ) %dopar% {
-
-
-  print(paste("coucou ", i))
-  nusms <- as.numeric(successive_usms_tab[i,2])
-  print(paste0("coco ", nusms))
-  
-  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")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/redelacSticsSimulator.R	Fri Jun 23 10:17:27 2023 +0000
@@ -0,0 +1,81 @@
+library(SticsRFiles)
+library(SticsOnR)
+library(parallel)
+library(doParallel)
+library(readxl)
+
+workspace <- paste0(getwd(), "/WS")
+javastics_path <- getwd()
+default_config_path <- paste0(javastics_path, "/config")
+
+# copy of the var.mod and rap.mod into the config folder
+# generalizing maybe should be inside a config folder
+
+#file.copy(from = file.path(workspace, "var.mod"),
+#          to = file.path(default_config_path, "var.mod"),
+#	  overwrite = TRUE)
+#file.copy(from = file.path(workspace, "rap.mod"),
+#          to = file.path(default_config_path, "rap.mod"),
+#	  overwrite = TRUE)
+
+txt_path <- paste0(getwd(), "/WS/txt_files")
+#dir.create(txt_path,recursive = T)
+
+#gen_usms_xml2txt(javastics = javastics_path,
+#                 workspace = workspace,
+#		 out_dir = txt_path,
+#		 check = FALSE)
+
+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 <- ("successionPlan.csv")
+successive_usms_tab <- read.csv(file = file.path(workspace, successive_usms_file), sep =";")
+
+no_cores <- detectCores() - 1  
+#no_cores <- 10  
+cl <- makeCluster(no_cores)  
+registerDoParallel(cl)
+
+result <- foreach(i=1:nrow(successive_usms_tab),
+                  .packages = c("SticsRFiles", "SticsOnR") ) %dopar% {
+
+
+  print(paste("coucou ", i))
+  nusms <- as.numeric(successive_usms_tab[i,2])
+  print(paste0("coco ", nusms))
+  
+  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")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/redelacSticsSimulator.xml	Fri Jun 23 10:17:27 2023 +0000
@@ -0,0 +1,54 @@
+<tool id="redelacSticsSimulator" name="redelacSticsSimulator" version="1.0.1">
+  <description>to run sequences 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 . &&
+	     rm JavaSTICS-1.5.1-STICS-10.0.0/bin/stics_modulo &&
+             cp $__tool_directory__/stics_modulo JavaSTICS-1.5.1-STICS-10.0.0/bin &&
+	     unzip -qq ${WorkSpace} -d TMP &&
+             export WSname=\$(ls TMP) &&
+	     mv TMP/* JavaSTICS-1.5.1-STICS-10.0.0/WS &&
+	     cp ${SuccessionPlan} JavaSTICS-1.5.1-STICS-10.0.0/WS/successionPlan.csv &&
+	     cd JavaSTICS-1.5.1-STICS-10.0.0 &&
+	     Rscript --verbose $__tool_directory__/redelacSticsSimulator.R \${GALAXY_SLOTS:-2}	&&
+             mv WS \$WSname &&
+	     zip -qq -r \$WSname \$WSname &&
+	     cp \$WSname.zip ${SimulatedWorkspace} &&
+	     cp results.RData ${SimulationResults}
+     ]]>
+  </command>
+  <inputs>
+    <param name="WorkSpace" type="data" format="zip" label="Select a stics Workspace(zip file)"/>
+    <param name="SuccessionPlan" type="data" format="csv" label="Select a plan of succession (csv)"/>
+    <param name="Tag" type="text" value="" label="Outputs tag"/>
+  </inputs>
+  <outputs>
+    <data format="zip" name="SimulatedWorkspace"
+          label="SticsSimulatedWorkspace${Tag}">
+    </data>
+    <data format="rdata" name="SimulationResults"
+          label="SticsOnResults${Tag}">
+    </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>
Binary file stics_modulo has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/version.txt	Fri Jun 23 10:17:27 2023 +0000
@@ -0,0 +1,2 @@
+origin/plecharpent/debug/prairies               6b6441bd ndecalf and ndecalg are (as for bare soil)  now set to 0 at non perenial crops harvest, or perenial crop destruction
+