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 modules metabuli: Add- Build- Classify #5862

Draft
wants to merge 22 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
furthere splitting up add & build
  • Loading branch information
Joon-Klaps committed Jun 21, 2024
commit f2f8ea93e0d4c24c35e216349151e2619fff6849
31 changes: 14 additions & 17 deletions modules/nf-core/metabuli/add/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ process METABULI_ADD {

input:
tuple val(meta), path(fasta)
path taxonomy_names, stageAs: 'taxonomy/names.dmp'
path taxonomy_nodes, stageAs: 'taxonomy/nodes.dmp'
path accession2taxid, stageAs: 'taxonomy/*'
path accession2taxid
path db

output:
tuple val(meta), path("${prefix}"), emit: db
Expand All @@ -25,33 +24,31 @@ process METABULI_ADD {
def prefix = task.ext.prefix ?: "${meta.id}"

"""
samtools \\
sort \\
$args \\
-@ $task.cpus \\
-o ${prefix}.bam \\
-T $prefix \\
$bam
mkdir -p $prefix
mv $db/* $prefix

ls $fasta > fasta.txt
metabuli add-to-library \\
fasta.txt \\
$accession2taxid \\
$prefix \\
$args

cat <<-END_VERSIONS > versions.yml
"${task.process}":
metabuli: \$(samtools --version |& sed '1!d ; s/samtools //')
metabuli: \$(metabuli version)
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
// TODO nf-core: A stub section should mimic the execution of the original module as best as possible
// Have a look at the following examples:
// Simple example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bcftools/annotate/main.nf#L47-L63
// Complex example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bedtools/split/main.nf#L38-L54
"""
touch ${prefix}.bam
mkdir -p $prefix

cat <<-END_VERSIONS > versions.yml
"${task.process}":
metabuli: \$(samtools --version |& sed '1!d ; s/samtools //')
metabuli: \$(metabuli version)
END_VERSIONS
"""
}
69 changes: 33 additions & 36 deletions modules/nf-core/metabuli/add/meta.yml
Original file line number Diff line number Diff line change
@@ -1,57 +1,54 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "metabuli_add"
## TODO nf-core: Add a description of the module and list keywords
description: write your description here
description: Add fasta sequences to a database needed to use the metabuli classification tool
keywords:
- sort
- example
- genomics
- metabuli
- metagenomics
- profiling
- taxonomy
- database
tools:
- "metabuli":
## TODO nf-core: Add a description and other details for the software below
description: "Metabuli: specific and sensitive metagenomic classification via joint analysis of DNA and amino acid"
homepage: "None"
documentation: "None"
tool_dev_url: "None"
doi: ""
licence: ['GPL v3']
homepage: "https://github.com/steineggerlab/Metabuli"
documentation: "https://github.com/steineggerlab/Metabuli#readme"
tool_dev_url: "https://github.com/steineggerlab/Metabuli"
doi: "10.1101/2023.05.31.543018"
licence: "['GPL v3']"

## TODO nf-core: Add a description of all of the variables used as input
input:
# Only when we have meta
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`

## TODO nf-core: Delete / customise this example input
- bam:
e.g. [ id:'test', single_end:false ]
- fasta:
type: file
description: Sorted BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"
description: Genome files that serve as entries in the database
pattern: "*.{fa,fasta,fna}"
- accession2taxid:
type: file
description: |
Accession number to taxid file.
A four column tsv with the following header:
accession, accession.revision, taxid, gi.
- db:
type: directory
description: |
Output folder name for the database.
If the taxonomy-path optional parameter is not set to a directory
containing names.dmp and nodes.dmp, this directory needs
to contain a folder named taxonomy containing those two files.

## TODO nf-core: Add a description of all of the variables used as output
output:
#Only when we have meta
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`

- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
## TODO nf-core: Delete / customise this example output
- bam:
type: file
description: Sorted BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"
- db:
type: directory
description: Compressed metabuli database
pattern: "${prefix}/"

authors:
- "@Joon-Klaps"
maintainers:
- "@TheOafidian"
- "@Joon-Klaps"
15 changes: 0 additions & 15 deletions modules/nf-core/metabuli/build/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ process METABULI_BUILD {
'biocontainers/metabuli:1.0.5--pl5321h6a68c12_1' }"

input:
tuple val(meta),path(genomes)
path(acc2taxid)
path(db)

output:
Expand All @@ -22,16 +20,7 @@ process METABULI_BUILD {

script:
def args = task.ext.args ?: ''
def args_lib = task.ext.args_lib ?: ''
// def skip_lib = params.skip_lib ?: false
"""
ls $genomes > fastas.txt
metabuli \\
add-to-library \\
fastas.txt \\
$acc2taxid \\
$db
$args_lib

ls $db/library/* > lib.txt
metabuli \\
Expand All @@ -42,10 +31,6 @@ process METABULI_BUILD {
$acc2taxid \\
$args

rm -r $db/library
tar -czf metabuli_db.tar.gz $db
rm -r $db

cat <<-END_VERSIONS > versions.yml
"${task.process}":
metabuli: \$(metabuli | grep Version | sed 's/^metabuli Version: //';))
Expand Down
Loading