Plotting
novae.plot.domains(adata, obs_key=None, slide_name_key=None, cell_size=10, ncols=4, fig_size_per_slide=(5, 5), na_color='#ccc', show=True, library_id=None, **kwargs)
Show the Novae spatial domains for all slides in the AnnData
object.
Info
Make sure you have already your Novae domains assigned to the AnnData
object. You can use model.assign_domains(...)
to do so.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adata
|
AnnData | list[AnnData]
|
An |
required |
obs_key
|
str | None
|
Name of the key from |
None
|
slide_name_key
|
str | None
|
Key of |
None
|
cell_size
|
int | None
|
Size of the cells or spots. |
10
|
ncols
|
int
|
Number of columns to be shown. |
4
|
fig_size_per_slide
|
tuple[int, int]
|
Size of the figure for each slide. |
(5, 5)
|
na_color
|
str
|
Color for cells that does not belong to any domain (i.e. cells with a too small neighborhood). |
'#ccc'
|
show
|
bool
|
Whether to show the plot. |
True
|
library_id
|
str | None
|
|
None
|
**kwargs
|
int
|
Additional arguments for |
{}
|
Source code in novae/plot/_spatial.py
novae.plot.domains_proportions(adata, obs_key=None, slide_name_key=None, figsize=(2, 5), show=True)
Show the proportion of each domain in the slide(s).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adata
|
AnnData | list[AnnData]
|
One |
required |
obs_key
|
str | None
|
The key in |
None
|
figsize
|
tuple[int, int]
|
Matplotlib figure size. |
(2, 5)
|
show
|
bool
|
Whether to show the plot. |
True
|
Source code in novae/plot/_bar.py
novae.plot.connectivities(adata, ngh_threshold=2, cell_size=5, ncols=4, fig_size_per_slide=(5, 5), linewidths=0.1, line_color='#333', cmap='rocket', color_isolated_cells='orangered', show=True)
Show the graph of the spatial connectivities between cells. By default,
the cells which have a number of neighbors inferior to ngh_threshold
are shown
in red. If ngh_threshold
is None
, the cells are colored by the number of neighbors.
Quality control
This plot is useful to check the quality of the spatial connectivities obtained via novae.utils.spatial_neighbors.
Make sure few cells (e.g., less than 5%) have a number of neighbors below ngh_threshold
.
If too many cells are isolated, you may want to increase the radius
parameter in novae.utils.spatial_neighbors.
Conversely, if there are some less that are really far from each other, but still connected, so may want to decrease the radius
parameter to disconnect them.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adata
|
AnnData
|
An AnnData object. |
required |
ngh_threshold
|
int | None
|
Only cells with a number of neighbors below this threshold are shown (with color |
2
|
cell_size
|
int
|
Size of the dots for each cell. |
5
|
ncols
|
int
|
Number of columns to be shown. |
4
|
fig_size_per_slide
|
tuple[int, int]
|
Size of the figure for each slide. |
(5, 5)
|
linewidths
|
float
|
Width of the lines/edges connecting the cells. |
0.1
|
line_color
|
str
|
Color of the lines/edges. |
'#333'
|
cmap
|
str
|
Name of the colormap to use for the number of neighbors. |
'rocket'
|
color_isolated_cells
|
str
|
Color for the cells with a number of neighbors below |
'orangered'
|
show
|
bool
|
Whether to show the plot. |
True
|
Source code in novae/plot/_graph.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
|
novae.plot.pathway_scores(adata, pathways, obs_key=None, pathway_name=None, slide_name_key=None, return_df=False, figsize=(10, 5), min_pathway_size=4, show=True, **kwargs)
Show a heatmap of either (i) the score of multiple pathways for each domain, or (ii) one pathway score for each domain and for each slide.
To use the latter case, provide pathway_name
, or make sure to have only one pathway in pathways
.
Info
Currently, this function only supports one AnnData object per call.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adata
|
AnnData
|
An |
required |
pathways
|
dict[str, list[str]] | str
|
Either a dictionary of pathways (keys are pathway names, values are lists of gene names), or a path to a GSEA JSON file. |
required |
obs_key
|
str | None
|
Key in |
None
|
pathway_name
|
str | None
|
If |
None
|
slide_name_key
|
str | None
|
Key of |
None
|
return_df
|
bool
|
Whether to return the DataFrame. |
False
|
figsize
|
tuple[int, int]
|
Matplotlib figure size. |
(10, 5)
|
min_pathway_size
|
int
|
Minimum number of known genes in the pathway to be considered. |
4
|
show
|
bool
|
Whether to show the plot. |
True
|
Returns:
Type | Description |
---|---|
DataFrame | None
|
A DataFrame of scores per domain if |
Source code in novae/plot/_heatmap.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
|
novae.plot.paga(adata, obs_key=None, show=True, **paga_plot_kwargs)
Plot a PAGA graph.
Info
Currently, this function only supports one slide per call.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adata
|
AnnData
|
An AnnData object. |
required |
obs_key
|
str | None
|
Name of the key from |
None
|
show
|
bool
|
Whether to show the plot. |
True
|
**paga_plot_kwargs
|
int
|
Additional arguments for |
{}
|
Source code in novae/plot/_graph.py
novae.plot.spatially_variable_genes(adata, obs_key=None, top_k=5, cell_size=10, min_positive_ratio=0.05, return_list=False, show=True, **kwargs)
Plot the most spatially variable genes (SVG) for a given AnnData
object.
Info
Currently, this function only supports one slide per call.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adata
|
AnnData
|
An |
required |
obs_key
|
str | None
|
Key in |
None
|
top_k
|
int
|
Number of SVG to be shown. |
5
|
cell_size
|
int
|
Size of the cells or spots ( |
10
|
min_positive_ratio
|
float
|
Genes whose "ratio of cells expressing it" is lower than this threshold are not considered. |
0.05
|
return_list
|
bool
|
Whether to return the list of SVG instead of plotting them. |
False
|
show
|
bool
|
Whether to show the plot. |
True
|
**kwargs
|
int
|
Additional arguments for |
{}
|
Returns:
Type | Description |
---|---|
None | list[str]
|
A list of SVG names if |