From e9c57083a0938c142e14ccf2b0275ed7724fe9a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fern=C3=A1ndez=20Navarro?= Date: Wed, 15 Sep 2021 20:55:08 +0200 Subject: [PATCH] Fix bug in gffread (#686) * Fix bug in gffread that would cause it to fail if the input has .gtf as extension * Update test.yml * Update meta file * Update main.nf * Apply suggestions from code review Co-authored-by: Harshil Patel --- modules/gffread/main.nf | 6 +++++- modules/gffread/meta.yml | 16 +++------------- tests/modules/gffread/main.nf | 2 +- tests/modules/gffread/test.yml | 4 ++-- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/modules/gffread/main.nf b/modules/gffread/main.nf index 6c5aecbc..6b0dd666 100644 --- a/modules/gffread/main.nf +++ b/modules/gffread/main.nf @@ -27,8 +27,12 @@ process GFFREAD { script: def software = getSoftwareName(task.process) + def prefix = options.suffix ? "${gff.baseName}${options.suffix}" : "${gff.baseName}" """ - gffread $gff $options.args -o ${gff.baseName}.gtf + gffread \\ + $gff \\ + $options.args \\ + -o ${prefix}.gtf echo \$(gffread --version 2>&1) > ${software}.version.txt """ } diff --git a/modules/gffread/meta.yml b/modules/gffread/meta.yml index 63d281f5..af2abb6e 100644 --- a/modules/gffread/meta.yml +++ b/modules/gffread/meta.yml @@ -14,26 +14,16 @@ tools: licence: ['MIT'] input: - - meta: - type: map - description: | - Groovy Map containing sample information - e.g. [ id:'test', single_end:false ] - gff: type: file - description: A GFF file in either the GFF3 or GFF2 format. - patter: "*.gff" + description: A reference file in either the GFF3, GFF2 or GTF format. + pattern: "*.{gff, gtf}" output: - - meta: - type: map - description: | - Groovy Map containing sample information - e.g. [ id:'test', single_end:false ] - gtf: type: file description: GTF file resulting from the conversion of the GFF input file - pattern: "*.gtf" + pattern: "*.{gtf}" - version: type: file description: File containing software version diff --git a/tests/modules/gffread/main.nf b/tests/modules/gffread/main.nf index e7b5441a..87e95275 100644 --- a/tests/modules/gffread/main.nf +++ b/tests/modules/gffread/main.nf @@ -2,7 +2,7 @@ nextflow.enable.dsl = 2 -include { GFFREAD } from '../../../modules/gffread/main.nf' addParams( options: [:] ) +include { GFFREAD } from '../../../modules/gffread/main.nf' addParams( options: [suffix: '.out'] ) workflow test_gffread { input = file(params.test_data['sarscov2']['genome']['genome_gff3'], checkIfExists: true) diff --git a/tests/modules/gffread/test.yml b/tests/modules/gffread/test.yml index 21a7bb6a..48096f1e 100644 --- a/tests/modules/gffread/test.yml +++ b/tests/modules/gffread/test.yml @@ -3,5 +3,5 @@ tags: - gffread files: - - path: ./output/gffread/genome.gtf - md5sum: f184f856b7fe3e159d21b052b5dd3954 + - path: ./output/gffread/genome.out.gtf + md5sum: fcbf5744ed806e47768bc456fa043263