smftools.plotting.pod5_plotting#
POD5 signal plotting utilities for nanopore reads.
Functions
|
Plot raw current signal from POD5 files for specified reads. |
- smftools.plotting.pod5_plotting.plot_read_current_traces(adata, read_ids, reference_start=None, reference_end=None, var_start=None, var_end=None, use_moves=True, figsize=(15, 4), title=None, pod5_dir=None, save_path=None)#
Plot raw current signal from POD5 files for specified reads.
Parameters#
- adataanndata.AnnData
AnnData object with obs['fn'] or obs['pod5_origin'] (POD5 filenames) and uns['bam_paths'] (experiment-specific BAM file paths).
- read_idslist of str
List of read IDs to plot.
- reference_startint, optional
Start position in reference coordinates (0-based). If provided with reference_end, only plot signal for this genomic region.
- reference_endint, optional
End position in reference coordinates (0-based, exclusive).
- var_startint, optional
Start var index (0-based) into adata.var. The corresponding reference coordinate is looked up from
adata.var["Original_var_names"](if the adata was reindexed) oradata.var_names. Takes precedence overreference_start/reference_endwhen both are provided.- var_endint, optional
End var index (0-based, exclusive).
- use_movesbool, default True
If True and move table (mv tag) is available, use it for precise signal-to-base mapping. If False or mv tag unavailable, use proportional estimation.
- figsizetuple, default (15, 4)
Figure size (width, height) in inches.
- titlestr, optional
Plot title. If None, uses read ID.
- pod5_dirstr or Path, optional
Directory containing POD5 files. When provided, the basename from obs['fn'] / obs['pod5_origin'] is joined with this directory to form the absolute path.
- save_pathstr or Path, optional
If provided, save the figure to this path as PNG.
Returns#
- figmatplotlib.figure.Figure
The created figure object.
Notes#
Requires POD5 files to be accessible at the paths stored in obs['fn'] or obs['pod5_origin']. For precise signal mapping, requires BAM files with move tables (mv tag) generated using dorado's --emit-moves flag.
Examples#
>>> plot_read_current_traces(adata, ["read_001", "read_002"], ... reference_start=1000, reference_end=1500) >>> # Or use var indices to plot signal for a span of adata columns: >>> plot_read_current_traces(adata, ["read_001"], var_start=0, var_end=100)