Skip to main content

Rectangle

Tests Documentation

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

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

Overview of the Rectangle signature-building and multiscale deconvolution workflow

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.

See LICENSE-Commercial.md.

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.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rectanglepy 1.6.0
File Size Uploaded
rectanglepy-1.6.0.tar.gz 3.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for rectanglepy 1.6.0
File Interpreter ABI Platform
rectanglepy-1.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 5.5 MB

Release files / rectanglepy-1.6.0.tar.gz

Download URL rectanglepy-1.6.0.tar.gz
Size 3.8 MB
Tags Source
SHA-256 checksum
How to use checksums
7f2dcd4f11dfdbf6665144a2da3d362efef96acf47f5cc95c88f07887880136e
BLAKE2b-256 checksum
How to use checksums
5aacdb0443b615a2e4fdb27a010e8324373836a4be86c648af3627d2dfa9d95f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / rectanglepy-1.6.0-py3-none-any.whl

Download URL rectanglepy-1.6.0-py3-none-any.whl
Size 1.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
0fb44802d8bb4b783154e20f1f0033f622bba825cd45ad5c4b8c426d906b6ad5
BLAKE2b-256 checksum
How to use checksums
532c548b0124a366a338351e23192306703bae0b8cff91f980ad3b1dbcffe91d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

1.7.0

2 release files

This release

1.6.0 This release

2 release files

1.5.0

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page