Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c865166
feat(rpbp): add 8 rpbp modules + bam_rpbp_predictorfs / fasta_gtf_bam…
pinin4fjords May 19, 2026
3addd5e
refactor(rpbp): drop buildconfig, call get_orfs directly, real tests …
pinin4fjords May 19, 2026
cce7bc2
Merge branch 'master' into rpbp-add-modules-and-subworkflows
pinin4fjords May 19, 2026
4cdb5e6
refactor(rpbp): merge bam_rpbp_predictorfs into fasta_gtf_bam_rpbp
pinin4fjords May 19, 2026
60401cd
Merge branch 'rpbp-add-modules-and-subworkflows' of https://github.co…
pinin4fjords May 19, 2026
98f94e2
style(fasta_gtf_bam_rpbp): drop narrative comments, align emit // cha…
pinin4fjords May 19, 2026
6ad0dfc
fix(rpbp): address review feedback
pinin4fjords May 20, 2026
126b14a
build(rpbp): switch to a STAR-free Wave container built from environm…
pinin4fjords May 20, 2026
0720cbb
fix(rpbp/extractorfprofiles): call get_periodic_lengths_and_offsets d…
pinin4fjords May 20, 2026
59c26f0
style(rpbp/extractorfprofiles): tighten the embedded python heredoc
pinin4fjords May 20, 2026
b2cbb10
refactor(rpbp): split filter and consume static fixtures in module tests
pinin4fjords May 20, 2026
5fcfc54
refactor(rpbp): take Stan models as path inputs with bundled-default …
pinin4fjords May 20, 2026
15bf02c
refactor(rpbp): tuple-with-meta path inputs + python templates
pinin4fjords May 20, 2026
c5aa768
style(rpbp): simplify Stan-models conditional in both BF modules
pinin4fjords May 20, 2026
2a77cef
fix(rpbp): satisfy ruff in template scripts
pinin4fjords May 20, 2026
78892b9
fix(rpbp): drop f-prefix on `${task.process}` lines (no noqa needed)
pinin4fjords May 20, 2026
9efad5e
refactor(rpbp): use yaml.safe_dump for versions.yml in templates
pinin4fjords May 20, 2026
5da69a3
style(rpbp): apply ruff check --fix + ruff format to templates
pinin4fjords May 20, 2026
3e7851e
Merge branch 'master' into rpbp-add-modules-and-subworkflows
pinin4fjords May 20, 2026
f12e277
docs(rpbp): rewrite meta.yml descriptions for readers unfamiliar with…
pinin4fjords May 20, 2026
0c0ad92
rpbp: drop optional Stan-model inputs and tighten BF modules
pinin4fjords May 20, 2026
c07e919
test(rpbp): rebuild path-emit versions snapshots for NF 25.10.2
pinin4fjords May 20, 2026
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
channels:
- conda-forge
- bioconda
dependencies:
- bioconda::rpbp=4.0.1
42 changes: 42 additions & 0 deletions modules/nf-core/rpbp/estimatemetagenebayesfactors/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
process RPBP_ESTIMATEMETAGENEBAYESFACTORS {
tag "$meta.id"
label 'process_high'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container ?
'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/14/146c3f15abf184a5ec13531d2a040ba7b9235c1091723aa37c7a119817411367/data' :
'community.wave.seqera.io/library/rpbp:4.0.1--71297b462026e13b' }"

input:
tuple val(meta), path(profile_csv)

output:
tuple val(meta), path("${prefix}.metagene-periodicity-bayes-factors.csv.gz"), emit: bayes_factors
tuple val("${task.process}"), val('rpbp'), eval('python -c "import rpbp; print(rpbp.__version__)"'), emit: versions_rpbp, topic: versions

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

script:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
"""
RPBP_MODELS_BASE=\$(python3 -c "import os, inspect, rpbp; print(os.path.join(os.path.dirname(inspect.getfile(rpbp)), 'models'))")
PERIODIC=\$(ls "\$RPBP_MODELS_BASE"/periodic/*.stan)
NONPERIODIC=\$(ls "\$RPBP_MODELS_BASE"/nonperiodic/*.stan)

estimate-metagene-profile-bayes-factors \\
${profile_csv} \\
${prefix}.metagene-periodicity-bayes-factors.csv.gz \\
--periodic-models \$PERIODIC \\
--nonperiodic-models \$NONPERIODIC \\
--num-cpus ${task.cpus} \\
${args}
"""

stub:
prefix = task.ext.prefix ?: "${meta.id}"
"""
echo "" | gzip > ${prefix}.metagene-periodicity-bayes-factors.csv.gz
"""
}
79 changes: 79 additions & 0 deletions modules/nf-core/rpbp/estimatemetagenebayesfactors/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: "rpbp_estimatemetagenebayesfactors"
description: |
Score how strongly each per-read-length metagene profile shows the
3-nucleotide periodicity expected of actively translating ribosomes.
For each candidate (read length, P-site offset) pair, Rp-Bp fits two
competing Bayesian models to the count window around annotated start
codons: a "periodic" model whose signal repeats every three
nucleotides, and a "non-periodic" background model. The Bayes factor
(ratio of the two marginal likelihoods) quantifies how much the data
prefer the periodic explanation.

Returns one row per (length, offset) pair with the mean and variance of
the log Bayes factor across MCMC samples. Downstream,
`rpbp/selectperiodicoffsets` picks the best offset per length from
this table, and `rpbp/getperiodiclengthsoffsets` filters to the
high-confidence pairs that drive ORF-level scoring.

Uses the Stan models bundled inside the rpbp Python package.
keywords:
- rpbp
- metagene
- bayes
- orf
- riboseq
tools:
- "rpbp":
description: "Rp-Bp - Bayesian inference of ribosome profiling data for identifying translated open reading frames"
homepage: "https://github.com/dieterich-lab/rp-bp"
documentation: "https://rp-bp.readthedocs.io"
tool_dev_url: "https://github.com/dieterich-lab/rp-bp"
doi: "10.1093/nar/gkw1350"
licence:
- "MIT"
identifier: ""
input:
- - meta:
type: map
description: |
Groovy Map containing sample information, e.g. `[ id:'sample1' ]`.
- profile_csv:
type: file
description: Metagene profile CSV produced by `rpbp/extractmetageneprofiles`.
pattern: "*.metagene-profile.csv.gz"
ontologies: []
output:
bayes_factors:
- - meta:
type: map
description: Groovy Map inherited from input meta.
- "${prefix}.metagene-periodicity-bayes-factors.csv.gz":
type: file
description: Per-read-length metagene periodicity Bayes factors.
pattern: "*.metagene-periodicity-bayes-factors.csv.gz"
ontologies: []
versions_rpbp:
- - ${task.process}:
type: string
description: The name of the process
- rpbp:
type: string
description: The name of the tool
- python -c "import rpbp; print(rpbp.__version__)":
type: eval
description: The expression to obtain the version of the tool
topics:
versions:
- - ${task.process}:
type: string
description: The name of the process
- rpbp:
type: string
description: The name of the tool
- python -c "import rpbp; print(rpbp.__version__)":
type: eval
description: The expression to obtain the version of the tool
authors:
- "@pinin4fjords"
maintainers:
- "@pinin4fjords"
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "rpbp"
tag "rpbp/estimatemetagenebayesfactors"

test("homo_sapiens chr20 - metagene bayes factors") {

when {
process {
"""
input[0] = Channel.of([
[ id:'test', single_end:true, strandedness:'forward' ],
file("https://raw.githubusercontent.com/pinin4fjords/test-datasets/rpbp-test-data/data/genomics/homo_sapiens/riboseq_expression/rpbp/SRX11780888_chr20.metagene-profile.csv.gz", checkIfExists: true)
])
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
file(process.out.bayes_factors[0][1]).name,
process.out.findAll { key, val -> key.startsWith('versions') }
).match() }
)
}
}

test("homo_sapiens chr20 - metagene bayes factors - stub") {

options '-stub'

when {
process {
"""
input[0] = Channel.of([
[ id:'test', single_end:true, strandedness:'forward' ],
file("https://raw.githubusercontent.com/pinin4fjords/test-datasets/rpbp-test-data/data/genomics/homo_sapiens/riboseq_expression/rpbp/SRX11780888_chr20.metagene-profile.csv.gz", checkIfExists: true)
])
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"homo_sapiens chr20 - metagene bayes factors": {
"content": [
"test.metagene-periodicity-bayes-factors.csv.gz",
{
"versions_rpbp": [
[
"RPBP_ESTIMATEMETAGENEBAYESFACTORS",
"rpbp",
"4.0.1"
]
]
}
],
"timestamp": "2026-05-20T10:38:07.590598565",
"meta": {
"nf-test": "0.9.5",
"nextflow": "26.04.1"
}
},
"homo_sapiens chr20 - metagene bayes factors - stub": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": true,
"strandedness": "forward"
},
"test.metagene-periodicity-bayes-factors.csv.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"1": [
[
"RPBP_ESTIMATEMETAGENEBAYESFACTORS",
"rpbp",
"4.0.1"
]
],
"bayes_factors": [
[
{
"id": "test",
"single_end": true,
"strandedness": "forward"
},
"test.metagene-periodicity-bayes-factors.csv.gz:md5,68b329da9893e34099c7d8ad5cb9c940"
]
],
"versions_rpbp": [
[
"RPBP_ESTIMATEMETAGENEBAYESFACTORS",
"rpbp",
"4.0.1"
]
]
}
],
"timestamp": "2026-05-20T10:38:11.903165804",
"meta": {
"nf-test": "0.9.5",
"nextflow": "26.04.1"
}
}
}
5 changes: 5 additions & 0 deletions modules/nf-core/rpbp/estimateorfbayesfactors/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
channels:
- conda-forge
- bioconda
dependencies:
- bioconda::rpbp=4.0.1
44 changes: 44 additions & 0 deletions modules/nf-core/rpbp/estimateorfbayesfactors/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
process RPBP_ESTIMATEORFBAYESFACTORS {
tag "$meta.id"
label 'process_high'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container ?
'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/14/146c3f15abf184a5ec13531d2a040ba7b9235c1091723aa37c7a119817411367/data' :
'community.wave.seqera.io/library/rpbp:4.0.1--71297b462026e13b' }"

input:
tuple val(meta), path(profiles)
tuple val(meta2), path(orfs_genomic_bed)

output:
tuple val(meta), path("${prefix}.bayes-factors.bed.gz"), emit: bayes_factors
tuple val("${task.process}"), val('rpbp'), eval('python -c "import rpbp; print(rpbp.__version__)"'), emit: versions_rpbp, topic: versions

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

script:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
"""
RPBP_MODELS_BASE=\$(python3 -c "import os, inspect, rpbp; print(os.path.join(os.path.dirname(inspect.getfile(rpbp)), 'models'))")
TRANSLATED=\$(ls "\$RPBP_MODELS_BASE"/translated/*.stan)
UNTRANSLATED=\$(ls "\$RPBP_MODELS_BASE"/untranslated/*.stan)

estimate-orf-bayes-factors \\
${profiles} \\
${orfs_genomic_bed} \\
${prefix}.bayes-factors.bed.gz \\
--translated-models \$TRANSLATED \\
--untranslated-models \$UNTRANSLATED \\
--num-cpus ${task.cpus} \\
${args}
"""

stub:
prefix = task.ext.prefix ?: "${meta.id}"
"""
echo "" | gzip > ${prefix}.bayes-factors.bed.gz
"""
}
87 changes: 87 additions & 0 deletions modules/nf-core/rpbp/estimateorfbayesfactors/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: "rpbp_estimateorfbayesfactors"
description: |
Score every candidate ORF for evidence of active translation. For
each ORF, Rp-Bp fits two competing Bayesian models to its per-codon
P-site count vector: a "translated" model that expects P-site density
to concentrate at codon-start positions (the in-frame signal a
translating ribosome produces), and an "untranslated" / noise model
for the same data. The Bayes factor (ratio of marginal likelihoods)
quantifies how much the data favour the translated hypothesis.

Emits a BED-style table with one row per ORF carrying genomic
coordinates plus the mean and variance of the log Bayes factor across
MCMC samples. Downstream, `rpbp/selectfinalpredictionset` applies
Bayes-factor, length and overlap rules to this table to produce the
final filtered prediction set.

Uses the Stan models bundled inside the rpbp Python package.
keywords:
- rpbp
- orf
- bayes
- translation
- riboseq
tools:
- "rpbp":
description: "Rp-Bp - Bayesian inference of ribosome profiling data for identifying translated open reading frames"
homepage: "https://github.com/dieterich-lab/rp-bp"
documentation: "https://rp-bp.readthedocs.io"
tool_dev_url: "https://github.com/dieterich-lab/rp-bp"
doi: "10.1093/nar/gkw1350"
licence:
- "MIT"
identifier: ""
input:
- - meta:
type: map
description: |
Groovy Map containing sample information, e.g. `[ id:'sample1' ]`.
- profiles:
type: file
description: Per-ORF P-site profile matrix from `rpbp/extractorfprofiles`.
pattern: "*.profiles.mtx.gz"
ontologies: []
- - meta2:
type: map
description: |
Groovy Map identifying the reference (e.g. `[ id:'reference' ]`).
- orfs_genomic_bed:
type: file
description: Per-ORF genomic BED from `rpbp/preparegenome`.
pattern: "*.orfs-genomic.annotated.bed.gz"
ontologies: []
output:
bayes_factors:
- - meta:
type: map
description: Groovy Map inherited from input meta.
- "${prefix}.bayes-factors.bed.gz":
type: file
description: Per-ORF translation Bayes factors (BED).
pattern: "*.bayes-factors.bed.gz"
ontologies: []
versions_rpbp:
- - ${task.process}:
type: string
description: The name of the process
- rpbp:
type: string
description: The name of the tool
- python -c "import rpbp; print(rpbp.__version__)":
type: eval
description: The expression to obtain the version of the tool
topics:
versions:
- - ${task.process}:
type: string
description: The name of the process
- rpbp:
type: string
description: The name of the tool
- python -c "import rpbp; print(rpbp.__version__)":
type: eval
description: The expression to obtain the version of the tool
authors:
- "@pinin4fjords"
maintainers:
- "@pinin4fjords"
Loading
Loading