diff --git a/modules/eido/convert/main.nf b/modules/eido/convert/main.nf new file mode 100644 index 00000000..40cd57a7 --- /dev/null +++ b/modules/eido/convert/main.nf @@ -0,0 +1,37 @@ +process EIDO_CONVERT { + 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 + val format + + output: + path "versions.yml" , emit: versions + path "${prefix}.${format}" , emit: samplesheet_converted + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "samplesheet_converted" + """ + eido \\ + convert \\ + -f $format \\ + $samplesheet \\ + $args \\ + -p samples=${prefix}.${format} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + eido: \$(echo \$(eido --version 2>&1) | sed 's/^.*eido //;s/ .*//' )) + END_VERSIONS + """ +} diff --git a/modules/eido/convert/meta.yml b/modules/eido/convert/meta.yml new file mode 100644 index 00000000..0cf354a2 --- /dev/null +++ b/modules/eido/convert/meta.yml @@ -0,0 +1,36 @@ +name: "eido_convert" +description: Convert any PEP project or Nextflow samplesheet to any format +keywords: + - eido + - convert + - PEP + - format + - samplesheet +tools: + - "eido": + description: "Convert any PEP project or Nextflow samplesheet to any format" + 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: Nextflow samplesheet or PEP project + pattern: "*.{yaml,yml,csv}" + - format: + type: value + description: Extension of an output file + +output: + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - samplesheet_converted: + type: file + description: PEP project or samplesheet converted to csv file + +authors: + - "@rafalstepien" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 8cae24b8..6831b57e 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -687,14 +687,18 @@ ectyper: - modules/ectyper/** - tests/modules/ectyper/** -elprep/filter: - - modules/elprep/filter/** - - tests/modules/elprep/filter/** +eido/convert: + - modules/eido/convert/** + - tests/modules/eido/convert/** eido/validate: - modules/eido/validate/** - tests/modules/eido/validate/** +elprep/filter: + - modules/elprep/filter/** + - tests/modules/elprep/filter/** + elprep/merge: - modules/elprep/merge/** - tests/modules/elprep/merge/** diff --git a/tests/modules/eido/convert/main.nf b/tests/modules/eido/convert/main.nf new file mode 100644 index 00000000..9477a5a2 --- /dev/null +++ b/tests/modules/eido/convert/main.nf @@ -0,0 +1,22 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { EIDO_CONVERT } from '../../../../modules/eido/convert/main.nf' + +workflow test_eido_convert_nextflow_samplesheet { + + nextflow_samplesheet = file("https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/pep/test_nextflow_original_samplesheet.csv", checkIfExists: true) + format = "csv" + + EIDO_CONVERT ( nextflow_samplesheet, format ) +} + + +workflow test_eido_convert_pep_project { + + pep_project = file("https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/pep/test_pep_format_files/config.yaml", checkIfExists: true) + format = "csv" + + EIDO_CONVERT ( pep_project, format ) +} diff --git a/tests/modules/eido/convert/nextflow.config b/tests/modules/eido/convert/nextflow.config new file mode 100644 index 00000000..bc02ae6d --- /dev/null +++ b/tests/modules/eido/convert/nextflow.config @@ -0,0 +1,7 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + withName: 'EIDO_CONVERT' { + ext.args = '--st-index sample' + } +} diff --git a/tests/modules/eido/convert/test.yml b/tests/modules/eido/convert/test.yml new file mode 100644 index 00000000..5a6a571c --- /dev/null +++ b/tests/modules/eido/convert/test.yml @@ -0,0 +1,17 @@ +- name: eido convert test_eido_convert_nextflow_samplesheet + command: nextflow run ./tests/modules/eido/convert -entry test_eido_convert_nextflow_samplesheet -c ./tests/config/nextflow.config -c ./tests/modules/eido/convert/nextflow.config + tags: + - eido + - eido/convert + files: + - path: output/eido/samplesheet_converted.csv + md5sum: 7aa4da4944650b9c7c451c5dfbeae663 + +- name: eido convert test_eido_convert_pep_project + command: nextflow run ./tests/modules/eido/convert -entry test_eido_convert_pep_project -c ./tests/config/nextflow.config -c ./tests/modules/eido/convert/nextflow.config + tags: + - eido + - eido/convert + files: + - path: output/eido/samplesheet_converted.csv + md5sum: 2191ccc9c9c1ac4577726ea24cdb9fda