Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new module pangolin/updatedata & patch pangolin/run #7182

Merged
merged 8 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
process PANGOLIN {
process PANGOLIN_RUN {
tag "$meta.id"
label 'process_medium'

Expand All @@ -9,6 +9,7 @@ process PANGOLIN {

input:
tuple val(meta), path(fasta)
path(db)

output:
tuple val(meta), path('*.csv'), emit: report
Expand All @@ -20,11 +21,13 @@ process PANGOLIN {
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def db_command = db ? "--datadir ${db}" : ''
"""
export XDG_CACHE_HOME=/tmp/.cache

pangolin \\
$fasta\\
$db_command \\
--outfile ${prefix}.pangolin.csv \\
--threads $task.cpus \\
$args
Expand All @@ -34,4 +37,17 @@ process PANGOLIN {
pangolin: \$(pangolin --version | sed "s/pangolin //g")
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
export XDG_CACHE_HOME=/tmp/.cache

touch ${prefix}.pangolin.csv

cat <<-END_VERSIONS > versions.yml
"${task.process}":
pangolin: \$(pangolin --version | sed "s/pangolin //g")
END_VERSIONS
"""
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: pangolin
name: pangolin_run
description: Phylogenetic Assignment of Named Global Outbreak LINeages
keywords:
- covid
- pangolin
- lineage
- run
tools:
- pangolin:
description: |
Expand All @@ -21,6 +22,11 @@ input:
type: file
description: |
The genome assembly to be evaluated
- - db:
type: directory
description: |
Directory containing the Pangolin database

output:
- report:
- meta:
Expand Down
99 changes: 99 additions & 0 deletions modules/nf-core/pangolin/run/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "pangolin/updatedata"
tag "pangolin/run"
tag "pangolin"

test("sarscov2 genome [fasta]") {

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
[ file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ]
]
input[1] = []
"""
}
}

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

}

test("sarscov2 genome [fasta] - update data") {
setup{
run("PANGOLIN_UPDATEDATA") {
script "../../updatedata/main.nf"
process {
"""
input[0] = 'testdb'
"""
}
}
}

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
[ file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ]
]
input[1] = PANGOLIN_UPDATEDATA.out.db
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert path(process.out.report[0][1]).readLines().first().contains("taxon,lineage,conflict,ambiguity_score,scorpio_call,scorpio_support,scorpio_conflict,scorpio_notes,version,pangolin_version,scorpio_version,constellation_version,is_designated,qc_status,qc_notes,note") },
{ assert snapshot(
file(process.out.report[0][1]).name,
Joon-Klaps marked this conversation as resolved.
Show resolved Hide resolved
process.out.versions
).match()
}
)
}
}

test("sarscov2 genome [fasta] - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
[ file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ]
]
input[1] = []
"""
}
}

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

}


}
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,43 @@
{
"id": "test"
},
"test.pangolin.csv:md5,2cc701567cf37bad5c6574c29aa595d4"
"test.pangolin.csv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,65ec45a19faa92a922073b9b08d90a8a"
"versions.yml:md5,4e70f8b44182b5be5eb0b706c2c551bd"
],
"report": [
[
{
"id": "test"
},
"test.pangolin.csv:md5,2cc701567cf37bad5c6574c29aa595d4"
"test.pangolin.csv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,65ec45a19faa92a922073b9b08d90a8a"
"versions.yml:md5,4e70f8b44182b5be5eb0b706c2c551bd"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-09T16:27:30.099020683"
},
"sarscov2 genome [fasta] - update data": {
"content": [
"test.pangolin.csv",
[
"versions.yml:md5,4e70f8b44182b5be5eb0b706c2c551bd"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-10-18T10:33:48.797026222"
"timestamp": "2024-12-09T16:36:50.212759186"
},
"sarscov2 genome [fasta]": {
"content": [
Expand All @@ -44,7 +57,7 @@
]
],
"1": [
"versions.yml:md5,65ec45a19faa92a922073b9b08d90a8a"
"versions.yml:md5,4e70f8b44182b5be5eb0b706c2c551bd"
],
"report": [
[
Expand All @@ -55,14 +68,14 @@
]
],
"versions": [
"versions.yml:md5,65ec45a19faa92a922073b9b08d90a8a"
"versions.yml:md5,4e70f8b44182b5be5eb0b706c2c551bd"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.04.4"
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-10-18T10:33:17.535254436"
"timestamp": "2024-12-09T16:25:48.834093927"
}
}
57 changes: 0 additions & 57 deletions modules/nf-core/pangolin/tests/main.nf.test

This file was deleted.

7 changes: 7 additions & 0 deletions modules/nf-core/pangolin/updatedata/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
channels:
- conda-forge
- bioconda
dependencies:
- bioconda::pangolin-data=1.30
- bioconda::pangolin=4.3
- bioconda::snakemake=7.30.1
49 changes: 49 additions & 0 deletions modules/nf-core/pangolin/updatedata/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
process PANGOLIN_UPDATEDATA {
tag "$dbname"
label 'process_single'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/bb/bb7bac48e43a9cd6274e1f99c761a5785b74f6d8a55313ee634aaffbe87c1869/data' :
'community.wave.seqera.io/library/pangolin-data_pangolin_snakemake:5bbc297f7502ff33' }"

input:
val(dbname)

output:
path("${prefix}") , emit: db
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${dbname}"
"""
export XDG_CACHE_HOME=/tmp/.cache
mkdir -p ${prefix}

pangolin \\
$args \\
--update-data \\
--threads $task.cpus \\
--datadir ${prefix}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
pangolin: \$(pangolin --version | sed "s/pangolin //g")
END_VERSIONS
"""

stub:
prefix = task.ext.prefix ?: "${dbname}"
"""
mkdir -p ${prefix}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
pangolin: \$(pangolin --version | sed "s/pangolin //g")
END_VERSIONS
"""
}
Loading
Loading