Skip to content

Commit 2dc635d

Browse files
author
Andrew Ramirez
committed
Add calculateFMS docstring and mock imports to fix API reference rendering
1 parent 6f49f90 commit 2dc635d

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

RISE/figures/figureS4.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,38 @@ def makeFigure():
3232

3333

3434
def calculateFMS(A: anndata.AnnData, B: anndata.AnnData):
35-
"""Calculates FMS between 2 factors"""
35+
"""Calculate Factor Match Score (FMS) between two RISE decompositions.
36+
37+
Factor Match Score measures the similarity between two tensor decompositions
38+
by comparing their factor matrices. Values range from 0 (no similarity) to 1
39+
(identical factors). Used to assess decomposition stability across different
40+
initializations or data subsamples.
41+
42+
Parameters
43+
----------
44+
A : anndata.AnnData
45+
First AnnData object with RISE decomposition results. Must contain:
46+
- A.uns["Pf2_weights"]: Component weights
47+
- A.uns["Pf2_A"]: Condition factors
48+
- A.uns["Pf2_B"]: Eigen-state factors
49+
- A.varm["Pf2_C"]: Gene factors
50+
B : anndata.AnnData
51+
Second AnnData object with RISE decomposition results. Must have the
52+
same rank as A and contain the same decomposition attributes.
53+
54+
Returns
55+
-------
56+
float
57+
Factor Match Score between 0 and 1. Higher values indicate more similar
58+
decompositions. Typically: >0.9 = highly stable, >0.6 = acceptable,
59+
<0.6 = unstable decomposition.
60+
61+
Notes
62+
-----
63+
This function uses tlviz.factor_tools.factor_match_score with weights
64+
consideration disabled (consider_weights=False) and skipping the condition
65+
mode (skip_mode=1) for stability assessment across replicate decompositions.
66+
"""
3667
factors = [A.uns["Pf2_A"], A.uns["Pf2_B"], A.varm["Pf2_C"]]
3768
A_CP = CPTensor(
3869
(

docs/conf.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@
5252
"inherited-members": False,
5353
}
5454

55+
# Mock imports for packages that might fail during doc build
56+
autodoc_mock_imports = [
57+
"cupy",
58+
"torch",
59+
"scvi",
60+
]
61+
5562
# Intersphinx mapping for external documentation
5663
intersphinx_mapping = {
5764
"python": ("https://docs.python.org/3", None),

0 commit comments

Comments
 (0)