Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Feature POC: VALIDATE_MODEL #404

Merged
merged 14 commits into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,21 @@ process {
ext.args = "--sample_id_col '${params.observations_id_col}' --feature_id_col '${params.features_id_col}'"
}

withName: VALIDATE_MODEL {
ext.args = {
params.observations_name_col ?
"--sample_id_col ${params.observations_name_col}" :
params.observations_id_col ?
"--sample_id_col ${params.observations_id_col}" :
''
}
publishDir = [
path: { "${params.outdir}/validate" },
mode: params.publish_dir_mode,
]

}

withName: AFFY_JUSTRMA_RAW {
publishDir = [
[
Expand Down
8 changes: 8 additions & 0 deletions modules/local/validatemodel/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
channels:
- conda-forge
- bioconda
dependencies:
- conda-forge::r-jsonlite
- conda-forge::r-optparse
- conda-forge::r-tidyverse
- conda-forge::r-yaml
57 changes: 57 additions & 0 deletions modules/local/validatemodel/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
process VALIDATE_MODEL {
tag "${models_yml}"
label 'process_single'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/f5/f5ef116da0b04fc6359efa48f08b9acfc040a02d7a1ec62476c77b6db0fc1499/data' :
'community.wave.seqera.io/library/r-jsonlite_r-optparse_r-tidyverse_r-yaml:18dc3fc2d990206d' }"

input:
tuple val(meta) , path(samplesheet)
tuple val(meta2), path(models_yml)

output:
tuple val(meta), path("pheno_table.csv"), emit: pheno_table
tuple val(meta), path("designs.json") , emit: designs
tuple val(meta), path("warnings.json") , emit: warnings, optional: true
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
"""
validate_model.R \\
--yml "${models_yml}" \\
--samplesheet "${samplesheet}" \\
${args}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
r-base: \$(Rscript -e 'R.Version()\$version.string' | sed -n 's|\\[1\\] "R version \\(.*\\) (.*|\\1|p')
tidyverse: \$(Rscript -e "cat(paste(packageVersion('tidyverse'), collapse='.'))")
optparse: \$(Rscript -e "cat(paste(packageVersion('optparse'), collapse='.'))")
yaml: \$(Rscript -e "cat(paste(packageVersion('yaml'), collapse='.'))")
jsonlite: \$(Rscript -e "cat(paste(packageVersion('jsonlite'), collapse='.'))")
END_VERSIONS
"""

stub:
"""
touch pheno_table.csv
touch designs.json
touch warnings.json

cat <<-END_VERSIONS > versions.yml
"${task.process}":
r-base: \$(Rscript -e 'R.Version()\$version.string' | sed -n 's|\\[1\\] "R version \\(.*\\) (.*|\\1|p')
tidyverse: \$(Rscript -e "cat(paste(packageVersion('tidyverse'), collapse='.'))")
optparse: \$(Rscript -e "cat(paste(packageVersion('optparse'), collapse='.'))")
yaml: \$(Rscript -e "cat(paste(packageVersion('yaml'), collapse='.'))")
jsonlite: \$(Rscript -e "cat(paste(packageVersion('jsonlite'), collapse='.'))")
END_VERSIONS
"""

}
Loading
Loading