cellrank.estimators.CFLARE#
- class cellrank.estimators.CFLARE(*args, **kwargs)[source]#
Clustering and filtering of left and right eigenvectors (CFLARE).
This estimator computes initial and terminal states, as well as fate probabilities. It uses the left eigenvectors of the transition matrix to filter to a set of (approximately) recurrent cells and the right eigenvectors to cluster this set of cells into discrete groups. CFLARE exists mostly for legacy reasons, we recommend using the
cellrank.estimators.GPCCAestimator, which is mathematically more principled.- Parameters:
- object
Can be one of the following types:
AnnData- annotated data object.KernelExpression- kernel expression.str- key inobspwhere the transition matrix is stored andadatamust be provided in this case.bool- directionality of the transition matrix that will be used to infer its storage location. IfNone, the directionality will be determined automatically andadatamust be provided in this case.
- kwargs
Any Keyword arguments for the
PrecomputedKernel.- args Any
Attributes table#
Mean and variance of the time until absorption. |
|
Annotated data object. |
|
Direction of the |
|
Eigendecomposition of the |
|
Fate probabilities. |
|
Categorical annotation of initial states. |
|
Probability to be an initial state. |
|
Underlying kernel expression. |
|
Potential lineage drivers. |
|
Estimator parameters. |
|
Priming degree. |
|
Shape of the kernel. |
|
Categorical annotation of terminal states. |
|
Probability to be a terminal state. |
|
Transition matrix of the |
Methods table#
|
Compute the mean time to absorption and optionally its variance. |
|
Compute eigendecomposition of the |
|
Compute fate probabilities. |
|
Compute driver genes per lineage. |
|
Compute the degree of lineage priming. |
|
Return a copy of self. |
|
Prepare self for terminal states prediction. |
|
De-serialize self from |
|
Plot fate probabilities. |
|
Plot lineage drivers. |
|
Show scatter plot of gene-correlations between two lineages. |
|
Plot macrostates on an embedding or along pseudotime. |
|
Plot the top eigenvalues in a real or a complex plane. |
|
Find approximate recurrent classes of the Markov chain. |
|
De-serialize self from a file. |
|
Rename the |
|
Rename the |
|
Set the |
|
Set the |
|
Serialize self to |
|
Serialize self to a file using |
Attributes#
absorption_times#
- CFLARE.absorption_times#
Mean and variance of the time until absorption.
Related to conditional mean first passage times. Corresponds to the expectation of the time until absorption, depending on initialization, and the variance.
adata#
- CFLARE.adata#
Annotated data object.
backward#
eigendecomposition#
- CFLARE.eigendecomposition#
Eigendecomposition of the
transition_matrix.For non-symmetric real matrices, left and right eigenvectors will in general be different and complex. We compute both left and right eigenvectors.
- Returns:
A dictionary with the following keys:
'D'- the eigenvalues.'eigengap'- the eigengap.'params'- parameters used for the computation.'V_l'- left eigenvectors (optional).'V_r'- right eigenvectors (optional).'stationary_dist'- stationary distribution of thetransition_matrix, if present.
fate_probabilities#
- CFLARE.fate_probabilities#
Fate probabilities.
Informally, given a (finite, discrete) Markov chain with a set of transient states \(T\) and a set of absorbing states \(A\), the absorption probability for cell \(i\) from \(T\) to reach cell \(j\) from \(R\) is the probability that a random walk initialized in \(i\) will reach absorbing state \(j\).
In our context, states correspond to cells, in particular, absorbing states correspond to cells in
terminal_states.
initial_states#
- CFLARE.initial_states#
Categorical annotation of initial states.
By default, all transient cells will be labeled as
NaN.
initial_states_probabilities#
- CFLARE.initial_states_probabilities#
Probability to be an initial state.
kernel#
- CFLARE.kernel#
Underlying kernel expression.
lineage_drivers#
- CFLARE.lineage_drivers#
Potential lineage drivers.
Computes Pearson correlation of each gene with fate probabilities for every terminal state. High Pearson correlation indicates potential lineage drivers. Also computes p-values and confidence intervals.
- Returns:
Dataframe of shape
(n_genes, n_lineages * 5)containing the following columns, one for each lineage:
params#
- CFLARE.params#
Estimator parameters.
priming_degree#
- CFLARE.priming_degree#
Priming degree.
Given a cell \(i\) and a set of terminal states, this quantifies how committed vs. naive cell \(i\) is, i.e. its degree of pluripotency. Low values correspond to naive cells (high degree of pluripotency), high values correspond to committed cells (low degree of pluripotency).
shape#
- CFLARE.shape#
Shape of the kernel.
terminal_states#
- CFLARE.terminal_states#
Categorical annotation of terminal states.
By default, all transient cells will be labeled as
NaN.
terminal_states_probabilities#
- CFLARE.terminal_states_probabilities#
Probability to be a terminal state.
transition_matrix#
Methods#
compute_absorption_times#
- CFLARE.compute_absorption_times(keys=None, calculate_variance=False, solver='gmres', use_petsc=True, n_jobs=None, backend='loky', show_progress_bar=None, tol=1e-06, preconditioner=None)#
Compute the mean time to absorption and optionally its variance.
- Parameters:
- keys
Sequence[str] |None Terminal states for which to compute the fate probabilities. If
None, use all states defined interminal_states.- calculate_variance
bool Whether to calculate the variance.
- solver
Union[str,Literal['direct','gmres','lgmres','bicgstab','gcrotmk']] Solver to use for the linear problem. Options are
'direct','gmres','lgmres','bicgstab'or'gcrotmk'whenuse_petsc = False.Information on the
scipyiterative solvers can be found inscipy.sparse.linalgor for thepetscsolvers here.- use_petsc
bool Whether to use solvers from
petsc4pyorscipy. Recommended for large problems. If no installation is found, defaults togmres().- n_jobs
int|None Number of parallel jobs to use when using an iterative solver.
- backend
Literal['loky','multiprocessing','threading'] Which backend to use for multiprocessing. See
Parallelfor valid options.- show_progress_bar
bool|None Whether to show progress bar. Only used when
solver != 'direct'.- tol
float Convergence tolerance for the iterative solver. The default is fine for most cases, only consider decreasing this for severely ill-conditioned matrices.
- preconditioner
str|None Preconditioner to use, only available when
use_petsc = True. For valid options, see here. We recommend the'ilu'preconditioner for badly conditioned problems.- check_sum_tol
Tolerance for checking whether fate probabilities sum to 1. Fate probabilities are computed by solving a linear system; this tolerance is used to verify the solution is valid. Increase the argument value if the solver converges but the check fails due to numerical precision.
- self FateProbsProtocol
- keys
- Return type:
- Returns:
Nothing, just updates the following fields:
absorption_times- Mean and variance of the time until absorption.
compute_eigendecomposition#
- CFLARE.compute_eigendecomposition(k=20, which='LR', alpha=1.0, only_evals=False, ncv=None)#
Compute eigendecomposition of the
transition_matrix.Uses a sparse implementation, if possible, and only computes the top \(k\) eigenvectors to speed up the computation. Computes both left and right eigenvectors.
- Parameters:
- k
int Number of eigenvectors or eigenvalues to compute.
- which
Literal['LR','LM'] How to sort the eigenvalues. Valid option are:
'LR'- the largest real part.'LM'- the largest magnitude.
- alpha
float Used to compute the eigengap.
alphais the weight given to the deviation of an eigenvalue from one.- only_evals
bool Whether to compute only eigenvalues.
- ncv
int|None Number of Lanczos vectors generated.
- self EigenProtocol
- k
- Return type:
EigenMixin- Returns:
Self and updates the following fields:
eigendecomposition- Eigendecomposition of thetransition_matrix.
compute_fate_probabilities#
- CFLARE.compute_fate_probabilities(keys=None, solver='gmres', use_petsc=True, n_jobs=None, backend='loky', show_progress_bar=True, tol=1e-06, preconditioner=None, check_sum_tol=0.001)#
Compute fate probabilities.
For each cell, this computes the probability of being absorbed in any of the
terminal_states. In particular, this corresponds to the probability that a random walk initialized in transient cell \(i\) will reach any cell from a fixed transient state before reaching a cell from any other transient state.- Parameters:
- keys
Sequence[str] |None Terminal states for which to compute the fate probabilities. If
None, use all states defined interminal_states.- solver
Union[str,Literal['direct','gmres','lgmres','bicgstab','gcrotmk']] Solver to use for the linear problem. Options are
'direct','gmres','lgmres','bicgstab'or'gcrotmk'whenuse_petsc = False.Information on the
scipyiterative solvers can be found inscipy.sparse.linalgor for thepetscsolvers here.- use_petsc
bool Whether to use solvers from
petsc4pyorscipy. Recommended for large problems. If no installation is found, defaults togmres().- n_jobs
int|None Number of parallel jobs to use when using an iterative solver.
- backend
Literal['loky','multiprocessing','threading'] Which backend to use for multiprocessing. See
Parallelfor valid options.- show_progress_bar
bool Whether to show progress bar. Only used when
solver != 'direct'.- tol
float Convergence tolerance for the iterative solver. The default is fine for most cases, only consider decreasing this for severely ill-conditioned matrices.
- preconditioner
str|None Preconditioner to use, only available when
use_petsc = True. For valid options, see here. We recommend the'ilu'preconditioner for badly conditioned problems.- check_sum_tol
float Tolerance for checking whether fate probabilities sum to 1. Fate probabilities are computed by solving a linear system; this tolerance is used to verify the solution is valid. Increase the argument value if the solver converges but the check fails due to numerical precision.
- self FateProbsProtocol
- keys
- Return type:
- Returns:
Nothing, just updates the following fields:
fate_probabilities- Fate probabilities.
compute_lineage_drivers#
- CFLARE.compute_lineage_drivers(lineages=None, method='fisher', cluster_key=None, clusters=None, layer=None, use_raw=False, confidence_level=0.95, n_perms=1000, seed=None, nan_policy='propagate', **kwargs)#
Compute driver genes per lineage.
Correlates gene expression with lineage probabilities, for a given lineage and set of clusters. Often, it makes sense to restrict this to a set of clusters which are relevant for the specified lineages.
- Parameters:
- lineages
str|Sequence|None Lineage names from
fate_probabilities. IfNone, use all lineages.- method
Literal['fisher','perm_test'] Mode to use when calculating p-values and confidence intervals. Valid options are:
'fisher'- Fisher transformation [Fisher, 1921].'perm_test'- permutation test.
- cluster_key
str|None Key in
obsto obtain cluster annotations. These are considered forclusters.- clusters
str|Sequence|None Restrict the correlations to these clusters.
- layer
str|None Key from
layersfrom which to get the expression. IfNoneor'X', useX.- use_raw
bool Whether to use
rawto correlate gene expression.- confidence_level
float Confidence level for the confidence interval calculation. Must be in interval \([0, 1]\).
- n_perms
int Number of permutations to use when
method = 'perm_test'.- seed
int|None Random seed when
method = 'perm_test'.- nan_policy
Literal['propagate','omit'] How to handle missing values (
nan) in the expression data. Valid options are:'propagate'- missing values propagate to the result.'omit'- correlate each gene and lineage only over the cells where both are non-missing, akin toscipy.stats.pearsonr(). Only supported for dense expression data andmethod = 'fisher'.
- show_progress_bar
Whether to show a progress bar. Disabling it may slightly improve performance.
- n_jobs
Number of parallel jobs. If -1, use all available cores. If
Noneor 1, the execution is sequential.- backend
Which backend to use for parallelization. See
Parallelfor valid options.- kwargs
Any Keyword for the correlation test.
- self LinDriversProtocol
- lineages
- Return type:
- Returns:
Dataframe of shape
(n_genes, n_lineages * 5)containing the following columns, one for each lineage: Also updates the following field:lineage_drivers- the samepandas.DataFrameas described above.
compute_lineage_priming#
- CFLARE.compute_lineage_priming(method='kl_divergence', early_cells=None)#
Compute the degree of lineage priming.
It returns a score in \([0, 1]\) where \(0\) stands for naive and \(1\) stands for committed.
- Parameters:
- method
Literal['kl_divergence','entropy'] The method used to compute the degree of lineage priming. Valid options are:
'kl_divergence'- as in [Velten et al., 2017], computes KL-divergence between the fate probabilities of a cell and the average fate probabilities. Computation of average fate probabilities can be restricted to a set of user-definedearly_cells.'entropy'- as in [Setty et al., 2019], computes entropy over a cell’s fate probabilities.
- early_cells
Mapping[str,Sequence[str]] |Sequence[str] |None Cell IDs or a mask marking early cells. If
None, use all cells. Only used whenmethod = 'kl_divergence'. If adict, the key specifies a cluster key inobsand the values specify cluster labels containing early cells.- self FateProbsProtocol
- method
- Return type:
- Returns:
Returns the priming degree and updates the following fields:
priming_degree- Priming degree.
copy#
- CFLARE.copy(*, deep=False)#
Return a copy of self.
- Parameters:
- Return type:
- Returns:
A copy of self.
fit#
- CFLARE.fit(k=20, **kwargs)[source]#
Prepare self for terminal states prediction.
Deprecated since version 2.1: Will be removed in CellRank 3.0. Use
compute_eigendecomposition()directly.- Parameters:
- k
int Number of eigenvectors to compute.
- kwargs
Any Keyword arguments for
compute_eigendecomposition().
- k
- Return type:
- Returns:
Returns self and updates the following fields:
eigendecomposition- Eigendecomposition of thetransition_matrix.
from_adata#
plot_fate_probabilities#
- CFLARE.plot_fate_probabilities(states=None, color=None, mode='embedding', time_key=None, basis='umap', same_plot=True, title=None, cmap='viridis', **kwargs)#
Plot fate probabilities.
- Parameters:
- states
str|Sequence[str] |None Subset of the macrostates to show. If
None, plot all macrostates.- color
str|None Key in
obsoranndata.AnnData.varused to color the observations.- mode
Literal['embedding','time'] Whether to plot the probabilities in an embedding or along the pseudotime.
- time_key
str|None Key in
obswhere pseudotime is stored. Only used whenmode = 'time'.- basis
str Key in
obsmfor the embedding to use, e.g.'umap'or'tsne'.- title
str|Sequence[str] |None Title of the plot.
- same_plot
bool Whether to plot the data on the same plot or not. Only use when
mode = 'embedding'. IfTrueanddiscrete = False,coloris ignored.- cmap
str Colormap for continuous annotations.
- kwargs
Any Keyword arguments for
embedding().- self FateProbsProtocol
- states
- Return type:
- Returns:
Nothing, just plots the figure. Optionally saves it based on
save.
plot_lineage_drivers#
- CFLARE.plot_lineage_drivers(lineage, n_genes=8, use_raw=False, ascending=False, ncols=None, title_fmt='{gene} qval={qval:.4e}', figsize=None, dpi=None, save=None, **kwargs)#
Plot lineage drivers.
- Parameters:
- lineage
str Lineage for which to plot the driver genes.
- n_genes
int Top most correlated genes to plot.
- use_raw
bool Whether to access data in
rawor not.- ascending
bool Whether to sort the genes in ascending order.
- ncols
int|None Number of columns.
- title_fmt
str Title format. Can include
{gene},{pval},{qval}or{corr}, which will be substituted with the actual values.- figsize
tuple[float,float] |None Size of the figure.
- dpi
int|None Dots per inch.
- save
str|Path|None Filename where to save the plot.
- kwargs
Any Keyword arguments for
embedding().- self LinDriversProtocol
- lineage
- Return type:
- Returns:
Nothing, just plots the figure. Optionally saves it based on
save.
plot_lineage_drivers_correlation#
- CFLARE.plot_lineage_drivers_correlation(lineage_x, lineage_y, color=None, gene_sets=None, gene_sets_colors=None, use_raw=False, cmap='RdYlBu_r', fontsize=12, adjust_text=False, legend_loc='best', figsize=(4, 4), dpi=None, save=None, show=True, **kwargs)#
Show scatter plot of gene-correlations between two lineages.
Optionally, a
dictof gene names can be passed to highlight in the plot.- Parameters:
- lineage_x
str Name of the lineage on the x-axis.
- lineage_y
str Name of the lineage on the y-axis.
- color
str|None - gene_sets
dict[str,Sequence[str]] |None Gene sets annotations of the form
{'gene_set_name': ['gene_1', 'gene_2'], ...}.- gene_sets_colors
Sequence[str] |None List of colors where each entry corresponds to a gene set from
genes_sets. IfNoneand keys ingene_setscorrespond to lineage names, use the lineage colors. Otherwise, use default colors.- use_raw
bool Whether to access
rawor not.- cmap
str Colormap to use.
- fontsize
int Size of the text when plotting
gene_sets.- adjust_text
bool Whether to automatically adjust text in order to reduce overlap.
- legend_loc
str|None Position of the legend. If
None, don’t show the legend. Only used whengene_sets != None.- figsize
tuple[float,float] |None Size of the figure.
- dpi
int|None Dots per inch.
- save
str|Path|None Filename where to save the plot.
- show
bool - kwargs
Any Keyword arguments for
scatter().- self LinDriversProtocol
- lineage_x
- Return type:
- Returns:
If
show = True, nothing, just plots, otherwise returns the axes object. Optionally saves it based onsave.
Notes
This plot is based on the following notebook by Maren Büttner.
plot_macrostates#
- CFLARE.plot_macrostates(which, states=None, color=None, discrete=True, mode='embedding', time_key='latent_time', basis='umap', same_plot=True, title=None, cmap='viridis', **kwargs)#
Plot macrostates on an embedding or along pseudotime.
- Parameters:
- which
Literal['all','initial','terminal','initial_and_terminal'] Which macrostates to plot. Valid options are:
'all'- plot all macrostates.'initial'- plot macrostates marked asinitial_states.'terminal'- plot macrostates marked asterminal_states.'initial_and_terminal'- plot bothinitial_statesandterminal_statesin one plot. States are renamed to'initial: <name>'and'terminal: <name>'to tell them apart.
- states
str|Sequence[str] |None Subset of the macrostates to show. If
None, plot all macrostates.- color
str|None - discrete
bool Whether to plot the data as continuous or discrete observations. If the data cannot be plotted as continuous observations, it will be plotted as discrete.
- mode
Literal['embedding','time'] Whether to plot the probabilities in an embedding or along the pseudotime.
- time_key
str Key in
obswhere pseudotime is stored. Only used whenmode = 'time'.- basis
str Key in
obsmfor the embedding to use, e.g.'umap'or'tsne'.- title
str|Sequence[str] |None Title of the plot.
- same_plot
bool Whether to plot the data on the same plot or not. Only use when
mode = 'embedding'. IfTrueanddiscrete = False,coloris ignored.- cmap
str Colormap for continuous annotations.
- kwargs
Any Keyword arguments for
embedding().
- which
- Return type:
- Returns:
Nothing, just plots the figure. Optionally saves it based on
save.
plot_spectrum#
- CFLARE.plot_spectrum(n=None, real_only=None, show_eigengap=True, show_all_xticks=True, legend_loc=None, title=None, marker='.', figsize=(5, 5), dpi=100, save=None, **kwargs)#
Plot the top eigenvalues in a real or a complex plane.
- Parameters:
- n
int|None Number of eigenvalues to show. If
None, show all that have been computed.- real_only
bool|None Whether to plot only the real part of the spectrum. If
None, plot real spectrum if no complex eigenvalues are present.- show_eigengap
bool When
real_only = True, this determines whether to show the inferred eigengap as a dotted line.- show_all_xticks
bool When
real_only = True, this determines whether to show the indices of all eigenvalues on the x-axis.- legend_loc
str|None Location parameter for the legend.
- title
str|None Title of the figure.
- marker
str Marker symbol used, valid options can be found in
markers.- figsize
tuple[float,float] |None Size of the figure.
- dpi
int Dots per inch.
- save
str|Path|None Filename where to save the plot.
- kwargs
Any Keyword arguments for
scatter().
- n
- Return type:
- Returns:
Nothing, just plots the figure. Optionally saves it based on
save.
predict#
- CFLARE.predict(use=None, percentile=98, method='leiden', cluster_key=None, n_clusters_kmeans=None, n_neighbors=20, resolution=0.1, n_matches_min=0, n_neighbors_filtering=15, basis=None, n_comps=5, scale=None)[source]#
Find approximate recurrent classes of the Markov chain.
Deprecated since version 2.1: Will be removed in CellRank 3.0. The entire
CFLAREestimator is deprecated. Usecellrank.estimators.GPCCAinstead.Filter to obtain recurrent states from left eigenvectors. Cluster to obtain approximate recurrent classes from right eigenvectors.
- Parameters:
- use
int|Sequence[int] |None Which or how many first eigenvectors to use as features for filtering and clustering. If
None, use the eigengap statistic.- percentile
int|None Threshold used for filtering out cells which are most likely transient states. Cells which are in the lower
percentilepercent of each eigenvector will be removed from the data matrix.- method
Literal['leiden','kmeans'] Method to be used for clustering. Valid option are:
- cluster_key
str|None Key in
obsin order to associate names and colors withterminal_states.- n_clusters_kmeans
int|None Number of clusters when
method = 'kmeans'. IfNone, this is set touse + 1.- n_neighbors
int Number of neighbors in a kNN graph. This is the \(K\) parameter for that, the number of neighbors for each cell. Only used when
method = 'leiden'.- resolution
float Resolution parameter for
leiden(). Should be chosen relatively small.- n_matches_min
int Filters out cells which don’t have at least
n_matches_minneighbors from the same category. This filters out some cells which are transient but have been misassigned.- n_neighbors_filtering
int Parameter for filtering cells. Cells are filtered out if they don’t have at least
n_matches_minneighbors among then_neighbors_filteringnearest cells.- basis
str|None Key from
obsmas additional features for clustering. IfNone, use only the right eigenvectors.- n_comps
int Number of embedding components to be used when
basis != None.- scale
bool|None Scale the values to z-scores. If
None, scale the values ifbasis != None.
- use
- Return type:
- Returns:
Returns self and just updates the following fields:
terminal_states- Categorical annotation of terminal states.terminal_states_probabilities- Probability to be a terminal state.
read#
- static CFLARE.read(fname, adata=None, copy=False)#
De-serialize self from a file.
- Parameters:
- Return type:
IOMixin- Returns:
The de-serialized object.
rename_initial_states#
- CFLARE.rename_initial_states(old_new)#
Rename the
initial_states.- Parameters:
- Return type:
- Returns:
Returns self and updates the following fields:
initial_states- Categorical annotation of initial states.
rename_terminal_states#
- CFLARE.rename_terminal_states(old_new)#
Rename the
terminal_states.- Parameters:
- Return type:
- Returns:
Returns self and updates the following fields:
terminal_states- Categorical annotation of terminal states.
set_initial_states#
- CFLARE.set_initial_states(states, cluster_key=None, weight_key=None, allow_overlap=False, **kwargs)#
Set the
initial_states.- Parameters:
- states
Series|dict[str,Sequence[Any]] Which states to select. Valid options are:
categorical
Serieswhere each category corresponds to an individual state.NaNentries denote cells that do not belong to any state, i.e., transient cells.dictwhere keys are states and values are lists of cell barcodes corresponding to annotations inobs_names. If only 1 key is provided, values should correspond to clusters if a categoricalSeriescan be found inobs.
- cluster_key
str|Mapping[str,str] |None Reference annotations to associate names and colors with
initial_states. Either a categoricalobscolumn (astror{"obs": <column>}) or{"obsm": <key>}pointing to a proportionDataFrame; seecompute_macrostates().- weight_key
str|None Per-observation weights, only used when
cluster_keypoints toobsm; seecompute_macrostates().- allow_overlap
bool Whether to allow overlapping names between initial and terminal states.
- kwargs
Any Additional keyword arguments.
- states
- Return type:
- Returns:
Returns self and updates the following fields:
initial_states- Categorical annotation of initial states.initial_states_probabilities- Probability to be an initial state.
set_terminal_states#
- CFLARE.set_terminal_states(states, cluster_key=None, weight_key=None, allow_overlap=False, **kwargs)#
Set the
terminal_states.- Parameters:
- states
Series|dict[str,Sequence[Any]] States to select. Valid options are:
categorical
Serieswhere each category corresponds to an individual state.NaNentries denote cells that do not belong to any state, i.e., transient cells.dictwhere keys are states and values are lists of cell barcodes corresponding to annotations inobs_names. If only 1 key is provided, values should correspond to clusters if a categoricalSeriescan be found inobs.
- cluster_key
str|Mapping[str,str] |None Reference annotations to associate names and colors with
terminal_states. Either a categoricalobscolumn (astror{"obs": <column>}) or{"obsm": <key>}pointing to a proportionDataFrame; seecompute_macrostates().- weight_key
str|None Per-observation weights, only used when
cluster_keypoints toobsm; seecompute_macrostates().- allow_overlap
bool Whether to allow overlapping names between initial and terminal states.
- kwargs
Any Additional keyword arguments.
- states
- Return type:
- Returns:
Returns self and updates the following fields:
terminal_states- Categorical annotation of terminal states.terminal_states_probabilities- Probability to be a terminal state.
to_adata#
- CFLARE.to_adata(keep=('X', 'raw'), *, copy=True)#
Serialize self to
Anndata.- Parameters:
- keep
Union[Literal['all'],Sequence[Literal['X','raw','layers','obs','var','obsm','varm','obsp','varp','uns']]] Which attributes to keep from the underlying
adata. Valid options are:'all'- keep all attributes specified in the signature.Sequence- keep only subset of these attributes.dict- the keys correspond the attribute names and values to a subset of keys which to keep from this attribute. If the values are specified either asTrueor'all', everything from this attribute will be kept.
- copy
bool|Sequence[Literal['X','raw','layers','obs','var','obsm','varm','obsp','varp','uns']] Whether to copy the data. Can be specified on per-attribute basis. Useful for attributes that are array-like.
- keep
- Return type:
- Returns:
Annotated data object.