Skip to content

Commit

Permalink
Merge pull request #484 from Ukyeon/regressout
Browse files Browse the repository at this point in the history
Regressout
  • Loading branch information
Xiaojieqiu authored May 4, 2023
2 parents 7a3dc6b + 8a767ac commit 1fdc89a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dynamo/preprocessing/Preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ def preprocess_adata_monocle(
self._normalize_selected_genes(adata)
self._normalize_by_cells(adata)

self._log1p(adata) # Always done in normalization process. Do we need this process explictly?
self._log1p(adata)

if len(self.regress_out_kwargs["obs_keys"]) > 0:
self._regress_out(adata)
Expand Down
4 changes: 1 addition & 3 deletions dynamo/preprocessing/preprocessor_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,6 @@ def regress_out_parallel(
obs_keys: Optional[List[str]] = None,
gene_selection_key: Optional[str] = None,
n_cores: Optional[int] = None,
obsm_store_key: str = "X_regress_out",
):
"""Perform linear regression to remove the effects of given variables from a target variable.
Expand Down Expand Up @@ -1573,13 +1572,12 @@ def regress_out_parallel(
regressor = DKM.select_layer_data(subset_adata, layer)

import itertools
import os

if issparse(regressor):
regressor = regressor.toarray()

if n_cores is None:
n_cores = os.cpu_count() // 2 # Use half of available cores as the default.
n_cores = 1 # Use no parallel computing as default

# Split the input data into chunks for parallel processing
chunk_size = min(1000, regressor.shape[1] // n_cores + 1)
Expand Down

0 comments on commit 1fdc89a

Please sign in to comment.