Rectangle
Rectangle is an open-source Python package for single-cell-informed cell-type deconvolution of bulk and spatial transcriptomic data, which is part of the scverse ecosystem.
Rectangle presents a novel approach to second-generation deconvolution, characterized by hierarchical signature building for fine-grained cell-type deconvolution, estimation and correction of unknown cellular content, and efficient handling of large-scale single-cell data during signature matrix computation.
Rectangle was developed to overcome the current challenges in cell-type deconvolution, providing a robust and accurate methodology while ensuring a low computational profile.
Getting started
Please refer to the documentation. In particular, the
-
Tutorials for a step-by-step guide on how to use Rectangle, and the
Installation
You need Python 3.10–3.12 installed on your system.
How to install Rectangle:
Install the latest release of Rectangle from PyPI https://pypi.org/project/rectanglepy/:
pip install rectanglepy
How Rectangle works
Rectangle performs robust multiscale deconvolution informed by single-cell transcriptomics. Rectangle takes annotated scRNA-seq data and a bulk RNA-seq mixture as input. In the signature-building phase, it performs bootstrapped pseudobulking of the scRNA-seq data, followed by signature-gene selection based on log-fold-change (logFC) and p-value, and signature-matrix optimization (minimizing the condition number and correcting for cell-type-specific mRNA content bias). Based on this, it constructs two signature matrices: a “direct signature”, resolving individual cell types, and a “clustered signature” grouping transcriptionally similar cell types. In the deconvolution phase, Rectangle first uses the clustered signature to deconvolve the bulk data into coarse cell-type estimates. These are then used to constrain a second deconvolution step that leverages the direct signature to resolve individual cell-type fractions. Finally, the resulting estimates are scaled to account for unknown cellular content not represented in the reference.
License
Rectangle is dual-licensed: BSD-3-Clause OR Commercial.
Open-source option: BSD-3-Clause
You may use, modify, and redistribute Rectangle, including in proprietary products, if you keep the copyright and license notices and do not use the authors’ names for endorsement.
See LICENSE.
Commercial option
For alternative terms, such as warranties, indemnities, dedicated support, SLAs, or redistribution without BSD notice requirements, contact innovation-psb@uibk.ac.at.
Release notes
See the changelog.
Contact
If you found a bug, please use the issue tracker.
For commercial licensing: innovation-psb@uibk.ac.at
Citation
If you use Rectangle in your project, please cite:
Eder B, Rigato I, Dietrich A, Merotto L, Sturm G, Treis T, List M, Theis FJ, Finotello F. Rectangle: robust and scalable multiscale deconvolution informed by single-cell RNA sequencing data. bioRxiv. 2026. doi:10.64898/2026.07.07.736950
Metadata
Release files for rectanglepy 1.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rectanglepy-1.7.0.tar.gz | 3.8 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rectanglepy-1.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.5 MB
Release files / rectanglepy-1.7.0.tar.gz
| Download URL | rectanglepy-1.7.0.tar.gz |
|---|---|
| Size | 3.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f6f8d79fef3550fa68a17430a8336e6d18e283cdf1ce5e5fcd77ed8fc70ae27
|
|
BLAKE2b-256 checksum How to use checksums |
84a583dbc3a3eb67d286ad073b2edac29acc43b9fbc05b105be5d37e25f36a94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|
Release files / rectanglepy-1.7.0-py3-none-any.whl
| Download URL | rectanglepy-1.7.0-py3-none-any.whl |
|---|---|
| Size | 1.7 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cfc22b28fbca9f20ccce065b569ce55a722550b82217bcccae3f10b8739c2264
|
|
BLAKE2b-256 checksum How to use checksums |
dbeeb722b39839edf07cf409179c1b7544afc902c70e25b052344d789445453a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|