Skip to content

Commit

Permalink
cellranger count: start with L001 when renaming files (nf-core#4901)
Browse files Browse the repository at this point in the history
* cellranger count: start with L001 when renaming files

Previously it started with L000 which was still recognized by cellranger, but there would never be a file named L000 generated by demultiplexing.

* automated pytest migration

* Update nf-test file

* Update nf-test snapshot

* [automated] Fix linting with Prettier

* Fix module lint

* Update nf-test

* exclude empty file from snap

* Fix nf-test

---------

Co-authored-by: nf-core-bot <[email protected]>
Co-authored-by: Alexander Peltzer <[email protected]>
  • Loading branch information
3 people authored Mar 6, 2024
1 parent dd1b3c4 commit a2dfd9a
Show file tree
Hide file tree
Showing 11 changed files with 170 additions and 125 deletions.
5 changes: 0 additions & 5 deletions modules/nf-core/cellranger/count/environment.yml

This file was deleted.

2 changes: 1 addition & 1 deletion modules/nf-core/cellranger/count/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ process CELLRANGER_COUNT {
def prefix = task.ext.prefix ?: "${meta.id}"
"""
mkdir -p "${prefix}/outs/"
touch ${prefix}/outs/fake_file.txt
echo "$prefix" > ${prefix}/outs/fake_file.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
3 changes: 2 additions & 1 deletion modules/nf-core/cellranger/count/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ tools:
homepage: https://support.10xgenomics.com/single-cell-gene-expression/software/pipelines/latest/what-is-cell-ranger
documentation: https://support.10xgenomics.com/single-cell-gene-expression/software/pipelines/latest/using/tutorial_ov
tool_dev_url: https://support.10xgenomics.com/single-cell-gene-expression/software/pipelines/latest/using/tutorial_ov
licence: 10x Genomics EULA
licence:
- 10x Genomics EULA
input:
- meta:
type: map
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def chunk_iter(seq, size):
# do not match "SRR12345", "file_INFIXR12", etc
filename_pattern = r'([^a-zA-Z0-9])R1([^a-zA-Z0-9])'

for i, (r1, r2) in enumerate(chunk_iter(fastqs, 2)):
for i, (r1, r2) in enumerate(chunk_iter(fastqs, 2), start=1):
# double escapes are required because nextflow processes this python 'template'
if re.sub(filename_pattern, r'\\1R2\\2', r1.name) != r2.name:
raise AssertionError(
Expand Down
101 changes: 101 additions & 0 deletions modules/nf-core/cellranger/count/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
nextflow_process {

name "Test Process CELLRANGER_COUNT"
script "../main.nf"
process "CELLRANGER_COUNT"

tag "modules"
tag "modules_nfcore"
tag "cellranger"
tag "cellranger/count"
tag "cellranger/mkref"
tag "cellranger/mkgtf"

setup {
config "./nextflow.config"

run("CELLRANGER_MKGTF") {
script "../../mkgtf/main.nf"
process {
"""
input[0] = file(params.test_data['homo_sapiens']['genome']['genome_gtf'], checkIfExists: true)
"""
}
}
run("CELLRANGER_MKREF") {
script "../../mkref/main.nf"
process {
"""
input[0] = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true)
input[1] = CELLRANGER_MKGTF.out.gtf
input[2] = "homo_sapiens_chr22_reference"
"""
}
}
}

test("10x example file") {
config "./nextflow.config"
when {
process {
"""
input[0] = [
[ id:'test_10x', single_end:false, strandedness:'auto' ], // meta map
[
file(params.test_data['homo_sapiens']['10xgenomics']['cellranger']['test_10x_5k_cmvpos_tcells_gex1_fastq_1_gz'], checkIfExists: true),
file(params.test_data['homo_sapiens']['10xgenomics']['cellranger']['test_10x_5k_cmvpos_tcells_gex1_fastq_2_gz'], checkIfExists: true)
]
]
input[1] = CELLRANGER_MKREF.out.reference
"""
}
}

then {
assertAll(
{ assert process.success },
{
assert snapshot(
process.out.versions,
process.out.outs[0][1].findAll { file(it).name !in [
'web_summary.html', // unstable checksum
'barcodes.tsv.gz' // empty file in test data -> would raise linting error
]}
).match()
},
{ assert file(process.out.outs.get(0).get(1).find { file(it).name == 'web_summary.html' }).exists() },
{ assert file(process.out.outs.get(0).get(1).find { file(it).name == 'barcodes.tsv.gz' }).exists() }
)
}

}

test("10x example file - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test_10x', single_end:false, strandedness:'auto' ], // meta map
[
file(params.test_data['homo_sapiens']['10xgenomics']['cellranger']['test_10x_5k_cmvpos_tcells_gex1_fastq_1_gz'], checkIfExists: true),
file(params.test_data['homo_sapiens']['10xgenomics']['cellranger']['test_10x_5k_cmvpos_tcells_gex1_fastq_2_gz'], checkIfExists: true)
]
]
input[1] = CELLRANGER_MKREF.out.reference
"""
}
}

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

}

}
63 changes: 63 additions & 0 deletions modules/nf-core/cellranger/count/tests/main.nf.test.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
process {

publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }

withName: CELLRANGER_MKGTF {
ext.args = '--attribute=gene_biotype:protein_coding \
--attribute=gene_biotype:lincRNA \
Expand All @@ -20,12 +17,8 @@ process {
--attribute=gene_biotype:TR_J_gene \
--attribute=gene_biotype:TR_J_pseudogene \
--attribute=gene_biotype:TR_C_gene'


}

withName: CELLRANGER_COUNT {
ext.args = '--chemistry SC3Pv3'
}

}
2 changes: 2 additions & 0 deletions modules/nf-core/cellranger/count/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cellranger/count:
- "modules/nf-core/cellranger/count/**"
7 changes: 0 additions & 7 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,6 @@ canu:
cdhit/cdhitest:
- modules/nf-core/cdhit/cdhitest/**
- tests/modules/nf-core/cdhit/cdhitest/**
cellranger/count:
- modules/nf-core/cellranger/count/**
- tests/modules/nf-core/cellranger/count/**
- modules/nf-core/cellranger/mkref/**
- tests/modules/nf-core/cellranger/mkref/**
- modules/nf-core/cellranger/mkgtf/**
- tests/modules/nf-core/cellranger/mkgtf/**
cellranger/mkfastq:
- modules/nf-core/cellranger/mkfastq/**
- tests/modules/nf-core/cellranger/mkfastq/**
Expand Down
33 changes: 0 additions & 33 deletions tests/modules/nf-core/cellranger/count/main.nf

This file was deleted.

70 changes: 0 additions & 70 deletions tests/modules/nf-core/cellranger/count/test.yml

This file was deleted.

0 comments on commit a2dfd9a

Please sign in to comment.