Skip to content

Commit 7a08b2a

Browse files
authored
Fix error with shape of sliced objects (CellArr#75)
1 parent 604ce24 commit 7a08b2a

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
## Version 0.5.1
3+
## Version 0.5.1 - 0.5.2
44

55
- Support csc matrices in layers, although not common ran into a situation where the
66
anndata object was stored from R.

src/cellarr/CellArrDatasetSlice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def to_summarizedexperiment(self):
8383

8484
@property
8585
def shape(self):
86-
return self.matrix.shape
86+
return (len(self.cell_metadata), len(self.gene_annotation))
8787

8888
def __len__(self):
8989
return self.shape[0]

tests/test_query.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,11 @@ def test_query_cellarrdataset():
120120
for cell, cell_chunk in cd.itercells():
121121
cell_count += 1
122122
assert cell_count == 1100
123+
124+
full_row_slice = cd[1,]
125+
assert full_row_slice is not None
126+
assert full_row_slice.shape == (1, 1000)
127+
128+
full_col_slice = cd[:, 1]
129+
assert full_col_slice is not None
130+
assert full_col_slice.shape == (1100, 1)

0 commit comments

Comments
 (0)