Visualizer class provides comprehensive plotting methods for visualizing quality control metrics, cell-cell communication patterns, chamber composition, and other HeartMAP analysis results.
Class Definition
HeartMAP configuration object containing analysis parameters and settings
Methods
plot_qc_metrics()
Plot quality control metrics from single-cell data.Annotated data object containing QC metrics in
.obsDirectory path where the QC metrics plot will be saved
qc_metrics.png)
Visualizations Generated:
- Histogram of genes per cell
- Histogram of UMI counts per cell
- Histogram of mitochondrial gene percentage (if available)
- Scatter plot of genes vs UMI counts
plot_communication_heatmap()
Plot cell-cell communication scores as a heatmap.DataFrame containing communication scores with columns:
source: Source cell typetarget: Target cell typecommunication_score: Specificity score
Directory path where the heatmap will be saved
communication_heatmap.png)
Example:
plot_hub_scores()
Visualize communication hub scores on UMAP embedding.Annotated data object. UMAP will be computed if not present in
.obsm['X_umap']Series containing hub scores for each cell
Directory path where the hub scores plot will be saved
hub_scores.png)
Example:
plot_pathway_scores()
Plot pathway activity scores across cell types.DataFrame with pathway activity scores (rows: pathways, columns: cell types)
Directory path where the pathway scores heatmap will be saved
pathway_scores.png)
Example:
plot_chamber_composition()
Visualize chamber composition as bar plot and pie chart.Annotated data object with
chamber annotation in .obs['chamber']Directory path where the composition plot will be saved
chamber_composition.png)
Visualizations Generated:
- Bar plot showing cell counts by chamber
- Pie chart showing chamber proportions
plot_chamber_markers()
Plot top chamber-specific marker genes.Dictionary mapping chamber names to DataFrames containing marker genes with columns:
names: Gene namespvals_adj: Adjusted p-values
Directory path where the markers plot will be saved
chamber_markers.png)
Example:
plot_cross_chamber_correlations()
Plot correlation heatmap between chambers.DataFrame containing correlation matrix between chambers
Directory path where the correlation plot will be saved
cross_chamber_correlations.png)
Example:
create_comprehensive_dashboard()
Create a comprehensive multi-panel visualization dashboard.Annotated data object. PCA, neighbors, and UMAP will be computed if not present
Dictionary containing analysis results from HeartMAP pipeline
Directory path where the dashboard will be saved
comprehensive_dashboard.png)
Dashboard Panels:
- Cell type clusters (UMAP)
- Communication hubs (UMAP)
- Chamber distribution (pie chart)
- Additional analysis-specific panels
Visualization Types
Quality Control
- Genes per cell: Distribution histogram
- UMI counts: Distribution histogram
- Mitochondrial percentage: Distribution histogram
- Genes vs UMI: Scatter plot correlation
Communication Analysis
- Communication heatmap: Source-target specificity scores
- Hub scores: UMAP overlay showing communication hub cells
- Pathway scores: Activity heatmap across cell types
Chamber Analysis
- Chamber composition: Bar plots and pie charts
- Chamber markers: Top marker genes by significance
- Cross-chamber correlations: Expression correlation heatmap
Comprehensive Dashboards
- Multi-panel figures: Combining multiple analysis views
- Publication-ready: High-resolution (300 DPI) outputs
Output Formats
All visualizations are saved as PNG files with:- Resolution: 300 DPI (publication quality)
- Format: PNG with tight bounding boxes
- File naming: Descriptive names (e.g.,
qc_metrics.png,communication_heatmap.png)
Dependencies
The Visualizer class requires the following plotting libraries:- matplotlib
- seaborn
- pandas
- numpy
- scanpy
Notes
All plotting methods automatically compute missing embeddings (PCA, neighbors, UMAP) when needed. This ensures visualizations work even if preprocessing steps were skipped.