Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions modules/nf-core/deacon/filter/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
channels:
- conda-forge
- bioconda
dependencies:
# renovate: datasource=conda depName=bioconda/deacon
- bioconda::deacon=0.10.0
68 changes: 68 additions & 0 deletions modules/nf-core/deacon/filter/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
process DEACON_FILTER {
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/deacon:0.10.0--h4349ce8_0':
'biocontainers/deacon:0.10.0--h4349ce8_0' }"


input:
tuple val(meta), path(index)
tuple val(meta2), path(reads)
val (save_summary)

output:
tuple val(meta2), path("filtered_reads/*.fastq.gz"), emit: filtered_reads
tuple val(meta2), path("*.json") , emit: summary_json, optional: true
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 reads_input = meta2.single_end ? reads : "${reads.sort()[0]} ${reads.sort()[1]}"
def summary_arg = save_summary ? "-s ${prefix}_summary.json" : ""
def output_arg = meta2.single_end ? "-o filtered_reads/${prefix}.fastq.gz" : "-o filtered_reads/${prefix}_1.fastq.gz -O filtered_reads/${prefix}_2.fastq.gz"
"""
mkdir -p filtered_reads/

deacon \\
filter \\
$args \\
--threads ${task.cpus} \\
$index \\
$reads_input \\
$summary_arg \\
$output_arg

cat <<-END_VERSIONS > versions.yml
"${task.process}":
deacon: \$(deacon --version | head -n1 | sed 's/deacon //g')
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta2.id}"
"""
mkdir -p filtered_reads
if [[ "${meta2.single_end}" == "true" ]]; then
echo "" | gzip -c > filtered_reads/${prefix}.fastq.gz
else
echo "" | gzip -c > filtered_reads/ ${prefix}_1.fastq.gz
echo "" | gzip -c > filtered_reads/ ${prefix}_2.fastq.gz
fi

if [[ "${save_summary}" == "true" ]]; then
touch ${prefix}_summary.json
fi

cat <<-END_VERSIONS > versions.yml
"${task.process}":
deacon: \$(deacon --version | head -n1 | sed 's/deacon //g')
END_VERSIONS
"""
}
80 changes: 80 additions & 0 deletions modules/nf-core/deacon/filter/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: "deacon_filter"
description: write your description here
keywords:
- filter
- decontamination
- minimizer
- alignment-free
- genomics
tools:
- "deacon":
description: "Fast alignment-free sequence filter"
homepage: "https://github.com/bede/deacon"
documentation: "https://github.com/bede/deacon#readme"
tool_dev_url: "https://github.com/bede/deacon"
doi: "10.1093/bioinformatics/btae004"
licence: ["MIT"]
identifier: "biotools:deacon"

input:
- - meta:
type: map
description: |
Groovy Map containing index information.
e.g. [ id:'test', single_end:false ]
- index:
type: file
description: Deacon minimizer index file
pattern: "*.idx"
ontologies:
- edam: "http://edamontology.org/data_3210" # Genome index
- - meta2:
type: map
description: |
Groovy Map containing sample information.
e.g. [ id:'sample1', single_end:false ]
- reads:
type: file
description: Input genomic reads in FASTQ format
pattern: "*.{fastq,fastq.gz,fq,fq.gz}"
ontologies:
- edam: "http://edamontology.org/data_0850" # Sequence set
- edam: "http://edamontology.org/format_1930" # FASTQ

output:
- reads:
- meta2:
type: map
description: |
Groovy Map containing sample information.
e.g. [ id:'sample1', single_end:false ]
- "*.fastq.gz":
type: file
description: Filtered genomic reads in compressed FASTQ format
pattern: "*.fastq.gz"
ontologies:
- edam: "http://edamontology.org/data_0850" # Sequence set
- edam: "http://edamontology.org/format_1930" # FASTQ
- json:
- meta2:
type: map
description: |
Groovy Map containing sample information.
e.g. [ id:'sample1', single_end:false ]
- "*.json":
type: file
description: Summary statistics in JSON format (optional)
pattern: "*.json"
ontologies:
- edam: "http://edamontology.org/format_3464" # JSON
- versions:
- "versions.yml":
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@mberacochea"
- "@sofstam"
maintainers:
- "@mberacochea"
- "@sofstam"
198 changes: 198 additions & 0 deletions modules/nf-core/deacon/filter/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@

nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "deacon"
tag "deacon/filter"

setup {
run("DEACON_INDEX") {
script "../../index/main.nf"
process {
"""
input[0] = [
[ id:'test' ],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)
]
"""
}
}
}

test("sarscov2 - fastq single end") {

when {
process {
"""
input[0] = DEACON_INDEX.out.index
input[1] = [
[ id:'test', single_end:true ],
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)
]
input[2] = false
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out,
process.out.versions.collect{ path(it).yaml }
).match() }
)
}

}

test("sarscov2 - fastq paired end") {

when {
process {
"""
input[0] = DEACON_INDEX.out.index
input[1] = [
[ id:'test', single_end:false ],
[
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true)
]
]
input[2] = false
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out,
process.out.versions.collect{ path(it).yaml }
).match() }
)
}

}

test("sarscov2 - fastq paired end - host depletion") {

config "./nextflow.config"

when {
params {
depletion = '-d'
}

process {
"""
input[0] = DEACON_INDEX.out.index
input[1] = [
[ id:'test', single_end:false ],
[
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true)
]
]
input[2] = false
"""
}
}

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


}

test("sarscov2 - fastq single end with summary") {

when {
process {
"""
input[0] = DEACON_INDEX.out.index
input[1] = [
[ id:'test', single_end:true ],
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)
]
input[2] = true
"""
}
}

then {
assertAll(
{ assert process.success },
// Only a subset of the summary json, as it contains non-stable values
{ assert snapshot(
process.out.filtered_reads,
path(process.out.summary_json.get(0).get(1)).json.version,
path(process.out.summary_json.get(0).get(1)).json.index,
path(process.out.summary_json.get(0).get(1)).json.input1,
path(process.out.summary_json.get(0).get(1)).json.input2,
path(process.out.summary_json.get(0).get(1)).json.output,
path(process.out.summary_json.get(0).get(1)).json.output2,
path(process.out.summary_json.get(0).get(1)).json.k,
path(process.out.summary_json.get(0).get(1)).json.w,
path(process.out.summary_json.get(0).get(1)).json.match_threshold,
path(process.out.summary_json.get(0).get(1)).json.prefix_length,
path(process.out.summary_json.get(0).get(1)).json.deplete,
path(process.out.summary_json.get(0).get(1)).json.rename,
path(process.out.summary_json.get(0).get(1)).json.seqs_in,
path(process.out.summary_json.get(0).get(1)).json.seqs_out,
path(process.out.summary_json.get(0).get(1)).json.seqs_removed,
path(process.out.summary_json.get(0).get(1)).json.seqs_removed_proportion,
path(process.out.summary_json.get(0).get(1)).json.bp_in,
path(process.out.summary_json.get(0).get(1)).json.bp_out,
path(process.out.summary_json.get(0).get(1)).json.bp_removed,
path(process.out.summary_json.get(0).get(1)).json.bp_removed_proportion,
process.out.versions.collect{ path(it).yaml }
).match() }
)
}

}

test("sarscov2 - fastq single end - stub") {

options "-stub"

when {
process {
"""
input[0] = DEACON_INDEX.out.index
input[1] = [
[ id:'test', single_end:true ],
file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)
]
input[2] = false
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out,
process.out.versions.collect{ path(it).yaml }
).match() }
)
}

}

}
Loading
Loading