Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic_stats and max_pmito_s in Preprocessing #466

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions dynamo/preprocessing/Preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,16 @@ def standardize_adata(self, adata: AnnData, tkey: str, experiment_type: str) ->
main_info_insert_adata("experiment_type=%s" % adata.uns["pp"]["experiment_type"], "uns['pp']", indent_level=2)

self.convert_layers2csr(adata)
self.collapse_species_adata(adata)
if self.collapse_species_adata:
main_info("applying collapse species adata...")
self.collapse_species_adata(adata)

main_debug("applying convert_gene_name function...")
self.convert_gene_name(adata)

main_debug("making adata observation index unique after gene name conversion...")
self.unique_var_obs_adata(adata)

def _filter_cells_by_outliers(self, adata: AnnData) -> None:
"""Select valid cells based on the method specified as the preprocessor's `filter_cells_by_outliers`.

Expand Down
6 changes: 2 additions & 4 deletions dynamo/preprocessing/preprocessor_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,11 +755,9 @@ def filter_cells_by_outliers(

if max_pmito_s is not None:
detected_bool = detected_bool & (adata.obs["pMito"] < max_pmito_s)
main_info(
main_debug(
"filtered out %d cells by %f%% of mitochondrial genes for a cell."
% (adata.n_obs - (adata.obs["pMito"] < max_pmito_s).sum(), max_pmito_s),
indent_level=2,
)
% ((adata.obs["pMito"] < max_pmito_s).sum(), max_pmito_s), indent_level=2)

filter_bool = detected_bool if filter_bool is None else np.array(filter_bool) & detected_bool

Expand Down