Skip to content

Commit

Permalink
Merge pull request #50 from klarman-cell-observatory/boli
Browse files Browse the repository at this point in the history
Fixed a bug for caching percent mito rate
  • Loading branch information
bli25 committed Dec 21, 2020
2 parents 405769d + ef03b84 commit 7bdc022
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions pegasusio/qc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,10 @@ def calc_qc_filters(
filters.append(unidata.obs["n_counts"] < max_umis)
if calc_mito:
mito_genes = unidata.var_names.map(lambda x: x.startswith(mito_prefix)).values.nonzero()[0]

if "percent_mito" not in unidata.obs:
unidata.obs["percent_mito"] = (
unidata.X[:, mito_genes].sum(axis=1).A1
/ np.maximum(unidata.obs["n_counts"].values, 1.0)
) * 100

unidata.obs["percent_mito"] = (
unidata.X[:, mito_genes].sum(axis=1).A1
/ np.maximum(unidata.obs["n_counts"].values, 1.0)
) * 100
filters.append(unidata.obs["percent_mito"] < percent_mito)

if len(filters) > 0:
Expand Down

0 comments on commit 7bdc022

Please sign in to comment.