Skip to content

Commit

Permalink
Use nonempty_domain to access dimensions of the cell and gene axes (#…
Browse files Browse the repository at this point in the history
…23)

Co-authored-by: Tony Kuo <[email protected]>
  • Loading branch information
tony-kuo and Tony Kuo authored Jun 28, 2024
1 parent cb76ed8 commit 963c923
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/cellarr/CellArrDataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,10 @@ def __getitem__(
####
@property
def shape(self):
return (self._cell_metadata_tdb.shape[0], self._gene_annotation_tdb.shape[0])
return (
self._cell_metadata_tdb.nonempty_domain()[0][1] + 1,
self._gene_annotation_tdb.nonempty_domain()[0][1] + 1,
)

def __len__(self):
return self.shape[0]
Expand Down
4 changes: 2 additions & 2 deletions src/cellarr/dataloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ def __init__(
)

self.matrix_shape = (
self.cell_metadata_tdb.shape[0],
self.gene_annotation_tdb.shape[0],
self.cell_metadata_tdb.nonempty_domain()[0][1] + 1,
self.gene_annotation_tdb.nonempty_domain()[0][1] + 1,
)

# limit to cells with labels
Expand Down

0 comments on commit 963c923

Please sign in to comment.