Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
7 changes: 7 additions & 0 deletions modules/nf-core/modkit/extractcalls/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
- "bioconda::ont-modkit=0.6.1"
45 changes: 45 additions & 0 deletions modules/nf-core/modkit/extractcalls/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
process MODKIT_EXTRACTCALLS {
tag "$meta.id"
label 'process_high'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/ont-modkit:0.6.1--hcdda2d0_0':
'quay.io/biocontainers/ont-modkit:0.6.1--hcdda2d0_0' }"

input:
tuple val(meta), path(bam), path(bai)
tuple val(meta2), path(fasta), path(fai)

output:
tuple val(meta), path("*.tsv{,.gz}"), emit: tsv
tuple val(meta), path("*.log") , emit: log, optional: true
tuple val("${task.process}"), val('modkit'), eval("modkit --version | sed 's/modkit //'"), emit: versions_modkit, topic: versions

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

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def reference = fasta ? "--reference ${fasta}" : ''
def out_suffix = args.tokenize().contains('--bgzf') ? 'tsv.gz' : 'tsv'
"""
modkit \\
extract \\
calls \\
$args \\
--threads ${task.cpus} \\
${reference} \\
${bam} \\
${prefix}.${out_suffix}
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def out_suffix = args.tokenize().contains('--bgzf') ? 'tsv.gz' : 'tsv'
"""
touch ${prefix}.${out_suffix}
"""
}
118 changes: 118 additions & 0 deletions modules/nf-core/modkit/extractcalls/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: modkit_extractcalls
description: |
Produce a per-read per-position table of base modification **calls**
(pass/fail/filtered, with the called base) from a modBAM using the same
thresholding algorithm as `modkit pileup`. Complementary to `modkit
extract full`, which emits raw probabilities: `extract calls` emits the
thresholded categorical decision per site per read.
keywords:
- modkit
- methylation
- extract
- calls
- read-level
- modbam
- nanopore
- ont
tools:
- "modkit":
description: A bioinformatics tool for working with modified bases in Oxford Nanopore
sequencing data.
homepage: https://github.com/nanoporetech/modkit
documentation: https://nanoporetech.github.io/modkit/
tool_dev_url: https://github.com/nanoporetech/modkit
licence:
- "Oxford Nanopore Technologies PLC. Public License Version 1.0"
identifier: ""
input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`. The output inherits this meta.
- bam:
type: file
description: |
Input modBAM/modCRAM with MM/ML tags. A CRAM input also requires
`fasta` to be supplied.
pattern: "*.{bam,cram}"
ontologies:
- edam: http://edamontology.org/format_2572
- bai:
type: file
description: |
Index for `bam` — `.bai`/`.csi` for a BAM, `.crai` for a CRAM.
pattern: "*.{bai,csi,crai}"
ontologies: []
- - meta2:
type: map
description: |
Groovy Map containing reference information
e.g. `[ id:'mm10' ]`. May be `[[], [], []]` to skip — reference
context columns will then be "." in the output.
- fasta:
type: file
description: Optional reference FASTA. Required only to populate reference-context
columns in the output.
pattern: "*.{fa,fasta,fna}"
ontologies:
- edam: http://edamontology.org/format_1929
- fai:
type: file
description: Samtools FASTA index for `fasta`.
pattern: "*.fai"
ontologies:
- edam: http://edamontology.org/format_3475
output:
tsv:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`.
- "*.tsv{,.gz}":
type: file
description: |
Per-read per-position call table. BGZF-compressed when `--bgzf`
is passed via `ext.args`.
pattern: "*.{tsv,tsv.gz}"
ontologies:
- edam: http://edamontology.org/format_3475
log:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`.
- "*.log":
type: file
description: |
Optional modkit debug log (only emitted when `--log-filepath
<name>.log` is passed via `ext.args`).
pattern: "*.log"
ontologies: []
versions_modkit:
- - ${task.process}:
type: string
description: The name of the process
- modkit:
type: string
description: The name of the tool
- modkit --version | sed 's/modkit //':
type: eval
description: The expression to obtain the version of the tool
topics:
versions:
- - ${task.process}:
type: string
description: The name of the process
- modkit:
type: string
description: The name of the tool
- modkit --version | sed 's/modkit //':
type: eval
description: The expression to obtain the version of the tool
authors:
- "@sahuno"
maintainers:
- "@sahuno"
68 changes: 68 additions & 0 deletions modules/nf-core/modkit/extractcalls/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "modkit"
tag "modkit/extract"
tag "modkit/extractcalls"

test("homo sapiens - nanopore modbam - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id: 'test' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.phased.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.phased.bam.bai', checkIfExists: true)
]
input[1] = [
[ id: 'genome' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true)
]
"""
}
}

then {
assert process.success
assertAll(
{ assert snapshot(sanitizeOutput(process.out)).match() }
)
Comment thread
SPPearce marked this conversation as resolved.
}
}

test("homo sapiens - nanopore modbam") {

when {
process {
"""
input[0] = [
[ id: 'test' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.phased.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.phased.bam.bai', checkIfExists: true)
]
input[1] = [
[ id: 'genome' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta.fai', checkIfExists: true)
]
"""
}
}

then {
assert process.success
assertAll(
{ assert snapshot(sanitizeOutput(process.out)).match() }
)
Comment thread
SPPearce marked this conversation as resolved.
}
}
}
60 changes: 60 additions & 0 deletions modules/nf-core/modkit/extractcalls/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"homo sapiens - nanopore modbam": {
"content": [
{
"log": [

],
"tsv": [
[
{
"id": "test"
},
"test.tsv:md5,0ce2e5a6bf0889aaf8cbd682e2b17acb"
]
],
"versions_modkit": [
[
"MODKIT_EXTRACTCALLS",
"modkit",
"0.6.1"
]
]
}
],
"timestamp": "2026-09-07T05:57:46.17857069",
"meta": {
"nf-test": "0.9.5",
"nextflow": "25.10.4"
}
},
"homo sapiens - nanopore modbam - stub": {
"content": [
{
"log": [

],
"tsv": [
[
{
"id": "test"
},
"test.tsv:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions_modkit": [
[
"MODKIT_EXTRACTCALLS",
"modkit",
"0.6.1"
]
]
}
],
"timestamp": "2026-09-07T05:57:35.907259742",
"meta": {
"nf-test": "0.9.5",
"nextflow": "25.10.4"
}
}
}