Skip to content

Commit

Permalink
Added kmer_len as a parameter to set the kmer distribution files used…
Browse files Browse the repository at this point in the history
… by BRACKEN to estimate the abundance at a single taxonomic level
  • Loading branch information
kylacochrane committed Apr 12, 2024
1 parent d009b7f commit 6e75e48
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
7 changes: 5 additions & 2 deletions modules/local/bracken/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ process BRACKEN {
tuple val(meta), path(report_txt)
path(bracken_db)
val(taxonomic_level)
val(kmer_len)

output:
tuple val(meta), path("*_bracken.txt"), emit: bracken_reports
Expand All @@ -33,9 +34,11 @@ process BRACKEN {
-i ${report_txt} \\
-w ${meta.id}_${taxonomic_level}_bracken.txt \\
-o ${meta.id}_${taxonomic_level}_bracken_abundances_unsorted.tsv \\
-l ${taxonomic_level}
-l ${taxonomic_level} \\
-r ${kmer_len}
# generate header to be used when adjusting the bracken report and abundances for unclassified reads
# generate header to be used when adjusting the bracken report and abundances for unclassified reads in ADJUST_BRACKEN
paste <(echo "meta.id") <(head -n 1 ${meta.id}_${taxonomic_level}_bracken_abundances_unsorted.tsv) | tr \$'\\t' ',' > bracken_abundances_header.csv
cat <<-END_VERSIONS > versions.yml
Expand Down
1 change: 1 addition & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ params {
kraken2_db = null
bracken_db = null
taxonomic_level = 'S'
kmer_len = 100
top_n = 5

// Boilerplate options
Expand Down
7 changes: 7 additions & 0 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@
"description": "Requested taxonomic level for BRACKEN",
"default": "S"
},
"kmer_len": {
"type": "integer",
"errorMessage": "kmer_len must be provided as one of: 50, 75, 100, 150, 200, 250, or 300",
"enum": [50, 75, 100, 150, 200, 250, 300],
"description": "Requested kmer length for the BRACKEN distribution file used during abundance estimation",
"default": 100
},
"top_n": {
"type": "integer",
"default": 5,
Expand Down
4 changes: 3 additions & 1 deletion workflows/speciesabundance.nf
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ workflow SpAnce {
bracken_database = select_bracken_database(params.bracken_db)
ch_taxonomic_level = Channel.value(params.taxonomic_level)
ch_top_n = Channel.value(params.top_n)
ch_kmer_len = Channel.value(params.kmer_len)

FASTP_TRIM (
input
Expand All @@ -95,7 +96,8 @@ workflow SpAnce {
BRACKEN (
KRAKEN2.out.report_txt,
bracken_database,
ch_taxonomic_level
ch_taxonomic_level,
ch_kmer_len
)
ch_versions = ch_versions.mix(BRACKEN.out.versions)

Expand Down

0 comments on commit 6e75e48

Please sign in to comment.