cellrank.tl.estimators.GPCCA

class cellrank.tl.estimators.GPCCA(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]

Generalized Perron Cluster Cluster Analysis [GPCCA18].

Coarse-grains a discrete Markov chain into a set of macrostates and computes coarse-grained transition probabilities among the macrostates. Each macrostate corresponds to an area of the state space, i.e. to a subset of cells. The assignment is soft, i.e. each cell is assigned to every macrostate with a certain weight, where weights sum to one per cell. Macrostates are computed by maximizing the ‘crispness’ which can be thought of as a measure for minimal overlap between macrostates in a certain inner-product sense. Once the macrostates have been computed, we project the large transition matrix onto a coarse-grained transition matrix among the macrostates via a Galerkin projection. This projection is based on invariant subspaces of the original transition matrix which are obtained using the real Schur decomposition [GPCCA18].

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.

coarse_T

Coarse-grained transition matrix.

coarse_initial_distribution

Coarse initial distribution.

coarse_stationary_distribution

Coarse stationary distribution.

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.

macrostates

Macrostates.

macrostates_memberships

Macrostates memberships.

recurrent_classes

Recurrent classes of the Markov chain.

schur

Schur vectors.

schur_matrix

Schur matrix.

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_gdpt([n_components, key_added])

Compute generalized Diffusion pseudotime from [Haghverdi16] using the real Schur decomposition.

compute_lineage_drivers([lineages, …])

Compute driver genes per lineage.

compute_macrostates([n_states, n_cells, …])

Compute the macrostates.

compute_partition()

Compute communication classes for the Markov chain.

compute_schur([n_components, …])

Compute the Schur decomposition.

compute_terminal_states([method, n_cells, …])

Automatically select terminal states from macrostates.

copy()

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

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

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

plot_absorption_probabilities(data, prop[, …])

Plot discrete states or probabilities in an embedding.

plot_coarse_T([show_stationary_dist, …])

Plot the coarse-grained transition matrix between macrostates.

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_macrostates(data, prop[, discrete, …])

Plot discrete states or probabilities in an embedding.

plot_schur(vectors, prop[, use, abs_value, …])

Plot vectors in an embedding.

plot_schur_matrix([title, cmap, figsize, …])

Plot the Schur matrix.

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.

set_terminal_states_from_macrostates([…])

Manually select terminal states from macrostates.

write(fname[, ext])

Serialize self to a file.