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

Add metamaps/classify #5466

Merged
merged 29 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
999ea9d
Add metamaps/classify
sofstam Apr 11, 2024
4cf239c
Add suggestions
sofstam Apr 11, 2024
71201e0
Add bracket
sofstam Apr 11, 2024
6b22094
Merge branch 'master' into metamaps_classify
sofstam Apr 18, 2024
7fe32dd
Update PR
sofstam Apr 22, 2024
037c2a4
Merge branch 'master' into metamaps_classify
sofstam May 2, 2024
408bab2
Add one line for output in mapDirectly
sofstam May 2, 2024
4260d85
Correct snap
sofstam May 2, 2024
30664e4
Merge branch 'master' into metamaps_classify
sofstam May 16, 2024
6ab92e8
Update metamaps module
sofstam May 16, 2024
a8bad3a
Merge branch 'master' into metamaps_classify
sofstam May 16, 2024
a2dd916
Update modules/nf-core/metamaps/classify/main.nf
sofstam May 16, 2024
7c30c51
Merge branch 'master' into metamaps_classify
sofstam May 16, 2024
1349b04
Snap for mapdirectly
sofstam May 16, 2024
07633c6
Merge branch 'metamaps_classify' of https://github.com/sofstam/module…
sofstam May 16, 2024
1ed76c5
Apply review suggestions
sofstam May 16, 2024
2b21937
Update meta.yaml
sofstam May 16, 2024
45c8ac8
Merge branch 'master' into metamaps_classify
sofstam Jun 5, 2024
0a64398
Apply review suggestions
sofstam Jun 5, 2024
61c7136
Update modules/nf-core/metamaps/mapdirectly/main.nf
sofstam Jun 6, 2024
80fd1a5
Merge branch 'master' into metamaps_classify
sofstam Jun 6, 2024
8a9e591
Merge branch 'master' into metamaps_classify
sofstam Jun 10, 2024
f185502
Merge branch 'master' into metamaps_classify
sofstam Jun 12, 2024
aa50fe4
Add stub
sofstam Jun 12, 2024
dd8feeb
Merge branch 'metamaps_classify' of https://github.com/sofstam/module…
sofstam Jun 12, 2024
d9c2fae
Various minor formatting changes
jfy133 Jun 12, 2024
71aab13
Stub for mapDirectly
sofstam Jun 12, 2024
9d8c0d6
Trailing whitespace
sofstam Jun 12, 2024
a9694ca
Merge branch 'master' into metamaps_classify
jfy133 Jun 12, 2024
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
7 changes: 7 additions & 0 deletions modules/nf-core/metamaps/classify/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: "metamaps_classify"
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- "bioconda::metamaps=0.1.633d2e0"
68 changes: 68 additions & 0 deletions modules/nf-core/metamaps/classify/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

sofstam marked this conversation as resolved.
Show resolved Hide resolved
process METAMAPS_CLASSIFY {
tag "$meta.id"
label 'process_single'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/metamaps:0.1.633d2e0--h21ec9f0_0':
'biocontainers/metamaps:0.1.633d2e0--h21ec9f0_0' }"

input:
tuple val(meta), path(classification_res)
tuple val(meta), path(meta_file)
tuple val(meta), path(meta_unmappedreadsLengths)
tuple val(meta), path(para_file)
nvnieuwk marked this conversation as resolved.
Show resolved Hide resolved
path database_folder


output:
tuple val(meta), path("*classification_res.EM.WIMP") , emit: wimp
tuple val(meta), path("*classification_res.EM.evidenceUnknownSpecies") , emit: evidence_unknown_species
tuple val(meta), path("*classification_res.EM.reads2Taxon") , emit: reads2taxon
tuple val(meta), path("*classification_res.EM") , emit: em
tuple val(meta), path("*classification_res.EM.contigCoverage") , emit: contig_coverage
tuple val(meta), path("*classification_res.EM.lengthAndIdentitiesPerMappingUnit") , emit: length_and_id
tuple val(meta), path("*classification_res.EM.reads2Taxon.krona") , emit: krona
path "versions.yml" , emit: versions

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

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
metamaps \\
classify \\
$args \\
--mappings $classification_res \\
--threads $task.cpus \\
--DB $database_folder

cat <<-END_VERSIONS > versions.yml
"${task.process}":
metamaps: \$(metamaps | sed -n 2p | sed 's/^.*MetaMaps v //')
END_VERSIONS
"""
stub:
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"

jfy133 marked this conversation as resolved.
Show resolved Hide resolved
"""
touch ${prefix}_classification_res.EM.WIMP
touch ${prefix}_classification_res.EM.evidenceUnknownSpecies
touch ${prefix}_classification_res.EM.reads2Taxon
touch ${prefix}_classification_res.EM
touch ${prefix}_classification_res.EM.contigCoverage
touch ${prefix}_classification_res.EM.lengthAndIdentitiesPerMappingUnit
touch ${prefix}_classification_res.EM.reads2Taxon.krona

jfy133 marked this conversation as resolved.
Show resolved Hide resolved

cat <<-END_VERSIONS > versions.yml
"${task.process}":
metamaps: \$(metamaps | sed -n 2p | sed 's/^.*MetaMaps v //')
END_VERSIONS
"""

}
73 changes: 73 additions & 0 deletions modules/nf-core/metamaps/classify/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: metamaps_classify
description: Strain-level metagenomic assignment
keywords:
- metamaps
- long reads
- metagenomics
- taxonomy
tools:
- metamaps:
description: MetaMaps is a tool for long-read metagenomic analysis
homepage: https://github.com/DiltheyLab/MetaMaps
documentation: https://github.com/DiltheyLab/MetaMaps/blob/master/README.md
tool_dev_url: https://github.com/DiltheyLab/MetaMaps
doi: "10.1038/s41467-019-10934-2"
licence: ["Public Domain"]

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- classification_res:
type: file
description: Coordinates where reads map
pattern: "*.{classification_res}"
- database_folder:
type: directory
description: Path to MetaMaps database
pattern: "*"

output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- wimp:
type: file
description: Sample composition at different taxonomic levels
pattern: "*.{classification_res.EM.WIMP}"
- evidence_unknown_species:
type: file
description: Statistics on read identities and zero-coverage regions
pattern: "*.{classification_res.EM.evidenceUnknownSpecies}"
- reads2taxon:
type: file
description: Taxon ID assignement of reads
pattern: "*.{classification_res.EM.reads2Taxon}"
- em:
type: file
description: The final and complete set of approximate read mappings
pattern: "*.{classification_res.EM}"
- contig_coverage:
type: file
description: Read coverage for contigs
pattern: "*.{classification_res.EM.contigCoverage}"
- length_and_id:
type: file
description: Read length and estimated identity for all reads
pattern: "*.{classification_res.EM.lengthAndIdentitiesPerMappingUnit}"
- krona:
type: file
description: Taxon ID assignement of reads in Krona format
pattern: "*.{classification_res.EM.reads2Taxon.krona}"

authors:
- "@henningonsbring"
- "@sofstam"
69 changes: 69 additions & 0 deletions modules/nf-core/metamaps/classify/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "metamaps"
tag "metamaps/mapdirectly"
tag "metamaps/classify"
tag "untar"


jfy133 marked this conversation as resolved.
Show resolved Hide resolved
test("sarscov2_nanopore_classify") {
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
setup {
run("UNTAR") {
config "./nextflow.config"
script "../../../untar/main.nf"
process {
"""
input[0] = [
[],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/metamaps_db.tar.gz', checkIfExists: true)
]
"""
}
}
run("METAMAPS_MAPDIRECTLY") {
script "../../../metamaps/mapdirectly/main.nf"
process {
"""
input[0] = [
[ id:'test', single_end:true ], // meta map
file(params.test_data['sarscov2']['nanopore']['test2_fastq_gz'], checkIfExists: true)
]
input[1] = UNTAR.out.untar.map { id, it ->
filename = it.toString() + "/DB.fa"
return [ file(filename) ]
sofstam marked this conversation as resolved.
Show resolved Hide resolved
}
"""
}
}
}

when {
process {
"""
input[0] = METAMAPS_MAPDIRECTLY.out.classification_res
input[1] = METAMAPS_MAPDIRECTLY.out.meta_file
input[2] = METAMAPS_MAPDIRECTLY.out.meta_unmappedreadsLengths
input[3] = METAMAPS_MAPDIRECTLY.out.para_file
input[4] = UNTAR.out.untar.map{ it[1] }
"""
}
}



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

}
}


145 changes: 145 additions & 0 deletions modules/nf-core/metamaps/classify/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
{
"sarscov2_nanopore_classify": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": true
},
"test.classification_res.EM.WIMP:md5,b39a980519a382422ac6da49bea13de8"
]
],
"1": [
[
{
"id": "test",
"single_end": true
},
"test.classification_res.EM.evidenceUnknownSpecies:md5,a8577e31b3d9b3a598b43fc531075e81"
]
],
"2": [
[
{
"id": "test",
"single_end": true
},
"test.classification_res.EM.reads2Taxon:md5,f08d1d1865a3949a9c542b5b930fb37c"
]
],
"3": [
[
{
"id": "test",
"single_end": true
},
"test.classification_res.EM:md5,c6b1f5475e3fb9c6633aa0623456eebc"
]
],
"4": [
[
{
"id": "test",
"single_end": true
},
"test.classification_res.EM.contigCoverage:md5,131507f62806647f11b1dc10d546c73f"
]
],
"5": [
[
{
"id": "test",
"single_end": true
},
"test.classification_res.EM.lengthAndIdentitiesPerMappingUnit:md5,56be33596aa37bc360bbec47cebdc5e2"
]
],
"6": [
[
{
"id": "test",
"single_end": true
},
"test.classification_res.EM.reads2Taxon.krona:md5,9f644c743e2f4ed5617fe3d421758771"
]
],
"7": [
"versions.yml:md5,60993f8b87f7a2e25367c7dc96c9b859"
],
"contig_coverage": [
[
{
"id": "test",
"single_end": true
},
"test.classification_res.EM.contigCoverage:md5,131507f62806647f11b1dc10d546c73f"
]
],
"em": [
[
{
"id": "test",
"single_end": true
},
"test.classification_res.EM:md5,c6b1f5475e3fb9c6633aa0623456eebc"
]
],
"evidence_unknown_species": [
[
{
"id": "test",
"single_end": true
},
"test.classification_res.EM.evidenceUnknownSpecies:md5,a8577e31b3d9b3a598b43fc531075e81"
]
],
"krona": [
[
{
"id": "test",
"single_end": true
},
"test.classification_res.EM.reads2Taxon.krona:md5,9f644c743e2f4ed5617fe3d421758771"
]
],
"length_and_id": [
[
{
"id": "test",
"single_end": true
},
"test.classification_res.EM.lengthAndIdentitiesPerMappingUnit:md5,56be33596aa37bc360bbec47cebdc5e2"
]
],
"reads2taxon": [
[
{
"id": "test",
"single_end": true
},
"test.classification_res.EM.reads2Taxon:md5,f08d1d1865a3949a9c542b5b930fb37c"
]
],
"versions": [
"versions.yml:md5,60993f8b87f7a2e25367c7dc96c9b859"
],
"wimp": [
[
{
"id": "test",
"single_end": true
},
"test.classification_res.EM.WIMP:md5,b39a980519a382422ac6da49bea13de8"
]
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.04.1"
},
"timestamp": "2024-05-16T10:38:20.785516"
}
}
5 changes: 5 additions & 0 deletions modules/nf-core/metamaps/classify/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: UNTAR {
ext.args2 = "--no-same-owner"
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/metamaps/classify/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
metamaps/classify:
- "modules/nf-core/metamaps/classify/**"
2 changes: 1 addition & 1 deletion modules/nf-core/metamaps/mapdirectly/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ process METAMAPS_MAPDIRECTLY {
tuple val(meta), path("*classification_res.meta") , emit: meta_file
tuple val(meta), path("*classification_res.meta.unmappedReadsLengths"), emit: meta_unmappedreadsLengths
tuple val(meta), path("*classification_res.parameters") , emit: para_file
path "versions.yml" , emit: versions
path "versions.yml" , emit: versions

sofstam marked this conversation as resolved.
Show resolved Hide resolved
when:
task.ext.when == null || task.ext.when
Expand Down
Loading
Loading