Skip to content

Commit

Permalink
Bump kallistobustools to 0.28.2 (nf-core#4981)
Browse files Browse the repository at this point in the history
* bump version, add new options from 0.28.2

* waiting on conda

* style

* Update environment.yml

* workflow mode is reqd

* editing tests: the quantification logic has changed

* fixing licenses

* workflow should be specified explicitly

* container fixed at bioconda

* incorrectly recorded md5s

* Added nf-tests for kallistobustools modules

* Delete modules/nf-core/kallistobustools/ref/tests/nextflow.config

* Added kallistobustools/ref tag to kallistobustools/count test

* Don't include path lines in count test

* Apply suggestions from code review

Co-authored-by: Jasmin Frangenberg <73216762+jasmezz@users.noreply.github.com>

---------

Co-authored-by: Carson J Miller <carsonjmiller@outlook.com>
Co-authored-by: Carson J Miller <68351153+CarsonJM@users.noreply.github.com>
Co-authored-by: Jasmin Frangenberg <73216762+jasmezz@users.noreply.github.com>
  • Loading branch information
4 people authored and jennylsmith committed Mar 20, 2024
1 parent 96b1e50 commit d695534
Show file tree
Hide file tree
Showing 20 changed files with 531 additions and 178 deletions.
2 changes: 1 addition & 1 deletion modules/nf-core/kallistobustools/count/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ channels:
- bioconda
- defaults
dependencies:
- bioconda::kb-python=0.27.2
- bioconda::kb-python=0.28.2
32 changes: 23 additions & 9 deletions modules/nf-core/kallistobustools/count/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ process KALLISTOBUSTOOLS_COUNT {

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/kb-python:0.27.2--pyhdfd78af_0' :
'biocontainers/kb-python:0.27.2--pyhdfd78af_0' }"
'https://depot.galaxyproject.org/singularity/kb-python:0.28.2--pyhdfd78af_2' :
'biocontainers/kb-python:0.28.2--pyhdfd78af_2' }"

input:
tuple val(meta), path(reads)
Expand All @@ -14,11 +14,12 @@ process KALLISTOBUSTOOLS_COUNT {
path t1c
path t2c
val technology
val workflow_mode

output:
tuple val(meta), path ("*.count"), emit: count
path "versions.yml" , emit: versions
path "*.count/*/*.mtx" , emit: matrix //Ensure that kallisto finished and produced outputs
tuple val(meta), path ("*.count") , emit: count
path "versions.yml" , emit: versions
path "*.count/*/*.mtx" , emit: matrix //Ensure that kallisto finished and produced outputs

when:
task.ext.when == null || task.ext.when
Expand All @@ -27,7 +28,7 @@ process KALLISTOBUSTOOLS_COUNT {
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def cdna = t1c ? "-c1 $t1c" : ''
def introns = t2c ? "-c2 $t2c" : ''
def intron = t2c ? "-c2 $t2c" : ''
def memory = task.memory.toGiga() - 1
"""
kb \\
Expand All @@ -36,12 +37,25 @@ process KALLISTOBUSTOOLS_COUNT {
-i $index \\
-g $t2g \\
$cdna \\
$introns \\
$intron \\
-x $technology \\
--workflow $workflow_mode \\
$args \\
-o ${prefix}.count \\
${reads.join( " " )} \\
-m ${memory}G
-m ${memory}G \\
${reads.join( " " )}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
kallistobustools: \$(echo \$(kb --version 2>&1) | sed 's/^.*kb_python //;s/positional arguments.*\$//')
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
mkdir -p ${prefix}.count/counts_unfiltered/
touch ${prefix}.count/counts_unfiltered/cells_x_genes.mtx
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
12 changes: 6 additions & 6 deletions modules/nf-core/kallistobustools/count/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tools:
homepage: https://www.kallistobus.tools/
documentation: https://kb-python.readthedocs.io/en/latest/index.html
tool_dev_url: https://github.com/pachterlab/kb_python
licence: MIT License
licence: ["MIT"]
input:
- meta:
type: map
Expand All @@ -34,16 +34,16 @@ input:
pattern: "*t2g.txt"
- t1c:
type: file
description: kb ref's c1 spliced_t2c file
description: kb ref's c1 cdna_t2c file
pattern: "*.{cdna_t2c.txt}"
- t2c:
type: file
description: kb ref's c2 unspliced_t2c file
pattern: "*.{introns_t2c.txt}"
description: kb ref's c2 intron_t2c file
pattern: "*.{intron_t2c.txt}"
- workflow_mode:
type: string
description: String value defining workflow to use, can be one of "standard", "lamanno", "nucleus"
pattern: "{standard,lamanno,nucleus,kite}"
description: String value defining workflow to use, can be one of "standard", "nac", "lamanno" (obsolete)
pattern: "{standard,lamanno,nac}"
- technology:
type: string
description: String value defining the sequencing technology used.
Expand Down
98 changes: 98 additions & 0 deletions modules/nf-core/kallistobustools/count/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "kallistobustools"
tag "kallistobustools/count"
tag "kallistobustools/ref"

setup {
run("KALLISTOBUSTOOLS_REF") {
script "../../ref/main.nf"
process {
"""
input[0] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true)
input[1] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.gtf', checkIfExists: true)
input[2] = "standard"
"""
}
}
}

test("genome.fasta + genome.gtf + '10X3' + 'standard'") {

when {
process {
"""
input[0] = Channel.of(
[
[id:'test'], // meta map
[
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/10xgenomics/cellranger/10k_pbmc_cmo/fastqs/gex_1/subsampled_SC3_v3_NextGem_DI_CellPlex_Human_PBMC_10K_1_gex_S2_L001_R1_001.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/10xgenomics/cellranger/10k_pbmc_cmo/fastqs/gex_1/subsampled_SC3_v3_NextGem_DI_CellPlex_Human_PBMC_10K_1_gex_S2_L001_R2_001.fastq.gz', checkIfExists: true)
]
]
)
input[1] = KALLISTOBUSTOOLS_REF.out.index
input[2] = KALLISTOBUSTOOLS_REF.out.t2g
input[3] = KALLISTOBUSTOOLS_REF.out.cdna_t2c.ifEmpty{ [] } // when empty the module doesn't run unless something is passed.
input[4] = KALLISTOBUSTOOLS_REF.out.intron_t2c.ifEmpty{ [] } // when empty the module doesn't run unless something is passed.
input[5] = "10XV3"
input[6] = "standard"
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.versions,
process.out.matrix,
path(process.out.count.get(0).get(1)).list().findAll { file(it.toString()).name != "run_info.json" && file(it.toString()).name != "kb_info.json" },
file(path(process.out.count.get(0).get(1)).list().find { file(it.toString()).name == "kb_info.json" }.toString()).readLines()[15..22],
file(path(process.out.count.get(0).get(1)).list().find { file(it.toString()).name == "run_info.json" }.toString()).readLines()[0..9]
).match()
}
)
}
}

test("genome.fasta + genome.gtf + '10X3' + 'standard' - stub") {

options "-stub"

when {
process {
"""
input[0] = Channel.of(
[
[id:'test'], // meta map
[
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/10xgenomics/cellranger/10k_pbmc_cmo/fastqs/gex_1/subsampled_SC3_v3_NextGem_DI_CellPlex_Human_PBMC_10K_1_gex_S2_L001_R1_001.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/10xgenomics/cellranger/10k_pbmc_cmo/fastqs/gex_1/subsampled_SC3_v3_NextGem_DI_CellPlex_Human_PBMC_10K_1_gex_S2_L001_R2_001.fastq.gz', checkIfExists: true)
]
]
)
input[1] = KALLISTOBUSTOOLS_REF.out.index
input[2] = KALLISTOBUSTOOLS_REF.out.t2g
input[3] = KALLISTOBUSTOOLS_REF.out.cdna_t2c.ifEmpty{ [] } // when empty the module doesn't run unless something is passed.
input[4] = KALLISTOBUSTOOLS_REF.out.intron_t2c.ifEmpty{ [] } // when empty the module doesn't run unless something is passed.
input[5] = "10XV3"
input[6] = "standard"
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
}
100 changes: 100 additions & 0 deletions modules/nf-core/kallistobustools/count/tests/main.nf.test.snap

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

5 changes: 5 additions & 0 deletions modules/nf-core/kallistobustools/count/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: KALLISTOBUSTOOLS_COUNT {
ext.args = '--cellranger -m 1'
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/kallistobustools/count/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
kallistobustools/count:
- "modules/nf-core/kallistobustools/count/**"
2 changes: 1 addition & 1 deletion modules/nf-core/kallistobustools/ref/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ channels:
- bioconda
- defaults
dependencies:
- bioconda::kb-python=0.27.2
- bioconda::kb-python=0.28.2
- conda-forge::requests>=2.23.0
32 changes: 30 additions & 2 deletions modules/nf-core/kallistobustools/ref/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ process KALLISTOBUSTOOLS_REF {

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/kb-python:0.27.2--pyhdfd78af_0' :
'biocontainers/kb-python:0.27.2--pyhdfd78af_0' }"
'https://depot.galaxyproject.org/singularity/kb-python:0.28.2--pyhdfd78af_2' :
'biocontainers/kb-python:0.28.2--pyhdfd78af_2' }"

input:
path fasta
Expand Down Expand Up @@ -62,4 +62,32 @@ process KALLISTOBUSTOOLS_REF {
END_VERSIONS
"""
}

stub:
if (workflow_mode == "standard") {
"""
touch kb_ref_out.idx \\
touch t2g.txt \\
touch cdna.fa
cat <<-END_VERSIONS > versions.yml
"${task.process}":
kallistobustools: \$(echo \$(kb --version 2>&1) | sed 's/^.*kb_python //;s/positional arguments.*\$//')
END_VERSIONS
"""
} else {
"""
touch kb_ref_out.idx \\
touch t2g.txt \\
touch cdna.fa
touch intron.fa \\
touch cdna_t2c.txt \\
touch intron_t2c.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
kallistobustools: \$(echo \$(kb --version 2>&1) | sed 's/^.*kb_python //;s/positional arguments.*\$//')
END_VERSIONS
"""
}
}
Loading

0 comments on commit d695534

Please sign in to comment.