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

added new module lofraq/viterbi; solves new module: lofreq/viterbi #5158 #5197

Merged
merged 9 commits into from
Mar 19, 2024
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/**"
Loading