Transcriptomics · Software
Rectangle
Estimates cell-type proportions in bulk and spatial transcriptomic data using single-cell RNA sequencing references.
What Rectangle is
Rectangle is an open-source Python package developed for cell-type deconvolution of bulk RNA-sequencing (RNA-seq) and spatial transcriptomic data. Cell-type deconvolution is the computational estimation of individual cell-type proportions from heterogeneous tissue samples. Developed by the Computational Biomedicine Group as part of the scverse ecosystem, Rectangle uses annotated single-cell RNA sequencing (scRNA-seq) data to inform its estimation process.
The software addresses key challenges in transcriptomic deconvolution, including resolving fine-grained or transcriptionally similar cell types, correcting for cell-type-specific mRNA content differences, and accounting for cell populations present in the mixture that are absent from the reference. It is designed to perform these calculations with a low computational profile on large-scale single-cell reference datasets.
How it works
Rectangle accepts annotated scRNA-seq data and a transcriptomic mixture, such as bulk RNA-seq or spatial transcriptomics, as inputs. In its signature-building phase, it generates bootstrapped pseudobulks from the single-cell data, selects signature genes based on log-fold change and p-values, and optimizes the signature matrix by minimising the condition number and correcting for cell-type-specific mRNA content bias. Through this process, it creates two distinct matrices: a direct signature representing individual cell types, and a clustered signature that combines transcriptionally similar cell types.
During deconvolution, Rectangle first applies the clustered signature to the bulk mixture to calculate coarse cell-type estimates. These coarse estimates then act as constraints in a second deconvolution step that uses the direct signature to separate individual cell-type fractions. In the final step, the estimated proportions are scaled to estimate and correct for unknown cellular content that is not captured in the single-cell reference.
Key facts
- Language
- Python (3.10 to 3.12)
- Core dependencies
- PyDESeq2, OSQP
- Ecosystem
- scverse
- Input formats
- Annotated scRNA-seq reference and bulk or spatial transcriptomic mixtures
- Output
- Cell-type proportion estimates, including unknown cellular content correction
What you can use it for
- Bulk RNA-seq cell-type proportion estimation
- Determining individual cell-type fractions within complex bulk RNA sequencing samples using an annotated scRNA-seq reference.
- Spatial transcriptomic deconvolution
- Estimating cell-type compositions across spatial transcriptomic spots or regions.
- Hierarchical deconvolution of closely related cell types
- Resolving fine-grained sub-populations by first estimating broad clusters and then applying constrained deconvolution to separate similar cell types.
- Accounting for uncharacterised cellular content
- Detecting and scaling for cellular fractions in tissue mixtures that are missing from the reference scRNA-seq atlas.
Run it here
Ask the research agent and it runs Rectangle as a job on a dedicated machine, then reads the results back to you. Nothing to install, and it keeps running if you close the page.
Try asking
“Deconvolve these bulk RNA-seq samples into cell types with Rectangle.”
Strengths and limits
Good at
- Uses a hierarchical two-step deconvolution strategy that improves the resolution of transcriptionally similar cell types.
- Corrects for cell-type-specific mRNA content bias during the signature matrix optimization phase.
- Estimates and adjusts for unknown cellular content missing from the single-cell reference.
- Maintains an efficient computational profile capable of processing large-scale single-cell reference data.
Watch out for
- Requires an annotated scRNA-seq reference dataset to construct signature matrices.
- Supported only on Python versions 3.10 to 3.12.
- Cannot annotate or classify missing cell populations specifically, only estimating their aggregate unknown fraction.
Questions
Can I run Rectangle online without installing it?
Ask the research agent and it runs Rectangle as a job on a dedicated machine, then reads the results back to you. Nothing to install, and it keeps running if you close the page.
What licence is Rectangle under?
BSD-3-Clause (dual-licensed; a commercial licence is offered for other terms, not required). The terms are published at https://github.com/ComputationalBiomedicineGroup/Rectangle/blob/main/LICENSE.
What inputs does Rectangle require?
It requires an annotated scRNA-seq dataset to build cell-type signatures and a mixture dataset, such as bulk RNA-seq or spatial transcriptomics, to deconvolve.
How does Rectangle resolve transcriptionally similar cell types?
It builds two signature matrices: a clustered signature for broad, transcriptionally similar groups and a direct signature for individual cell types. It first calculates coarse proportions using the clustered signature and uses those results to constrain deconvolution with the direct signature.
Does Rectangle account for differences in RNA content between cell types?
Yes. During signature matrix optimization, Rectangle corrects for cell-type-specific mRNA content bias alongside minimising the matrix condition number.
What happens if a cell type in the mixture is missing from the reference?
Rectangle includes an estimation step that scales the resulting fractions to account for unknown cellular content that was not present in the scRNA-seq reference.
How to cite it
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
Written from Rectangle's own README and project page. Statements citing a figure that does not appear there are removed before publication. Licence and running details come from our registry.