cellrank.tl.estimators.CFLARE

class cellrank.tl.estimators.CFLARE(obj, inplace=True, read_from_adata=False, obsp_key=None, g2m_key='G2M_score', s_key='S_score', write_to_adata=True, key=None)[source]

Clustering and Filtering of Left and Right Eigenvectors based on Markov chains.

This is one of the two main classes of CellRank. We model cellular development as a Markov chain (MC), where each measured cell is represented by a state in the MC. We assume that transition probabilities between these states have already been computed using either the cellrank.tl.kernels.Kernel class directly or the cellrank.tl.transition_matrix() high level function.

The MC is time-homogeneous, i.e. the transition probabilities don’t change over time. Further, it’s discrete, as every state in the MC is given by a measured cell state. The state space is finite, as is the number of measured cells and we consider discrete time-increments.

Parameters
  • obj (Union[KernelExpression, ~AnnData, spmatrix, ndarray]) – Either a cellrank.tl.Kernel object, an anndata.AnnData object which stores the transition matrix in .obsp attribute or numpy or scipy array.

  • inplace (bool) – Whether to modify adata object inplace or make a copy.

  • read_from_adata (bool) – Whether to read available attributes in adata, if present.

  • obsp_key (Optional[str]) – Key in obj.obsp when obj is an anndata.AnnData object.

  • g2m_key (Optional[str]) – Key in adata .obs. Can be used to detect cell-cycle driven start- or endpoints.

  • s_key (Optional[str]) – Key in adata .obs. Can be used to detect cell-cycle driven start- or endpoints.

  • write_to_adata (bool) – Whether to write the transition matrix to adata .obsp and the parameters to adata .uns.

  • key (Optional[str]) – Key used when writing transition matrix to adata. If None, the key is set to ‘T_bwd’ if backward is True, else ‘T_fwd’. Only used when write_to_adata=True.

Attributes

absorption_probabilities

Absorption probabilities.

adata

Annotated data object.

diff_potential

Differentiation potential.

eigendecomposition

Eigendecomposition.

is_irreducible

Whether the Markov chain is irreducible or not.

issparse

Whether the transition matrix is sparse or not.

kernel

Underlying kernel.

lineage_absorption_times

Lineage absorption times.

lineage_drivers

Lineage drivers.

recurrent_classes

Recurrent classes of the Markov chain.

terminal_states

Terminal states.

terminal_states_probabilities

Terminal states probabilities.

transient_classes

Transient classes of the Markov chain.

transition_matrix

Transition matrix.

Methods

compute_absorption_probabilities([keys, …])

Compute absorption probabilities of a Markov chain.

compute_eigendecomposition([k, which, …])

Compute eigendecomposition of transition matrix.

compute_lineage_drivers([lineages, …])

Compute driver genes per lineage.

compute_partition()

Compute communication classes for the Markov chain.

compute_terminal_states([use, percentile, …])

Find approximate recurrent classes of the Markov chain.

copy()

Return a copy of self, including the underlying adata object.

fit(n_lineages[, keys, cluster_key, …])

Run the pipeline, computing the initial or terminal states and optionally the absorption probabilities.

plot_absorption_probabilities(data, prop[, …])

Plot discrete states or probabilities in an embedding.

plot_eigendecomposition([left])

Plot eigenvectors in an embedding.

plot_lineage_drivers(lineage[, n_genes, use_raw])

Plot lineage drivers discovered by compute_lineage_drivers().

plot_spectrum([n, real_only, show_eigengap, …])

Plot the top eigenvalues in real or complex plane.

plot_terminal_states(data, prop[, discrete, …])

Plot discrete states or probabilities in an embedding.

read(fname)

Deserialize self from a file.

rename_terminal_states(new_names[, update_adata])

Rename the names of terminal_states.

set_terminal_states(labels[, cluster_key, …])

Set the approximate recurrent classes, if they are known a priori.

write(fname[, ext])

Serialize self to a file.