From 2456ef7d999ffa9f6a27a031fbbda8307979c994 Mon Sep 17 00:00:00 2001 From: Rafal Stepien <43926522+rafalstepien@users.noreply.github.com> Date: Tue, 13 Sep 2022 10:27:28 -0400 Subject: [PATCH] Add eido/validate module (#2048) * Add eido/validate module * Apply first batch of updates after code review * Remove readlink, update sed, update paths * Move sample table index parameter to config * Update tests/modules/eido/validate/test.yml Co-authored-by: James A. Fellows Yates * Update tests/modules/eido/validate/test.yml Co-authored-by: James A. Fellows Yates * Update tests/modules/eido/validate/test.yml Co-authored-by: James A. Fellows Yates * Update tests/modules/eido/validate/test.yml Co-authored-by: James A. Fellows Yates * Update modules/eido/validate/main.nf Co-authored-by: James A. Fellows Yates Co-authored-by: James A. Fellows Yates --- modules/eido/validate/main.nf | 32 +++++++++++++++++ modules/eido/validate/meta.yml | 38 +++++++++++++++++++++ tests/config/pytest_modules.yml | 4 +++ tests/modules/eido/validate/main.nf | 21 ++++++++++++ tests/modules/eido/validate/nextflow.config | 8 +++++ tests/modules/eido/validate/test.yml | 17 +++++++++ 6 files changed, 120 insertions(+) create mode 100644 modules/eido/validate/main.nf create mode 100644 modules/eido/validate/meta.yml create mode 100644 tests/modules/eido/validate/main.nf create mode 100644 tests/modules/eido/validate/nextflow.config create mode 100644 tests/modules/eido/validate/test.yml diff --git a/modules/eido/validate/main.nf b/modules/eido/validate/main.nf new file mode 100644 index 00000000..22c9f162 --- /dev/null +++ b/modules/eido/validate/main.nf @@ -0,0 +1,32 @@ +process EIDO_VALIDATE { + tag '$samplesheet' + label 'process_single' + + conda (params.enable_conda ? "conda-forge::eido=0.1.9" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://containers.biocontainers.pro/s3/SingImgsRepo/eido/0.1.9_cv1/eido_0.1.9_cv1.sif' : + 'biocontainers/eido:0.1.9_cv1' }" + + input: + path samplesheet + path schema + + output: + path "versions.yml" , emit: versions + path "*.log" , emit: log + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "validation" + """ + eido validate $args $samplesheet -s $schema -e > ${prefix}.log + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + eido: \$(echo \$(eido --version 2>&1) | sed 's/^.*eido //;s/ .*//' )) + END_VERSIONS + """ +} diff --git a/modules/eido/validate/meta.yml b/modules/eido/validate/meta.yml new file mode 100644 index 00000000..962f59ee --- /dev/null +++ b/modules/eido/validate/meta.yml @@ -0,0 +1,38 @@ +name: "eido_validate" +description: Validate samplesheet or PEP config against a schema +keywords: + - eido + - validate + - schema + - format + - pep +tools: + - "validate": + description: "Validate samplesheet or PEP config against a schema." + homepage: "http://eido.databio.org/en/latest/" + documentation: "http://eido.databio.org/en/latest/" + doi: "10.1093/gigascience/giab077" + licence: "BSD-2-Clause" + +input: + - samplesheet: + type: file + description: Samplesheet or PEP file to be validated + pattern: "*.{yaml,yml,csv}" + - schema: + type: file + description: Schema that the samplesheet will be validated against + pattern: "*.{yaml,yml}" + +output: + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - log: + type: file + description: File containing validation log. + pattern: "*.log" + +authors: + - "@rafalstepien" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index e918cc22..8cae24b8 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -691,6 +691,10 @@ elprep/filter: - modules/elprep/filter/** - tests/modules/elprep/filter/** +eido/validate: + - modules/eido/validate/** + - tests/modules/eido/validate/** + elprep/merge: - modules/elprep/merge/** - tests/modules/elprep/merge/** diff --git a/tests/modules/eido/validate/main.nf b/tests/modules/eido/validate/main.nf new file mode 100644 index 00000000..02490ccc --- /dev/null +++ b/tests/modules/eido/validate/main.nf @@ -0,0 +1,21 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { EIDO_VALIDATE } from '../../../../modules/eido/validate/main.nf' + +workflow test_eido_validate_on_nextflow_samplesheet { + + samplesheet = file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/pep/test_nextflow_original_samplesheet.csv", checkIfExists: true) + schema = file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/pep/test_samplesheet_schema.yaml", checkIfExists: true) + + EIDO_VALIDATE ( samplesheet, schema ) +} + +workflow test_eido_validate_on_pep_config { + + samplesheet = file("https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/pep/test_pep_format_files/config.yaml", checkIfExists: true) + schema = file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/pep/test_samplesheet_schema.yaml", checkIfExists: true) + + EIDO_VALIDATE ( samplesheet, schema ) +} diff --git a/tests/modules/eido/validate/nextflow.config b/tests/modules/eido/validate/nextflow.config new file mode 100644 index 00000000..47b62631 --- /dev/null +++ b/tests/modules/eido/validate/nextflow.config @@ -0,0 +1,8 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + withName: 'EIDO_VALIDATE' { + ext.args = '--st-index sample' + } + +} diff --git a/tests/modules/eido/validate/test.yml b/tests/modules/eido/validate/test.yml new file mode 100644 index 00000000..03a4e5b2 --- /dev/null +++ b/tests/modules/eido/validate/test.yml @@ -0,0 +1,17 @@ +- name: eido validate test_eido_validate_on_nextflow_samplesheet + command: nextflow run ./tests/modules/eido/validate -entry test_eido_validate_on_nextflow_samplesheet -c ./tests/config/nextflow.config -c ./tests/modules/eido/validate/nextflow.config + tags: + - eido/validate + - eido + files: + - path: output/eido/validation.log + md5sum: 3a197c21ebf411aac7616bf9b4470de3 + +- name: eido validate test_eido_validate_on_pep_config + command: nextflow run ./tests/modules/eido/validate -entry test_eido_validate_on_pep_config -c ./tests/config/nextflow.config -c ./tests/modules/eido/validate/nextflow.config + tags: + - eido/validate + - eido + files: + - path: output/eido/validation.log + md5sum: 3a197c21ebf411aac7616bf9b4470de3