Skip to content

Commit

Permalink
added new module lofraq/viterbi; solves new module: lofreq/viterbi nf…
Browse files Browse the repository at this point in the history
…-core#5158 (nf-core#5197)

* added new module lofraq/viterbi; solves new module: lofreq/viterbi nf-core#5158

* added new module lofraq/viterbi; solves new module: lofreq/viterbi nf-core#5158

* removed yml schema comments

* added samtools as conda dependency; chnaged container build version to py310h47ef89e_10; updated test snapshot
  • Loading branch information
MarieLataretu authored and Alexander Nater committed Mar 21, 2024
1 parent 74b4561 commit 4e95572
Show file tree
Hide file tree
Showing 6 changed files with 250 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/nf-core/lofreq/viterbi/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: "lofreq_viterbi"
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- bioconda::lofreq=2.1.5
- bioconda::samtools=1.17
54 changes: 54 additions & 0 deletions modules/nf-core/lofreq/viterbi/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
process LOFREQ_VITERBI {
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/lofreq:2.1.5--py310h47ef89e_10' :
'biocontainers/lofreq:2.1.5--py310h47ef89e_10' }"

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

output:
tuple val(meta), path("*.bam"), emit: bam
path "versions.yml" , emit: versions

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

script:
def args = task.ext.args ?: ''
def args2 = task.ext.args2 ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
lofreq \\
viterbi \\
$args \\
-ref $fasta \\
$bam |
samtools sort \\
$args2 \\
-T ${prefix} \\
--threads $task.cpus \\
-o ${prefix}.bam
cat <<-END_VERSIONS > versions.yml
"${task.process}":
lofreq: \$(echo \$(lofreq version 2>&1) | sed 's/^version: //; s/ *commit.*\$//')
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.bam
cat <<-END_VERSIONS > versions.yml
"${task.process}":
lofreq: \$(echo \$(lofreq version 2>&1) | sed 's/^version: //; s/ *commit.*\$//')
END_VERSIONS
"""
}
50 changes: 50 additions & 0 deletions modules/nf-core/lofreq/viterbi/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: "lofreq_viterbi"
description: Lofreq subcommand to call low frequency variants from alignments when tumor-normal paired samples are available
keywords:
- variant calling
- low frequency variant calling
- variants
- bam
- probabilistic realignment
tools:
- "lofreq":
description: "A fast and sensitive variant-caller for inferring SNVs and indels from next-generation sequencing data"
homepage: https://csb5.github.io/lofreq/
documentation: https://csb5.github.io/lofreq/commands/
doi: 10.1093/nar/gks918
licence: ["MIT"]
input:
# Only when we have meta
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- bam:
type: file
description: Sorted BAM file
pattern: "*.{bam}"
- fasta:
type: file
description: Reference genome FASTA file
pattern: "*.{fasta}"
output:
- 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"
- bam:
type: file
description: Realignment and sorted BAM file
pattern: "*.{bam}"

authors:
- "@MarieLataretu"
maintainers:
- "@MarieLataretu"
64 changes: 64 additions & 0 deletions modules/nf-core/lofreq/viterbi/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "lofreq"
tag "lofreq/viterbi"

test("sarscov2 - bam, fasta") {

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true)
]
input[1] = [
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
]
"""
}
}

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

}

test("sarscov2 - bam, fasta - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true)
]
input[1] = [
file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
]
"""
}
}

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

}

}
72 changes: 72 additions & 0 deletions modules/nf-core/lofreq/viterbi/tests/main.nf.test.snap

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

2 changes: 2 additions & 0 deletions modules/nf-core/lofreq/viterbi/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lofreq/viterbi:
- "modules/nf-core/lofreq/viterbi/**"

0 comments on commit 4e95572

Please sign in to comment.