Mercurial > repos > siwaa > redelac_stics_t
changeset 22:15317ef4816b draft default tip
"planemo upload for repository https://forgemia.inra.fr/redelac commit 3867fb88de7181d8703dec0b69d1f03a9a36b34b"
| author | siwaa |
|---|---|
| date | Tue, 21 Jul 2026 14:23:47 +0000 |
| parents | 5dcba002e019 |
| children | |
| files | redelacSticsTool.R redelacSticsTool.xml |
| diffstat | 2 files changed, 48 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/redelacSticsTool.R Fri Jul 10 15:02:33 2026 +0000 +++ b/redelacSticsTool.R Tue Jul 21 14:23:47 2026 +0000 @@ -66,6 +66,53 @@ # Tec files loading and generating xml tec_param <- read_params_table(file.path(workspace, TecFile)) + +# sanitizing (trying to) + +paramDesc = SticsRFiles:::get_param_desc() + +paramTecDesc <- paramDesc[paramDesc$kind=="PARTEC",] + +expectedTypes <- setNames(as.list(paramTecDesc$type), paramTecDesc$name) + +expectedTypes <- lapply(expectedTypes, function(x) { + if (identical(x, "real")) "numeric" else x +}) + +check <- sapply(names(tec_param), function(col) { +colref <- col +col <- sub("_[0-9]+$", "", col) +if (!col %in% names(expectedTypes)) { + NA + } else { +class(tec_param[[colref]])[1] == expectedTypes[[col]] + } +}) + +finalCheck <- check[!is.na(check)] + +toFix <- finalCheck[sapply(finalCheck, function(x) x == FALSE)] + +converters <- list( + integer = as.integer, + numeric = as.numeric, + character = as.character, + logical = as.logical, + factor = as.factor, + Date = as.Date +) + +for (col in names(toFix)) { + if (col %in% names(tec_param)) { + type <- expectedTypes[[sub("_[0-9]+$", "", col)]] + if (type %in% names(converters)) { + tec_param[[col]] <- converters[[type]](tec_param[[col]]) + } else { + warning(sprintf("Unknown type '%s' for column '%s'", type, col)) + } + } + } + columnToRemove <- names(tec_param[grep("juleclair|nbinfloecl", names(tec_param))]) columnToKeep <-
--- a/redelacSticsTool.xml Fri Jul 10 15:02:33 2026 +0000 +++ b/redelacSticsTool.xml Tue Jul 21 14:23:47 2026 +0000 @@ -1,4 +1,4 @@ -<tool id="redelacSticsTool" name="redelacSticsTool" version="1.0.23"> +<tool id="redelacSticsTool" name="redelacSticsTool" version="1.0.24"> <description>to run Stics for REDELAC</description> <requirements> <container type="singularity">docker://registry.forge.inrae.fr/redelac/redelac-toolbox/sticsrpacks:5337507635242b3ad0f3559a1a6b666512ecf002
