From 30764e679560faba9704bfbe7b14dab6521faf5b Mon Sep 17 00:00:00 2001 From: Aaron Wolen Date: Thu, 12 Sep 2024 13:49:45 -0500 Subject: [PATCH] Use correct shape for obsm/varm layers in anndata export (#216) * Fix * Revert to original approach for obtaining n_row * 4X perf improvement using unique+len --- python-spec/src/somacore/query/query.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python-spec/src/somacore/query/query.py b/python-spec/src/somacore/query/query.py index e7f19c7e..3823670a 100644 --- a/python-spec/src/somacore/query/query.py +++ b/python-spec/src/somacore/query/query.py @@ -593,11 +593,11 @@ def _axism_inner_ndarray( layer: str, ) -> np.ndarray: axism = axis.getitem_from(self._ms, suf="m") + table = axism[layer].read().tables().concat() - _, n_col = axism[layer].shape n_row = len(axis.getattr_from(self._joinids)) + n_col = len(table["soma_dim_1"].unique()) - table = self._axism_inner(axis, layer).tables().concat() return self._convert_to_ndarray(axis, table, n_row, n_col) @property