pertpy 0.7.0__py3-none-any.whl → 0.8.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- pertpy/__init__.py +2 -1
- pertpy/data/__init__.py +61 -0
- pertpy/data/_dataloader.py +27 -23
- pertpy/data/_datasets.py +58 -0
- pertpy/metadata/__init__.py +2 -0
- pertpy/metadata/_cell_line.py +39 -70
- pertpy/metadata/_compound.py +3 -4
- pertpy/metadata/_drug.py +2 -6
- pertpy/metadata/_look_up.py +38 -51
- pertpy/metadata/_metadata.py +7 -10
- pertpy/metadata/_moa.py +2 -6
- pertpy/plot/__init__.py +0 -5
- pertpy/preprocessing/__init__.py +2 -0
- pertpy/preprocessing/_guide_rna.py +2 -3
- pertpy/tools/__init__.py +42 -4
- pertpy/tools/_augur.py +14 -15
- pertpy/tools/_cinemaot.py +2 -2
- pertpy/tools/_coda/_base_coda.py +118 -142
- pertpy/tools/_coda/_sccoda.py +16 -15
- pertpy/tools/_coda/_tasccoda.py +21 -22
- pertpy/tools/_dialogue.py +18 -23
- pertpy/tools/_differential_gene_expression/__init__.py +20 -0
- pertpy/tools/_differential_gene_expression/_base.py +657 -0
- pertpy/tools/_differential_gene_expression/_checks.py +41 -0
- pertpy/tools/_differential_gene_expression/_dge_comparison.py +86 -0
- pertpy/tools/_differential_gene_expression/_edger.py +125 -0
- pertpy/tools/_differential_gene_expression/_formulaic.py +189 -0
- pertpy/tools/_differential_gene_expression/_pydeseq2.py +95 -0
- pertpy/tools/_differential_gene_expression/_simple_tests.py +162 -0
- pertpy/tools/_differential_gene_expression/_statsmodels.py +72 -0
- pertpy/tools/_distances/_distance_tests.py +21 -16
- pertpy/tools/_distances/_distances.py +406 -70
- pertpy/tools/_enrichment.py +10 -15
- pertpy/tools/_kernel_pca.py +1 -1
- pertpy/tools/_milo.py +76 -53
- pertpy/tools/_mixscape.py +15 -11
- pertpy/tools/_perturbation_space/_clustering.py +5 -2
- pertpy/tools/_perturbation_space/_comparison.py +112 -0
- pertpy/tools/_perturbation_space/_discriminator_classifiers.py +20 -22
- pertpy/tools/_perturbation_space/_perturbation_space.py +23 -21
- pertpy/tools/_perturbation_space/_simple.py +3 -3
- pertpy/tools/_scgen/__init__.py +1 -1
- pertpy/tools/_scgen/_base_components.py +2 -3
- pertpy/tools/_scgen/_scgen.py +33 -28
- pertpy/tools/_scgen/_utils.py +2 -2
- {pertpy-0.7.0.dist-info → pertpy-0.8.0.dist-info}/METADATA +22 -13
- pertpy-0.8.0.dist-info/RECORD +57 -0
- {pertpy-0.7.0.dist-info → pertpy-0.8.0.dist-info}/WHEEL +1 -1
- pertpy/plot/_augur.py +0 -171
- pertpy/plot/_coda.py +0 -601
- pertpy/plot/_guide_rna.py +0 -64
- pertpy/plot/_milopy.py +0 -209
- pertpy/plot/_mixscape.py +0 -355
- pertpy/tools/_differential_gene_expression.py +0 -325
- pertpy-0.7.0.dist-info/RECORD +0 -53
- {pertpy-0.7.0.dist-info → pertpy-0.8.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,57 @@
|
|
1
|
+
pertpy/__init__.py,sha256=GMFyfRErEysnlkYKMqQxtO7QbqjGki7SpvgtLxIuG6o,658
|
2
|
+
pertpy/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
+
pertpy/data/__init__.py,sha256=ah3yvoxkgbdMUNAWxS3SyqcUuVamBOSeuWkF2QRAEwM,2703
|
4
|
+
pertpy/data/_dataloader.py,sha256=fl16n82nun01gGiP7qhr5sShfcDchp0szzZp7aXkfBI,2495
|
5
|
+
pertpy/data/_datasets.py,sha256=I-keaJSTsRBySCPjiVonKmC9rRIM0AEgo0_0UlEX804,65616
|
6
|
+
pertpy/metadata/__init__.py,sha256=zoE_VXNyuKa4nlXlUk2nTgsHRW3jSQSpDEulcCnzOT0,222
|
7
|
+
pertpy/metadata/_cell_line.py,sha256=-8KSqmP5XjmLEmNX3TavxSM_MtIHwLWS_x3MVkk6JEw,38595
|
8
|
+
pertpy/metadata/_compound.py,sha256=JEFwP_TOTyMzfd2qFMb2VkJJvPhCVIvu6gs9Bq_stgs,4756
|
9
|
+
pertpy/metadata/_drug.py,sha256=8QDSyxiFl25JdS80EQJC_krg6fEe5LIQEE6BsV1r8nY,9006
|
10
|
+
pertpy/metadata/_look_up.py,sha256=DoWp6OxIk_HyyyOhW1p8z5E68IZ31_nZDnqxk1rJqps,28778
|
11
|
+
pertpy/metadata/_metadata.py,sha256=pvarnv3X5pblnvG8AQ8Omu5jQcC5ORzCxRk3FRhOLgs,3276
|
12
|
+
pertpy/metadata/_moa.py,sha256=u_OcMonjOeeoW5P9xOltquVSoTH3Vs80ztHsXf-X1DY,4701
|
13
|
+
pertpy/plot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
|
+
pertpy/preprocessing/__init__.py,sha256=VAPFaeq2_qCvdFkQTCj_Hm460HC4Tersu8Rig_tnp_Y,71
|
15
|
+
pertpy/preprocessing/_guide_rna.py,sha256=Xrv0cN16Ub1U1z-3LDNTkm98zs9JOjc2h1N7IAt_FaE,7612
|
16
|
+
pertpy/tools/__init__.py,sha256=yhDyv5J-nd3SDqc3T08Nzca8dzj3SpoVG2m9VU1rFUk,1481
|
17
|
+
pertpy/tools/_augur.py,sha256=UWro1nIEZe_rWtjlQCBv4ucqeh3Vt1m8IRzKlux72Z8,55683
|
18
|
+
pertpy/tools/_cinemaot.py,sha256=BD_oYC1TktbFMX7fpp0A57QAF6frLEgNQ_2wFUpxjyo,39509
|
19
|
+
pertpy/tools/_dialogue.py,sha256=f2fbhKWdm4Co79ZzVgtVq9xYwjYWFLdGNDeGFOO_pfM,51990
|
20
|
+
pertpy/tools/_enrichment.py,sha256=rjPHK9YBCJZfpa5Rvfxo3Ii7W5Mvm5dOdolAD7QazVg,21440
|
21
|
+
pertpy/tools/_kernel_pca.py,sha256=_EJ9WlBLjHOafF34sZGdyBgZL6Fj0WiJ1elVT1XMmo4,1579
|
22
|
+
pertpy/tools/_milo.py,sha256=kGnfx-CMOpYSl85fOW62J2X3utVjOsQFne7ixEptDmI,43691
|
23
|
+
pertpy/tools/_mixscape.py,sha256=FtH3PKvbLTe03LPgN4O9sS70oj_6AHz4Mz5otzEwRl8,52406
|
24
|
+
pertpy/tools/decoupler_LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
25
|
+
pertpy/tools/transferlearning_MMD_LICENSE,sha256=MUvDA-o_j9htRpI8fStVdCRuyLdPkQUuIH0a_EIc57w,1069
|
26
|
+
pertpy/tools/_coda/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
27
|
+
pertpy/tools/_coda/_base_coda.py,sha256=jnoLPFfluxB0_CK8-T-qolPa7xPIEb6NpeEpGwHPiNg,113058
|
28
|
+
pertpy/tools/_coda/_sccoda.py,sha256=gGmyd0MGpchulV9d4PxKSmGORyZ8fCDS9tQVPOuF_Og,22622
|
29
|
+
pertpy/tools/_coda/_tasccoda.py,sha256=vNk43OQHn7pBLsez2rmSj0bMZKOf8jZTI7G8TfBByRg,30665
|
30
|
+
pertpy/tools/_differential_gene_expression/__init__.py,sha256=sabAXym8mMLwp19ZjyBN7wp-oJh32iVj9plvJ-AbXlE,521
|
31
|
+
pertpy/tools/_differential_gene_expression/_base.py,sha256=qnQkK_hyIcViHBSkgJcAazC26JQ72bEyafKiytZikCY,23624
|
32
|
+
pertpy/tools/_differential_gene_expression/_checks.py,sha256=SxNHJDsCYZ6rWLTMEymEBpigs_B9cnXyw0kkAe1l6e0,1675
|
33
|
+
pertpy/tools/_differential_gene_expression/_dge_comparison.py,sha256=9HjmWkrqZhj_ZJeR-ymyEDzpRJNx7JiYJoStvCfKuCU,4188
|
34
|
+
pertpy/tools/_differential_gene_expression/_edger.py,sha256=JziiW5rkXuQBJISAD_LvB2HOZUgJ1_qoqiR5Q4hEoP0,4321
|
35
|
+
pertpy/tools/_differential_gene_expression/_formulaic.py,sha256=X4rPv4j8SDu5VJnf6_AIYJCCquUQka7G2LGtDLa8FhE,8715
|
36
|
+
pertpy/tools/_differential_gene_expression/_pydeseq2.py,sha256=JK7H7u4va0q_TLE_sqi4JEzoPBd_xNRycYGu1507HS4,4117
|
37
|
+
pertpy/tools/_differential_gene_expression/_simple_tests.py,sha256=tTSr0Z2Qbpxdy9bcO8Gi_up6R616IcoK_e4_rlanyx4,6621
|
38
|
+
pertpy/tools/_differential_gene_expression/_statsmodels.py,sha256=zSOwJYDJyrl3hsEhMI5Q9Pyw2XLuEuj7T0zSAVcP6tQ,2585
|
39
|
+
pertpy/tools/_distances/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
40
|
+
pertpy/tools/_distances/_distance_tests.py,sha256=mNmNu5cX0Wj5IegR6x5K-CbBSid8EhrH2jZPQxuvK4U,13521
|
41
|
+
pertpy/tools/_distances/_distances.py,sha256=iuHpBtWZbJhMZNSEjQkZUu6KPJXCjs_fX6YjopIWvwY,50343
|
42
|
+
pertpy/tools/_perturbation_space/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
43
|
+
pertpy/tools/_perturbation_space/_clustering.py,sha256=m52-J8c8OnIXRCf3NoFabIO2yMHIuy1X0m0amtsK2vE,3556
|
44
|
+
pertpy/tools/_perturbation_space/_comparison.py,sha256=rLO-EGU0I7t5MnLw4k1gYU-ypRu-JsDPLat1t4h2U2M,4329
|
45
|
+
pertpy/tools/_perturbation_space/_discriminator_classifiers.py,sha256=BNMP-2g4X_9jhs3Vf2rwlIjSCAcADkxBAFYGlsQ5Irw,21609
|
46
|
+
pertpy/tools/_perturbation_space/_metrics.py,sha256=y8-baP8WRdB1iDgvP3uuQxSCDxA2lcxvEHHM2C_vWHY,3248
|
47
|
+
pertpy/tools/_perturbation_space/_perturbation_space.py,sha256=cZPPzzK4_UZV7ktcD5BQVXEy6ITHrfkg1CLFov3TzsY,18497
|
48
|
+
pertpy/tools/_perturbation_space/_simple.py,sha256=LH5EYvcAbzFMvgd9bH7AUPKFmdioPiy2xG8xGaXzmq0,12624
|
49
|
+
pertpy/tools/_scgen/__init__.py,sha256=uERFlFyF88TH0uLiwmsUGEfHfLVCiZMFuk8gO5f7164,45
|
50
|
+
pertpy/tools/_scgen/_base_components.py,sha256=Qq8myRUm43q9XBrZ9gBggfa2cSV2wbz_KYoLgH7iF1A,3009
|
51
|
+
pertpy/tools/_scgen/_scgen.py,sha256=HPvFVjY9SS9bGqgTkCDuPYjmA4QHW7rKgHnI2yuI_Q4,30608
|
52
|
+
pertpy/tools/_scgen/_scgenvae.py,sha256=v_6tZ4wY-JjdMH1QVd_wG4_N0PoaqB-FM8zC2JsDu1o,3935
|
53
|
+
pertpy/tools/_scgen/_utils.py,sha256=1upgOt1FpadfvNG05YpMjYYG-IAlxrC3l_ZxczmIczo,2841
|
54
|
+
pertpy-0.8.0.dist-info/METADATA,sha256=cLAhPubizJ7vgCThHv-kHsAAvepUyRTnTHTKRKX9kYQ,6054
|
55
|
+
pertpy-0.8.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
56
|
+
pertpy-0.8.0.dist-info/licenses/LICENSE,sha256=OZ-ZkXM5CmExJiEMM90b_7dGNNvRpj7kdE-49AnrLuI,1070
|
57
|
+
pertpy-0.8.0.dist-info/RECORD,,
|
pertpy/plot/_augur.py
DELETED
@@ -1,171 +0,0 @@
|
|
1
|
-
from __future__ import annotations
|
2
|
-
|
3
|
-
import warnings
|
4
|
-
from typing import TYPE_CHECKING, Any
|
5
|
-
|
6
|
-
from anndata import AnnData
|
7
|
-
from matplotlib import pyplot as plt
|
8
|
-
|
9
|
-
if TYPE_CHECKING:
|
10
|
-
import pandas as pd
|
11
|
-
from matplotlib.axes import Axes
|
12
|
-
from matplotlib.figure import Figure
|
13
|
-
|
14
|
-
|
15
|
-
class AugurpyPlot:
|
16
|
-
"""Plotting functions for Augurpy."""
|
17
|
-
|
18
|
-
@staticmethod
|
19
|
-
def dp_scatter(results: pd.DataFrame, top_n=None, ax: Axes = None) -> Figure | Axes:
|
20
|
-
"""Plot result of differential prioritization.
|
21
|
-
|
22
|
-
Args:
|
23
|
-
results: Results after running differential prioritization.
|
24
|
-
top_n: optionally, the number of top prioritized cell types to label in the plot
|
25
|
-
ax: optionally, axes used to draw plot
|
26
|
-
return_figure: if `True` returns figure of the plot
|
27
|
-
|
28
|
-
Returns:
|
29
|
-
Axes of the plot.
|
30
|
-
|
31
|
-
Examples:
|
32
|
-
>>> import pertpy as pt
|
33
|
-
>>> adata = pt.dt.bhattacherjee()
|
34
|
-
>>> ag_rfc = pt.tl.Augur("random_forest_classifier")
|
35
|
-
|
36
|
-
>>> data_15 = ag_rfc.load(adata, condition_label="Maintenance_Cocaine", treatment_label="withdraw_15d_Cocaine")
|
37
|
-
>>> adata_15, results_15 = ag_rfc.predict(data_15, random_state=None, n_threads=4)
|
38
|
-
>>> adata_15_permute, results_15_permute = ag_rfc.predict(data_15, augur_mode="permute", n_subsamples=100, random_state=None, n_threads=4)
|
39
|
-
|
40
|
-
>>> data_48 = ag_rfc.load(adata, condition_label="Maintenance_Cocaine", treatment_label="withdraw_48h_Cocaine")
|
41
|
-
>>> adata_48, results_48 = ag_rfc.predict(data_48, random_state=None, n_threads=4)
|
42
|
-
>>> adata_48_permute, results_48_permute = ag_rfc.predict(data_48, augur_mode="permute", n_subsamples=100, random_state=None, n_threads=4)
|
43
|
-
|
44
|
-
>>> pvals = ag_rfc.predict_differential_prioritization(augur_results1=results_15, augur_results2=results_48, \
|
45
|
-
permuted_results1=results_15_permute, permuted_results2=results_48_permute)
|
46
|
-
>>> ag_rfc.plot_dp_scatter(pvals)
|
47
|
-
"""
|
48
|
-
warnings.warn(
|
49
|
-
"This function is deprecated and will be removed in pertpy 0.8.0!"
|
50
|
-
" Please use the corresponding 'pt.tl' object",
|
51
|
-
FutureWarning,
|
52
|
-
stacklevel=2,
|
53
|
-
)
|
54
|
-
|
55
|
-
from pertpy.tools import Augur
|
56
|
-
|
57
|
-
ag = Augur("random_forest_classifier")
|
58
|
-
|
59
|
-
return ag.plot_dp_scatter(results=results, top_n=top_n, ax=ax)
|
60
|
-
|
61
|
-
@staticmethod
|
62
|
-
def important_features(
|
63
|
-
data: dict[str, Any], key: str = "augurpy_results", top_n=10, ax: Axes = None
|
64
|
-
) -> Figure | Axes:
|
65
|
-
"""Plot a lollipop plot of the n features with largest feature importances.
|
66
|
-
|
67
|
-
Args:
|
68
|
-
results: results after running `predict()` as dictionary or the AnnData object.
|
69
|
-
key: Key in the AnnData object of the results
|
70
|
-
top_n: n number feature importance values to plot. Default is 10.
|
71
|
-
ax: optionally, axes used to draw plot
|
72
|
-
return_figure: if `True` returns figure of the plot, default is `False`
|
73
|
-
|
74
|
-
Returns:
|
75
|
-
Axes of the plot.
|
76
|
-
|
77
|
-
Examples:
|
78
|
-
>>> import pertpy as pt
|
79
|
-
>>> adata = pt.dt.sc_sim_augur()
|
80
|
-
>>> ag_rfc = pt.tl.Augur("random_forest_classifier")
|
81
|
-
>>> loaded_data = ag_rfc.load(adata)
|
82
|
-
>>> v_adata, v_results = ag_rfc.predict(
|
83
|
-
... loaded_data, subsample_size=20, select_variance_features=True, n_threads=4
|
84
|
-
... )
|
85
|
-
>>> ag_rfc.plot_important_features(v_results)
|
86
|
-
"""
|
87
|
-
warnings.warn(
|
88
|
-
"This function is deprecated and will be removed in pertpy 0.8.0!"
|
89
|
-
" Please use the corresponding 'pt.tl' object",
|
90
|
-
FutureWarning,
|
91
|
-
stacklevel=2,
|
92
|
-
)
|
93
|
-
|
94
|
-
from pertpy.tools import Augur
|
95
|
-
|
96
|
-
ag = Augur("random_forest_classifier")
|
97
|
-
|
98
|
-
return ag.plot_important_features(data=data, key=key, top_n=top_n, ax=ax)
|
99
|
-
|
100
|
-
@staticmethod
|
101
|
-
def lollipop(data: dict[str, Any], key: str = "augurpy_results", ax: Axes = None) -> Figure | Axes | None:
|
102
|
-
"""Plot a lollipop plot of the mean augur values.
|
103
|
-
|
104
|
-
Args:
|
105
|
-
results: results after running `predict()` as dictionary or the AnnData object.
|
106
|
-
key: Key in the AnnData object of the results
|
107
|
-
ax: optionally, axes used to draw plot
|
108
|
-
return_figure: if `True` returns figure of the plot
|
109
|
-
|
110
|
-
Returns:
|
111
|
-
Axes of the plot.
|
112
|
-
|
113
|
-
Examples:
|
114
|
-
>>> import pertpy as pt
|
115
|
-
>>> adata = pt.dt.sc_sim_augur()
|
116
|
-
>>> ag_rfc = pt.tl.Augur("random_forest_classifier")
|
117
|
-
>>> loaded_data = ag_rfc.load(adata)
|
118
|
-
>>> v_adata, v_results = ag_rfc.predict(
|
119
|
-
... loaded_data, subsample_size=20, select_variance_features=True, n_threads=4
|
120
|
-
... )
|
121
|
-
>>> ag_rfc.plot_lollipop(v_results)
|
122
|
-
"""
|
123
|
-
warnings.warn(
|
124
|
-
"This function is deprecated and will be removed in pertpy 0.8.0!"
|
125
|
-
" Please use the corresponding 'pt.tl' object",
|
126
|
-
FutureWarning,
|
127
|
-
stacklevel=2,
|
128
|
-
)
|
129
|
-
|
130
|
-
from pertpy.tools import Augur
|
131
|
-
|
132
|
-
ag = Augur("random_forest_classifier")
|
133
|
-
|
134
|
-
return ag.plot_lollipop(data=data, key=key, ax=ax)
|
135
|
-
|
136
|
-
@staticmethod
|
137
|
-
def scatterplot(results1: dict[str, Any], results2: dict[str, Any], top_n=None) -> Figure | Axes:
|
138
|
-
"""Create scatterplot with two augur results.
|
139
|
-
|
140
|
-
Args:
|
141
|
-
results1: results after running `predict()`
|
142
|
-
results2: results after running `predict()`
|
143
|
-
top_n: optionally, the number of top prioritized cell types to label in the plot
|
144
|
-
return_figure: if `True` returns figure of the plot
|
145
|
-
|
146
|
-
Returns:
|
147
|
-
Axes of the plot.
|
148
|
-
|
149
|
-
Examples:
|
150
|
-
>>> import pertpy as pt
|
151
|
-
>>> adata = pt.dt.sc_sim_augur()
|
152
|
-
>>> ag_rfc = pt.tl.Augur("random_forest_classifier")
|
153
|
-
>>> loaded_data = ag_rfc.load(adata)
|
154
|
-
>>> h_adata, h_results = ag_rfc.predict(loaded_data, subsample_size=20, n_threads=4)
|
155
|
-
>>> v_adata, v_results = ag_rfc.predict(
|
156
|
-
... loaded_data, subsample_size=20, select_variance_features=True, n_threads=4
|
157
|
-
... )
|
158
|
-
>>> ag_rfc.plot_scatterplot(v_results, h_results)
|
159
|
-
"""
|
160
|
-
warnings.warn(
|
161
|
-
"This function is deprecated and will be removed in pertpy 0.8.0!"
|
162
|
-
" Please use the corresponding 'pt.tl' object",
|
163
|
-
FutureWarning,
|
164
|
-
stacklevel=2,
|
165
|
-
)
|
166
|
-
|
167
|
-
from pertpy.tools import Augur
|
168
|
-
|
169
|
-
ag = Augur("random_forest_classifier")
|
170
|
-
|
171
|
-
return ag.plot_scatterplot(results1=results1, results2=results2, top_n=top_n)
|