From 2bb941b6d3a01006c9f5bb49ca7eb8bb395dda9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Schcolnicov?= <90359308+nschcolnicov@users.noreply.github.com> Date: Mon, 22 Jul 2024 09:13:01 -0300 Subject: [PATCH] Updated mkfastq module (#5984) * Updated mkfastq module * Combined input channels * Updated main.nf.test and snap --------- Co-authored-by: zxBIB Schcolnicov Co-authored-by: Anabella Trigila <18577080+atrigila@users.noreply.github.com> --- modules/nf-core/cellranger/mkfastq/main.nf | 34 ++++-- .../cellranger/mkfastq/tests/main.nf.test | 32 +++-- .../mkfastq/tests/main.nf.test.snap | 113 ++++++++++-------- 3 files changed, 108 insertions(+), 71 deletions(-) diff --git a/modules/nf-core/cellranger/mkfastq/main.nf b/modules/nf-core/cellranger/mkfastq/main.nf index b605b892b6c..ad51227f854 100644 --- a/modules/nf-core/cellranger/mkfastq/main.nf +++ b/modules/nf-core/cellranger/mkfastq/main.nf @@ -1,16 +1,18 @@ process CELLRANGER_MKFASTQ { - tag "mkfastq" + tag {"$meta.lane" ? "$meta.id"+"."+"$meta.lane" : "$meta.id" } label 'process_medium' container "nf-core/cellrangermkfastq:8.0.0" input: - path bcl - path csv + tuple val(meta), path(csv), path(bcl) output: - path "**/outs/fastq_path/*.fastq.gz", emit: fastq - path "versions.yml" , emit: versions + tuple val(meta), path("*_outs/outs/fastq_path/*.fastq.gz"), emit: fastq + tuple val(meta), path("*_outs/outs/fastq_path/Reports") , emit: reports + tuple val(meta), path("*_outs/outs/fastq_path/Stats") , emit: stats + tuple val(meta), path("*_outs/outs/interop_path/*.bin") , emit: interop + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -21,11 +23,11 @@ process CELLRANGER_MKFASTQ { error "CELLRANGER_MKFASTQ module does not support Conda. Please use Docker / Singularity / Podman instead." } def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${bcl.getSimpleName()}" + def prefix = task.ext.prefix ?: "${meta.id}" //run_dir (bcl) and id must be different because a folder is created with the id value """ cellranger \\ mkfastq \\ - --id=${prefix} \\ + --id=${prefix}_outs \\ --run=$bcl \\ --csv=$csv \\ $args @@ -41,17 +43,27 @@ process CELLRANGER_MKFASTQ { if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { error "CELLRANGER_MKFASTQ module does not support Conda. Please use Docker / Singularity / Podman instead." } - def prefix = task.ext.prefix ?: "${bcl.getSimpleName()}" + def prefix = task.ext.prefix ?: "${meta.id}" """ - mkdir -p "${prefix}/outs/fastq_path/" + mkdir -p "${prefix}_outs/outs/fastq_path/" # data with something to avoid breaking nf-test java I/O stream - cat <<-FAKE_FQ > ${prefix}/outs/fastq_path/fake_file.fastq + cat <<-FAKE_FQ > ${prefix}_outs/outs/fastq_path/fake_file.fastq @SEQ_ID GATTTGGGGTTCAAAGCAGTATCGATCAAATAGTAAATCCATTTGTTCAACTCACAGTTT + !''*((((***+))%%%++)(%%%%).1***-+*''))**55CCF>>>>>>CCCCCCC65 FAKE_FQ - gzip -n ${prefix}/outs/fastq_path/fake_file.fastq + gzip -n ${prefix}_outs/outs/fastq_path/fake_file.fastq + + # data for reports output channel + mkdir -p "${prefix}_outs/outs/fastq_path/Reports" + + # data for stats output channel + mkdir -p "${prefix}_outs/outs/fastq_path/Stats" + + # data for interops output channel + mkdir -p "${prefix}_outs/outs/interop_path/" + touch "${prefix}_outs/outs/interop_path/IndexMetricsOut.bin" cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/cellranger/mkfastq/tests/main.nf.test b/modules/nf-core/cellranger/mkfastq/tests/main.nf.test index ab5e2969654..8aee40011a9 100644 --- a/modules/nf-core/cellranger/mkfastq/tests/main.nf.test +++ b/modules/nf-core/cellranger/mkfastq/tests/main.nf.test @@ -18,7 +18,7 @@ nextflow_process { process { """ input[0] = [ - [], + [ id: 'test', lane:1 ], file("https://cf.10xgenomics.com/supp/cell-exp/cellranger-tiny-bcl-1.2.0.tar.gz", checkIfExists: true) ] """ @@ -31,8 +31,7 @@ nextflow_process { when { process { """ - input[0] = UNTAR.out.untar.map{ it[1] } - input[1] = file("https://cf.10xgenomics.com/supp/cell-exp/cellranger-tiny-bcl-simple-1.2.0.csv", checkIfExists: true) + input[0] = UNTAR.out.untar.map{ it -> [ [ id: 'test', lane:1 ], file("https://cf.10xgenomics.com/supp/cell-exp/cellranger-tiny-bcl-simple-1.2.0.csv", checkIfExists: true), it[1] ] } """ } } @@ -40,7 +39,12 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot( + process.out.fastq, + process.out.interop, + process.out.versions + ).match() + } ) } @@ -51,8 +55,7 @@ nextflow_process { when { process { """ - input[0] = UNTAR.out.untar.map{ it[1] } - input[1] = file("https://cf.10xgenomics.com/supp/cell-exp/cellranger-tiny-bcl-samplesheet-1.2.0.csv", checkIfExists: true) + input[0] = UNTAR.out.untar.map{ it -> [ [ id: 'test', lane:1 ], file("https://cf.10xgenomics.com/supp/cell-exp/cellranger-tiny-bcl-samplesheet-1.2.0.csv", checkIfExists: true), it[1] ] } """ } } @@ -60,7 +63,12 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot( + process.out.fastq, + process.out.interop, + process.out.versions + ).match() + } ) } @@ -73,8 +81,7 @@ nextflow_process { when { process { """ - input[0] = UNTAR.out.untar.map{ it[1] } - input[1] = file("https://cf.10xgenomics.com/supp/cell-exp/cellranger-tiny-bcl-simple-1.2.0.csv", checkIfExists: true) + input[0] = UNTAR.out.untar.map{ it -> [ [ id: 'test', lane:1 ], file("https://cf.10xgenomics.com/supp/cell-exp/cellranger-tiny-bcl-simple-1.2.0.csv", checkIfExists: true), it[1] ] } """ } } @@ -82,7 +89,12 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } + { assert snapshot( + process.out.fastq, + process.out.interop, + process.out.versions + ).match() + } ) } diff --git a/modules/nf-core/cellranger/mkfastq/tests/main.nf.test.snap b/modules/nf-core/cellranger/mkfastq/tests/main.nf.test.snap index 52c0ae63b19..e539f8e24ac 100644 --- a/modules/nf-core/cellranger/mkfastq/tests/main.nf.test.snap +++ b/modules/nf-core/cellranger/mkfastq/tests/main.nf.test.snap @@ -1,87 +1,100 @@ { "cellranger - tiny - simple": { "content": [ - { - "0": [ + [ + [ + { + "id": "test", + "lane": 1 + }, [ "Undetermined_S0_L001_I1_001.fastq.gz:md5,c93946d67bdb1d5b2ab955fd1dc9cb31", "Undetermined_S0_L001_R1_001.fastq.gz:md5,faa79ce215ae72fdc3375cda066c6757", "Undetermined_S0_L001_R2_001.fastq.gz:md5,d8955db4dfbf7aee89b6bdc3b7629f8f" ] - ], - "1": [ - "versions.yml:md5,2177bf2d035c62d2fd543af8e9184f90" - ], - "fastq": [ - [ - "Undetermined_S0_L001_I1_001.fastq.gz:md5,c93946d67bdb1d5b2ab955fd1dc9cb31", - "Undetermined_S0_L001_R1_001.fastq.gz:md5,faa79ce215ae72fdc3375cda066c6757", - "Undetermined_S0_L001_R2_001.fastq.gz:md5,d8955db4dfbf7aee89b6bdc3b7629f8f" - ] - ], - "versions": [ - "versions.yml:md5,2177bf2d035c62d2fd543af8e9184f90" ] - } + ], + [ + [ + { + "id": "test", + "lane": 1 + }, + "IndexMetricsOut.bin:md5,437d55bac453ddf603ef084ba2dab82e" + ] + ], + [ + "versions.yml:md5,2177bf2d035c62d2fd543af8e9184f90" + ] ], "meta": { "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nextflow": "24.04.3" }, - "timestamp": "2024-03-22T08:34:04.684513054" + "timestamp": "2024-07-19T20:45:20.493024717" }, "cellranger - tiny - simple - stub": { "content": [ - { - "0": [ - "fake_file.fastq.gz:md5,8e16c1f4a441cbb3b7de374d2c924da7" - ], - "1": [ - "versions.yml:md5,2177bf2d035c62d2fd543af8e9184f90" - ], - "fastq": [ + [ + [ + { + "id": "test", + "lane": 1 + }, "fake_file.fastq.gz:md5,8e16c1f4a441cbb3b7de374d2c924da7" - ], - "versions": [ - "versions.yml:md5,2177bf2d035c62d2fd543af8e9184f90" ] - } + ], + [ + [ + { + "id": "test", + "lane": 1 + }, + "IndexMetricsOut.bin:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + [ + "versions.yml:md5,2177bf2d035c62d2fd543af8e9184f90" + ] ], "meta": { "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nextflow": "24.04.3" }, - "timestamp": "2024-03-22T08:45:05.911737344" + "timestamp": "2024-07-19T20:47:11.995685118" }, "cellranger - tiny - illumina": { "content": [ - { - "0": [ + [ + [ + { + "id": "test", + "lane": 1 + }, [ "Undetermined_S0_L001_I1_001.fastq.gz:md5,c93946d67bdb1d5b2ab955fd1dc9cb31", "Undetermined_S0_L001_R1_001.fastq.gz:md5,faa79ce215ae72fdc3375cda066c6757", "Undetermined_S0_L001_R2_001.fastq.gz:md5,d8955db4dfbf7aee89b6bdc3b7629f8f" ] - ], - "1": [ - "versions.yml:md5,2177bf2d035c62d2fd543af8e9184f90" - ], - "fastq": [ - [ - "Undetermined_S0_L001_I1_001.fastq.gz:md5,c93946d67bdb1d5b2ab955fd1dc9cb31", - "Undetermined_S0_L001_R1_001.fastq.gz:md5,faa79ce215ae72fdc3375cda066c6757", - "Undetermined_S0_L001_R2_001.fastq.gz:md5,d8955db4dfbf7aee89b6bdc3b7629f8f" - ] - ], - "versions": [ - "versions.yml:md5,2177bf2d035c62d2fd543af8e9184f90" ] - } + ], + [ + [ + { + "id": "test", + "lane": 1 + }, + "IndexMetricsOut.bin:md5,e2ac28695537336b53a509f48e93ed1f" + ] + ], + [ + "versions.yml:md5,2177bf2d035c62d2fd543af8e9184f90" + ] ], "meta": { "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nextflow": "24.04.3" }, - "timestamp": "2024-03-22T08:36:09.943652935" + "timestamp": "2024-07-19T20:46:17.031302052" } } \ No newline at end of file