pertpy 0.7.0__py3-none-any.whl → 0.9.1__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. pertpy/__init__.py +2 -1
  2. pertpy/data/__init__.py +61 -0
  3. pertpy/data/_dataloader.py +27 -23
  4. pertpy/data/_datasets.py +58 -0
  5. pertpy/metadata/__init__.py +2 -0
  6. pertpy/metadata/_cell_line.py +39 -70
  7. pertpy/metadata/_compound.py +3 -4
  8. pertpy/metadata/_drug.py +2 -6
  9. pertpy/metadata/_look_up.py +38 -51
  10. pertpy/metadata/_metadata.py +7 -10
  11. pertpy/metadata/_moa.py +2 -6
  12. pertpy/plot/__init__.py +0 -5
  13. pertpy/preprocessing/__init__.py +2 -0
  14. pertpy/preprocessing/_guide_rna.py +6 -7
  15. pertpy/tools/__init__.py +67 -6
  16. pertpy/tools/_augur.py +14 -15
  17. pertpy/tools/_cinemaot.py +2 -2
  18. pertpy/tools/_coda/_base_coda.py +118 -142
  19. pertpy/tools/_coda/_sccoda.py +16 -15
  20. pertpy/tools/_coda/_tasccoda.py +21 -22
  21. pertpy/tools/_dialogue.py +18 -23
  22. pertpy/tools/_differential_gene_expression/__init__.py +20 -0
  23. pertpy/tools/_differential_gene_expression/_base.py +657 -0
  24. pertpy/tools/_differential_gene_expression/_checks.py +41 -0
  25. pertpy/tools/_differential_gene_expression/_dge_comparison.py +86 -0
  26. pertpy/tools/_differential_gene_expression/_edger.py +125 -0
  27. pertpy/tools/_differential_gene_expression/_formulaic.py +189 -0
  28. pertpy/tools/_differential_gene_expression/_pydeseq2.py +95 -0
  29. pertpy/tools/_differential_gene_expression/_simple_tests.py +162 -0
  30. pertpy/tools/_differential_gene_expression/_statsmodels.py +72 -0
  31. pertpy/tools/_distances/_distance_tests.py +21 -16
  32. pertpy/tools/_distances/_distances.py +406 -70
  33. pertpy/tools/_enrichment.py +10 -15
  34. pertpy/tools/_kernel_pca.py +1 -1
  35. pertpy/tools/_milo.py +77 -54
  36. pertpy/tools/_mixscape.py +15 -11
  37. pertpy/tools/_perturbation_space/_clustering.py +5 -2
  38. pertpy/tools/_perturbation_space/_comparison.py +112 -0
  39. pertpy/tools/_perturbation_space/_discriminator_classifiers.py +21 -23
  40. pertpy/tools/_perturbation_space/_perturbation_space.py +23 -21
  41. pertpy/tools/_perturbation_space/_simple.py +3 -3
  42. pertpy/tools/_scgen/__init__.py +1 -1
  43. pertpy/tools/_scgen/_base_components.py +2 -3
  44. pertpy/tools/_scgen/_scgen.py +33 -28
  45. pertpy/tools/_scgen/_utils.py +2 -2
  46. {pertpy-0.7.0.dist-info → pertpy-0.9.1.dist-info}/METADATA +32 -14
  47. pertpy-0.9.1.dist-info/RECORD +57 -0
  48. {pertpy-0.7.0.dist-info → pertpy-0.9.1.dist-info}/WHEEL +1 -1
  49. pertpy/plot/_augur.py +0 -171
  50. pertpy/plot/_coda.py +0 -601
  51. pertpy/plot/_guide_rna.py +0 -64
  52. pertpy/plot/_milopy.py +0 -209
  53. pertpy/plot/_mixscape.py +0 -355
  54. pertpy/tools/_differential_gene_expression.py +0 -325
  55. pertpy-0.7.0.dist-info/RECORD +0 -53
  56. {pertpy-0.7.0.dist-info → pertpy-0.9.1.dist-info}/licenses/LICENSE +0 -0
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pertpy
3
- Version: 0.7.0
3
+ Version: 0.9.1
4
4
  Summary: Perturbation Analysis in the scverse ecosystem.
5
5
  Project-URL: Documentation, https://pertpy.readthedocs.io
6
- Project-URL: Source, https://github.com/theislab/pertpy
7
- Project-URL: Home-page, https://github.com/theislab/pertpy
8
- Author: Lukas Heumos, Yuge Ji, Alejandro Tejada, Johannes Köster, Emma Dann, Xinyue Zhang, Xichen Wu, Amir Moinfar, Sergei Rybakov, Tessa Green, Stefan Peidli, Antonia Schumacher, Lilly May
6
+ Project-URL: Source, https://github.com/scverse/pertpy
7
+ Project-URL: Home-page, https://github.com/scverse/pertpy
8
+ Author: Lukas Heumos, Yuge Ji, Lilly May, Alejandro Tejada, Johannes Köster, Emma Dann, Xinyue Zhang, Xichen Wu, Tessa Green, Stefan Peidli, Antonia Schumacher, Gregor Sturm
9
9
  Maintainer-email: Lukas Heumos <lukas.heumos@posteo.net>
10
10
  License: MIT License
11
11
 
@@ -41,15 +41,15 @@ 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
47
48
  Requires-Dist: adjusttext
48
- Requires-Dist: arviz
49
49
  Requires-Dist: blitzgsea
50
50
  Requires-Dist: decoupler
51
+ Requires-Dist: lamin-utils
51
52
  Requires-Dist: muon
52
- Requires-Dist: numpyro
53
53
  Requires-Dist: openpyxl
54
54
  Requires-Dist: ott-jax
55
55
  Requires-Dist: pubchempy
@@ -61,10 +61,14 @@ Requires-Dist: scikit-misc
61
61
  Requires-Dist: scipy
62
62
  Requires-Dist: scvi-tools
63
63
  Requires-Dist: sparsecca
64
- Requires-Dist: toytree
65
64
  Provides-Extra: coda
65
+ Requires-Dist: arviz; extra == 'coda'
66
66
  Requires-Dist: ete3; extra == 'coda'
67
67
  Requires-Dist: pyqt5; extra == 'coda'
68
+ Requires-Dist: toytree; extra == 'coda'
69
+ Provides-Extra: de
70
+ Requires-Dist: formulaic; extra == 'de'
71
+ Requires-Dist: pydeseq2; extra == 'de'
68
72
  Provides-Extra: dev
69
73
  Requires-Dist: pre-commit; extra == 'dev'
70
74
  Provides-Extra: doc
@@ -94,18 +98,18 @@ Requires-Dist: pytest; extra == 'test'
94
98
  Description-Content-Type: text/markdown
95
99
 
96
100
  [![Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
97
- [![Build](https://github.com/theislab/pertpy/actions/workflows/build.yml/badge.svg)](https://github.com/theislab/pertpy/actions/workflows/build.yml)
98
- [![codecov](https://codecov.io/gh/theislab/pertpy/graph/badge.svg?token=1dTpIPBShv)](https://codecov.io/gh/theislab/pertpy)
99
- [![License](https://img.shields.io/github/license/theislab/pertpy)](https://opensource.org/licenses/Apache2.0)
101
+ [![Build](https://github.com/scverse/pertpy/actions/workflows/build.yml/badge.svg)](https://github.com/scverse/pertpy/actions/workflows/build.yml)
102
+ [![codecov](https://codecov.io/gh/scverse/pertpy/graph/badge.svg?token=1dTpIPBShv)](https://codecov.io/gh/scverse/pertpy)
103
+ [![License](https://img.shields.io/github/license/scverse/pertpy)](https://opensource.org/licenses/Apache2.0)
100
104
  [![PyPI](https://img.shields.io/pypi/v/pertpy.svg)](https://pypi.org/project/pertpy/)
101
105
  [![Python Version](https://img.shields.io/pypi/pyversions/pertpy)](https://pypi.org/project/pertpy)
102
106
  [![Read the Docs](https://img.shields.io/readthedocs/pertpy/latest.svg?label=Read%20the%20Docs)](https://pertpy.readthedocs.io/)
103
- [![Test](https://github.com/theislab/pertpy/actions/workflows/test.yml/badge.svg)](https://github.com/theislab/pertpy/actions/workflows/test.yml)
107
+ [![Test](https://github.com/scverse/pertpy/actions/workflows/test.yml/badge.svg)](https://github.com/scverse/pertpy/actions/workflows/test.yml)
104
108
  [![PyPI](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
105
109
 
106
110
  # pertpy
107
111
 
108
- ![fig1](https://github.com/theislab/pertpy/assets/99650244/182fa9c3-6d23-4002-b86a-82bf2a243377)
112
+ ![fig1](https://github.com/user-attachments/assets/d2e32d69-b767-4be3-a938-77a9dce45d3f)
109
113
 
110
114
  ## Documentation
111
115
 
@@ -113,18 +117,32 @@ Please read the [documentation](https://pertpy.readthedocs.io/en/latest).
113
117
 
114
118
  ## Installation
115
119
 
116
- You can install _pertpy_ via [pip] from [PyPI]:
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]:
117
124
 
118
125
  ```console
119
126
  pip install pertpy
120
127
  ```
121
128
 
122
- if you want to use scCODA please install it as:
129
+ if you want to use scCODA or tascCODA, please install pertpy as follows:
123
130
 
124
131
  ```console
125
132
  pip install pertpy[coda]
126
133
  ```
127
134
 
135
+ If you want to use the differential gene expression interface, please install pertpy by running:
136
+
137
+ ```console
138
+ pip install pertpy[de]
139
+ ```
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
+
128
146
  [pip]: https://pip.pypa.io/
129
147
  [pypi]: https://pypi.org/
130
148
  [usage]: https://pertpy.readthedocs.io/en/latest/usage/usage.html
@@ -0,0 +1,57 @@
1
+ pertpy/__init__.py,sha256=OaiANyTVOegBAYDyD4004b7LXIWFpN2HkvQpKLC8P3I,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=IgKhXEyfRwEA7ccKJNLA_aIxKHm09QJINM09KaIwn68,7644
16
+ pertpy/tools/__init__.py,sha256=laoRUOIjnjR4D41miOg6tISC_8pNJsu79785_CxMbSE,2603
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=FDFGmGMkJiVrvATEnOeAMCe-Q2w7F0nbBMuACVbyIQI,43699
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=OA2eZeG_4iuW1T5ilsRIkS0rU-azmwEch7IuB546KSY,21617
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.9.1.dist-info/METADATA,sha256=JrAJR7n35TG8BZ30XmTdsrkaI6ADaz1PQE_DGLHT1TM,6848
55
+ pertpy-0.9.1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
56
+ pertpy-0.9.1.dist-info/licenses/LICENSE,sha256=OZ-ZkXM5CmExJiEMM90b_7dGNNvRpj7kdE-49AnrLuI,1070
57
+ pertpy-0.9.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.22.5
2
+ Generator: hatchling 1.25.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
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)