Skip to content

Commit

Permalink
Updated mkfastq module (nf-core#5984)
Browse files Browse the repository at this point in the history
* Updated mkfastq module

* Combined input channels

* Updated main.nf.test and snap

---------

Co-authored-by: zxBIB Schcolnicov <[email protected]>
Co-authored-by: Anabella Trigila <[email protected]>
  • Loading branch information
3 people authored Jul 22, 2024
1 parent b50aa17 commit 2bb941b
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 71 deletions.
34 changes: 23 additions & 11 deletions modules/nf-core/cellranger/mkfastq/main.nf
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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}":
Expand Down
32 changes: 22 additions & 10 deletions modules/nf-core/cellranger/mkfastq/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -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)
]
"""
Expand All @@ -31,16 +31,20 @@ 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] ] }
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
{ assert snapshot(
process.out.fastq,
process.out.interop,
process.out.versions
).match()
}
)
}

Expand All @@ -51,16 +55,20 @@ 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] ] }
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
{ assert snapshot(
process.out.fastq,
process.out.interop,
process.out.versions
).match()
}
)
}

Expand All @@ -73,16 +81,20 @@ 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] ] }
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
{ assert snapshot(
process.out.fastq,
process.out.interop,
process.out.versions
).match()
}
)
}

Expand Down
113 changes: 63 additions & 50 deletions modules/nf-core/cellranger/mkfastq/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -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"
}
}

0 comments on commit 2bb941b

Please sign in to comment.