Add eido/convert module (#2051)

* Add eido/convert module

* Run prettier

* Update modules/eido/convert/main.nf

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>

* Update modules/eido/convert/main.nf

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>

* Update extension format

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>
This commit is contained in:
Rafal Stepien 2022-09-13 12:17:29 -04:00 committed by GitHub
parent 2456ef7d99
commit c9b29c7686
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 126 additions and 3 deletions

View file

@ -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
"""
}

View file

@ -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"

View file

@ -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/**

View file

@ -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 )
}

View file

@ -0,0 +1,7 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
withName: 'EIDO_CONVERT' {
ext.args = '--st-index sample'
}
}

View file

@ -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