pertpy 0.8.0__py3-none-any.whl → 0.9.3__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- pertpy/__init__.py +1 -1
- pertpy/preprocessing/_guide_rna.py +4 -4
- pertpy/tools/__init__.py +35 -10
- pertpy/tools/_milo.py +1 -1
- pertpy/tools/_perturbation_space/_discriminator_classifiers.py +1 -1
- {pertpy-0.8.0.dist-info → pertpy-0.9.3.dist-info}/METADATA +14 -5
- {pertpy-0.8.0.dist-info → pertpy-0.9.3.dist-info}/RECORD +9 -9
- {pertpy-0.8.0.dist-info → pertpy-0.9.3.dist-info}/WHEEL +0 -0
- {pertpy-0.8.0.dist-info → pertpy-0.9.3.dist-info}/licenses/LICENSE +0 -0
pertpy/__init__.py
CHANGED
@@ -48,7 +48,7 @@ class GuideAssignment:
|
|
48
48
|
"""
|
49
49
|
counts = adata.X if layer is None else adata.layers[layer]
|
50
50
|
if scipy.sparse.issparse(counts):
|
51
|
-
counts = counts.
|
51
|
+
counts = counts.toarray()
|
52
52
|
|
53
53
|
assigned_grnas = np.where(counts >= assignment_threshold, 1, 0)
|
54
54
|
assigned_grnas = scipy.sparse.csr_matrix(assigned_grnas)
|
@@ -92,7 +92,7 @@ class GuideAssignment:
|
|
92
92
|
"""
|
93
93
|
counts = adata.X if layer is None else adata.layers[layer]
|
94
94
|
if scipy.sparse.issparse(counts):
|
95
|
-
counts = counts.
|
95
|
+
counts = counts.toarray()
|
96
96
|
|
97
97
|
assigned_grna = np.where(
|
98
98
|
counts.max(axis=1).squeeze() >= assignment_threshold,
|
@@ -152,9 +152,9 @@ class GuideAssignment:
|
|
152
152
|
|
153
153
|
if order_by is None:
|
154
154
|
if scipy.sparse.issparse(data):
|
155
|
-
max_values = data.max(axis=1).
|
155
|
+
max_values = data.max(axis=1).toarray().squeeze()
|
156
156
|
data_argmax = data.argmax(axis=1).A.squeeze()
|
157
|
-
max_guide_index = np.where(max_values != data.min(axis=1).
|
157
|
+
max_guide_index = np.where(max_values != data.min(axis=1).toarray().squeeze(), data_argmax, -1)
|
158
158
|
else:
|
159
159
|
max_guide_index = np.where(
|
160
160
|
data.max(axis=1).squeeze() != data.min(axis=1).squeeze(), data.argmax(axis=1).squeeze(), -1
|
pertpy/tools/__init__.py
CHANGED
@@ -1,16 +1,30 @@
|
|
1
|
+
from functools import wraps
|
2
|
+
from importlib import import_module
|
3
|
+
|
4
|
+
|
5
|
+
def lazy_import(module_path, class_name, extras):
|
6
|
+
def _import():
|
7
|
+
try:
|
8
|
+
for extra in extras:
|
9
|
+
import_module(extra)
|
10
|
+
except ImportError as e:
|
11
|
+
raise ImportError(
|
12
|
+
f"Extra dependencies required: {', '.join(extras)}. "
|
13
|
+
f"Please install with: pip install {' '.join(extras)}"
|
14
|
+
) from e
|
15
|
+
module = import_module(module_path)
|
16
|
+
return getattr(module, class_name)
|
17
|
+
|
18
|
+
@wraps(_import)
|
19
|
+
def wrapper(*args, **kwargs):
|
20
|
+
return _import()(*args, **kwargs)
|
21
|
+
|
22
|
+
return wrapper
|
23
|
+
|
24
|
+
|
1
25
|
from pertpy.tools._augur import Augur
|
2
26
|
from pertpy.tools._cinemaot import Cinemaot
|
3
|
-
from pertpy.tools._coda._sccoda import Sccoda
|
4
|
-
from pertpy.tools._coda._tasccoda import Tasccoda
|
5
27
|
from pertpy.tools._dialogue import Dialogue
|
6
|
-
from pertpy.tools._differential_gene_expression import (
|
7
|
-
DGEEVAL,
|
8
|
-
EdgeR,
|
9
|
-
PyDESeq2,
|
10
|
-
Statsmodels,
|
11
|
-
TTest,
|
12
|
-
WilcoxonTest,
|
13
|
-
)
|
14
28
|
from pertpy.tools._distances._distance_tests import DistanceTest
|
15
29
|
from pertpy.tools._distances._distances import Distance
|
16
30
|
from pertpy.tools._enrichment import Enrichment
|
@@ -30,6 +44,17 @@ from pertpy.tools._perturbation_space._simple import (
|
|
30
44
|
)
|
31
45
|
from pertpy.tools._scgen import Scgen
|
32
46
|
|
47
|
+
CODA_EXTRAS = ["toytree", "arviz", "ete3"] # also pyqt5 technically
|
48
|
+
Sccoda = lazy_import("pertpy.tools._coda._sccoda", "Sccoda", CODA_EXTRAS)
|
49
|
+
Tasccoda = lazy_import("pertpy.tools._coda._tasccoda", "Tasccoda", CODA_EXTRAS)
|
50
|
+
|
51
|
+
DE_EXTRAS = ["formulaic", "pydeseq2"]
|
52
|
+
EdgeR = lazy_import("pertpy.tools._differential_gene_expression", "EdgeR", DE_EXTRAS + ["edger"])
|
53
|
+
PyDESeq2 = lazy_import("pertpy.tools._differential_gene_expression", "PyDESeq2", DE_EXTRAS)
|
54
|
+
Statsmodels = lazy_import("pertpy.tools._differential_gene_expression", "Statsmodels", DE_EXTRAS + ["statsmodels"])
|
55
|
+
TTest = lazy_import("pertpy.tools._differential_gene_expression", "TTest", DE_EXTRAS)
|
56
|
+
WilcoxonTest = lazy_import("pertpy.tools._differential_gene_expression", "WilcoxonTest", DE_EXTRAS)
|
57
|
+
|
33
58
|
__all__ = [
|
34
59
|
"Augur",
|
35
60
|
"Cinemaot",
|
pertpy/tools/_milo.py
CHANGED
@@ -1014,7 +1014,7 @@ class Milo:
|
|
1014
1014
|
if subset_nhoods is None:
|
1015
1015
|
subset_nhoods = nhood_adata.obs_names
|
1016
1016
|
|
1017
|
-
pl_df = pd.DataFrame(nhood_adata[subset_nhoods].X.
|
1017
|
+
pl_df = pd.DataFrame(nhood_adata[subset_nhoods].X.toarray(), columns=nhood_adata.var_names).melt(
|
1018
1018
|
var_name=nhood_adata.uns["sample_col"], value_name="n_cells"
|
1019
1019
|
)
|
1020
1020
|
pl_df = pd.merge(pl_df, nhood_adata.var)
|
@@ -408,7 +408,7 @@ class PLDataset(Dataset):
|
|
408
408
|
|
409
409
|
def __getitem__(self, idx):
|
410
410
|
"""Returns a sample and corresponding perturbations applied (labels)"""
|
411
|
-
sample = self.data[idx].
|
411
|
+
sample = self.data[idx].toarray().squeeze() if scipy.sparse.issparse(self.data) else self.data[idx]
|
412
412
|
num_label = self.labels.iloc[idx]
|
413
413
|
str_label = self.pert_labels.iloc[idx]
|
414
414
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: pertpy
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.9.3
|
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
|
@@ -41,6 +41,7 @@ Classifier: Operating System :: POSIX :: Linux
|
|
41
41
|
Classifier: Programming Language :: Python :: 3
|
42
42
|
Classifier: Programming Language :: Python :: 3.10
|
43
43
|
Classifier: Programming Language :: Python :: 3.11
|
44
|
+
Classifier: Programming Language :: Python :: 3.12
|
44
45
|
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
45
46
|
Classifier: Topic :: Scientific/Engineering :: Visualization
|
46
47
|
Requires-Python: >=3.10
|
@@ -108,7 +109,7 @@ Description-Content-Type: text/markdown
|
|
108
109
|
|
109
110
|
# pertpy
|
110
111
|
|
111
|
-

|
112
113
|
|
113
114
|
## Documentation
|
114
115
|
|
@@ -116,7 +117,10 @@ Please read the [documentation](https://pertpy.readthedocs.io/en/latest).
|
|
116
117
|
|
117
118
|
## Installation
|
118
119
|
|
119
|
-
|
120
|
+
We recommend installing and running pertpy on a recent version of Linux (e.g. Ubuntu 24.04 LTS).
|
121
|
+
No particular hardware beyond a standard laptop is required.
|
122
|
+
|
123
|
+
You can install _pertpy_ in less than a minute via [pip] from [PyPI]:
|
120
124
|
|
121
125
|
```console
|
122
126
|
pip install pertpy
|
@@ -125,15 +129,20 @@ pip install pertpy
|
|
125
129
|
if you want to use scCODA or tascCODA, please install pertpy as follows:
|
126
130
|
|
127
131
|
```console
|
128
|
-
pip install pertpy[coda]
|
132
|
+
pip install 'pertpy[coda]'
|
129
133
|
```
|
130
134
|
|
131
135
|
If you want to use the differential gene expression interface, please install pertpy by running:
|
132
136
|
|
133
137
|
```console
|
134
|
-
pip install pertpy[de]
|
138
|
+
pip install 'pertpy[de]'
|
135
139
|
```
|
136
140
|
|
141
|
+
## Citation
|
142
|
+
|
143
|
+
[Lukas Heumos, Yuge Ji, Lilly May, Tessa Green, Xinyue Zhang, Xichen Wu, Johannes Ostner, Stefan Peidli, Antonia Schumacher, Karin Hrovatin, Michaela Mueller, Faye Chong, Gregor Sturm, Alejandro Tejada, Emma Dann, Mingze Dong, Mojtaba Bahrami, Ilan Gold, Sergei Rybakov, Altana Namsaraeva, Amir Ali Moinfar, Zihe Zheng, Eljas Roellin, Isra Mekki, Chris Sander, Mohammad Lotfollahi, Herbert B. Schiller, Fabian J. Theis
|
144
|
+
bioRxiv 2024.08.04.606516; doi: https://doi.org/10.1101/2024.08.04.606516](https://www.biorxiv.org/content/10.1101/2024.08.04.606516v1)
|
145
|
+
|
137
146
|
[pip]: https://pip.pypa.io/
|
138
147
|
[pypi]: https://pypi.org/
|
139
148
|
[usage]: https://pertpy.readthedocs.io/en/latest/usage/usage.html
|
@@ -1,4 +1,4 @@
|
|
1
|
-
pertpy/__init__.py,sha256=
|
1
|
+
pertpy/__init__.py,sha256=BDOzyW_PnNzv7Nfa8Skj90mC9T1ILiYtxI_bPXwhc1E,658
|
2
2
|
pertpy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
pertpy/data/__init__.py,sha256=ah3yvoxkgbdMUNAWxS3SyqcUuVamBOSeuWkF2QRAEwM,2703
|
4
4
|
pertpy/data/_dataloader.py,sha256=fl16n82nun01gGiP7qhr5sShfcDchp0szzZp7aXkfBI,2495
|
@@ -12,14 +12,14 @@ pertpy/metadata/_metadata.py,sha256=pvarnv3X5pblnvG8AQ8Omu5jQcC5ORzCxRk3FRhOLgs,
|
|
12
12
|
pertpy/metadata/_moa.py,sha256=u_OcMonjOeeoW5P9xOltquVSoTH3Vs80ztHsXf-X1DY,4701
|
13
13
|
pertpy/plot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
14
|
pertpy/preprocessing/__init__.py,sha256=VAPFaeq2_qCvdFkQTCj_Hm460HC4Tersu8Rig_tnp_Y,71
|
15
|
-
pertpy/preprocessing/_guide_rna.py,sha256=
|
16
|
-
pertpy/tools/__init__.py,sha256=
|
15
|
+
pertpy/preprocessing/_guide_rna.py,sha256=IgKhXEyfRwEA7ccKJNLA_aIxKHm09QJINM09KaIwn68,7644
|
16
|
+
pertpy/tools/__init__.py,sha256=Zl4W4bWDIIUVRUFDh1qjT14Rg2hjJ6gvRHcupV_sywk,2647
|
17
17
|
pertpy/tools/_augur.py,sha256=UWro1nIEZe_rWtjlQCBv4ucqeh3Vt1m8IRzKlux72Z8,55683
|
18
18
|
pertpy/tools/_cinemaot.py,sha256=BD_oYC1TktbFMX7fpp0A57QAF6frLEgNQ_2wFUpxjyo,39509
|
19
19
|
pertpy/tools/_dialogue.py,sha256=f2fbhKWdm4Co79ZzVgtVq9xYwjYWFLdGNDeGFOO_pfM,51990
|
20
20
|
pertpy/tools/_enrichment.py,sha256=rjPHK9YBCJZfpa5Rvfxo3Ii7W5Mvm5dOdolAD7QazVg,21440
|
21
21
|
pertpy/tools/_kernel_pca.py,sha256=_EJ9WlBLjHOafF34sZGdyBgZL6Fj0WiJ1elVT1XMmo4,1579
|
22
|
-
pertpy/tools/_milo.py,sha256=
|
22
|
+
pertpy/tools/_milo.py,sha256=FDFGmGMkJiVrvATEnOeAMCe-Q2w7F0nbBMuACVbyIQI,43699
|
23
23
|
pertpy/tools/_mixscape.py,sha256=FtH3PKvbLTe03LPgN4O9sS70oj_6AHz4Mz5otzEwRl8,52406
|
24
24
|
pertpy/tools/decoupler_LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
25
25
|
pertpy/tools/transferlearning_MMD_LICENSE,sha256=MUvDA-o_j9htRpI8fStVdCRuyLdPkQUuIH0a_EIc57w,1069
|
@@ -42,7 +42,7 @@ pertpy/tools/_distances/_distances.py,sha256=iuHpBtWZbJhMZNSEjQkZUu6KPJXCjs_fX6Y
|
|
42
42
|
pertpy/tools/_perturbation_space/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
43
43
|
pertpy/tools/_perturbation_space/_clustering.py,sha256=m52-J8c8OnIXRCf3NoFabIO2yMHIuy1X0m0amtsK2vE,3556
|
44
44
|
pertpy/tools/_perturbation_space/_comparison.py,sha256=rLO-EGU0I7t5MnLw4k1gYU-ypRu-JsDPLat1t4h2U2M,4329
|
45
|
-
pertpy/tools/_perturbation_space/_discriminator_classifiers.py,sha256=
|
45
|
+
pertpy/tools/_perturbation_space/_discriminator_classifiers.py,sha256=OA2eZeG_4iuW1T5ilsRIkS0rU-azmwEch7IuB546KSY,21617
|
46
46
|
pertpy/tools/_perturbation_space/_metrics.py,sha256=y8-baP8WRdB1iDgvP3uuQxSCDxA2lcxvEHHM2C_vWHY,3248
|
47
47
|
pertpy/tools/_perturbation_space/_perturbation_space.py,sha256=cZPPzzK4_UZV7ktcD5BQVXEy6ITHrfkg1CLFov3TzsY,18497
|
48
48
|
pertpy/tools/_perturbation_space/_simple.py,sha256=LH5EYvcAbzFMvgd9bH7AUPKFmdioPiy2xG8xGaXzmq0,12624
|
@@ -51,7 +51,7 @@ pertpy/tools/_scgen/_base_components.py,sha256=Qq8myRUm43q9XBrZ9gBggfa2cSV2wbz_K
|
|
51
51
|
pertpy/tools/_scgen/_scgen.py,sha256=HPvFVjY9SS9bGqgTkCDuPYjmA4QHW7rKgHnI2yuI_Q4,30608
|
52
52
|
pertpy/tools/_scgen/_scgenvae.py,sha256=v_6tZ4wY-JjdMH1QVd_wG4_N0PoaqB-FM8zC2JsDu1o,3935
|
53
53
|
pertpy/tools/_scgen/_utils.py,sha256=1upgOt1FpadfvNG05YpMjYYG-IAlxrC3l_ZxczmIczo,2841
|
54
|
-
pertpy-0.
|
55
|
-
pertpy-0.
|
56
|
-
pertpy-0.
|
57
|
-
pertpy-0.
|
54
|
+
pertpy-0.9.3.dist-info/METADATA,sha256=S6HYSnvP3MYzaICvPCVeFkkOd6HSQU14kMzRTv2RUkI,6852
|
55
|
+
pertpy-0.9.3.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
56
|
+
pertpy-0.9.3.dist-info/licenses/LICENSE,sha256=OZ-ZkXM5CmExJiEMM90b_7dGNNvRpj7kdE-49AnrLuI,1070
|
57
|
+
pertpy-0.9.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|