You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Perform PARAFAC2 tensor decomposition on single-cell RNA-seq data.
14
+
15
+
This is the main function for running RISE analysis. It decomposes the
16
+
multi-condition single-cell data into condition factors, eigen-state factors,
17
+
and gene factors, revealing patterns across experimental conditions.
18
+
19
+
:param X: Preprocessed AnnData object containing single-cell RNA-seq data. Must have X.obs["condition_unique_idxs"] indicating which condition each cell belongs to (0-indexed).
20
+
:type X: anndata.AnnData
21
+
:param rank: Number of components to extract. Determines the complexity of the decomposition. Typically chosen based on variance explained and Factor Match Score analysis.
22
+
:type rank: int
23
+
:param random_state: Random seed for reproducibility of the decomposition.
24
+
:type random_state: int, optional
25
+
:param doEmbedding: If True, automatically computes PaCMAP embedding of cell projections and stores in X.obsm["X_pf2_PaCMAP"].
26
+
:type doEmbedding: bool, optional
27
+
:param tolerance: Convergence threshold for the optimization algorithm.
28
+
:type tolerance: float, optional
29
+
:param max_iter: Maximum number of iterations for the optimization algorithm.
30
+
:type max_iter: int, optional
31
+
:returns: The input AnnData object with added RISE decomposition results in X.uns["Pf2_weights"], X.uns["Pf2_A"], X.uns["Pf2_B"], X.varm["Pf2_C"], X.obsm["projections"], X.obsm["weighted_projections"], and X.obsm["X_pf2_PaCMAP"]
Plot condition factors as a heatmap showing how conditions contribute to components.
115
+
116
+
This visualization shows how each experimental condition (rows) contributes to each RISE component (columns). High values indicate strong association between a condition and a component's pattern.
117
+
118
+
:param data: AnnData object with RISE decomposition results. Must contain data.uns["Pf2_A"] and data.obs[cond].
119
+
:type data: anndata.AnnData
120
+
:param ax: Matplotlib axes object to plot on.
121
+
:type ax: matplotlib.axes.Axes
122
+
:param cond: Name of column in data.obs containing condition labels.
123
+
:type cond: str, optional
124
+
:param log_transform: If True, applies log10 transformation to condition factors before plotting.
125
+
:type log_transform: bool, optional
126
+
:param cond_group_labels: Series mapping conditions to group labels for colored row annotations.
127
+
:type cond_group_labels: pandas.Series, optional
128
+
:param ThomsonNorm: If True, normalizes factors using only control conditions.
129
+
:type ThomsonNorm: bool, optional
130
+
:param color_key: Custom colors for condition group labels.
131
+
:type color_key: list, optional
132
+
:param group_cond: If True and cond_group_labels provided, sorts conditions by group.
Plot eigen-state factors as a heatmap showing cell state patterns.
139
+
140
+
Eigen-state factors represent the underlying cell state patterns across components. Each row represents an eigen-state and each column represents a component.
141
+
142
+
:param data: AnnData object with RISE decomposition results. Must contain data.uns["Pf2_B"].
Calculate Factor Match Score (FMS) between two RISE decompositions.
248
+
249
+
Factor Match Score measures the similarity between two tensor decompositions by comparing their factor matrices. Values range from 0 (no similarity) to 1 (identical factors).
250
+
251
+
:param A: First AnnData object with RISE decomposition results.
252
+
:type A: anndata.AnnData
253
+
:param B: Second AnnData object with RISE decomposition results.
254
+
:type B: anndata.AnnData
255
+
:returns: Factor Match Score between 0 and 1. Higher values indicate more similar decompositions.
0 commit comments