From 9446428976cef86d2cd5d746adb4a08fed4e3ba0 Mon Sep 17 00:00:00 2001 From: Rike Date: Tue, 29 Mar 2022 19:01:01 +0200 Subject: [PATCH 1/8] Fix typo --- modules/controlfreec/freec/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/controlfreec/freec/main.nf b/modules/controlfreec/freec/main.nf index ba48ea1e..eb66eeaa 100644 --- a/modules/controlfreec/freec/main.nf +++ b/modules/controlfreec/freec/main.nf @@ -41,7 +41,7 @@ process CONTROLFREEC_FREEC { def chr_length = fai ? "chrLenFile = \${PWD}/${fai}" : "" def breakpointthreshold = task.ext.args?["general"]?["breakpointthreshold"] ? "breakPointThreshold = ${task.ext.args["general"]["breakpointthreshold"]}" : "" def breakpointtype = task.ext.args?["general"]?["breakpointtype"] ? "breakPointType = ${task.ext.args["general"]["breakpointtype"]}" : "" - def coefficientofvariation = task.ext.args?["general"]?["coefficient"] ? "coefficientOfVariation = ${task.ext.args["general"]["coefficientofvariation"]}" : "" + def coefficientofvariation = task.ext.args?["general"]?["coefficientofvariation"] ? "coefficientOfVariation = ${task.ext.args["general"]["coefficientofvariation"]}" : "" def contamination = task.ext.args?["general"]?["contamination"] ? "contamination = ${task.ext.args["general"]["contamination"]}" : "" def contaminationadjustment = task.ext.args?["general"]?["contaminationadjustment"] ? "contaminationAdjustment = ${task.ext.args["general"]["contaminationadjustment"]}" : "" def degree = task.ext.args?["general"]?["degree"] ? "degree = ${task.ext.args["general"]["degree"]}" : "" From 129f57ccd9adc9016aaa3f2e2e6ab556ba8de7b6 Mon Sep 17 00:00:00 2001 From: Mahesh Binzer-Panchal Date: Mon, 9 May 2022 08:50:28 +0000 Subject: [PATCH 2/8] Add meryl histogram --- modules/meryl/histogram/main.nf | 34 +++++++++++++++ modules/meryl/histogram/meta.yml | 41 +++++++++++++++++++ tests/config/pytest_modules.yml | 12 ++++-- tests/modules/meryl/histogram/main.nf | 17 ++++++++ tests/modules/meryl/histogram/nextflow.config | 5 +++ tests/modules/meryl/histogram/test.yml | 14 +++++++ 6 files changed, 119 insertions(+), 4 deletions(-) create mode 100644 modules/meryl/histogram/main.nf create mode 100644 modules/meryl/histogram/meta.yml create mode 100644 tests/modules/meryl/histogram/main.nf create mode 100644 tests/modules/meryl/histogram/nextflow.config create mode 100644 tests/modules/meryl/histogram/test.yml diff --git a/modules/meryl/histogram/main.nf b/modules/meryl/histogram/main.nf new file mode 100644 index 00000000..a1f18f05 --- /dev/null +++ b/modules/meryl/histogram/main.nf @@ -0,0 +1,34 @@ +process MERYL_HISTOGRAM { + tag "$meta.id" + label 'process_low' + + conda (params.enable_conda ? "bioconda::meryl=1.3" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/meryl:1.3--h87f3376_1': + 'quay.io/biocontainers/meryl:1.3--h87f3376_1' }" + + input: + tuple val(meta), path(meryl_db) + + output: + tuple val(meta), path("*.hist"), emit: hist + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + meryl histogram \\ + threads=$task.cpus \\ + $args \\ + $meryl_db > ${prefix}.hist + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + meryl: \$( meryl --version |& sed 's/meryl //' ) + END_VERSIONS + """ +} diff --git a/modules/meryl/histogram/meta.yml b/modules/meryl/histogram/meta.yml new file mode 100644 index 00000000..b786e076 --- /dev/null +++ b/modules/meryl/histogram/meta.yml @@ -0,0 +1,41 @@ +name: "meryl_histogram" +description: A genomic k-mer counter (and sequence utility) with nice features. +keywords: + - k-mer + - histogram +tools: + - "meryl": + description: "A genomic k-mer counter (and sequence utility) with nice features. " + homepage: "https://github.com/marbl/meryl" + documentation: "https://meryl.readthedocs.io/en/latest/quick-start.html" + tool_dev_url: "https://github.com/marbl/meryl" + doi: "" + licence: "['GPL']" + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - meryl_dbs: + type: directory + description: Meryl k-mer database + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - hist: + type: file + description: Histogram of k-mers + pattern: "*.hist" + +authors: + - "@mahesh-panchal" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index b9c67363..2aa9a20d 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1214,6 +1214,10 @@ meningotype: - modules/meningotype/** - tests/modules/meningotype/** +meryl/histogram: + - modules/meryl/histogram/** + - tests/modules/meryl/histogram/** + metabat2/jgisummarizebamcontigdepths: - modules/metabat2/jgisummarizebamcontigdepths/** - tests/modules/metabat2/jgisummarizebamcontigdepths/** @@ -1763,14 +1767,14 @@ slimfastq: - modules/slimfastq/** - tests/modules/slimfastq/** -snapaligner/index: - - modules/snapaligner/index/** - - tests/modules/snapaligner/index/** - snapaligner/align: - modules/snapaligner/align/** - tests/modules/snapaligner/align/** +snapaligner/index: + - modules/snapaligner/index/** + - tests/modules/snapaligner/index/** + snpdists: - modules/snpdists/** - tests/modules/snpdists/** diff --git a/tests/modules/meryl/histogram/main.nf b/tests/modules/meryl/histogram/main.nf new file mode 100644 index 00000000..697a12ef --- /dev/null +++ b/tests/modules/meryl/histogram/main.nf @@ -0,0 +1,17 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { MERYL_COUNT } from '../../../../modules/meryl/count/main.nf' +include { MERYL_HISTOGRAM } from '../../../../modules/meryl/histogram/main.nf' + +workflow test_meryl_histogram { + + input = [ + [ id:'test' ], // meta map + file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) + ] + + MERYL_COUNT ( input ) + MERYL_HISTOGRAM ( MERYL_COUNT.out.meryl_db ) +} diff --git a/tests/modules/meryl/histogram/nextflow.config b/tests/modules/meryl/histogram/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/meryl/histogram/nextflow.config @@ -0,0 +1,5 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + +} \ No newline at end of file diff --git a/tests/modules/meryl/histogram/test.yml b/tests/modules/meryl/histogram/test.yml new file mode 100644 index 00000000..ef358943 --- /dev/null +++ b/tests/modules/meryl/histogram/test.yml @@ -0,0 +1,14 @@ +## TODO nf-core: Please run the following command to build this file: +# nf-core modules create-test-yml meryl/histogram +- name: "meryl histogram" + command: nextflow run ./tests/modules/meryl/histogram -entry test_meryl_histogram -c ./tests/config/nextflow.config -c ./tests/modules/meryl/histogram/nextflow.config + tags: + - "meryl" + # + - "meryl/histogram" + # + files: + - path: "output/meryl/test.bam" + md5sum: e667c7caad0bc4b7ac383fd023c654fc + - path: output/meryl/versions.yml + md5sum: a01fe51bc4c6a3a6226fbf77b2c7cf3b From ef5f145342cb0f25be6867f9ac17fe460b11571c Mon Sep 17 00:00:00 2001 From: Rike Date: Mon, 9 May 2022 15:22:54 +0200 Subject: [PATCH 3/8] Generalize Bam2Cram do either conversion --- .../samtools/{bamtocram => convert}/main.nf | 20 ++++++++---- .../samtools/{bamtocram => convert}/meta.yml | 12 +++---- tests/config/pytest_modules.yml | 6 ++-- tests/modules/samtools/bamtocram/main.nf | 17 ---------- .../samtools/bamtocram/nextflow.config | 5 --- tests/modules/samtools/bamtocram/test.yml | 9 ------ tests/modules/samtools/convert/main.nf | 31 +++++++++++++++++++ .../modules/samtools/convert/nextflow.config | 12 +++++++ tests/modules/samtools/convert/test.yml | 21 +++++++++++++ 9 files changed, 87 insertions(+), 46 deletions(-) rename modules/samtools/{bamtocram => convert}/main.nf (59%) rename modules/samtools/{bamtocram => convert}/meta.yml (84%) delete mode 100644 tests/modules/samtools/bamtocram/main.nf delete mode 100644 tests/modules/samtools/bamtocram/nextflow.config delete mode 100644 tests/modules/samtools/bamtocram/test.yml create mode 100644 tests/modules/samtools/convert/main.nf create mode 100644 tests/modules/samtools/convert/nextflow.config create mode 100644 tests/modules/samtools/convert/test.yml diff --git a/modules/samtools/bamtocram/main.nf b/modules/samtools/convert/main.nf similarity index 59% rename from modules/samtools/bamtocram/main.nf rename to modules/samtools/convert/main.nf index b49c308f..a7ec1bda 100644 --- a/modules/samtools/bamtocram/main.nf +++ b/modules/samtools/convert/main.nf @@ -1,5 +1,4 @@ -//There is a -L option to only output alignments in interval, might be an option for exons/panel data? -process SAMTOOLS_BAMTOCRAM { +process SAMTOOLS_CONVERT { tag "$meta.id" label 'process_medium' @@ -14,8 +13,9 @@ process SAMTOOLS_BAMTOCRAM { path fai output: - tuple val(meta), path("*.cram"), path("*.crai"), emit: cram_crai - path "versions.yml" , emit: versions + tuple val(meta), path("*.cram"), path("*.crai") , emit: cram_crai, optional: true + tuple val(meta), path("*.bam"), path("*.bai") , emit: bam_bai, optional:true + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -23,9 +23,17 @@ process SAMTOOLS_BAMTOCRAM { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def file_type = input.getExtension() == "bam" ? "cram" : "bam" + """ - samtools view --threads ${task.cpus} --reference ${fasta} -C $args $input > ${prefix}.cram - samtools index -@${task.cpus} ${prefix}.cram + samtools view \\ + --threads ${task.cpus} \\ + --reference ${fasta} \\ + $args \\ + $input \\ + -o ${prefix}.${file_type} + + samtools index -@${task.cpus} ${prefix}.${file_type} cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/samtools/bamtocram/meta.yml b/modules/samtools/convert/meta.yml similarity index 84% rename from modules/samtools/bamtocram/meta.yml rename to modules/samtools/convert/meta.yml index 037704c6..506febb6 100644 --- a/modules/samtools/bamtocram/meta.yml +++ b/modules/samtools/convert/meta.yml @@ -1,5 +1,5 @@ -name: samtools_bamtocram -description: filter/convert and then index CRAM file +name: samtools_convert +description: convert and then index CRAM -> BAM or BAM -> CRAM file keywords: - view - index @@ -23,12 +23,12 @@ input: e.g. [ id:'test', single_end:false ] - input: type: file - description: BAM/SAM file - pattern: "*.{bam,sam}" + description: BAM/CRAM file + pattern: "*.{bam,cram}" - index: type: file - description: BAM/SAM index file - pattern: "*.{bai,sai}" + description: BAM/CRAM index file + pattern: "*.{bai,crai}" - fasta: type: file description: Reference file to create the CRAM file diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index ec7fc321..53aa44b9 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1631,9 +1631,9 @@ samtools/bam2fq: - modules/samtools/bam2fq/** - tests/modules/samtools/bam2fq/** -samtools/bamtocram: - - modules/samtools/bamtocram/** - - tests/modules/samtools/bamtocram/** +samtools/convert: + - modules/samtools/convert/** + - tests/modules/samtools/convert/** samtools/collatefastq: - modules/samtools/collatefastq/** diff --git a/tests/modules/samtools/bamtocram/main.nf b/tests/modules/samtools/bamtocram/main.nf deleted file mode 100644 index b1743310..00000000 --- a/tests/modules/samtools/bamtocram/main.nf +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { SAMTOOLS_BAMTOCRAM } from '../../../../modules/samtools/bamtocram/main.nf' - -workflow test_samtools_bamtocram { - - input = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), - file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true)] - - fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) - fai = file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true) - - SAMTOOLS_BAMTOCRAM ( input, fasta, fai ) -} \ No newline at end of file diff --git a/tests/modules/samtools/bamtocram/nextflow.config b/tests/modules/samtools/bamtocram/nextflow.config deleted file mode 100644 index 8730f1c4..00000000 --- a/tests/modules/samtools/bamtocram/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} diff --git a/tests/modules/samtools/bamtocram/test.yml b/tests/modules/samtools/bamtocram/test.yml deleted file mode 100644 index 3cb82902..00000000 --- a/tests/modules/samtools/bamtocram/test.yml +++ /dev/null @@ -1,9 +0,0 @@ -- name: samtools bamtocram test_samtools_bamtocram - command: nextflow run ./tests/modules/samtools/bamtocram -entry test_samtools_bamtocram -c ./tests/config/nextflow.config -c ./tests/modules/samtools/bamtocram/nextflow.config - tags: - - samtools/bamtocram - - samtools - files: - - path: output/samtools/test.cram - - path: output/samtools/test.cram.crai - - path: output/samtools/versions.yml diff --git a/tests/modules/samtools/convert/main.nf b/tests/modules/samtools/convert/main.nf new file mode 100644 index 00000000..01bdfe7f --- /dev/null +++ b/tests/modules/samtools/convert/main.nf @@ -0,0 +1,31 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { SAMTOOLS_CONVERT as SAMTOOLS_BAMTOCRAM } from '../../../../modules/samtools/convert/main.nf' +include { SAMTOOLS_CONVERT as SAMTOOLS_CRAMTOBAM } from '../../../../modules/samtools/convert/main.nf' + +workflow test_samtools_convert_bamtocram { + + input = [ [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true)] + + fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + fai = file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true) + + SAMTOOLS_BAMTOCRAM ( input, fasta, fai ) +} + +workflow test_samtools_convert_cramtobam { + + input = [ [ id:'test', single_end:false ], // meta map + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_cram'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_recalibrated_sorted_cram_crai'], checkIfExists: true) + ] + + fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true) + fai = file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true) + + SAMTOOLS_CRAMTOBAM ( input, fasta, fai ) +} diff --git a/tests/modules/samtools/convert/nextflow.config b/tests/modules/samtools/convert/nextflow.config new file mode 100644 index 00000000..4f1e83f6 --- /dev/null +++ b/tests/modules/samtools/convert/nextflow.config @@ -0,0 +1,12 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + + withName:SAMTOOLS_BAMTOCRAM{ + ext.args = "-C" + } + + withName:SAMTOOLS_CRAMTOBAM{ + ext.args = "-b" + } +} diff --git a/tests/modules/samtools/convert/test.yml b/tests/modules/samtools/convert/test.yml new file mode 100644 index 00000000..979f36ca --- /dev/null +++ b/tests/modules/samtools/convert/test.yml @@ -0,0 +1,21 @@ +- name: samtools convert test_samtools_convert_bamtocram + command: nextflow run tests/modules/samtools/convert -entry test_samtools_convert_bamtocram -c tests/config/nextflow.config + tags: + - samtools + - samtools/convert + files: + - path: output/samtools/test.cram + - path: output/samtools/test.cram.crai + - path: output/samtools/versions.yml + +- name: samtools convert test_samtools_convert_cramtobam + command: nextflow run tests/modules/samtools/convert -entry test_samtools_convert_cramtobam -c tests/config/nextflow.config + tags: + - samtools + - samtools/convert + files: + - path: output/samtools/test.bam + md5sum: c262b6dc15f9b480bdb47d6d018b4b56 + - path: output/samtools/test.bam.bai + md5sum: 6e8f5034f728401bfa841c8e70c62463 + - path: output/samtools/versions.yml From 24d5e7feedfe0eaefe1293f5e233c79fa63a3f9a Mon Sep 17 00:00:00 2001 From: Rike Date: Mon, 9 May 2022 15:42:55 +0200 Subject: [PATCH 4/8] Code review suggestions --- modules/samtools/convert/meta.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/samtools/convert/meta.yml b/modules/samtools/convert/meta.yml index 506febb6..2396f0b3 100644 --- a/modules/samtools/convert/meta.yml +++ b/modules/samtools/convert/meta.yml @@ -43,6 +43,10 @@ output: type: file description: filtered/converted CRAM file + index pattern: "*{.cram,.crai}" + - bam_bai: + type: file + description: filtered/converted BAM file + index + pattern: "*{.bam,.bai}" - version: type: file description: File containing software version From da93beaf606a9f4ea7ae335ed3e25afdeac2bc26 Mon Sep 17 00:00:00 2001 From: Mahesh Binzer-Panchal Date: Mon, 9 May 2022 13:50:49 +0000 Subject: [PATCH 5/8] Update pytests --- tests/modules/meryl/histogram/nextflow.config | 5 +++-- tests/modules/meryl/histogram/test.yml | 18 +++++++----------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/tests/modules/meryl/histogram/nextflow.config b/tests/modules/meryl/histogram/nextflow.config index 50f50a7a..6d899c50 100644 --- a/tests/modules/meryl/histogram/nextflow.config +++ b/tests/modules/meryl/histogram/nextflow.config @@ -1,5 +1,6 @@ process { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} \ No newline at end of file + ext.args = 'k=21' + +} diff --git a/tests/modules/meryl/histogram/test.yml b/tests/modules/meryl/histogram/test.yml index ef358943..dce26b65 100644 --- a/tests/modules/meryl/histogram/test.yml +++ b/tests/modules/meryl/histogram/test.yml @@ -1,14 +1,10 @@ -## TODO nf-core: Please run the following command to build this file: -# nf-core modules create-test-yml meryl/histogram -- name: "meryl histogram" - command: nextflow run ./tests/modules/meryl/histogram -entry test_meryl_histogram -c ./tests/config/nextflow.config -c ./tests/modules/meryl/histogram/nextflow.config +- name: meryl histogram test_meryl_histogram + command: nextflow run tests/modules/meryl/histogram -entry test_meryl_histogram -c tests/config/nextflow.config tags: - - "meryl" - # - - "meryl/histogram" - # + - meryl/histogram + - meryl files: - - path: "output/meryl/test.bam" - md5sum: e667c7caad0bc4b7ac383fd023c654fc + - path: output/meryl/test.hist + md5sum: 4bfdc8b287ee0cfd9922bbfa8cd64650 - path: output/meryl/versions.yml - md5sum: a01fe51bc4c6a3a6226fbf77b2c7cf3b + md5sum: 050038f1b1df79977a393cce1b4b2ddb From 1de1c2253e2d5c6bc37ebeda5500120f6f023750 Mon Sep 17 00:00:00 2001 From: Rike Date: Mon, 9 May 2022 16:04:58 +0200 Subject: [PATCH 6/8] Combine output after code review --- modules/samtools/convert/main.nf | 7 +++---- modules/samtools/convert/meta.yml | 10 +++------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/modules/samtools/convert/main.nf b/modules/samtools/convert/main.nf index a7ec1bda..b20f2b93 100644 --- a/modules/samtools/convert/main.nf +++ b/modules/samtools/convert/main.nf @@ -13,16 +13,15 @@ process SAMTOOLS_CONVERT { path fai output: - tuple val(meta), path("*.cram"), path("*.crai") , emit: cram_crai, optional: true - tuple val(meta), path("*.bam"), path("*.bai") , emit: bam_bai, optional:true - path "versions.yml" , emit: versions + tuple val(meta), path("*.{cram,bam}"), path("*.{crai,bai}") , emit: aligned_index + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when script: def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" + prefix = task.ext.prefix ?: "${meta.id}" def file_type = input.getExtension() == "bam" ? "cram" : "bam" """ diff --git a/modules/samtools/convert/meta.yml b/modules/samtools/convert/meta.yml index 2396f0b3..87727255 100644 --- a/modules/samtools/convert/meta.yml +++ b/modules/samtools/convert/meta.yml @@ -39,14 +39,10 @@ output: description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] - - cram_crai: + - aligned_index: type: file - description: filtered/converted CRAM file + index - pattern: "*{.cram,.crai}" - - bam_bai: - type: file - description: filtered/converted BAM file + index - pattern: "*{.bam,.bai}" + description: filtered/converted BAM/CRAM file + index + pattern: "*{.bam/cram,.bai/crai}" - version: type: file description: File containing software version From 5bd456e5e8cdc9cf8a34ce9bc5fc1f949714e0fe Mon Sep 17 00:00:00 2001 From: Rike Date: Mon, 9 May 2022 16:06:22 +0200 Subject: [PATCH 7/8] rename file_type to output extension --- modules/samtools/convert/main.nf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/samtools/convert/main.nf b/modules/samtools/convert/main.nf index b20f2b93..4638d360 100644 --- a/modules/samtools/convert/main.nf +++ b/modules/samtools/convert/main.nf @@ -21,8 +21,8 @@ process SAMTOOLS_CONVERT { script: def args = task.ext.args ?: '' - prefix = task.ext.prefix ?: "${meta.id}" - def file_type = input.getExtension() == "bam" ? "cram" : "bam" + def prefix = task.ext.prefix ?: "${meta.id}" + def output_extension = input.getExtension() == "bam" ? "cram" : "bam" """ samtools view \\ @@ -30,9 +30,9 @@ process SAMTOOLS_CONVERT { --reference ${fasta} \\ $args \\ $input \\ - -o ${prefix}.${file_type} + -o ${prefix}.${output_extension} - samtools index -@${task.cpus} ${prefix}.${file_type} + samtools index -@${task.cpus} ${prefix}.${output_extension} cat <<-END_VERSIONS > versions.yml "${task.process}": From da79396f066a96450d9cc9f115c17c9d738595fd Mon Sep 17 00:00:00 2001 From: Rike Date: Mon, 9 May 2022 16:07:49 +0200 Subject: [PATCH 8/8] rename aligned to alignment --- modules/samtools/convert/main.nf | 2 +- modules/samtools/convert/meta.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/samtools/convert/main.nf b/modules/samtools/convert/main.nf index 4638d360..e0e7d725 100644 --- a/modules/samtools/convert/main.nf +++ b/modules/samtools/convert/main.nf @@ -13,7 +13,7 @@ process SAMTOOLS_CONVERT { path fai output: - tuple val(meta), path("*.{cram,bam}"), path("*.{crai,bai}") , emit: aligned_index + tuple val(meta), path("*.{cram,bam}"), path("*.{crai,bai}") , emit: alignment_index path "versions.yml" , emit: versions when: diff --git a/modules/samtools/convert/meta.yml b/modules/samtools/convert/meta.yml index 87727255..937b1403 100644 --- a/modules/samtools/convert/meta.yml +++ b/modules/samtools/convert/meta.yml @@ -39,7 +39,7 @@ output: description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] - - aligned_index: + - alignment_index: type: file description: filtered/converted BAM/CRAM file + index pattern: "*{.bam/cram,.bai/crai}"