Skip to content

Commit

Permalink
POC ready
Browse files Browse the repository at this point in the history
  • Loading branch information
alanmmobbs93 committed Dec 18, 2024
1 parent afa2472 commit 9e42bdd
Show file tree
Hide file tree
Showing 10 changed files with 270 additions and 84 deletions.
9 changes: 9 additions & 0 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ process {
ext.args = "--sample_id_col '${params.observations_id_col}' --feature_id_col '${params.features_id_col}'"
}

withName: VALIDATE_MODEL {
ext.args = { 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 path(samplesheet)
tuple val(meta), 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

0 comments on commit 9e42bdd

Please sign in to comment.