NanoMethViz is a Bioconductor package designed to visualise methylation data from long-read sequencing. It provides a simple interface to plot methylation data and perform dimensionality reduction on a per-read basis.
The package is designed to work with methylation data from the Oxford Nanopore Technologies (ONT) platform. It supports:
modkit extract full)Features are developed for 5mC CpG methylation but will work with other modifications if data is in the correct format. If you would like additional formats supported, please create an issue at https://github.com/Shians/NanoMethViz/issues.
Install from Bioconductor:
if (!requireNamespace("BiocManager", quietly = TRUE)) {
install.packages("BiocManager")
}
BiocManager::install("NanoMethViz")
Install the Bioconductor devel version:
if (!requireNamespace("BiocManager", quietly = TRUE)) {
install.packages("BiocManager")
}
BiocManager::install(version = "devel")
BiocManager::install("NanoMethViz")
To generate a methylation plot, you need three components:
data.frame with at least a sample columndata.frame with columns gene_id, chr, strand, start, end, transcript_id, symbol
library(NanoMethViz)
# Load bundled example data
nmr <- load_example_nanomethresult()
# Plot methylation for a single gene
plot_gene(nmr, "Peg3")
# Aggregate methylation across multiple genes
plot_agg_genes(nmr)
# Dimensionality reduction on methylation profiles
bss <- methy_to_bsseq(nmr)
gene_regions <- exons_to_genes(exons(nmr))
lmr <- bsseq_to_log_methy_ratio(bss, gene_regions)
plot_mds(lmr)
plot_pca(lmr)
create_tabix_file() or modbam_to_tabix().
ModBamResult directly without conversion.sample column and gene/exon annotation using get_exons_hg38(), get_exons_mm10(), or custom annotation.NanoMethResult() for tabix files or ModBamResult() for modBAM files.For NanoMethResult, data must be in tabix format (bgzip-compressed and tabix-indexed) and sorted by genomic position. Use create_tabix_file() to convert tabular data from modkit, Megalodon, Nanopolish, or f5c.
Recent versions of dorado and ONT software store modifications directly in BAM files. These can be used with ModBamResult without conversion:
mbr <- ModBamResult(
methy = ModBamFiles(
samples = c("sample1", "sample2"),
c("path/to/sample1.bam", "path/to/sample2.bam")
),
samples = data.frame(sample = c("sample1", "sample2"), group = c("A", "B")),
exons = exon_tibble
)
For sharing, convert to tabix format using modbam_to_tabix().
Use helper functions for common organisms: get_exons_hg38(), get_exons_mm10(), get_exons_grcm39(), or provide custom annotation. See the Importing Annotations section of the user's guide for details.
Plotting regions: plot_gene(), plot_region() for single genes or genomic intervals; plot_gene_heatmap(), plot_region_heatmap() for per-read heatmaps.
Aggregate analysis: plot_agg_genes(), plot_agg_regions() for group-level summaries.
Dimensionality reduction: Convert to bsseq format with methy_to_bsseq(), compute log-methylation ratios with bsseq_to_log_methy_ratio(), then visualize with plot_mds() or plot_pca().
Querying data: Extract methylation values for regions using query_methy() or filter with filter_methy().
Export for downstream analysis: Use methy_to_bsseq() for bsseq/DSS, or bsseq_to_edger() for edgeR differential methylation analysis.
See the function reference for complete function documentation and examples.
Data format requirements:
samples$sample
gene_id, chr, strand, start, end, transcript_id, symbol
Package options:
NanoMethViz.site_filter (default: 3) - Remove sites with coverage below thresholdNanoMethViz.highlight_col (default: "grey50") - Color for annotated regions in plots


This project is licensed under Apache License, Version 2.0.