Skip to content
Merged
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
4 changes: 4 additions & 0 deletions assets/catalog/catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@
- [annevo/decoding](../../modules/nextflow/annevo/decoding/main.nf) — Decode ANNEVO H5 predictions into GFF3 on CPU.
- [subworkflows/annevo](../../subworkflows/annevo/main.nf) — Scatter (none / chromosome / weighted), predict, decode, and gather GFF3.
- [workflows/annevo](../../workflows/annevo/main.nf) — Standalone ANNEVO pipeline. Bundled ANNEVO is non-commercial.
- [tiberius/predict](../../modules/nextflow/tiberius/predict/main.nf) — Tiberius ab initio inference (`process_gpu`; CPU if no GPU profile). Scatter jobs emit GTF only.
- [tiberius/merge](../../modules/nextflow/tiberius/merge/main.nf) — Merge chunk GTFs with merge_annotations.py, restore FASTA order, emit GTF/GFF3 and optional protein/CDS FASTAs.
- [subworkflows/tiberius](../../subworkflows/tiberius/main.nf) — Scatter (none / chromosome / weighted), predict, and merge.
- [workflows/tiberius](../../workflows/tiberius/main.nf) — Standalone Tiberius pipeline.

---

Expand Down
74 changes: 74 additions & 0 deletions modules/nextflow/tiberius/merge/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
Copyright (c) 2026 The Hiller Lab at the Senckenberg Gessellschaft für Naturforschung
Distributed under the terms of the Apache License, Version 2.0.
*/

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TIBERIUS_MERGE — Merge scattered Tiberius chunk annotations.

Runs merge_annotations.py (full mode), restores FASTA record order from
the sequence-order manifest, writes GTF, and optionally extracts
protein/CDS FASTAs from the merged annotation plus the original genome.
Gene IDs are assigned by (seqid, start, strand), not chunk order.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

process TIBERIUS_MERGE {
tag "$meta.id"
label 'process_medium'

container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'' :
'ghcr.io/hillerlab/tiberius:latest' }"

input:
tuple val(meta), path(annotations), path(manifest), path(genome)
val emit_protseq
val emit_codingseq

output:
tuple val(meta), path("*.gtf"), emit: gtf
tuple val(meta), path("*.gff3"), emit: gff
tuple val(meta), path("*.prot"), emit: proteins, optional: true
tuple val(meta), path("*.cds"), emit: codingseq, optional: true
path "versions.yml", emit: versions

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

script:
def prefix = task.ext.prefix ?: "${meta.id}"
def prot_flag = emit_protseq ? '--protseq' : ''
def cds_flag = emit_codingseq ? '--codingseq' : ''
"""
tiberius-merge \\
--manifest ${manifest} \\
--out-prefix ${prefix} \\
--genome ${genome} \\
${prot_flag} \\
${cds_flag} \\
${annotations}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
tiberius: \$( python3 -c "import tiberius; print(tiberius.__version__)" )
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
def emit_prot = emit_protseq ? true : false
def emit_cds = emit_codingseq ? true : false
"""
touch ${prefix}.gtf
touch ${prefix}.gff3
${emit_prot ? "touch ${prefix}.prot" : ''}
${emit_cds ? "touch ${prefix}.cds" : ''}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
tiberius: \$( python3 -c "import tiberius; print(tiberius.__version__)" 2>/dev/null || echo "2.0.7" )
END_VERSIONS
"""
}
95 changes: 95 additions & 0 deletions modules/nextflow/tiberius/predict/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
Copyright (c) 2026 The Hiller Lab at the Senckenberg Gessellschaft für Naturforschung
Distributed under the terms of the Apache License, Version 2.0.
*/

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TIBERIUS_PREDICT — Ab initio Tiberius inference.

Thin wrapper around `tiberius.py`. GPU is used when `-profile gpu`
exposes a device; otherwise TensorFlow falls back to CPU. Scatter jobs
should emit GTF only; GFF3 and protein/CDS FASTAs of a scattered run
come from TIBERIUS_MERGE.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

process TIBERIUS_PREDICT {
tag "$meta.id"
label 'process_high'
label 'process_gpu'

container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'' :
'ghcr.io/hillerlab/tiberius:latest' }"

input:
tuple val(meta), path(genome)
val model_cfg

output:
tuple val(meta), path("*.gtf"), emit: gtf
tuple val(meta), path("*.gff3"), emit: gff, optional: true
tuple val(meta), path("*.prot"), emit: proteins, optional: true
tuple val(meta), path("*.cds"), emit: codingseq, optional: true
path "versions.yml", emit: versions

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

script:
def args = [task.ext.args ?: '', meta.tiberius_args ?: ''].findAll { it }.join(' ')
def prefix = task.ext.prefix ?: "${meta.id}"
def custom = task.ext.model ?: (meta.model ?: '')
def emit_gff3 = meta.tiberius_emit_gff3 == true
def emit_prot = meta.tiberius_protseq == true
def emit_cds = meta.tiberius_codingseq == true
def out_files = emit_gff3 ? "${prefix}.gtf ${prefix}.gff3" : "${prefix}.gtf"
def prot_flag = emit_prot ? "--protseq ${prefix}.prot" : ''
def cds_flag = emit_cds ? "--codingseq ${prefix}.cds" : ''
"""
set -euo pipefail
model_args=""
if [ -n "${custom}" ]; then
model_args="--model ${custom}"
else
yaml=\$(awk -F '\\t' -v a="${model_cfg}" '\$1==a {print \$2; exit}' /opt/tiberius/models.tsv)
if [ -z "\$yaml" ]; then
echo "Unknown --model_cfg alias '${model_cfg}'. Use a hiller_alias from /opt/tiberius/models.tsv." >&2
awk -F '\\t' '\$1 !~ /^#/ && \$1 != "hiller_alias" {print \$1}' /opt/tiberius/models.tsv >&2
exit 1
fi
model_args="--model_cfg /opt/tiberius/model_cfg/\$yaml"
fi

tiberius.py \\
--genome ${genome} \\
\${model_args} \\
--out ${out_files} \\
${prot_flag} \\
${cds_flag} \\
${args}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
tiberius: \$( python3 -c "import tiberius; print(tiberius.__version__)" )
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
def emit_gff3 = meta.tiberius_emit_gff3 == true
def emit_prot = meta.tiberius_protseq == true
def emit_cds = meta.tiberius_codingseq == true
"""
touch ${prefix}.gtf
${emit_gff3 ? "touch ${prefix}.gff3" : ''}
${emit_prot ? "touch ${prefix}.prot" : ''}
${emit_cds ? "touch ${prefix}.cds" : ''}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
tiberius: \$( python3 -c "import tiberius; print(tiberius.__version__)" 2>/dev/null || echo "2.0.7" )
END_VERSIONS
"""
}
Loading
Loading