We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 32829d8 commit 016f0edCopy full SHA for 016f0ed
1 file changed
src/pyXenium/analysis/rna_protein_joint.py
@@ -47,16 +47,8 @@ class ProteinModelResult:
47
def _get_rna_matrix(adata: AnnData):
48
"""Return the raw RNA matrix from ``adata`` as CSR sparse matrix."""
49
50
- if "rna" in adata.layers:
51
- X = adata.layers["rna"]
52
- else:
53
- X = adata.X
54
-
55
- if sparse.issparse(X):
56
- return X.tocsr()
57
58
- # Dense array – convert to CSR to keep operations memory friendly.
59
- return sparse.csr_matrix(np.asarray(X))
+ X = adata.layers["rna"] if "rna" in adata.layers else adata.X
+ return X.tocsr() if sparse.issparse(X) else sparse.csr_matrix(np.asarray(X))
60
61
62
def _normalize_log1p(matrix: sparse.csr_matrix, target_sum: float = 1e4) -> sparse.csr_matrix:
0 commit comments