scmagnify.plotting.GenomeViewer#
- class scmagnify.plotting.GenomeViewer(data, modal='ATAC', gtf=None, fragment_files=None, cluster='celltype', links=None, auto_load_links=True, auto_load_peaks=True, barcode_delimiter='#', peak_delimiter=[':', '-'])#
A class to visualize genomic loci, including coverage tracks, gene annotations, and other genomic features.
This class is designed to handle the setup and pre-processing of genomic data once during initialization, allowing for efficient plotting of multiple genomic regions.
- Parameters:
data (
AnnData|MuData|GRNMuData) – Single cell data object. Can be ananndata.AnnData,mudata.MuData,scmagnify.GRNMuDatamodal (
Literal['GRN','RNA','ATAC'] (default:'ATAC')) – Modality key (e.g., ‘RNA’, ‘ATAC’) when using multi-modal data.mudata.MuDataorscmagnify.GRNMuDatamust be provided.gtf (
Union[PyRanges,str,None] (default:None)) – A path to a GTF file or a pre-loaded PyRanges GTF object. If not provided, it will fall back tosettings.gtf_file.fragment_files (
Optional[dict[str,str]] (default:None)) – A dictionary mapping sample names to their corresponding fragment file paths. This is required for plotting coverage.cluster (
str(default:'celltype')) – The column in.obsto use for grouping cells.links (
Optional[DataFrame] (default:None)) – A DataFrame containing peak-to-gene links.barcode_delimiter (
str(default:'#')) – The barcode_delimiter used to separate the barcode from the sample name inadata.obs_names.auto_load_links (bool)
auto_load_peaks (bool)
Methods table#
|
Adds transcription factor motifs to the object, ensuring no duplicates are added. |
|
Plot coverage tracks and associated genomic features for a given region or gene. |
Methods#
- GenomeViewer.add_motifs(tfs=None, motifs=None, motif_score=None, motif_db='HOCOMOCOv11_HUMAN', target_organism=None, path_to_motifs=None)#
Adds transcription factor motifs to the object, ensuring no duplicates are added.
This method can be called multiple times. Each call will add new, unique motifs based on the provided transcription factors or motif IDs, checking against already existing motifs by their
matrix_id.
- GenomeViewer.plot(region=None, anchor_gene=None, anchor_flank=500000, cluster_order=None, highlight_peaks=None, fig_width=10.0, plot_cov_size=1.0, plot_link_size=0.5, plot_bed_size=0.2, plot_motif_size=0.8, spacer_size=1.2, y_font=12, frag_type='All', min_coverage=0, smooth=75, normalize=True, nfrags_key='nFrags', links_color='Reds', collapsed=False, side_genes=None, side_modal='RNA', side_layer='log1p_norm', side_width_ratio=0.25, side_plot_type='violin', motifs_per_row=3, motif_facecolor='#4daf4a', show_motif_logos=True, broder_linewidth=1.0, context=None, default_context=None, theme='ticks', font_scale=1, rasterize_coverage=True, save=None, show=None)#
Plot coverage tracks and associated genomic features for a given region or gene.
This is the final integrated version with support for coverage, peaks, links, genes, side plots, highlighting, and sequence motif tracks.
- Return type:
Figure|None- Parameters:
region (str | None)
anchor_gene (str | None)
anchor_flank (int)
fig_width (float)
plot_cov_size (float)
plot_link_size (float)
plot_bed_size (float)
plot_motif_size (float)
spacer_size (float)
y_font (int | None)
frag_type (str)
min_coverage (float)
smooth (int)
normalize (bool)
nfrags_key (str)
links_color (str)
collapsed (bool)
side_modal (Literal['GRN', 'RNA', 'ATAC'])
side_layer (str)
side_width_ratio (float)
side_plot_type (Literal['violin', 'box'])
motifs_per_row (int)
motif_facecolor (str)
show_motif_logos (bool)
broder_linewidth (float)
context (str | None)
default_context (dict | None)
theme (str | None)
font_scale (float | None)
rasterize_coverage (bool)
save (str | None)
show (bool | None)