Skip to content

Commit

Permalink
Fixed pseudobulk bug where NAs were droped
Browse files Browse the repository at this point in the history
  • Loading branch information
PauBadiaM committed Sep 10, 2024
1 parent 1ec6de0 commit 0dd3da6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions decoupler/utils_anndata.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def format_psbulk_inputs(sample_col, groups_col, obs):

if groups_col is None:
# Filter extra columns in obs
cols = obs.groupby(sample_col, observed=True).nunique().eq(1).all(0)
cols = obs.groupby(sample_col, observed=True).nunique(dropna=False).eq(1).all(0)
cols = np.hstack([sample_col, cols[cols].index])
obs = obs.loc[:, cols]

Expand All @@ -179,7 +179,7 @@ def format_psbulk_inputs(sample_col, groups_col, obs):
groups_col = joined_cols

# Filter extra columns in obs
cols = obs.groupby([sample_col, groups_col], observed=True).nunique().eq(1).all(0)
cols = obs.groupby([sample_col, groups_col], observed=True).nunique(dropna=False).eq(1).all(0)
cols = np.hstack([sample_col, groups_col, cols[cols].index])
obs = obs.loc[:, cols]

Expand Down

0 comments on commit 0dd3da6

Please sign in to comment.