diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b9823593..27cf8217 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,13 +27,13 @@ jobs: - os: ubuntu-latest python: "3.12" run_mode: "slow" - - os: ubuntu-latest - python: "3.12" - run_mode: "fast" - - os: ubuntu-latest - python: "3.12" - run_mode: slow - pip-flags: "--pre" +# - os: ubuntu-latest +# python: "3.12" +# run_mode: "fast" +# - os: ubuntu-latest +# python: "3.12" +# run_mode: slow +# pip-flags: "--pre" env: OS: ${{ matrix.os }} diff --git a/docs/installation.md b/docs/installation.md index 90048ae5..e37ff0a9 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -78,10 +78,10 @@ Follow these steps to install pertpy on an Apple Silicon machine (tested on a Ma brew install --cask mambaforge ``` -3. Create a new environment using mamba (here with python 3.10) and activate it +3. Create a new environment using mamba and activate it ```console - mamba create -n pertpy-env python=3.11 + mamba create -n pertpy-env mamba activate pertpy-env ``` diff --git a/docs/usage/usage.md b/docs/usage/usage.md index cbc20647..cc8b3420 100644 --- a/docs/usage/usage.md +++ b/docs/usage/usage.md @@ -450,7 +450,7 @@ See [scGen predicts single-cell perturbation responses](https://www.nature.com/a .. autosummary:: :toctree: tools - tools.SCGEN + tools.Scgen ``` Example implementation: diff --git a/pertpy/tools/__init__.py b/pertpy/tools/__init__.py index 63fe91e8..d0f26e77 100644 --- a/pertpy/tools/__init__.py +++ b/pertpy/tools/__init__.py @@ -1,25 +1,22 @@ -from functools import wraps from importlib import import_module def lazy_import(module_path, class_name, extras): - def _import(): - try: - for extra in extras: - import_module(extra) - except ImportError as e: - raise ImportError( - f"Extra dependencies required: {', '.join(extras)}. " - f"Please install with: pip install {' '.join(extras)}" - ) from e + try: + for extra in extras: + import_module(extra) module = import_module(module_path) return getattr(module, class_name) + except ImportError: - @wraps(_import) - def wrapper(*args, **kwargs): - return _import()(*args, **kwargs) + class Placeholder: + def __init__(self, *args, **kwargs): + raise ImportError( + f"Extra dependencies required: {', '.join(extras)}. " + f"Please install with: pip install {' '.join(extras)}" + ) - return wrapper + return Placeholder from pertpy.tools._augur import Augur @@ -49,7 +46,7 @@ def wrapper(*args, **kwargs): Tasccoda = lazy_import("pertpy.tools._coda._tasccoda", "Tasccoda", CODA_EXTRAS) DE_EXTRAS = ["formulaic", "pydeseq2"] -EdgeR = lazy_import("pertpy.tools._differential_gene_expression", "EdgeR", DE_EXTRAS + ["edger"]) +EdgeR = lazy_import("pertpy.tools._differential_gene_expression", "EdgeR", DE_EXTRAS) # edgeR will be imported via rpy2 PyDESeq2 = lazy_import("pertpy.tools._differential_gene_expression", "PyDESeq2", DE_EXTRAS) Statsmodels = lazy_import("pertpy.tools._differential_gene_expression", "Statsmodels", DE_EXTRAS + ["statsmodels"]) TTest = lazy_import("pertpy.tools._differential_gene_expression", "TTest", DE_EXTRAS) diff --git a/pertpy/tools/_cinemaot.py b/pertpy/tools/_cinemaot.py index 61a63c1b..a4a77273 100644 --- a/pertpy/tools/_cinemaot.py +++ b/pertpy/tools/_cinemaot.py @@ -190,7 +190,7 @@ def causaleffect( TE.obsm["X_embedding"] = embedding if return_matching: - TE.obsm["ot"] = ot_sink.matrix.T + TE.obsm["ot"] = np.asarray(ot_sink.matrix.T) return TE else: return TE