rectanglepy 0.1.0__tar.gz → 0.1.3__tar.gz

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.
Files changed (57) hide show
  1. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/.bumpversion.cfg +1 -1
  2. rectanglepy-0.1.3/.github/ISSUE_TEMPLATE/bug_report.yml +21 -0
  3. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/PKG-INFO +2 -2
  4. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/README.md +1 -1
  5. rectanglepy-0.1.3/docs/notebooks/example.ipynb +351 -0
  6. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/pyproject.toml +1 -1
  7. rectanglepy-0.1.3/src/rectanglepy/data/hao1_annotations_small.zip +0 -0
  8. rectanglepy-0.1.3/src/rectanglepy/data/hao1_counts_small.zip +0 -0
  9. rectanglepy-0.1.3/src/rectanglepy/data/small_fino_bulks.zip +0 -0
  10. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/src/rectanglepy/rectangle.py +6 -6
  11. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/tests/test_rectangle.py +2 -2
  12. rectanglepy-0.1.0/.github/ISSUE_TEMPLATE/bug_report.yml +0 -89
  13. rectanglepy-0.1.0/docs/notebooks/example.ipynb +0 -351
  14. rectanglepy-0.1.0/src/rectanglepy/data/hao1_annotations_small.csv +0 -96
  15. rectanglepy-0.1.0/src/rectanglepy/data/hao1_counts_small.csv +0 -6934
  16. rectanglepy-0.1.0/src/rectanglepy/data/small_fino_bulks.csv +0 -3739
  17. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/.cruft.json +0 -0
  18. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/.editorconfig +0 -0
  19. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  20. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  21. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  22. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/.github/workflows/build.yaml +0 -0
  23. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/.github/workflows/release.yaml +0 -0
  24. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/.github/workflows/test.yaml +0 -0
  25. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/.gitignore +0 -0
  26. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/.pre-commit-config.yaml +0 -0
  27. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/.readthedocs.yaml +0 -0
  28. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/CHANGELOG.md +0 -0
  29. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/LICENSE +0 -0
  30. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/docs/Makefile +0 -0
  31. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/docs/_static/.gitkeep +0 -0
  32. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/docs/_templates/.gitkeep +0 -0
  33. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/docs/_templates/autosummary/class.rst +0 -0
  34. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/docs/api.md +0 -0
  35. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/docs/changelog.md +0 -0
  36. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/docs/conf.py +0 -0
  37. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/docs/contributing.md +0 -0
  38. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/docs/extensions/typed_returns.py +0 -0
  39. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/docs/index.md +0 -0
  40. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/docs/make.bat +0 -0
  41. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/docs/references.bib +0 -0
  42. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/docs/references.md +0 -0
  43. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/src/rectanglepy/__init__.py +0 -0
  44. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/src/rectanglepy/pp/__init__.py +0 -0
  45. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/src/rectanglepy/pp/create_signature.py +0 -0
  46. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/src/rectanglepy/pp/rectangle_signature.py +0 -0
  47. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/src/rectanglepy/tl/__init__.py +0 -0
  48. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/src/rectanglepy/tl/deconvolution.py +0 -0
  49. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/tests/data/TIL10_signature.txt +0 -0
  50. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/tests/data/bulk_small.csv +0 -0
  51. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/tests/data/cell_annotations_small.txt +0 -0
  52. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/tests/data/quanTIseq_SimRNAseq_mixture_smaller.csv +0 -0
  53. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/tests/data/quanTIseq_SimRNAseq_read_fractions_small.txt +0 -0
  54. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/tests/data/sc_object_small.csv +0 -0
  55. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/tests/data/signature_hao1.csv +0 -0
  56. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/tests/test_pp.py +0 -0
  57. {rectanglepy-0.1.0 → rectanglepy-0.1.3}/tests/test_tl.py +0 -0
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 0.1.0
2
+ current_version = 0.1.3
3
3
  tag = True
4
4
  commit = True
5
5
 
@@ -0,0 +1,21 @@
1
+ name: Bug report
2
+ description: Report something that is broken or incorrect
3
+ labels: bug
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ **Note**: Please read [this guide](https://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports)
9
+ detailing how to provide the necessary information for us to reproduce your bug. In brief:
10
+ * Please provide exact steps how to reproduce the bug in a clean Python environment.
11
+ * In case it's not clear what's causing this bug, please provide the data or the data generation procedure.
12
+ * Sometimes it is not possible to share the data, but usually it is possible to replicate problems on publicly
13
+ available datasets or to share a subset of your data.
14
+
15
+ - type: textarea
16
+ id: report
17
+ attributes:
18
+ label: Report
19
+ description: A clear and concise description of what the bug is.
20
+ validations:
21
+ required: true
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: rectanglepy
3
- Version: 0.1.0
3
+ Version: 0.1.3
4
4
  Summary: Hierarchical deconvolution of bulk transcriptomics
5
5
  Project-URL: Documentation, https://rectanglepy.readthedocs.io/
6
6
  Project-URL: Source, https://github.com/ComputationalBiomedicineGroup/Rectangle
@@ -97,6 +97,6 @@ If you found a bug, please use the [issue tracker][issue-tracker].
97
97
 
98
98
  [scverse-discourse]: https://discourse.scverse.org/
99
99
  [issue-tracker]: https://github.com/ComputationalBiomedicineGroup/Rectangle/issues
100
- [changelog]: https://Rectanglepy.readthedocs.io/latest/changelog.html
100
+ [changelog]: https://rectanglepy.readthedocs.io/changelog.html
101
101
  [link-docs]: https://Rectanglepy.readthedocs.io
102
102
  [link-api]: https://rectanglepy.readthedocs.io/api.html
@@ -45,6 +45,6 @@ If you found a bug, please use the [issue tracker][issue-tracker].
45
45
 
46
46
  [scverse-discourse]: https://discourse.scverse.org/
47
47
  [issue-tracker]: https://github.com/ComputationalBiomedicineGroup/Rectangle/issues
48
- [changelog]: https://Rectanglepy.readthedocs.io/latest/changelog.html
48
+ [changelog]: https://rectanglepy.readthedocs.io/changelog.html
49
49
  [link-docs]: https://Rectanglepy.readthedocs.io
50
50
  [link-api]: https://rectanglepy.readthedocs.io/api.html
@@ -0,0 +1,351 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "# Example workflow"
8
+ ]
9
+ },
10
+ {
11
+ "cell_type": "markdown",
12
+ "source": [],
13
+ "metadata": {
14
+ "collapsed": false
15
+ }
16
+ },
17
+ {
18
+ "cell_type": "code",
19
+ "execution_count": 1,
20
+ "metadata": {
21
+ "ExecuteTime": {
22
+ "end_time": "2024-03-25T16:12:40.629887Z",
23
+ "start_time": "2024-03-25T16:12:39.074585Z"
24
+ }
25
+ },
26
+ "outputs": [],
27
+ "source": [
28
+ "import rectanglepy as rectangle\n",
29
+ "from anndata import AnnData"
30
+ ]
31
+ },
32
+ {
33
+ "cell_type": "markdown",
34
+ "source": [
35
+ "## Load tutorial data"
36
+ ],
37
+ "metadata": {
38
+ "collapsed": false
39
+ }
40
+ },
41
+ {
42
+ "cell_type": "code",
43
+ "execution_count": 2,
44
+ "metadata": {
45
+ "ExecuteTime": {
46
+ "end_time": "2024-03-25T16:12:41.282874Z",
47
+ "start_time": "2024-03-25T16:12:40.630684Z"
48
+ }
49
+ },
50
+ "outputs": [],
51
+ "source": [
52
+ "sc_counts, annotations, bulks = rectangle.load_tutorial_data()"
53
+ ]
54
+ },
55
+ {
56
+ "cell_type": "code",
57
+ "execution_count": 3,
58
+ "outputs": [
59
+ {
60
+ "data": {
61
+ "text/plain": " MIR1302-2HG AL627309.1 AL627309.4 AC114498.1 \nE2L4_GATGCTACAGGCACAA 0 0 0 0 \\\nL5_AACAACCAGGAACTAT 0 0 0 0 \nL5_TCCTTCTGTACTCCGG 0 0 0 0 \nL2_GCCCGAACACGTATAC 0 0 0 0 \nE2L2_ATGCATGTCACACCCT 0 0 0 0 \n\n AL669831.5 FAM41C AL645608.5 NOC2L PERM1 ISG15 \nE2L4_GATGCTACAGGCACAA 0 0 0 0 0 7 \nL5_AACAACCAGGAACTAT 0 0 0 0 0 1 \nL5_TCCTTCTGTACTCCGG 0 0 0 0 0 0 \nL2_GCCCGAACACGTATAC 0 0 0 0 0 2 \nE2L2_ATGCATGTCACACCCT 0 1 0 0 0 1 ",
62
+ "text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>MIR1302-2HG</th>\n <th>AL627309.1</th>\n <th>AL627309.4</th>\n <th>AC114498.1</th>\n <th>AL669831.5</th>\n <th>FAM41C</th>\n <th>AL645608.5</th>\n <th>NOC2L</th>\n <th>PERM1</th>\n <th>ISG15</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>E2L4_GATGCTACAGGCACAA</th>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>7</td>\n </tr>\n <tr>\n <th>L5_AACAACCAGGAACTAT</th>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>1</td>\n </tr>\n <tr>\n <th>L5_TCCTTCTGTACTCCGG</th>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n </tr>\n <tr>\n <th>L2_GCCCGAACACGTATAC</th>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>2</td>\n </tr>\n <tr>\n <th>E2L2_ATGCATGTCACACCCT</th>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>1</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>1</td>\n </tr>\n </tbody>\n</table>\n</div>"
63
+ },
64
+ "execution_count": 3,
65
+ "metadata": {},
66
+ "output_type": "execute_result"
67
+ }
68
+ ],
69
+ "source": [
70
+ "sc_counts.iloc[:, :10].head()"
71
+ ],
72
+ "metadata": {
73
+ "collapsed": false,
74
+ "ExecuteTime": {
75
+ "end_time": "2024-03-25T16:12:41.300170Z",
76
+ "start_time": "2024-03-25T16:12:41.284686Z"
77
+ }
78
+ }
79
+ },
80
+ {
81
+ "cell_type": "code",
82
+ "execution_count": 4,
83
+ "outputs": [
84
+ {
85
+ "data": {
86
+ "text/plain": "E2L4_GATGCTACAGGCACAA Monocytes\nL5_AACAACCAGGAACTAT Monocytes\nL5_TCCTTCTGTACTCCGG Monocytes\nL2_GCCCGAACACGTATAC Monocytes\nE2L2_ATGCATGTCACACCCT Monocytes\nName: 0, dtype: object"
87
+ },
88
+ "execution_count": 4,
89
+ "metadata": {},
90
+ "output_type": "execute_result"
91
+ }
92
+ ],
93
+ "source": [
94
+ "annotations.head()"
95
+ ],
96
+ "metadata": {
97
+ "collapsed": false,
98
+ "ExecuteTime": {
99
+ "end_time": "2024-03-25T16:12:41.982618Z",
100
+ "start_time": "2024-03-25T16:12:41.979126Z"
101
+ }
102
+ }
103
+ },
104
+ {
105
+ "cell_type": "code",
106
+ "execution_count": 5,
107
+ "outputs": [
108
+ {
109
+ "data": {
110
+ "text/plain": " UBE2Q2P2 SSX9 CXorf67 EFCAB8 SPATA31B1P SDR16C6P GTPBP6 \npbmc_1 0.000000 0.0 0.118865 0.00000 0.0 0.0 57.280197 \\\npbmc_10 0.081115 0.0 0.086782 0.00000 0.0 0.0 72.275326 \npbmc_12 0.000000 0.0 0.188464 0.03157 0.0 0.0 50.997427 \n\n EFCAB12 A1BG A1CF \npbmc_1 0.252188 10.863071 0.0 \npbmc_10 0.095742 14.785649 0.0 \npbmc_12 0.100608 7.492537 0.0 ",
111
+ "text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>UBE2Q2P2</th>\n <th>SSX9</th>\n <th>CXorf67</th>\n <th>EFCAB8</th>\n <th>SPATA31B1P</th>\n <th>SDR16C6P</th>\n <th>GTPBP6</th>\n <th>EFCAB12</th>\n <th>A1BG</th>\n <th>A1CF</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>pbmc_1</th>\n <td>0.000000</td>\n <td>0.0</td>\n <td>0.118865</td>\n <td>0.00000</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>57.280197</td>\n <td>0.252188</td>\n <td>10.863071</td>\n <td>0.0</td>\n </tr>\n <tr>\n <th>pbmc_10</th>\n <td>0.081115</td>\n <td>0.0</td>\n <td>0.086782</td>\n <td>0.00000</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>72.275326</td>\n <td>0.095742</td>\n <td>14.785649</td>\n <td>0.0</td>\n </tr>\n <tr>\n <th>pbmc_12</th>\n <td>0.000000</td>\n <td>0.0</td>\n <td>0.188464</td>\n <td>0.03157</td>\n <td>0.0</td>\n <td>0.0</td>\n <td>50.997427</td>\n <td>0.100608</td>\n <td>7.492537</td>\n <td>0.0</td>\n </tr>\n </tbody>\n</table>\n</div>"
112
+ },
113
+ "execution_count": 5,
114
+ "metadata": {},
115
+ "output_type": "execute_result"
116
+ }
117
+ ],
118
+ "source": [
119
+ "bulks.iloc[:, :10].head()"
120
+ ],
121
+ "metadata": {
122
+ "collapsed": false,
123
+ "ExecuteTime": {
124
+ "end_time": "2024-03-25T16:12:43.131140Z",
125
+ "start_time": "2024-03-25T16:12:43.127235Z"
126
+ }
127
+ }
128
+ },
129
+ {
130
+ "cell_type": "markdown",
131
+ "metadata": {},
132
+ "source": [
133
+ "### Convert to AnnData object"
134
+ ]
135
+ },
136
+ {
137
+ "cell_type": "code",
138
+ "execution_count": 7,
139
+ "outputs": [],
140
+ "source": [
141
+ "sc_adata = AnnData(sc_counts, obs=annotations.to_frame(name=\"cell_type\"))"
142
+ ],
143
+ "metadata": {
144
+ "collapsed": false,
145
+ "ExecuteTime": {
146
+ "end_time": "2024-03-25T16:15:38.118620Z",
147
+ "start_time": "2024-03-25T16:15:38.098633Z"
148
+ }
149
+ }
150
+ },
151
+ {
152
+ "cell_type": "markdown",
153
+ "source": [
154
+ "# Single step Rectangle workflow"
155
+ ],
156
+ "metadata": {
157
+ "collapsed": false
158
+ }
159
+ },
160
+ {
161
+ "cell_type": "code",
162
+ "outputs": [],
163
+ "source": [
164
+ "estimations, signature_result = rectangle.rectangle(sc_adata, bulks)"
165
+ ],
166
+ "metadata": {
167
+ "collapsed": false
168
+ },
169
+ "execution_count": null
170
+ },
171
+ {
172
+ "cell_type": "code",
173
+ "outputs": [
174
+ {
175
+ "data": {
176
+ "text/plain": " B cells ILC Monocytes NK cells Plasma cells Platelet \npbmc_1 0.075919 0.001291 0.279064 0.046658 0.010834 0.008950 \\\npbmc_10 0.093986 0.003410 0.316445 0.033528 0.002279 0.036153 \npbmc_12 0.060533 0.017572 0.251589 0.114043 0.002038 0.027041 \n\n T cells CD4 conv T cells CD8 Tregs mDC pDC Unknown \npbmc_1 0.139600 0.268706 0.069930 0.017415 0.001971 0.079661 \npbmc_10 0.243435 0.146063 0.011599 0.032518 0.005273 0.075309 \npbmc_12 0.119488 0.325029 0.024586 0.027099 0.004422 0.026560 ",
177
+ "text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>B cells</th>\n <th>ILC</th>\n <th>Monocytes</th>\n <th>NK cells</th>\n <th>Plasma cells</th>\n <th>Platelet</th>\n <th>T cells CD4 conv</th>\n <th>T cells CD8</th>\n <th>Tregs</th>\n <th>mDC</th>\n <th>pDC</th>\n <th>Unknown</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>pbmc_1</th>\n <td>0.075919</td>\n <td>0.001291</td>\n <td>0.279064</td>\n <td>0.046658</td>\n <td>0.010834</td>\n <td>0.008950</td>\n <td>0.139600</td>\n <td>0.268706</td>\n <td>0.069930</td>\n <td>0.017415</td>\n <td>0.001971</td>\n <td>0.079661</td>\n </tr>\n <tr>\n <th>pbmc_10</th>\n <td>0.093986</td>\n <td>0.003410</td>\n <td>0.316445</td>\n <td>0.033528</td>\n <td>0.002279</td>\n <td>0.036153</td>\n <td>0.243435</td>\n <td>0.146063</td>\n <td>0.011599</td>\n <td>0.032518</td>\n <td>0.005273</td>\n <td>0.075309</td>\n </tr>\n <tr>\n <th>pbmc_12</th>\n <td>0.060533</td>\n <td>0.017572</td>\n <td>0.251589</td>\n <td>0.114043</td>\n <td>0.002038</td>\n <td>0.027041</td>\n <td>0.119488</td>\n <td>0.325029</td>\n <td>0.024586</td>\n <td>0.027099</td>\n <td>0.004422</td>\n <td>0.026560</td>\n </tr>\n </tbody>\n</table>\n</div>"
178
+ },
179
+ "execution_count": 9,
180
+ "metadata": {},
181
+ "output_type": "execute_result"
182
+ }
183
+ ],
184
+ "source": [
185
+ "estimations"
186
+ ],
187
+ "metadata": {
188
+ "collapsed": false,
189
+ "ExecuteTime": {
190
+ "end_time": "2024-03-25T16:18:17.737030Z",
191
+ "start_time": "2024-03-25T16:18:17.731946Z"
192
+ }
193
+ },
194
+ "execution_count": 9
195
+ },
196
+ {
197
+ "cell_type": "markdown",
198
+ "source": [
199
+ "signature_result is a [`RectangleSignatureResult`](../generated/rectanglepy.pp.RectangleSignatureResult.rst) object. Results of estimations vary slightly from machine to machine (due to difference in theunderlying linear algebra packages)"
200
+ ],
201
+ "metadata": {
202
+ "collapsed": false
203
+ }
204
+ },
205
+ {
206
+ "cell_type": "markdown",
207
+ "source": [
208
+ "## Even sampling and consensus"
209
+ ],
210
+ "metadata": {
211
+ "collapsed": false
212
+ }
213
+ },
214
+ {
215
+ "cell_type": "markdown",
216
+ "source": [
217
+ "We recommend even subsampling of the sc data.\n",
218
+ "You can use the `sample_size` parameter to sample a fixed number of cells per cell type, and run the consensus multiple times to get a more robust result."
219
+ ],
220
+ "metadata": {
221
+ "collapsed": false
222
+ }
223
+ },
224
+ {
225
+ "cell_type": "code",
226
+ "outputs": [],
227
+ "source": [
228
+ "estimations, signature_result = rectangle.rectangle(sc_adata, bulks, consensus_runs=5, sample_size=1500)"
229
+ ],
230
+ "metadata": {
231
+ "collapsed": false
232
+ },
233
+ "execution_count": null
234
+ },
235
+ {
236
+ "cell_type": "markdown",
237
+ "source": [
238
+ "# 2-step Rectangle workflow"
239
+ ],
240
+ "metadata": {
241
+ "collapsed": false
242
+ }
243
+ },
244
+ {
245
+ "cell_type": "markdown",
246
+ "source": [
247
+ "Rectangle can also be run in two steps, first creating the signature and then deconvoluting the bulk data."
248
+ ],
249
+ "metadata": {
250
+ "collapsed": false
251
+ }
252
+ },
253
+ {
254
+ "cell_type": "markdown",
255
+ "source": [
256
+ "## Create Signature result"
257
+ ],
258
+ "metadata": {
259
+ "collapsed": false
260
+ }
261
+ },
262
+ {
263
+ "cell_type": "code",
264
+ "execution_count": null,
265
+ "outputs": [],
266
+ "source": [
267
+ "signature_result = rectangle.pp.build_rectangle_signatures(sc_adata, bulks=bulks)"
268
+ ],
269
+ "metadata": {
270
+ "collapsed": false
271
+ }
272
+ },
273
+ {
274
+ "cell_type": "markdown",
275
+ "source": [
276
+ "This creates a [`RectangleSignatureResult`](../generated/rectanglepy.pp.RectangleSignatureResult.rst) object."
277
+ ],
278
+ "metadata": {
279
+ "collapsed": false
280
+ }
281
+ },
282
+ {
283
+ "cell_type": "markdown",
284
+ "source": [
285
+ "## Deconvolute bulk data"
286
+ ],
287
+ "metadata": {
288
+ "collapsed": false
289
+ }
290
+ },
291
+ {
292
+ "cell_type": "code",
293
+ "execution_count": null,
294
+ "outputs": [],
295
+ "source": [
296
+ "estimations = rectangle.tl.deconvolution(signature_result, bulks)"
297
+ ],
298
+ "metadata": {
299
+ "collapsed": false
300
+ }
301
+ },
302
+ {
303
+ "cell_type": "markdown",
304
+ "source": [
305
+ "This returns a pandas DataFrame with the estimated cell type proportions."
306
+ ],
307
+ "metadata": {
308
+ "collapsed": false
309
+ }
310
+ },
311
+ {
312
+ "cell_type": "code",
313
+ "outputs": [],
314
+ "source": [],
315
+ "metadata": {
316
+ "collapsed": false,
317
+ "ExecuteTime": {
318
+ "end_time": "2024-03-07T18:39:06.840457Z",
319
+ "start_time": "2024-03-07T18:39:06.838965Z"
320
+ }
321
+ },
322
+ "execution_count": 21
323
+ }
324
+ ],
325
+ "metadata": {
326
+ "kernelspec": {
327
+ "display_name": "Python 3.9.12 ('squidpy39')",
328
+ "language": "python",
329
+ "name": "python3"
330
+ },
331
+ "language_info": {
332
+ "codemirror_mode": {
333
+ "name": "ipython",
334
+ "version": 3
335
+ },
336
+ "file_extension": ".py",
337
+ "mimetype": "text/x-python",
338
+ "name": "python",
339
+ "nbconvert_exporter": "python",
340
+ "pygments_lexer": "ipython3",
341
+ "version": "3.9.12"
342
+ },
343
+ "vscode": {
344
+ "interpreter": {
345
+ "hash": "ae6466e8d4f517858789b5c9e8f0ed238fb8964458a36305fca7bddc149e9c64"
346
+ }
347
+ }
348
+ },
349
+ "nbformat": 4,
350
+ "nbformat_minor": 4
351
+ }
@@ -4,7 +4,7 @@ requires = ["hatchling"]
4
4
 
5
5
  [project]
6
6
  name = "rectanglepy"
7
- version = "0.1.0"
7
+ version = "0.1.3"
8
8
  description = "Hierarchical deconvolution of bulk transcriptomics"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -105,13 +105,13 @@ def load_tutorial_data() -> tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]:
105
105
  -------
106
106
  The single-cell count data, annotations, and bulk data.
107
107
  """
108
- with resource_stream(__name__, "data/hao1_annotations_small.csv") as annotations_file:
109
- annotations = pd.read_csv(annotations_file, index_col=0)["0"]
108
+ with resource_stream(__name__, "data/hao1_annotations_small.zip") as annotations_file:
109
+ annotations = pd.read_csv(annotations_file, index_col=0, compression="zip")["0"]
110
110
 
111
- with resource_stream(__name__, "data/hao1_counts_small.csv") as counts_file:
112
- sc_counts = pd.read_csv(counts_file, index_col=0).astype("int")
111
+ with resource_stream(__name__, "data/hao1_counts_small.zip") as counts_file:
112
+ sc_counts = pd.read_csv(counts_file, index_col=0, compression="zip").astype("int")
113
113
 
114
- with resource_stream(__name__, "data/small_fino_bulks.csv") as bulks_file:
115
- bulks = pd.read_csv(bulks_file, index_col=0)
114
+ with resource_stream(__name__, "data/small_fino_bulks.zip") as bulks_file:
115
+ bulks = pd.read_csv(bulks_file, index_col=0, compression="zip")
116
116
 
117
117
  return sc_counts.T, annotations, bulks.T
@@ -16,7 +16,7 @@ def test_rectangle():
16
16
  sc_data, annotations, bulks = rectanglepy.load_tutorial_data()
17
17
  sc_data_adata = AnnData(sc_data, obs=annotations.to_frame(name="cell_type"))
18
18
 
19
- result = rectanglepy.rectangle(sc_data_adata, bulks, optimize_cutoffs=False, p=0.1, lfc=0.5)
19
+ result = rectanglepy.rectangle(sc_data_adata, bulks)
20
20
 
21
21
  assert isinstance(result[0], pd.DataFrame)
22
22
  assert isinstance(result[1], RectangleSignatureResult)
@@ -27,7 +27,7 @@ def test_rectangle_consensus():
27
27
  sc_data_adata = AnnData(sc_data, obs=annotations.to_frame(name="cell_type"))
28
28
 
29
29
  result = rectanglepy.rectangle(
30
- sc_data_adata, bulks, optimize_cutoffs=False, p=0.5, lfc=0.0, consensus_runs=2, sample_size=9
30
+ sc_data_adata, bulks, optimize_cutoffs=False, p=0.5, lfc=0.0, consensus_runs=2, sample_size=50
31
31
  )
32
32
 
33
33
  assert isinstance(result[0], pd.DataFrame)
@@ -1,89 +0,0 @@
1
- name: Bug report
2
- description: Report something that is broken or incorrect
3
- labels: bug
4
- body:
5
- - type: markdown
6
- attributes:
7
- value: |
8
- **Note**: Please read [this guide](https://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports)
9
- detailing how to provide the necessary information for us to reproduce your bug. In brief:
10
- * Please provide exact steps how to reproduce the bug in a clean Python environment.
11
- * In case it's not clear what's causing this bug, please provide the data or the data generation procedure.
12
- * Sometimes it is not possible to share the data, but usually it is possible to replicate problems on publicly
13
- available datasets or to share a subset of your data.
14
-
15
- - type: textarea
16
- id: report
17
- attributes:
18
- label: Report
19
- description: A clear and concise description of what the bug is.
20
- validations:
21
- required: true
22
-
23
- - type: textarea
24
- id: versions
25
- attributes:
26
- label: Version information
27
- description: |
28
- Please paste below the output of
29
-
30
- ```python
31
- import session_info
32
- session_info.show(html=False, dependencies=True)
33
- ```
34
- placeholder: |
35
- -----
36
- anndata 0.8.0rc2.dev27+ge524389
37
- session_info 1.0.0
38
- -----
39
- asttokens NA
40
- awkward 1.8.0
41
- backcall 0.2.0
42
- cython_runtime NA
43
- dateutil 2.8.2
44
- debugpy 1.6.0
45
- decorator 5.1.1
46
- entrypoints 0.4
47
- executing 0.8.3
48
- h5py 3.7.0
49
- ipykernel 6.15.0
50
- jedi 0.18.1
51
- mpl_toolkits NA
52
- natsort 8.1.0
53
- numpy 1.22.4
54
- packaging 21.3
55
- pandas 1.4.2
56
- parso 0.8.3
57
- pexpect 4.8.0
58
- pickleshare 0.7.5
59
- pkg_resources NA
60
- prompt_toolkit 3.0.29
61
- psutil 5.9.1
62
- ptyprocess 0.7.0
63
- pure_eval 0.2.2
64
- pydev_ipython NA
65
- pydevconsole NA
66
- pydevd 2.8.0
67
- pydevd_file_utils NA
68
- pydevd_plugins NA
69
- pydevd_tracing NA
70
- pygments 2.12.0
71
- pytz 2022.1
72
- scipy 1.8.1
73
- setuptools 62.5.0
74
- setuptools_scm NA
75
- six 1.16.0
76
- stack_data 0.3.0
77
- tornado 6.1
78
- traitlets 5.3.0
79
- wcwidth 0.2.5
80
- zmq 23.1.0
81
- -----
82
- IPython 8.4.0
83
- jupyter_client 7.3.4
84
- jupyter_core 4.10.0
85
- -----
86
- Python 3.9.13 | packaged by conda-forge | (main, May 27 2022, 16:58:50) [GCC 10.3.0]
87
- Linux-5.18.6-arch1-1-x86_64-with-glibc2.35
88
- -----
89
- Session information updated at 2022-07-07 17:55