Skip to content

Commit 016f0ed

Browse files
Update src/pyXenium/analysis/rna_protein_joint.py
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
1 parent 32829d8 commit 016f0ed

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

src/pyXenium/analysis/rna_protein_joint.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,8 @@ class ProteinModelResult:
4747
def _get_rna_matrix(adata: AnnData):
4848
"""Return the raw RNA matrix from ``adata`` as CSR sparse matrix."""
4949

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))
50+
X = adata.layers["rna"] if "rna" in adata.layers else adata.X
51+
return X.tocsr() if sparse.issparse(X) else sparse.csr_matrix(np.asarray(X))
6052

6153

6254
def _normalize_log1p(matrix: sparse.csr_matrix, target_sum: float = 1e4) -> sparse.csr_matrix:

0 commit comments

Comments
 (0)