changeset 15:af807768332e draft default tip

"planemo upload for repository https://forgemia.inra.fr/redelac commit 179e64aac208ae8af4d7416a7d5ff4b9da572850"
author siwaa
date Fri, 06 Feb 2026 13:28:00 +0000
parents 30d7b0210581
children
files README.md redelacSticsTool.R redelacSticsTool.bash redelacSticsTool.xml
diffstat 4 files changed, 173 insertions(+), 53 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.md	Fri Feb 06 13:28:00 2026 +0000
@@ -0,0 +1,34 @@
+## About the redelacSticsTool.bash
+
+This script is reponsible to set a Stics and SticsRPacks environement and 
+workspace enabling to launch an virtual experimental plan.
+
+It has to face that we can't or don't want to modify what is on the container.
+This is a prerequisite, for instance when using a container in the Galaxy context.
+
+### Requirements
+
+A javastics_path is required to enable Stics. logs, config an plnat subfolder are expected to be found there.
+
+### What the script does
+
+note that The Stics binary is used directly from the container.
+
+1. Create a home folder at the current working directory (the name is not very convenient maybe)
+2. Populate with whait is available in the container 3 subfolders logs, config and plant.
+3. But remove the config?
+4. And populate with the one of the tool, from the galaxy tool folder ( arg 4 ). this could be reconsidered.
+5. Populate with a Stics WS given as arg 5 an keep the name.
+6. Populate the WS with the csv succession plan given by arg 17.
+7. Populate the WS with param_gen.xml and param_newform.xml from the local config.
+8. Unzip the climate arg 6 Zip folder and populate the WS with the content AKA stics yearly meteo files
+9. Populate USMS, Tec, Ini, Station CSV Files frome args 7 to 10
+10. In Case of specific conf given with arg 11, folder plant is replaced and param_gen and param_newform also
+11. Launch the R Script with arg 1 telling to use the optimised facilities of SticsRPacks, arg 2 telling if parallelisation is wanted, arg 3 telling the number of slots, arg 15 giving a scenario name.
+12. Zip the result folder to arg 16
+13. If arg 14 zip the WS and give to arg 12
+
+### TODO
+
+Maybe revisiting or simplify the relation between the "base" WS, and the parameters..To provide a generique approach.
+For Instance A single parameter = the WS
\ No newline at end of file
--- a/redelacSticsTool.R	Fri Dec 05 14:39:14 2025 +0000
+++ b/redelacSticsTool.R	Fri Feb 06 13:28:00 2026 +0000
@@ -10,7 +10,7 @@
 library(data.table)
 library(readr)
 library(tidyr)
-
+library(arrow)
 sessionInfo()
 
 args = commandArgs(trailingOnly = TRUE)
@@ -35,6 +35,10 @@
 nbSlots <- as.integer(args[3])
 print(paste("nbslots:", nbSlots))
 scenario <- args[4]
+resulType <- args[5]
+
+parquetOut <- (resulType == "parquet" || resulType == "both" )
+baseOut <- (resulType == "rds+csv" || resulType == "both" )
 
 # USMs file loading
 
@@ -103,8 +107,8 @@
 
 foreach (i = ids,
          .options.future = list(packages = c("foreach", "SticsRFiles"))) %dordopar% {
-	   usmsXfolder =  file.path(workspace, paste0("UXF__", i))
-	   dir.create(usmsXfolder)
+           usmsXfolder =  file.path(workspace, paste0("UXF__", i))
+           dir.create(usmsXfolder)
            gen_usms_xml(file = file.path(usmsXfolder, paste0("usms__", i, ".xml")),
                         param_df = usms_param[i:min(i + chunckSize - 1, nbUSMs),])
          }
@@ -292,44 +296,83 @@
 
   #sauvegarde sous la forme d'un fichier rds
 
-  if (dir.exists(paste0(
-    workspace,
-    "/analyse_simulations_STICS/",
-    systeme,
-    "/",
-    rotation
-  )) == FALSE) {
-    dir.create(
+  if (baseOut) {
+
+    if (dir.exists(paste0(
+      workspace,
+      "/analyse_simulations_STICS/",
+      systeme,
+      "/",
+      rotation
+    )) == FALSE) {
+      dir.create(
+        paste0(
+          workspace,
+          "/analyse_simulations_STICS/",
+          systeme,
+          "/",
+          rotation
+        ),
+        recursive = TRUE
+      )
+    }
+
+    saveRDS(
+      sim_df,
       paste0(
         workspace,
         "/analyse_simulations_STICS/",
         systeme,
         "/",
-        rotation
-      ),
-      recursive = TRUE
+        rotation,
+        "/outputs-",
+        rotation,
+        "-",
+        upc,
+        "-",
+        sol,
+        "-",
+        scenario,
+        ".rds"
+      )
     )
   }
 
-  saveRDS(
-    sim_df,
-    paste0(
+  if (parquetOut) {
+
+    if (dir.exists(paste0(
       workspace,
       "/analyse_simulations_STICS/",
-      systeme,
-      "/",
-      rotation,
-      "/outputs-",
-      rotation,
-      "-",
-      upc,
-      "-",
-      sol,
-      "-",
-      scenario,
-      ".rds"
-    )
-  )
+      "/donnees_parquet_outputs/"
+    )) == FALSE) {
+      dir.create(
+        paste0(
+          workspace,
+          "/analyse_simulations_STICS/",
+          "/donnees_parquet_outputs/"
+        ),
+        recursive = TRUE
+      )
+    }
+
+    write_parquet(
+      sim_df,
+      paste0(
+        workspace,
+        "/analyse_simulations_STICS/",
+        "/donnees_parquet_outputs/",
+        "outputs-",
+        rotation,
+        "-",
+        upc,
+        "-",
+        sol,
+        "-",
+        scenario,
+        ".parquet"
+
+      ))
+  }
 
   successive_usms_tab_split[[j]]$Treatment <- NULL
   successive_usms_tab_split[[j]]$Number_USM <- NULL
@@ -417,25 +460,63 @@
       remove = FALSE
     )
 
-  write_delim(
-    x = rap,
-    file = paste0(
+  if (baseOut) {
+
+    write_delim(
+      x = rap,
+      file = paste0(
+        workspace,
+        "/analyse_simulations_STICS/",
+        systeme,
+        "/",
+        rotation,
+        "/report-",
+        rotation,
+        "-",
+        upc,
+        "-",
+        sol,
+        "-",
+        scenario,
+        ".csv"
+      ),
+      delim = ";"
+    )
+  }
+
+  if (parquetOut) {
+
+    if (dir.exists(paste0(
       workspace,
       "/analyse_simulations_STICS/",
-      systeme,
-      "/",
-      rotation,
-      "/report-",
-      rotation,
-      "-",
-      upc,
-      "-",
-      sol,
-      "-",
-      scenario,
-      ".csv"
-    ),
-    delim = ";"
-  )
+      "/donnees_parquet_report/"
+    )) == FALSE) {
+      dir.create(
+        paste0(
+          workspace,
+          "/analyse_simulations_STICS/",
+          "/donnees_parquet_report/"
+        ),
+        recursive = TRUE
+      )
+    }
 
+    write_parquet(
+      sim_df,
+      paste0(
+        workspace,
+        "/analyse_simulations_STICS/",
+        "/donnees_parquet_report/",
+        "report-",
+        rotation,
+        "-",
+        upc,
+        "-",
+        sol,
+        "-",
+        scenario,
+        ".parquet"
+
+      ))
+  }
 }
\ No newline at end of file
--- a/redelacSticsTool.bash	Fri Dec 05 14:39:14 2025 +0000
+++ b/redelacSticsTool.bash	Fri Feb 06 13:28:00 2026 +0000
@@ -28,7 +28,7 @@
 	 cp config/param_gen.xml WS &&
 	 cp config/param_newform.xml WS
 fi) &&
-/usr/bin/time -p -o ./bashlog Rscript --verbose $4/redelacSticsTool.R $1 $2 $3 ${15} &&
+/usr/bin/time -p -o ./bashlog Rscript --verbose $4/redelacSticsTool.R $1 $2 $3 ${15} ${18} &&
 echo "Step 1, time to run the R script:" &&
 echo "=================================" && 
 cat ./bashlog &&
--- a/redelacSticsTool.xml	Fri Dec 05 14:39:14 2025 +0000
+++ b/redelacSticsTool.xml	Fri Feb 06 13:28:00 2026 +0000
@@ -1,7 +1,7 @@
-<tool id="redelacSticsTool" name="redelacSticsTool" version="1.0.16">
+<tool id="redelacSticsTool" name="redelacSticsTool" version="1.0.17">
   <description>to run Stics for REDELAC</description>
   <requirements>
-    <container type="singularity">docker://registry.forge.inrae.fr/redelac/redelac-toolbox/sticsrpacks:4bf27fdaedcc1ffe10a6017da2255f1d6e751796
+    <container type="singularity">docker://registry.forge.inrae.fr/redelac/redelac-toolbox/sticsrpacks:5337507635242b3ad0f3559a1a6b666512ecf002
     </container>
   </requirements>
   <command detect_errors="aggressive">
@@ -16,7 +16,7 @@
              #else
                 parallel=sequential &&
              #end if
-	        bash $__tool_directory__/redelacSticsTool.bash ${REDELAC.optim} \${parallel} \${GALAXY_SLOTS:-4} $__tool_directory__ ${Workspace} ${Climat} ${USMs} ${Tec} ${Ini} ${Station} \${additional} ${GeneratedWorkspace} ${compress} ${outputsOnly} ${Scenario} ${SimulationResults} ${SuccessionPlan}
+	        bash $__tool_directory__/redelacSticsTool.bash ${REDELAC.optim} \${parallel} \${GALAXY_SLOTS:-4} $__tool_directory__ ${Workspace} ${Climat} ${USMs} ${Tec} ${Ini} ${Station} \${additional} ${GeneratedWorkspace} ${compress} ${outputsOnly} ${Scenario} ${SimulationResults} ${SuccessionPlan} ${outpuType}
      ]]>
   </command>
   <inputs>
@@ -39,6 +39,11 @@
     </conditional>
     <param name="outputsOnly" type="boolean" checked="true" truevalue="yes" falsevalue="no" label="To get results only"/>
     <param name="compress" type="boolean" checked="true" truevalue="-6" falsevalue="-0" label="To compress or not the output(compressing does slow down the job)"/>
+    <param name="outpuType" type="select" label="To choose the outpuType of results (rds+csv, parquet, both)">
+      <option value="parquet">parquet</option>
+      <option value="rds+csv">rds+csv</option>
+      <option value="both" selected="true">both</option>
+    </param>
   </inputs>
   <outputs>
     <data format="zip" name="SimulationResults"