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 motus prep_long #6590

Merged
merged 30 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
00e68a2
Add motus prep_long
sofstam Sep 5, 2024
1cbee6f
Prettier
sofstam Sep 5, 2024
b881c2e
Update meta
sofstam Sep 5, 2024
7adbdd4
Merge branch 'master' into motus-prep_long
sofstam Sep 5, 2024
cf78dcd
Update modules/nf-core/motus/preplong/main.nf
sofstam Sep 6, 2024
d0bc778
Update modules/nf-core/motus/preplong/main.nf
sofstam Sep 6, 2024
11969c9
Merge branch 'master' into motus-prep_long
sofstam Sep 6, 2024
ddc3cf7
Update modules/nf-core/motus/preplong/tests/main.nf.test
sofstam Sep 6, 2024
6d6586d
Update modules/nf-core/motus/preplong/tests/main.nf.test
sofstam Sep 6, 2024
5af72e3
Update modules/nf-core/motus/preplong/meta.yml
sofstam Sep 6, 2024
c0c725e
Update modules/nf-core/motus/preplong/tests/main.nf.test
sofstam Sep 6, 2024
9d66e88
Update snap file
sofstam Sep 6, 2024
b4971df
Fix linting
sofstam Sep 6, 2024
226543b
Merge branch 'master' into motus-prep_long
sofstam Sep 9, 2024
dbbab3c
Merge branch 'master' into motus-prep_long
sofstam Sep 12, 2024
98ee2fc
Update meta.yml
sofstam Sep 12, 2024
1f8d5a5
Merge branch 'master' into motus-prep_long
sofstam Sep 12, 2024
520b598
Merge branch 'master' into motus-prep_long
jfy133 Sep 17, 2024
aad473d
Update modules/nf-core/motus/preplong/main.nf
sofstam Oct 4, 2024
5e80296
Merge branch 'master' into motus-prep_long
sofstam Oct 4, 2024
3d9fc0e
Fix formatting
sofstam Oct 4, 2024
01e3640
Update meta.yaml
sofstam Oct 4, 2024
b435564
Update meta.yml
sofstam Oct 4, 2024
5926dce
Update meta.yaml
sofstam Oct 4, 2024
5223764
Fix formatting for meta.yaml
sofstam Oct 4, 2024
260351d
Try to fix linting
sofstam Oct 4, 2024
809805a
Remove unnecessary output
sofstam Oct 4, 2024
1dd0666
Fix linting
sofstam Oct 4, 2024
c5cb81e
Update meta.yml with version.yml
sofstam Oct 4, 2024
59b892a
Merge branch 'master' into motus-prep_long
sofstam Oct 4, 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
5 changes: 5 additions & 0 deletions modules/nf-core/motus/preplong/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
channels:
- conda-forge
- bioconda
dependencies:
- bioconda::motus=3.1.0
53 changes: 53 additions & 0 deletions modules/nf-core/motus/preplong/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
process MOTUS_PREPLONG {
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/motus:3.1.0--pyhdfd78af_0':
'biocontainers/motus:3.1.0--pyhdfd78af_0' }"

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

output:
tuple val(meta), path("*.gz"), emit: out
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}"
def refdb = db ? "-db ${db}" : ""

"""
motus \\
prep_long \\
$args \\
-i $reads \\
$refdb \\
-t $task.cpus \\
-o ${prefix}.gz \\
2> >(tee ${prefix}.log >&2)
fellen31 marked this conversation as resolved.
Show resolved Hide resolved

sofstam marked this conversation as resolved.
Show resolved Hide resolved
cat <<-END_VERSIONS > versions.yml
"${task.process}":
motus: \$(motus --version 2>&1 | sed 's/.* \\([0-9]*\\.[0-9]*\\.[0-9]*\\) .*/\\1/')
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
echo '' | gzip > ${prefix}.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
motus: \$(motus --version 2>&1 | sed 's/.* \\([0-9]*\\.[0-9]*\\.[0-9]*\\) .*/\\1/')
END_VERSIONS
"""
}
52 changes: 52 additions & 0 deletions modules/nf-core/motus/preplong/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: "motus_preplong"
description: Taxonomic meta-omics profiling using universal marker genes
keywords:
- classify
- metagenomics
- fastq
- taxonomic profiling
tools:
- "motus":
description: "Marker gene-based operational taxonomic unit (mOTU) profiling"
homepage: "https://motu-tool.org/"
documentation: "https://github.com/motu-tool/mOTUs/wiki"
tool_dev_url: "https://github.com/motu-tool/mOTUs"
doi: "10.1186/s40168-022-01410-z"
licence: ["GPL v3"]

input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- reads:
type: file
description: Long read file to convert, can be fasta(.gz) or fastq(.gz)
pattern: "*.{gz}"
- - db:
type: directory
description: |
mOTUs database downloaded by `motus downloadDB`
pattern: "db_mOTU/"
output:
- out:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- "*.gz":
type: file
description: converted file (gzipped), ready to be used by motus profile
pattern: "*.gz"
- versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"

authors:
- "@sofstam"
maintainers:
- "@sofstam"
75 changes: 75 additions & 0 deletions modules/nf-core/motus/preplong/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "motus"
tag "motus/downloaddb"
tag "motus/preplong"

setup {
run("MOTUS_DOWNLOADDB") {
script "modules/nf-core/motus/downloaddb/main.nf"
process {
"""
input[0] = Channel.of([
file('https://raw.githubusercontent.com/motu-tool/mOTUs/master/motus/downloadDB.py')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems strange, why is the input a python script?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to run the module, we need to run the download of the motus db first.This is how we have been doing with the motus profile as well.

https://github.com/nf-core/modules/blob/master/modules/nf-core/motus/profile/tests/main.nf.test#L20

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the script could just be part of the module?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please explain what you mean? We need the script to run the test.

Copy link
Member

@jfy133 jfy133 Sep 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @SPPearce means we could just copy and paste teh code from the mOTUs repository and dump it straight into the module itself.

I think we did this @SPPearce as the script occasioanlly changes to account for changes in where the the database gets downloaded from or something, so it was easier to just download on the fly.

So any copied-code could potentially break.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is what I meant, to include the script itself with the module for the download module.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if there is a reason behind it then that is fine. It isn't relevant for this module anyway.

])
"""
}
}
}

test("sarscov2 - fasta") {

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/nanopore/fastq/test_2.fastq.gz', checkIfExists: true)
]
input[1] = MOTUS_DOWNLOADDB.out.db
"""
}
}

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

}

test("sarscov2 - fasta - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/nanopore/fastq/test_2.fastq.gz', checkIfExists: true)
]
input[1] = MOTUS_DOWNLOADDB.out.db
"""
}
}

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


}

}
72 changes: 72 additions & 0 deletions modules/nf-core/motus/preplong/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"sarscov2 - fasta - stub": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"test.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"1": [
"versions.yml:md5,8fc614f9fe354b0811def13c772bc6fb"
],
"out": [
[
{
"id": "test",
"single_end": false
},
"test.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"versions": [
"versions.yml:md5,8fc614f9fe354b0811def13c772bc6fb"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.04.1"
},
"timestamp": "2024-09-06T16:29:18.602046"
},
"sarscov2 - fasta": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"test.gz:md5,37be4a7321bcb2fdae60affb21a1737c"
]
],
"1": [
"versions.yml:md5,8fc614f9fe354b0811def13c772bc6fb"
],
"out": [
[
{
"id": "test",
"single_end": false
},
"test.gz:md5,37be4a7321bcb2fdae60affb21a1737c"
]
],
"versions": [
"versions.yml:md5,8fc614f9fe354b0811def13c772bc6fb"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.04.1"
},
"timestamp": "2024-09-06T15:55:48.439664"
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/motus/preplong/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
motus/preplong:
- "modules/nf-core/motus/preplong/**"
Loading