-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New module: modkit/extractcalls #11286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+298
−0
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a0ef572
feat: add modkit/extract/calls module
sahuno e7dd4ae
refactor(modkit/extractcalls): rename from modkit/extract/calls
sahuno 559d50c
fix(modkit/extractcalls): address review — sanitizeOutput, crai, drop…
sahuno a0b3ee9
Merge branch 'master' into add-modkit-extract-calls
SPPearce ff5d631
feat(modkit/extractcalls): bump ont-modkit 0.6.1 -> 0.6.4
sahuno File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.4" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.4--h7f49ad2_0': | ||
| 'quay.io/biocontainers/ont-modkit:0.6.4--h7f49ad2_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} | ||
| """ | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() } | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| 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() } | ||
| ) | ||
|
SPPearce marked this conversation as resolved.
|
||
| } | ||
| } | ||
| } | ||
60 changes: 60 additions & 0 deletions
60
modules/nf-core/modkit/extractcalls/tests/main.nf.test.snap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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.4" | ||
| ] | ||
| ] | ||
| } | ||
| ], | ||
| "timestamp": "2026-09-09T13:59:59.838529499", | ||
| "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.4" | ||
| ] | ||
| ] | ||
| } | ||
| ], | ||
| "timestamp": "2026-09-09T13:59:53.916004727", | ||
| "meta": { | ||
| "nf-test": "0.9.5", | ||
| "nextflow": "25.10.4" | ||
| } | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.