Plots
scyan.plot.umap(adata, color=None, vmax='p95', vmin='p05', show=True, **scanpy_kwargs)
Plot a UMAP using scanpy.
Note
If you trained your UMAP with scyan.tools.umap on a subset of cells, it will only display the desired subset of cells.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adata |
AnnData
|
An |
required |
color |
Union[str, List[str]]
|
Marker(s) or |
None
|
vmax |
Union[str, float]
|
|
'p95'
|
vmin |
Union[str, float]
|
|
'p05'
|
show |
bool
|
Whether or not to display the figure. |
True
|
**scanpy_kwargs |
int
|
Optional kwargs provided to |
{}
|
Source code in scyan/plot/dot.py
scyan.plot.scatter(adata, population, markers=None, n_markers=3, key='scyan_pop', max_obs=2000, s=1.0, show=True)
Display marker expressions on 2D scatter plots with colors per population. One scatter plot is displayed for each pair of markers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adata |
AnnData
|
An |
required |
population |
Union[str, List[str], None]
|
One population, or a list of population to be colored, or |
required |
markers |
Optional[List[str]]
|
List of markers to plot. If |
None
|
n_markers |
Optional[int]
|
Number of markers to choose automatically if |
3
|
key |
str
|
Key to look for populations in |
'scyan_pop'
|
max_obs |
int
|
Maximum number of cells per population to be displayed. If population is None, then this number is multiplied by 10. |
2000
|
s |
float
|
Dot marker size. |
1.0
|
show |
bool
|
Whether or not to display the figure. |
True
|
Source code in scyan/plot/dot.py
scyan.plot.probs_per_marker(model, population, key='scyan_pop', prob_name='Prob', vmin_threshold=-100, figsize=(10, 6), show=True)
Interpretability tool: get a group of cells and plot a heatmap of marker probabilities for each population.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
Scyan
|
Scyan model. |
required |
population |
str
|
Name of one population to interpret. To be valid, the population name has to be in |
required |
key |
str
|
Key to look for population in |
'scyan_pop'
|
prob_name |
str
|
Name to display on the plot. |
'Prob'
|
vmin_threshold |
int
|
Minimum threshold for the heatmap colorbar. |
-100
|
figsize |
Tuple[float]
|
Pair |
(10, 6)
|
show |
bool
|
Whether or not to display the figure. |
True
|
Source code in scyan/plot/heatmap.py
scyan.plot.pop_percentage(adata, groupby=None, key='scyan_pop', figsize=None, dendogram=False, show=True)
Show populations percentages. Depending on groupby
, this is either done globally, or as a stacked bar plot (one bar for each group).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adata |
AnnData
|
An |
required |
groupby |
Union[str, List[str], None]
|
Key(s) of |
None
|
key |
str
|
Key of |
'scyan_pop'
|
figsize |
tuple[float, float]
|
matplotlib figure size. |
None
|
dendogram |
bool
|
If True, the groups are sorted based on a dendogram clustering. |
False
|
show |
bool
|
Whether or not to display the figure. |
True
|
Source code in scyan/plot/ratios.py
scyan.plot.pop_dynamics(adata, time_key, groupby=None, key='scyan_pop', among=None, n_cols=4, size_mul=None, figsize=None, show=True)
Show populations percentages dynamics for different timepoints. Depending on groupby
, this is either done globally, or for each group.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adata |
AnnData
|
An |
required |
time_key |
str
|
Key of |
required |
groupby |
Union[str, List[str], None]
|
Key(s) of |
None
|
key |
str
|
Key of |
'scyan_pop'
|
among |
str
|
Key of |
None
|
n_cols |
int
|
Number of figures per row. |
4
|
size_mul |
Optional[float]
|
Dot size multiplication factor. By default, it is computed using the population counts. |
None
|
figsize |
tuple[float, float]
|
matplotlib figure size. |
None
|
show |
bool
|
Whether or not to display the figure. |
True
|
Source code in scyan/plot/ratios.py
58 59 60 61 62 63 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 150 151 152 153 154 155 156 157 158 159 |
|
scyan.plot.pop_expressions(model, population, key='scyan_pop', max_value=1.5, num_pieces=100, radius=0.05, figsize=(2, 6), show=True)
Plot latent cell expressions for one population. Contrary to scyan.plot.pops_expressions
, in displays expressions on a vertical bar, from Neg
to Pos
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
Scyan
|
Scyan model. |
required |
population |
str
|
Name of one population to interpret. To be valid, the population name has to be in |
required |
key |
str
|
Key to look for populations in |
'scyan_pop'
|
max_value |
float
|
Maximum absolute latent value. |
1.5
|
num_pieces |
int
|
Number of pieces to display the colorbar. |
100
|
radius |
float
|
Radius used to chunk the colorbar. Increase this value if multiple names overlap. |
0.05
|
figsize |
Tuple[float]
|
Pair |
(2, 6)
|
show |
bool
|
Whether or not to display the figure. |
True
|
Source code in scyan/plot/expressions.py
scyan.plot.pops_expressions(model, latent=True, key='scyan_pop', n_cells=200000, vmax=1.2, vmin=-1.2, cmap=None, figsize=(10, 6), show=True)
Heatmap that shows (latent or standardized) cell expressions for all populations.
Note
If using the latent space, it will only show the marker you provided to Scyan. Else, it shows every marker of the panel.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
Scyan
|
Scyan model. |
required |
latent |
bool
|
If |
True
|
key |
str
|
Key to look for populations in |
'scyan_pop'
|
n_cells |
Optional[int]
|
Number of cells to be considered for the heatmap (to accelerate it when \(N\) is very high). If |
200000
|
vmax |
float
|
Maximum value on the heatmap. |
1.2
|
vmax |
float
|
Minimum value on the heatmap. |
1.2
|
cmap |
Optional[str]
|
Colormap name. By default, uses |
None
|
figsize |
Tuple[float]
|
Pair |
(10, 6)
|
show |
bool
|
Whether or not to display the figure. |
True
|
Source code in scyan/plot/expressions.py
scyan.plot.kde(adata, population, markers=None, key='scyan_pop', n_markers=3, n_cells=100000, ncols=2, var_name='Marker', value_name='Expression', show=True)
Plot Kernel-Density-Estimation for each provided population and for multiple markers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adata |
AnnData
|
An |
required |
population |
Union[str, List[str], None]
|
One population, or a list of population to be analyzed, or |
required |
markers |
Optional[List[str]]
|
List of markers to plot. If |
None
|
key |
str
|
Key to look for populations in |
'scyan_pop'
|
n_markers |
Optional[int]
|
Number of markers to choose automatically if |
3
|
n_cells |
Optional[int]
|
Number of cells to be considered for the heatmap (to accelerate it when \(N\) is very high). If |
100000
|
ncols |
int
|
Number of figures per row. |
2
|
var_name |
str
|
Name displayed on the graphs. |
'Marker'
|
value_name |
str
|
Name displayed on the graphs. |
'Expression'
|
show |
bool
|
Whether or not to display the figure. |
True
|
Source code in scyan/plot/density.py
scyan.plot.log_prob_threshold(adata, show=True)
Plot the number of cells annotated depending on the log probability threshold (below which cells are left non-classified). It can be helpful to determine the best threshold value, i.e. before a significative decrease in term of number of cells annotated.
Note
To use this function, you first need to fit a scyan.Scyan
model and use the model.predict()
method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adata |
AnnData
|
The |
required |
show |
bool
|
Whether or not to display the figure. |
True
|
Source code in scyan/plot/density.py
scyan.plot.pop_level(model, group_name, level_name='level', key='scyan_pop', **scanpy_kwargs)
Plot all subpopulations of a group at a certain level on a UMAP (according to the populations levels provided in the knowledge table).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
Scyan
|
Scyan model. |
required |
group_name |
str
|
The group to look at among the populations of the selected level. |
required |
level_name |
str
|
Name of the column of the knowledge table containing the names of the grouped populations. |
'level'
|
key |
str
|
Key of |
'scyan_pop'
|
Source code in scyan/plot/dot.py
scyan.plot.pops_hierarchy(model, figsize=(18, 5), show=True)
Plot populations as a tree, where each level corresponds to more detailed populations. To run this function, your knowledge table need to contain at least one population 'level' (see this tutorial), and you need to install graphviz
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
Scyan
|
Scyan model. |
required |
figsize |
tuple
|
Matplotlib figure size. |
(18, 5)
|
show |
bool
|
Whether or not to display the figure. |
True
|