cellrank.pl.circular_projection¶
-
cellrank.pl.
circular_projection
(adata, keys, backward=False, lineages=None, lineage_order=None, metric='correlation', normalize_by_mean=True, ncols=4, space=0.25, use_raw=False, text_kwargs=mappingproxy({}), labeldistance=1.25, labelrot='best', show_edges=True, key_added=None, figsize=None, dpi=None, save=None, **kwargs)[source]¶ Plot absorption probabilities on a circular embedding as done in [Velten17].
- Parameters
adata¶ (
anndata.AnnData
) – Annotated data object.keys¶ (
Union
[str
,Sequence
[str
]]) –Keys in
anndata.AnnData.obs
oranndata.AnnData.var_names
. Extra available keys:’priming_degree’: the entropy relative to the “average” cell, as described in [Velten17]. It follows the formula \(\sum_{j} p_{i, j} \log \frac{p_{ij}}{\overline{p_j}}\) where \(i\) corresponds to a cell, \(j\) corresponds to a lineage and \(\overline{p_j}\) is the average probability for lineage \(j\).
’priming_direction’: defined as \(d_i = argmax_j \frac{p_{ij}}{\overline{p_j}}\) in [Velten17] where \(i\), \(j\) and \(\overline{p_j}\) are defined as above.
lineages¶ (
Union
[str
,Sequence
[str
],None
]) – Lineages to plot. If None, plot all lineages.lineage_order¶ (
Optional
[str
]) –Can be one of the following:
None: it will determined automatically, based on the number of lineages.
’optimal’: order the lineages optimally by solving the Travelling salesman problem (TSP). Recommended for <= 20 lineages.
’default’: use the order as specified in
lineages
.
metric¶ (
Union
[str
,Callable
,ndarray
,DataFrame
]) – Metric to use when constructing pairwise distance matrix whenlineage_order = 'optimal'
. For available options, seesklearn.metrics.pairwise_distances()
.normalize_by_mean¶ (
bool
) – If True, normalize each lineage by its mean probability, as done in [Velten17].ncols¶ (
int
) – Number of columns when plotting multiplekeys
.space¶ (
float
) – Horizontal and vertical space between formatplotlib.pyplot.subplots_adjust()
.use_raw¶ (
bool
) – Whether to accessanndata.AnnData.raw
when there arekeys
inanndata.AnnData.var_names
.text_kwargs¶ (
Mapping
[str
,Any
]) – Keyword arguments formatplotlib.pyplot.text()
.labeldistance¶ (
float
) – Distance at which the lineage labels will be drawn.labelrot¶ (
Union
[str
,float
]) –How to rotate the labels. Valid options are:
’best’: rotate labels so that they are easily readable.
’default’: use
matplotlib
’s default.None: same as ‘default’.
If a
float
, all labels will be rotated by this many degrees.show_edges¶ (
bool
) – Whether to show the edges surrounding the simplex.key_added¶ (
Optional
[str
]) – Key inanndata.AnnData.obsm
where to add the circular embedding. If None, it will be set to ‘X_fate_simplex_{fwd,bwd}’, based onbackward
.figsize¶ (
Optional
[Tuple
[float
,float
]]) – Size of the figure.save¶ (
Union
[Path
,str
,None
]) – Filename where to save the plot.kwargs¶ – Keyword arguments for
scvelo.pl.scatter()
.
- Returns
Nothing, just plots the figure. Optionally saves it based on
save
. Also updatesadata
with the following fields:anndata.AnnData.obsm
[{key_added}]
: the circular projection.anndata.AnnData.obs
['priming_degree_{fwd,bwd}']
: the priming degree, if inkeys
.anndata.AnnData.obs
['priming_direction_{fwd,bwd}']
: the priming direction, if inkeys
.
- Return type