snapatac2.pl.coverage#
- snapatac2.pl.coverage(adata, region, groupby, out_file=None)[source]#
Plot coverage tracks for grouped cells across one genomic region.
Use this function for quick local inspection of coverage patterns. Install
matplotlibbefore calling it.This is a simple implementation for quick visualization. For more advanced visualization, export the data with
snapatac2.ex.export_coverageand inspect it in a genome browser.Anti-Patterns#
Do NOT use this function for publication-scale genome browser tracks; export coverage files instead.
Do NOT pass multiple genomic intervals.
regionmust be a single string formatted as"chrom:start-end".
- param adata:
Annotated data matrix with fragments available for coverage retrieval.
- type adata:
AnnData- param region:
Genomic interval to plot, formatted as
"chrom:start-end"; for example,"chr1:100000-200000".- type region:
- param groupby:
Cell grouping definition. If a string, groups are read from
adata.obs[groupby].- type groupby:
- param out_file:
Output path for saving the Matplotlib figure. If
None, display the plot withmatplotlib.pyplot.show.- type out_file:
- returns:
Displays or saves the Matplotlib figure.
- rtype:
None
See also
snapatac2.ex.export_coverageExport coverage tracks for genome browsers.
Examples
>>> import snapatac2 as snap >>> adata = snap.read(snap.datasets.pbmc5k(type="h5ad")) >>> snap.pl.coverage( ... adata, ... region="chr1:100000-200000", ... groupby="cell_type", ... out_file="coverage.png", ... )