pertpy 0.11.0__py3-none-any.whl → 0.11.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pertpy/__init__.py CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  __author__ = "Lukas Heumos"
4
4
  __email__ = "lukas.heumos@posteo.net"
5
- __version__ = "0.11.0"
5
+ __version__ = "0.11.1"
6
6
 
7
7
  import warnings
8
8
 
pertpy/tools/__init__.py CHANGED
@@ -1,7 +1,7 @@
1
1
  from importlib import import_module
2
2
 
3
3
 
4
- def lazy_import(module_path, class_name, extras):
4
+ def lazy_import(module_path: str, class_name: str, extras: list[str]):
5
5
  try:
6
6
  for extra in extras:
7
7
  import_module(extra)
@@ -21,6 +21,7 @@ def lazy_import(module_path, class_name, extras):
21
21
 
22
22
  from pertpy.tools._augur import Augur
23
23
  from pertpy.tools._cinemaot import Cinemaot
24
+ from pertpy.tools._coda._sccoda import Sccoda
24
25
  from pertpy.tools._dialogue import Dialogue
25
26
  from pertpy.tools._distances._distance_tests import DistanceTest
26
27
  from pertpy.tools._distances._distances import Distance
@@ -41,8 +42,7 @@ from pertpy.tools._perturbation_space._simple import (
41
42
  )
42
43
  from pertpy.tools._scgen import Scgen
43
44
 
44
- CODA_EXTRAS = ["toytree", "arviz", "ete4"] # also pyqt6 technically
45
- Sccoda = lazy_import("pertpy.tools._coda._sccoda", "Sccoda", CODA_EXTRAS)
45
+ CODA_EXTRAS = ["toytree", "ete4"] # also "pyqt6" but it cannot be imported
46
46
  Tasccoda = lazy_import("pertpy.tools._coda._tasccoda", "Tasccoda", CODA_EXTRAS)
47
47
 
48
48
  DE_EXTRAS = ["formulaic", "pydeseq2"]
@@ -69,6 +69,7 @@ __all__ = [
69
69
  "Milo",
70
70
  "Mixscape",
71
71
  "ClusteringSpace",
72
+ "PerturbationComparison",
72
73
  "LRClassifierSpace",
73
74
  "MLPClassifierSpace",
74
75
  "CentroidSpace",
@@ -4,12 +4,10 @@ from abc import ABC, abstractmethod
4
4
  from pathlib import Path
5
5
  from typing import TYPE_CHECKING, Literal
6
6
 
7
- import arviz as az
8
7
  import jax.numpy as jnp
9
8
  import matplotlib.pyplot as plt
10
9
  import numpy as np
11
10
  import pandas as pd
12
- import patsy as pt
13
11
  import scanpy as sc
14
12
  import seaborn as sns
15
13
  from adjustText import adjust_text
@@ -126,7 +124,9 @@ class CompositionalModel2(ABC):
126
124
  sample_adata.X = sample_adata.X.astype(dtype)
127
125
 
128
126
  # Build covariate matrix from R-like formula, save in obsm
129
- covariate_matrix = pt.dmatrix(formula, sample_adata.obs)
127
+ import patsy
128
+
129
+ covariate_matrix = patsy.dmatrix(formula, sample_adata.obs)
130
130
  covariate_names = covariate_matrix.design_info.column_names[1:]
131
131
  sample_adata.obsm["covariate_matrix"] = np.array(covariate_matrix[:, 1:]).astype(dtype)
132
132
 
@@ -461,6 +461,8 @@ class CompositionalModel2(ABC):
461
461
  else:
462
462
  raise ValueError("No valid model type!")
463
463
 
464
+ import arviz as az
465
+
464
466
  summ = az.summary(
465
467
  data=self.make_arviz(sample_adata, num_prior_samples=0, use_posterior_predictive=False),
466
468
  var_names=var_names,
@@ -2,7 +2,6 @@ from __future__ import annotations
2
2
 
3
3
  from typing import TYPE_CHECKING, Literal
4
4
 
5
- import arviz as az
6
5
  import jax.numpy as jnp
7
6
  import numpy as np
8
7
  import numpyro as npy
@@ -17,6 +16,7 @@ from rich import print
17
16
  from pertpy.tools._coda._base_coda import CompositionalModel2, from_scanpy
18
17
 
19
18
  if TYPE_CHECKING:
19
+ import arviz as az
20
20
  import pandas as pd
21
21
 
22
22
  config.update("jax_enable_x64", True)
@@ -406,6 +406,8 @@ class Sccoda(CompositionalModel2):
406
406
  else:
407
407
  prior = None
408
408
 
409
+ import arviz as az
410
+
409
411
  # Create arviz object
410
412
  arviz_data = az.from_numpyro(
411
413
  self.mcmc, prior=prior, posterior_predictive=posterior_predictive, dims=dims, coords=coords
@@ -2,7 +2,6 @@ from __future__ import annotations
2
2
 
3
3
  from typing import TYPE_CHECKING, Literal
4
4
 
5
- import arviz as az
6
5
  import jax.numpy as jnp
7
6
  import numpy as np
8
7
  import numpyro as npy
@@ -25,6 +24,7 @@ from pertpy.tools._coda._base_coda import (
25
24
  )
26
25
 
27
26
  if TYPE_CHECKING:
27
+ import arviz as az
28
28
  import pandas as pd
29
29
 
30
30
  config.update("jax_enable_x64", True)
@@ -572,6 +572,8 @@ class Tasccoda(CompositionalModel2):
572
572
  else:
573
573
  prior = None
574
574
 
575
+ import arviz as az
576
+
575
577
  # Create arviz object
576
578
  arviz_data = az.from_numpyro(
577
579
  self.mcmc, prior=prior, posterior_predictive=posterior_predictive, dims=dims, coords=coords
pertpy/tools/_dialogue.py CHANGED
@@ -20,7 +20,6 @@ from rich.live import Live
20
20
  from rich.progress import BarColumn, Progress, SpinnerColumn, TaskProgressColumn, TextColumn
21
21
  from scipy import stats
22
22
  from scipy.optimize import nnls
23
- from seaborn import PairGrid
24
23
  from sklearn.linear_model import LinearRegression
25
24
  from sparsecca import lp_pmd, multicca_permute, multicca_pmd
26
25
  from statsmodels.sandbox.stats.multicomp import multipletests
@@ -1,6 +1,5 @@
1
1
  from __future__ import annotations
2
2
 
3
- import multiprocessing
4
3
  from abc import ABC, abstractmethod
5
4
  from typing import TYPE_CHECKING, Literal, NamedTuple
6
5
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pertpy
3
- Version: 0.11.0
3
+ Version: 0.11.1
4
4
  Summary: Perturbation Analysis in the scverse ecosystem.
5
5
  Project-URL: Documentation, https://pertpy.readthedocs.io
6
6
  Project-URL: Source, https://github.com/scverse/pertpy
@@ -67,7 +67,7 @@ Requires-Dist: sparsecca
67
67
  Provides-Extra: de
68
68
  Requires-Dist: formulaic; extra == 'de'
69
69
  Requires-Dist: formulaic-contrasts>=0.2.0; extra == 'de'
70
- Requires-Dist: pydeseq2>=v0.5.0pre1; extra == 'de'
70
+ Requires-Dist: pydeseq2>=v0.5.0; extra == 'de'
71
71
  Provides-Extra: dev
72
72
  Requires-Dist: pre-commit; extra == 'dev'
73
73
  Provides-Extra: doc
@@ -88,7 +88,7 @@ Requires-Dist: sphinx-gallery; extra == 'doc'
88
88
  Requires-Dist: sphinx-issues; extra == 'doc'
89
89
  Requires-Dist: sphinx-last-updated-by-git; extra == 'doc'
90
90
  Requires-Dist: sphinx-remove-toctrees; extra == 'doc'
91
- Requires-Dist: sphinx>=6; extra == 'doc'
91
+ Requires-Dist: sphinx>=8.1; extra == 'doc'
92
92
  Requires-Dist: sphinxcontrib-bibtex>=1.0.0; extra == 'doc'
93
93
  Requires-Dist: sphinxext-opengraph; extra == 'doc'
94
94
  Provides-Extra: tcoda
@@ -101,7 +101,6 @@ Requires-Dist: leidenalg; extra == 'test'
101
101
  Requires-Dist: pytest; extra == 'test'
102
102
  Description-Content-Type: text/markdown
103
103
 
104
- [![Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
105
104
  [![Build](https://github.com/scverse/pertpy/actions/workflows/build.yml/badge.svg)](https://github.com/scverse/pertpy/actions/workflows/build.yml)
106
105
  [![codecov](https://codecov.io/gh/scverse/pertpy/graph/badge.svg?token=1dTpIPBShv)](https://codecov.io/gh/scverse/pertpy)
107
106
  [![License](https://img.shields.io/github/license/scverse/pertpy)](https://opensource.org/licenses/Apache2.0)
@@ -111,13 +110,16 @@ Description-Content-Type: text/markdown
111
110
  [![Test](https://github.com/scverse/pertpy/actions/workflows/test.yml/badge.svg)](https://github.com/scverse/pertpy/actions/workflows/test.yml)
112
111
  [![PyPI](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
113
112
 
114
- # pertpy
113
+ # pertpy - Perturbation Analysis in Python
114
+
115
+ Pertpy is a scverse ecosystem framework for analyzing large-scale single-cell perturbation experiments.
116
+ It provides tools for harmonizing perturbation datasets, automating metadata annotation, calculating perturbation distances, and efficiently analyzing how cells respond to various stimuli like genetic modifications, drug treatments, and environmental changes.
115
117
 
116
118
  ![fig1](https://github.com/user-attachments/assets/d2e32d69-b767-4be3-a938-77a9dce45d3f)
117
119
 
118
120
  ## Documentation
119
121
 
120
- Please read the [documentation](https://pertpy.readthedocs.io/en/latest).
122
+ Please read the [documentation](https://pertpy.readthedocs.io/en/latest) for installation, tutorials, use cases, and more.
121
123
 
122
124
  ## Installation
123
125
 
@@ -1,4 +1,4 @@
1
- pertpy/__init__.py,sha256=2cNNXWvBztH3KQzxe5WEl_Krfh0tdax4pPg1iUYjhQE,716
1
+ pertpy/__init__.py,sha256=4KCpjhbsKaAAYJjZIPbAi12NCBtGGThexdh3QaausRg,716
2
2
  pertpy/_doc.py,sha256=j5TMNC-DA9yIMqIIUNpjpcVgWfRqyBBfvbRjnCM_OLs,427
3
3
  pertpy/_types.py,sha256=IcHCojCUqx8CapibNkcYf2TUqjBFP2ujeELvn_IBSBQ,154
4
4
  pertpy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -16,19 +16,19 @@ pertpy/plot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  pertpy/preprocessing/__init__.py,sha256=VAPFaeq2_qCvdFkQTCj_Hm460HC4Tersu8Rig_tnp_Y,71
17
17
  pertpy/preprocessing/_guide_rna.py,sha256=ijL-bjQ-9qn4r3DlhBxzsqk-bD4RqPsFlok-Otj4hg8,15872
18
18
  pertpy/preprocessing/_guide_rna_mixture.py,sha256=pT_YkjmN4iEJ-THBROu_dpbr8E6u8GJw36YoGseikD0,6422
19
- pertpy/tools/__init__.py,sha256=DhjK2mfjbtvg9vG1ox6dF7A7UgiPZ_qmVH5o0QaTQyk,2599
19
+ pertpy/tools/__init__.py,sha256=xjfw3Dd_KGytjjCID0uEs6Fz7DalH46fCjVL2Zf2kOo,2629
20
20
  pertpy/tools/_augur.py,sha256=7iB2_xq8knyxtmN0G_a0u37o8WPlMlJXZCwDqxGvoKQ,55296
21
21
  pertpy/tools/_cinemaot.py,sha256=54-rS0AEj31dMe7iU4kEmLoAunq3jNuhsBE3IEp9hrI,38071
22
- pertpy/tools/_dialogue.py,sha256=ngjDcJK0D6ukJwiyS9cLYjrDU82n1FJru8yx8TvKSt8,52384
22
+ pertpy/tools/_dialogue.py,sha256=cCSwo9ge1pOLoA7QHTPb3b865juCFWUaKX5aD7UoSjo,52355
23
23
  pertpy/tools/_enrichment.py,sha256=55mwotLH9DXQOhl85MCkxXu-MX0RysLyrPheJysAnF0,21369
24
24
  pertpy/tools/_milo.py,sha256=r-kZcpAcoQuhi41AnVuzh-cMIcV3HB3-RGzynHyDc1A,43712
25
25
  pertpy/tools/_mixscape.py,sha256=ob22FI1hqUtaEZzCqrocy0-k8iUOChItc2tdCDeNDGY,57173
26
26
  pertpy/tools/decoupler_LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
27
27
  pertpy/tools/transferlearning_MMD_LICENSE,sha256=MUvDA-o_j9htRpI8fStVdCRuyLdPkQUuIH0a_EIc57w,1069
28
28
  pertpy/tools/_coda/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
- pertpy/tools/_coda/_base_coda.py,sha256=cITCEWyiPlxqS1Buhs8JzE3yHCdQksFitcXscEK7WX4,111504
30
- pertpy/tools/_coda/_sccoda.py,sha256=UjT9mha14YPk6jIqigAbyb1zqhrtBDV7b3NMWeoMFJ4,22575
31
- pertpy/tools/_coda/_tasccoda.py,sha256=hZBUhqpymFLu-l8CZ0FDLk04kUah9aSyHZwQhvHVm-U,30433
29
+ pertpy/tools/_coda/_base_coda.py,sha256=-rpdipPLFd4cFXyLMN7uFgv-pFJseKaqDmyWRBrGfws,111519
30
+ pertpy/tools/_coda/_sccoda.py,sha256=0Ret6O56kAfCNOdBvtxqiyuj2rUPp18SV1GVK1AvYGU,22607
31
+ pertpy/tools/_coda/_tasccoda.py,sha256=BTaOAmL458zQ_og3x4ENlDnJHD6_F4YkdCoXWsF4i1U,30465
32
32
  pertpy/tools/_differential_gene_expression/__init__.py,sha256=SEydWg0iT3Y1pApjnCAOuHxFeI6xVUfgyBHv2s3LADU,487
33
33
  pertpy/tools/_differential_gene_expression/_base.py,sha256=PpfH_RZXsN79Bu0yBFPE9TXEqNsZ4bSzSbhM0wZou2I,38322
34
34
  pertpy/tools/_differential_gene_expression/_checks.py,sha256=hH_GP0lWGO-5zrCFX4YiIVCZBCuK0ZJ0jFmdlx2Qm4k,1639
@@ -39,7 +39,7 @@ pertpy/tools/_differential_gene_expression/_simple_tests.py,sha256=SfU8s_P2JzEA1
39
39
  pertpy/tools/_differential_gene_expression/_statsmodels.py,sha256=90h9EPuoCtNxAbJ1Xq4j_E4yYJJpk64zTP7GyTdmrxY,2220
40
40
  pertpy/tools/_distances/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
41
  pertpy/tools/_distances/_distance_tests.py,sha256=6_nqfHUfKxkI2Yhkzspq3ujMpq56zV_Ddn7bgPzgjyo,13513
42
- pertpy/tools/_distances/_distances.py,sha256=uzE8IcKPFYYXI0fKSgFHM_UIBZfA6uf9gBTSq8nZmZw,50496
42
+ pertpy/tools/_distances/_distances.py,sha256=89d1zShW_9dhphup2oWx5hMOFC7RdogOY56doMuBFts,50473
43
43
  pertpy/tools/_perturbation_space/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
44
  pertpy/tools/_perturbation_space/_clustering.py,sha256=pNx_SpPkZfCbgF7vzHWqAaiiHdbxPaA-L-hTWTbzFhI,3528
45
45
  pertpy/tools/_perturbation_space/_comparison.py,sha256=-NzCPRT-IlhJ9hOz7NQLSk0riIzr2C0yZvX6zm3kon4,4291
@@ -52,7 +52,7 @@ pertpy/tools/_scgen/_base_components.py,sha256=Qq8myRUm43q9XBrZ9gBggfa2cSV2wbz_K
52
52
  pertpy/tools/_scgen/_scgen.py,sha256=31T8ez0FxABIbunJHCk8xvGulHFb8RHXSsyM_z1WsPY,30850
53
53
  pertpy/tools/_scgen/_scgenvae.py,sha256=bPk4v7EdJc7ROdLuDitHiX_Pvwa7Flw2qHRUwBvjLJY,3889
54
54
  pertpy/tools/_scgen/_utils.py,sha256=qz5QUn_Bvk2NGyYVzp3jgjWTFOMt1YyHwUo6HWtoThY,2871
55
- pertpy-0.11.0.dist-info/METADATA,sha256=k17pDMEOKlDxSvRvG7D8iAA3jGidVvkOGrwuGef1uGc,7706
56
- pertpy-0.11.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
57
- pertpy-0.11.0.dist-info/licenses/LICENSE,sha256=XuiT2hxeRInhquEIBKMZ5M21n5syhDQ4XbABoposIAg,1100
58
- pertpy-0.11.0.dist-info/RECORD,,
55
+ pertpy-0.11.1.dist-info/METADATA,sha256=uLFTtFW3JuRShmdYTUR-byUMcRB3Zntu84xe_2BI3ZI,8051
56
+ pertpy-0.11.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
57
+ pertpy-0.11.1.dist-info/licenses/LICENSE,sha256=XuiT2hxeRInhquEIBKMZ5M21n5syhDQ4XbABoposIAg,1100
58
+ pertpy-0.11.1.dist-info/RECORD,,