Skip to content

Commit f8de9ea

Browse files
committed
Fixed corner case bug for pp pseudobulk when repeated cats inside same sample for other cats
1 parent da92e06 commit f8de9ea

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/decoupler/pp/anndata.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ def _psbulk(
238238
tmp = obs[(obs[sample_col] == smp) & (obs[groups_col] == grp)].drop_duplicates().values
239239
if tmp.shape[0] == 0:
240240
tmp = obs[obs[sample_col] == smp].drop(columns=groups_col).drop_duplicates()
241+
tmp = tmp.head(1) # Remove extra repeated cat variables
241242
tmp[groups_col] = grp
242243
tmp = tmp[obs.columns].values
243244
new_obs.loc[index, :] = tmp
@@ -273,7 +274,7 @@ def pseudobulk(
273274
groups_col: str | None,
274275
layer: str | None = None,
275276
raw: bool = False,
276-
empty: bool = True,
277+
empty: bool = False,
277278
mode: str | Callable | dict = 'sum',
278279
skip_checks: bool = False,
279280
verbose: bool = False,

0 commit comments

Comments
 (0)