rectanglepy 1.2.1__tar.gz → 1.4.0__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-1.2.1 → rectanglepy-1.4.0}/.bumpversion.cfg +1 -1
  2. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/.github/PULL_REQUEST_TEMPLATE.md +1 -0
  3. rectanglepy-1.4.0/LICENCE_COM +203 -0
  4. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/PKG-INFO +15 -2
  5. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/README.md +13 -0
  6. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/docs/contributing.md +4 -0
  7. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/pyproject.toml +1 -2
  8. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/src/rectanglepy/rectangle.py +7 -4
  9. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/src/rectanglepy/tl/deconvolution.py +18 -10
  10. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/tests/test_tl.py +3 -3
  11. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/.cruft.json +0 -0
  12. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/.editorconfig +0 -0
  13. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  14. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  15. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  16. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/.github/workflows/build.yaml +0 -0
  17. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/.github/workflows/release.yaml +0 -0
  18. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/.github/workflows/release_testpypi.yaml +0 -0
  19. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/.github/workflows/test.yaml +0 -0
  20. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/.gitignore +0 -0
  21. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/.pre-commit-config.yaml +0 -0
  22. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/.readthedocs.yaml +0 -0
  23. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/CHANGELOG.md +0 -0
  24. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/LICENSE +0 -0
  25. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/docs/Makefile +0 -0
  26. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/docs/_static/.gitkeep +0 -0
  27. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/docs/_static/rec_logo.001.png +0 -0
  28. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/docs/_templates/.gitkeep +0 -0
  29. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/docs/_templates/autosummary/class.rst +0 -0
  30. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/docs/api.md +0 -0
  31. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/docs/changelog.md +0 -0
  32. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/docs/conf.py +0 -0
  33. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/docs/extensions/typed_returns.py +0 -0
  34. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/docs/index.md +0 -0
  35. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/docs/installation.md +0 -0
  36. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/docs/make.bat +0 -0
  37. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/docs/notebooks/example.ipynb +0 -0
  38. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/docs/references.bib +0 -0
  39. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/docs/references.md +0 -0
  40. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/docs/tutorials.md +0 -0
  41. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/src/rectanglepy/__init__.py +0 -0
  42. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/src/rectanglepy/data/hao1_annotations_small.zip +0 -0
  43. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/src/rectanglepy/data/hao1_counts_small.zip +0 -0
  44. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/src/rectanglepy/data/small_fino_bulks.zip +0 -0
  45. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/src/rectanglepy/pp/__init__.py +0 -0
  46. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/src/rectanglepy/pp/create_signature.py +0 -0
  47. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/src/rectanglepy/pp/rectangle_signature.py +0 -0
  48. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/src/rectanglepy/tl/__init__.py +0 -0
  49. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/tests/data/TIL10_signature.txt +0 -0
  50. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/tests/data/bulk_small.csv +0 -0
  51. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/tests/data/cell_annotations_small.txt +0 -0
  52. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/tests/data/quanTIseq_SimRNAseq_mixture_smaller.csv +0 -0
  53. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/tests/data/quanTIseq_SimRNAseq_read_fractions_small.txt +0 -0
  54. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/tests/data/sc_object_small.csv +0 -0
  55. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/tests/data/signature_hao1.csv +0 -0
  56. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/tests/test_pp.py +0 -0
  57. {rectanglepy-1.2.1 → rectanglepy-1.4.0}/tests/test_rectangle.py +0 -0
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 1.2.1
2
+ current_version = 1.4.0
3
3
  tag = True
4
4
  commit = True
5
5
 
@@ -8,6 +8,7 @@ Please list closed, fixed, or resolved issues here with a # and the number.
8
8
 
9
9
  ### Checklist
10
10
 
11
+ - [ ] I have read and agree to the [Contributor License Agreement (CLA)](https://github.com/ComputationalBiomedicineGroup/Rectangle/blob/main/CLA.md)
11
12
  - [ ] Code builds correctly
12
13
  - [ ] Added tests that fail without the change (if possible)
13
14
  - [ ] All tests passing
@@ -0,0 +1,203 @@
1
+ Rectangle - Open Source Version
2
+
3
+ Copyright (C) 2026 Francesca Finotello, Bernhard Eder
4
+
5
+ This programme is released under proprietary licence for commercial use
6
+ (for proprietary licences, contact: innovation-psb@uibk.ac.at), but can
7
+ be used for non commercial use under the following conditions:
8
+
9
+ For non commercial use open source licence GNU General Public Licence v3 (GPLv3)
10
+
11
+
12
+ Rectangle
13
+
14
+ Rectangle is an open-source Python package for single-cell-informed cell-type
15
+ deconvolution of bulk and spatial transcriptomic data.
16
+
17
+
18
+ ## Licence
19
+
20
+ Rectangle is available under a **dual licence**:
21
+
22
+ - **Open source licence:** GNU General Public Licence v3 (GPLv3)
23
+ → Free to use as long as modifications and redistributions are also under GPLv3.
24
+
25
+ - **Commercial licence:** For companies that want to use Rectangle in proprietary
26
+ or closed applications the following applies:
27
+
28
+ Rectangle - Commercial Licence Terms
29
+
30
+ Copyright (C) 2026 Francesca Finotello, Bernhard Eder
31
+
32
+
33
+ For all users who use Rectangle under GPL v3 the following shall apply:
34
+
35
+
36
+ Contributor License Agreement (CLA)
37
+
38
+ Purpose of this Agreement
39
+
40
+ The project is distributed under a dual-licensing model, consisting of:
41
+ an open source license (GNU General Public License, GPL), and
42
+ a proprietary license offered by the project owner.
43
+ The purpose of this Agreement is to ensure that contributions initially
44
+ submitted under the GPL can be lawfully reused, integrated, and distributed
45
+ under the proprietary license.
46
+
47
+
48
+ Definitions
49
+
50
+ "Contribution" means any source code, documentation, bug fix, enhancement,
51
+ or other work intentionally submitted by the Contributor for inclusion in
52
+ the project.
53
+ "Contributor" means the individual or legal entity submitting a Contribution.
54
+ "Project Owner" means Francesca Finotello and Bernhard Eder, who maintain
55
+ and license the project.
56
+
57
+
58
+ Authorship and Authority
59
+
60
+ The Contributor represents and warrants that:
61
+ they are the sole author of the Contribution or have all necessary rights
62
+ to submit it;
63
+ the Contribution does not infringe any third-party rights;
64
+ the Contribution is free of patents, licenses, or other restrictions that
65
+ would conflict with the rights granted under this Agreement.
66
+
67
+
68
+ Grant of Rights (Dual Licensing Grant)
69
+
70
+ The Contributor hereby grants the Project Owner a perpetual, worldwide,
71
+ irrevocable, non-exclusive, transferable license to:
72
+ use,
73
+ reproduce,
74
+ modify,
75
+ combine with other works,
76
+ publish,
77
+ sublicense,
78
+ and distribute
79
+ the Contribution, including but not limited to the right to license and
80
+ distribute the Contribution:
81
+ under the GNU General Public License (GPL), and
82
+ under one or more proprietary licenses, as determined at the sole discretion
83
+ of the Project Owner.
84
+ This grant explicitly includes the right to incorporate Contributions
85
+ originally submitted under the GPL version of the project into proprietary
86
+ versions of the project.
87
+
88
+
89
+ No Obligation to Disclose Proprietary Versions
90
+
91
+ The Contributor acknowledges that Contributions submitted under this
92
+ Agreement are not required to be disclosed, published, or distributed
93
+ under an open source license in the proprietary version of the project.
94
+
95
+
96
+ Retention of Copyright
97
+
98
+ The Contributor retains all copyrights in their Contribution. This Agreement
99
+ does not constitute a transfer of ownership, but rather a comprehensive
100
+ grant of rights.
101
+
102
+
103
+ Attribution
104
+
105
+ Unless otherwise agreed, the Project Owner may list the Contributor's name
106
+ in a list of contributors. There is no obligation to provide attribution.
107
+
108
+
109
+ No Compensation
110
+
111
+ Contributions are made voluntarily and without compensation. The Contributor
112
+ is not entitled to fees, royalties, or other remuneration.
113
+
114
+
115
+ Disclaimer of Warranty
116
+
117
+ The Contribution is provided "AS IS", without warranty of any kind, express
118
+ or implied, including but not limited to warranties of merchantability or
119
+ fitness for a particular purpose.
120
+
121
+
122
+ Governing Law
123
+
124
+ This Agreement shall be governed by the laws of Austria, excluding its
125
+ conflict of law provisions.
126
+
127
+
128
+ Entire Agreement
129
+
130
+ This Agreement constitutes the entire agreement between the Contributor
131
+ and the Project Owner regarding Contributions and supersedes all prior
132
+ agreements or understandings.
133
+
134
+
135
+ Acceptance
136
+
137
+ By submitting a Contribution, the Contributor confirms that they have read,
138
+ understood, and agreed to the terms of this Agreement.
139
+
140
+
141
+
142
+ This licence permits the use of Rectangle in proprietary or non-open projects
143
+ under the following conditions:
144
+
145
+ 1. The licensee may use and distribute Rectangle in closed applications
146
+ without publishing the source code.
147
+ 2. The licence is non-transferable and applies only to the licensed company.
148
+ 3. Use is unlimited in time, provided that the licence fee has been paid in full.
149
+ 4. Support and updates are optional and must be agreed separately.
150
+ 5. Any use without a valid commercial licence is automatically subject to GPLv3.
151
+
152
+ For offers and pricing models: innovation-psb@uibk.ac.at
153
+ → Please contact us at innovation-psb@uibk.ac.at to obtain a commercial licence.
154
+
155
+
156
+ For all users of rectangle the following applies:
157
+
158
+
159
+ Updates & Support
160
+
161
+ 1. The copyright holder offers optional paid updates, maintenance and
162
+ technical support.
163
+ 2. Without a support contract, there is no entitlement to future versions
164
+ or bug fixes.
165
+
166
+
167
+ Liability & Warranty
168
+
169
+ 1. Rectangle is provided 'as is' without any express or implied warranty.
170
+ 2. The rights holder is not liable for any damage, loss of data or
171
+ consequential damage resulting from use.
172
+ 3. Liability is limited to a maximum of the licence fee paid.
173
+
174
+
175
+ Copyright & Ownership
176
+
177
+ 1. Rectangle remains the intellectual property of the rights holder at
178
+ all times.
179
+ 2. This licence does not transfer ownership, only rights of use.
180
+ 3. Modifications or derivative works by the licensee remain the property
181
+ of the licensee, unless they are derived directly from Rectangle code.
182
+
183
+
184
+ Termination
185
+
186
+ 1. This licence shall automatically expire if the licensee violates any
187
+ material terms of the agreement.
188
+ 2. Upon termination, the licensee must delete all copies of the Rectangle
189
+ software and may no longer use it.
190
+
191
+
192
+ Miscellaneous
193
+
194
+ 1. This licence is subject to the laws of Austria.
195
+ 2. The place of jurisdiction is the registered office of the rights holder.
196
+ 3. Amendments or additions must be made in writing.
197
+ 4. Should any provision be invalid, the remaining provisions shall remain valid.
198
+
199
+
200
+ ## Contact
201
+
202
+ **Authors:** Francesca Finotello, Bernhard Eder
203
+ **Email:** innovation-psb@uibk.ac.at
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rectanglepy
3
- Version: 1.2.1
3
+ Version: 1.4.0
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
@@ -681,6 +681,7 @@ License: GNU GENERAL PUBLIC LICENSE
681
681
  the library. If this is what you want to do, use the GNU Lesser General
682
682
  Public License instead of this License. But first, please read
683
683
  <https://www.gnu.org/licenses/why-not-lgpl.html>.
684
+ License-File: LICENCE_COM
684
685
  License-File: LICENSE
685
686
  Requires-Python: >=3.10
686
687
  Requires-Dist: anndata<0.10.9,>=0.8.0
@@ -690,7 +691,6 @@ Requires-Dist: osqp>=1.0.5
690
691
  Requires-Dist: pandas<3.0.0,>=2.0.0
691
692
  Requires-Dist: pydeseq2==0.4.11
692
693
  Requires-Dist: scipy==1.13.0
693
- Requires-Dist: setuptools>=80.0.0
694
694
  Requires-Dist: statsmodels>=0.14.1
695
695
  Provides-Extra: dev
696
696
  Requires-Dist: bump2version; extra == 'dev'
@@ -745,6 +745,17 @@ Install the latest release of `Rectangle` from `PyPI` <https://pypi.org/project/
745
745
  pip install rectanglepy
746
746
  ```
747
747
 
748
+ ## Licence
749
+
750
+ Rectangle is available under a **dual licence**:
751
+
752
+ - **Open-source licence:** [GNU General Public License v3.0 (GPLv3)](LICENSE)
753
+ → Free to use, modify, and redistribute as long as modifications and redistributions are also under GPLv3.
754
+
755
+ - **Commercial licence:** For companies and individuals who wish to use Rectangle in proprietary or closed-source applications, a separate commercial licence is available. See [LICENCE_COM](LICENCE_COM) for details.
756
+
757
+ For commercial licensing enquiries, please contact: **innovation-psb@uibk.ac.at**
758
+
748
759
  ## Release notes
749
760
 
750
761
  See the [changelog][changelog].
@@ -753,6 +764,8 @@ See the [changelog][changelog].
753
764
 
754
765
  If you found a bug, please use the [issue tracker][issue-tracker].
755
766
 
767
+ For commercial licensing: **innovation-psb@uibk.ac.at**
768
+
756
769
  ## Citation
757
770
 
758
771
  > If you use Rectangle in your project, please cite: (TBA)
@@ -33,6 +33,17 @@ Install the latest release of `Rectangle` from `PyPI` <https://pypi.org/project/
33
33
  pip install rectanglepy
34
34
  ```
35
35
 
36
+ ## Licence
37
+
38
+ Rectangle is available under a **dual licence**:
39
+
40
+ - **Open-source licence:** [GNU General Public License v3.0 (GPLv3)](LICENSE)
41
+ → Free to use, modify, and redistribute as long as modifications and redistributions are also under GPLv3.
42
+
43
+ - **Commercial licence:** For companies and individuals who wish to use Rectangle in proprietary or closed-source applications, a separate commercial licence is available. See [LICENCE_COM](LICENCE_COM) for details.
44
+
45
+ For commercial licensing enquiries, please contact: **innovation-psb@uibk.ac.at**
46
+
36
47
  ## Release notes
37
48
 
38
49
  See the [changelog][changelog].
@@ -41,6 +52,8 @@ See the [changelog][changelog].
41
52
 
42
53
  If you found a bug, please use the [issue tracker][issue-tracker].
43
54
 
55
+ For commercial licensing: **innovation-psb@uibk.ac.at**
56
+
44
57
  ## Citation
45
58
 
46
59
  > If you use Rectangle in your project, please cite: (TBA)
@@ -2,6 +2,10 @@
2
2
 
3
3
  We welcome contributions! The best way to contribute is by opening a pull request on GitHub.
4
4
 
5
+ ## Contributor License Agreement (CLA)
6
+
7
+ Rectangle uses a dual-licensing model (GPLv3 + commercial). By submitting a contribution (e.g., via pull request), you agree to the terms of our [Contributor License Agreement (CLA)](https://github.com/ComputationalBiomedicineGroup/Rectangle/blob/main/CLA.md). This ensures that contributions can be included in both the open-source and commercial versions of Rectangle.
8
+
5
9
  ## How to Contribute
6
10
 
7
11
  1. Fork the repository and create a new branch for your changes.
@@ -4,7 +4,7 @@ requires = ["hatchling"]
4
4
 
5
5
  [project]
6
6
  name = "rectanglepy"
7
- version = "1.2.1"
7
+ version = "1.4.0"
8
8
  description = "Hierarchical deconvolution of bulk transcriptomics"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -27,7 +27,6 @@ dependencies = [
27
27
  "numpy>=1.0.0,<2.0.0",
28
28
  "anndata>=0.8.0,<0.10.9",
29
29
  "statsmodels>=0.14.1",
30
- "setuptools>=80.0.0",
31
30
 
32
31
  ]
33
32
 
@@ -1,8 +1,9 @@
1
+ from importlib.resources import files
2
+
1
3
  import pandas as pd
2
4
  from anndata import AnnData
3
5
  from loguru import logger
4
6
  from pandas import DataFrame
5
- from pkg_resources import resource_stream
6
7
 
7
8
  from .pp import RectangleSignatureResult, build_rectangle_signatures
8
9
  from .tl import deconvolution
@@ -93,13 +94,15 @@ def load_tutorial_data() -> tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame]:
93
94
  -------
94
95
  The single-cell count data, annotations, and bulk data.
95
96
  """
96
- with resource_stream(__name__, "data/hao1_annotations_small.zip") as annotations_file:
97
+ data_dir = files(__package__) / "data"
98
+
99
+ with (data_dir / "hao1_annotations_small.zip").open("rb") as annotations_file:
97
100
  annotations = pd.read_csv(annotations_file, index_col=0, compression="zip")["0"]
98
101
 
99
- with resource_stream(__name__, "data/hao1_counts_small.zip") as counts_file:
102
+ with (data_dir / "hao1_counts_small.zip").open("rb") as counts_file:
100
103
  sc_counts = pd.read_csv(counts_file, index_col=0, compression="zip").astype("int")
101
104
 
102
- with resource_stream(__name__, "data/small_fino_bulks.zip") as bulks_file:
105
+ with (data_dir / "small_fino_bulks.zip").open("rb") as bulks_file:
103
106
  bulks = pd.read_csv(bulks_file, index_col=0, compression="zip")
104
107
 
105
108
  return sc_counts.T, annotations, bulks.T
@@ -121,13 +121,18 @@ def solve_qp(
121
121
  P = P / scale
122
122
  q = q / scale
123
123
 
124
+ # OSQP can return noticeably different solutions from active-set QP when P is singular/ill-conditioned.
125
+ # Add tiny ridge to make the problem strictly convex and closer to quadprog behavior.
126
+ ridge = 1e-8
127
+ P = ((P + P.T) / 2.0) + ridge * np.eye(n_vars, dtype=np.float64)
128
+
124
129
  # OSQP uses l <= A x <= u
125
130
  A = C.T # (n_constraints, n_vars)
126
131
  l = b
127
132
  u = np.full_like(l, np.inf, dtype=np.float64)
128
133
 
129
134
  # Sparse matrices (required/expected)
130
- P_sp = sp.csc_matrix((P + P.T) / 2.0) # enforce symmetry
135
+ P_sp = sp.csc_matrix(P)
131
136
  A_sp = sp.csc_matrix(A)
132
137
 
133
138
  solver = osqp.OSQP()
@@ -138,9 +143,12 @@ def solve_qp(
138
143
  l=l,
139
144
  u=u,
140
145
  verbose=False,
141
- eps_abs=1e-5,
142
- eps_rel=1e-5,
143
- max_iter=10000,
146
+ eps_abs=1e-8,
147
+ eps_rel=1e-8,
148
+ max_iter=50000,
149
+ polish=True,
150
+ warm_start=False,
151
+ scaled_termination=False,
144
152
  )
145
153
 
146
154
  res = solver.solve()
@@ -151,7 +159,7 @@ def solve_qp(
151
159
  return res.x
152
160
 
153
161
 
154
- def _find_dampening_constant(signature: pd.DataFrame, bulk: pd.Series, qp_gld: np.ndarray) -> int:
162
+ def _calculate_dampening_constant(signature: pd.DataFrame, bulk: pd.Series, qp_gld: np.ndarray) -> int:
155
163
  solutions_std = []
156
164
  np.random.seed(1)
157
165
  weights = np.square(1 / (np.dot(signature, qp_gld)))
@@ -182,7 +190,7 @@ def _find_dampening_constant(signature: pd.DataFrame, bulk: pd.Series, qp_gld: n
182
190
  return best_dampening_constant
183
191
 
184
192
 
185
- def _calculate_dwls(
193
+ def _calculate_ls(
186
194
  signature: pd.DataFrame,
187
195
  bulk: pd.Series,
188
196
  prev_assignments: list[int or str] = None,
@@ -193,7 +201,7 @@ def _calculate_dwls(
193
201
  bulk = bulk.loc[genes].sort_index().astype("double")
194
202
 
195
203
  approximate_solution = solve_qp(signature, bulk, prev_assignments, prev_weights)
196
- dampening_constant = _find_dampening_constant(signature, bulk, approximate_solution)
204
+ dampening_constant = _calculate_dampening_constant(signature, bulk, approximate_solution)
197
205
  multiplier = 2**dampening_constant
198
206
 
199
207
  max_iterations = 1000
@@ -296,7 +304,7 @@ def _deconvolute(
296
304
  bias_factors = bias_factors * 0 + 1 # set all bias factors to 1
297
305
 
298
306
  signature = pseudobulk_sig_cpm.loc[signature_genes_direct_reduced] * bias_factors
299
- start_fractions = _calculate_dwls(signature, bulk)
307
+ start_fractions = _calculate_ls(signature, bulk)
300
308
 
301
309
  if clustered_pseudobulk_sig_cpm is None:
302
310
  start_fractions, bulk_err = correct_for_unknown_cell_content(
@@ -315,8 +323,8 @@ def _deconvolute(
315
323
  clustered_signature = clustered_pseudobulk_sig_cpm.loc[clustered_signature_genes] * cluster_bias_factors
316
324
 
317
325
  try:
318
- clustered_fractions = _calculate_dwls(clustered_signature, bulk)
319
- recursive_fractions = _calculate_dwls(signature, bulk, signatures.assignments, clustered_fractions)
326
+ clustered_fractions = _calculate_ls(clustered_signature, bulk)
327
+ recursive_fractions = _calculate_ls(signature, bulk, signatures.assignments, clustered_fractions)
320
328
  except Exception as e:
321
329
  logger.warning(f"Recursive deconvolution failed with error: {e}")
322
330
  start_fractions, bulk_err = correct_for_unknown_cell_content(
@@ -9,7 +9,7 @@ from rectanglepy.pp.create_signature import (
9
9
  build_rectangle_signatures,
10
10
  )
11
11
  from rectanglepy.tl.deconvolution import (
12
- _calculate_dwls,
12
+ _calculate_ls,
13
13
  _scale_weights,
14
14
  correct_for_unknown_cell_content,
15
15
  deconvolution,
@@ -58,7 +58,7 @@ def test_simple_weighted_dampened_deconvolution(quantiseq_data):
58
58
  bulk = bulk.iloc[:, j]
59
59
  expected = real_fractions.T.iloc[:, j]
60
60
 
61
- result = _calculate_dwls(signature, bulk)
61
+ result = _calculate_ls(signature, bulk)
62
62
  corr = np.corrcoef(result, expected)[0, 1]
63
63
  rsme = np.sqrt(np.mean((result - expected) ** 2))
64
64
 
@@ -74,7 +74,7 @@ def test_correct_for_unknown_cell_content(small_data, quantiseq_data):
74
74
  bulk = bulk.iloc[:, 5]
75
75
  pseudo_signature = signature.pseudobulk_sig_cpm
76
76
  sig = pseudo_signature.loc[signature.signature_genes]
77
- fractions = _calculate_dwls(sig, bulk)
77
+ fractions = _calculate_ls(sig, bulk)
78
78
  biasfact = (pseudo_signature > 0).sum(axis=0)
79
79
  biasfact = biasfact / biasfact.min()
80
80
  result, bulk_err = correct_for_unknown_cell_content(bulk, pseudo_signature, fractions, biasfact)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes