Skip to content

Commit d3ba339

Browse files
committed
Fix KeyError in de_genes by converting mask/mask2 to numpy arrays before tensor indexing
1 parent 71a5292 commit d3ba339

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎destvi_utils/_destvi_utils.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -447,11 +447,11 @@ def de_genes(
447447
else:
448448
expression = st_adata.X
449449

450-
mask = np.logical_and(
451-
mask, st_adata.obsm[key_proportions][ct].to_numpy() > threshold
450+
mask = np.asarray(
451+
np.logical_and(mask, st_adata.obsm[key_proportions][ct].to_numpy() > threshold)
452452
)
453-
mask2 = np.logical_and(
454-
mask2, st_adata.obsm[key_proportions][ct].to_numpy() > threshold
453+
mask2 = np.asarray(
454+
np.logical_and(mask2, st_adata.obsm[key_proportions][ct].to_numpy() > threshold)
455455
)
456456

457457
avg_library_size = np.mean(np.sum(expression, axis=1).flatten())

0 commit comments

Comments
 (0)