Plotting
mina.pl.plot_view_samples(anndata_dict, min_samples, table=False, figsize=(5, 5), dpi=100, ax=None, return_fig=False, **kwargs)
Quality control plot to assess the quality of the obtained pseudobulk samples.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
anndata_dict
|
dict[str, AnnData]
|
Dictionary mapping view names to AnnData objects. |
required |
min_samples
|
int
|
Minimum number of samples required for a view to be included. |
required |
table
|
bool
|
Whether to return the underlying summary table instead of plotting. Default is False. |
False
|
figsize
|
tuple[int, int]
|
Size of the figure in inches. Default is (5, 5). |
(5, 5)
|
dpi
|
int
|
Resolution of the figure in dots per inch. Default is 100. |
100
|
ax
|
Axes or None
|
Matplotlib Axes object to plot on. If None, a new figure and axes are created. |
None
|
return_fig
|
bool
|
Whether to return the Figure object. Default is False. |
False
|
**kwargs
|
dict
|
Additional keyword arguments passed to |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
fig |
Figure or None
|
The created Figure object if |
mina.pl.plot_view_genes(anndata_dict, min_genes, table=False, figsize=(5, 5), dpi=100, ax=None, return_fig=False, **kwargs)
Quality control plot to assess the quality of the obtained pseudobulk samples.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
anndata_dict
|
dict[str, AnnData]
|
Dictionary mapping view names to AnnData objects. |
required |
min_genes
|
int
|
Minimum number of genes required for a view to be included. |
required |
table
|
bool
|
Whether to return the underlying summary table instead of plotting. Default is False. |
False
|
figsize
|
tuple[int, int]
|
Size of the figure in inches. Default is (5, 5). |
(5, 5)
|
dpi
|
int
|
Resolution of the figure in dots per inch. Default is 100. |
100
|
ax
|
Axes or None
|
Matplotlib Axes object to plot on. If None, a new figure and axes are created. |
None
|
return_fig
|
bool
|
Whether to return the Figure object. Default is False. |
False
|
**kwargs
|
dict
|
Additional keyword arguments passed to |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
fig |
Figure or None
|
The created Figure object if |
mina.pl.plot_sample_coverage(anndata_dict, threshold, proportion, table=False, figsize=(5, 5), dpi=100, return_fig=False, **kwargs)
Visualize coverage for each AnnData in a dictionary and highlight samples below a given proportion threshold.
One figure is produced per dictionary key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
anndata_dict
|
dict[str, AnnData]
|
Dictionary mapping view names to AnnData objects. |
required |
threshold
|
float or dict[str, float]
|
Gene expression threshold. If a dict, must contain all keys of
|
required |
proportion
|
float or dict[str, float]
|
Minimum proportion of genes above |
required |
table
|
bool
|
If True, return summary tables instead of plotting. Default is False. |
False
|
figsize
|
tuple[int, int]
|
Figure size per subplot. Default is (5, 5). |
(5, 5)
|
dpi
|
int
|
Figure resolution in dots per inch. Default is 100. |
100
|
return_fig
|
bool
|
If True, return the generated Figure objects. Default is False. |
False
|
**kwargs
|
dict
|
Additional keyword arguments passed to |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, DataFrame] or dict[str, Figure] or None
|
Summary tables if |
mina.pl.plot_pval_tiles(p_df: pd.DataFrame, star_threshold: float = 0.05, ax=None, title: str | None = None)
Create a tile plot colored by -log10(p) values, with tiles annotated
by a star when p <= star_threshold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p_df
|
DataFrame
|
DataFrame of p-values with rows and columns defining the tile grid. |
required |
star_threshold
|
float
|
P-value threshold for star annotation. Default is 0.05. |
0.05
|
ax
|
Axes or None
|
Axes to draw on. If None, a new figure and axes are created. |
None
|
title
|
str or None
|
Optional title for the plot. |
None
|
mina.pl.plot_mcell_funcomics(result_dict: dict[str, dict[str, pd.DataFrame]], result_key: str = 'pw_acts', pval_key: str = 'pw_padj', p_threshold: float = 0.05, top_n: int = 10, cmap: str = 'coolwarm', figsize: tuple = (14, 5), ytick_rotation: int = 0, use_var: bool = False)
Plot grouped heatmaps per view using a selected result matrix.
Features are filtered by adjusted p-value and ranked either by mean absolute value or variance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result_dict
|
dict[str, dict[str, DataFrame]]
|
Output of |
required |
result_key
|
str
|
Key within each view result containing values to plot. |
'pw_acts'
|
pval_key
|
str
|
Key within each view result containing adjusted p-values. |
'pw_padj'
|
p_threshold
|
float
|
Adjusted p-value significance threshold. |
0.05
|
top_n
|
int
|
Number of top significant features per view to display. |
10
|
cmap
|
str
|
Colormap for the heatmaps. |
'coolwarm'
|
figsize
|
tuple[int, int]
|
Overall figure size. |
(14, 5)
|
ytick_rotation
|
int
|
Rotation angle for y-axis tick labels. |
0
|
use_var
|
bool
|
If True, rank features by variance instead of mean absolute value. |
False
|
mina.pl.plot_mcell_network(df: pd.DataFrame, weight_col: str = 'coef', abs_cutoff: float = 0.0, keep_negative: bool = True, edge_width_range: tuple = (0.8, 6), node_size: int = 1100, arrowsize: int = 18, reciprocal_curvature: float = 0.25, default_curvature: float = 0.04, positive_color: str = 'tab:purple', negative_color: str = 'tab:red', show_edge_labels: bool = False, label_fmt: str = '{:.2f}', title: str | None = None, save_path: str | None = None, edge_margin_factor: float = 0.55, arrows_on_top: bool = True)
Given the inference of a multicellular information network, plot the resulting directed graph with edges colored and scaled by weight. The results are shown solely from one subset (positive or negative loadings).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
DataFrame defining directed edges. Must contain at least source, target, and edge weight columns. |
required |
weight_col
|
str
|
Column name containing edge weights. Default is "coef". |
'coef'
|
abs_cutoff
|
float
|
Minimum absolute weight required to keep an edge. |
0.0
|
keep_negative
|
bool
|
Whether to retain negatively weighted edges. |
True
|
edge_width_range
|
tuple[float, float]
|
Minimum and maximum edge widths used for scaling. |
(0.8, 6)
|
node_size
|
int
|
Size of network nodes. |
1100
|
arrowsize
|
int
|
Size of arrow heads. |
18
|
reciprocal_curvature
|
float
|
Curvature used for reciprocal edges. |
0.25
|
default_curvature
|
float
|
Curvature used for non-reciprocal edges. |
0.04
|
positive_color
|
str
|
Color for positively weighted edges. |
'tab:purple'
|
negative_color
|
str
|
Color for negatively weighted edges. |
'tab:red'
|
show_edge_labels
|
bool
|
Whether to display edge weight labels. |
False
|
label_fmt
|
str
|
Format string used for edge labels. |
'{:.2f}'
|
title
|
str or None
|
Optional plot title. |
None
|
save_path
|
str or None
|
If provided, save the figure to this path. |
None
|
edge_margin_factor
|
float
|
Factor controlling spacing between nodes and edges. |
0.55
|
arrows_on_top
|
bool
|
Whether arrows are drawn above nodes. |
True
|
Returns:
| Type | Description |
|---|---|
Figure or None
|
The generated figure, or None if not returned explicitly. |