Cisformer
Cisformer is a Transformer-based framework for cross-modality generation between single-cell RNA-seq and single-cell ATAC-seq. It supports RNA-to-ATAC generation, ATAC-to-RNA generation, and cell-type-specific cis-regulatory element (cCRE)-gene link inference from cross-attention.
The model uses a decoder-only cross-attention architecture designed for sparse, ultra-long single-cell genomic sequences. In practice, Cisformer can be used to predict a missing modality from an available assay and to extract interpretable regulatory links from trained ATAC-to-RNA models.
What's New in v1.1.0
- Added mouse support for preprocessing, config generation, prediction, and ATAC-to-RNA link analysis.
- Added species-aware default configs. Mouse configs use
total_gene: 23234; human configs usetotal_gene: 38244. - Added automatic log1p handling for ATAC-to-RNA preprocessing. Cisformer now
checks the input scRNA-seq expression matrix and reports whether
log1pis applied. - Optimized preprocessing and ATAC-to-RNA link generation performance.
- Clarified that
atac2rna_linkoutputs a rank-normalized link matrix. Values are ranking scores derived from valid attention scores, not raw correlation coefficients.
Documentation
Full documentation is available at cisformer.readthedocs.io.
Installation
Cisformer does not currently rely on PyPI to install all runtime dependencies automatically. Install the deep learning and genomics dependencies in a conda environment first, then install the Cisformer command-line package from PyPI:
conda create -n cisformer python=3.10
conda activate cisformer
bash ./requirement.sh
pip install cisformer
The PyPI package installs the cisformer command itself. Dependencies such as
PyTorch/CUDA, flash-attn, Scanpy, pybedtools, torcheval, tensorboard, and the
system bedtools backend should be installed according to your server
environment. See the installation guide in the documentation for the full
manual recipe.
Quick Start
Generate default configuration files:
# Human, default
cisformer generate_default_config --species human
# Mouse
cisformer generate_default_config --species mouse
This creates cisformer_config/ with:
accelerate_config.yamlatac2rna_config.yamlrna2atac_config.yamlresource/<species> Gencode annotation .gtf.gz
Edit accelerate_config.yaml before distributed training, especially gpu_ids,
num_processes, and main_process_port.
Large Gencode annotation files are downloaded during this step and are not bundled in the PyPI package. Human uses Gencode v49; mouse uses Gencode M39.
Input Requirements
Cisformer expects paired scRNA-seq and scATAC-seq inputs in Scanpy .h5ad
format.
- RNA and ATAC cell barcodes must overlap.
- RNA features can be gene symbols or Ensembl IDs.
- ATAC features should be genomic peak coordinates in
chr:start-endformat. - Set
--species humanor--species mouseconsistently across preprocessing, config generation, prediction, and link inference.
RNA-to-ATAC Workflow
Preprocess paired data:
cisformer data_preprocess \
-r test_data/rna.h5ad \
-a test_data/atac.h5ad \
-s preprocessed_dataset \
--species human
Train:
cisformer rna2atac_train \
-t preprocessed_dataset/cisformer_rna2atac_train_dataset \
-v preprocessed_dataset/cisformer_rna2atac_val_dataset \
-n rna2atac_test
Predict ATAC from RNA:
cisformer rna2atac_predict \
-r preprocessed_dataset/test_rna.h5ad \
-m save/2025-05-12_rna2atac_test/epoch34/pytorch_model.bin \
--species human
The output is saved as output/cisformer_predicted_atac.h5ad by default.
ATAC-to-RNA Workflow
Preprocess paired data for ATAC-to-RNA:
cisformer data_preprocess \
-r test_data/rna.h5ad \
-a test_data/atac.h5ad \
-s preprocessed_dataset \
--atac2rna \
--species human
During ATAC-to-RNA preprocessing, Cisformer inspects the loaded RNA matrix. If the
maximum expression value is <= 10, it applies log1p; if the maximum is > 10,
it assumes the matrix is already normalized and skips log1p. The decision is
printed to the terminal.
Train:
cisformer atac2rna_train \
-d preprocessed_dataset/cisformer_atac2rna_train_dataset \
-n atac2rna_test
Predict RNA from ATAC:
cisformer atac2rna_predict \
-d preprocessed_dataset/cisformer_atac2rna_test_dataset/atac2rna_0.pt \
-m save/2025-05-12_atac2rna_test/epoch30/pytorch_model.bin \
--species human
The output is saved as output/cisformer_predicted_rna.h5ad by default.
Link cCREs to Genes
After training an ATAC-to-RNA model, generate cell-type-specific link matrices:
cisformer atac2rna_link \
-d preprocessed_dataset/cisformer_atac2rna_test_dataset/atac2rna_0.pt \
-m save/2025-05-12_atac2rna_test/epoch30/pytorch_model.bin \
-c test_data/celltype_info.tsv \
--species human
celltype_info.tsv is a two-column, header-free TSV:
GTACCGGGTATACTGG-1 CD14 Mono
ACTGAATGTCACCAAA-1 cDC2
AACCTTGCAAACTGTT-1 CD14 Mono
The command writes one .h5ad matrix per cell type under
output/cisformer_link/. Rows are genes and columns are cCREs. Non-zero matrix
entries are rank-normalized link scores: Cisformer first ranks valid
attention-derived cCRE-gene scores and then writes the ranked values. Treat these
as relative regulatory association scores, not raw attention values or Pearson
correlations.
Pretrained Models
Pretrained models associated with the Cisformer paper are available from Zenodo: Pretrained_Models.zip.
Citation
If you use Cisformer, please cite:
Ji L, Zou Q, Tang K, Wang C. Cisformer: a scalable cross-modality generation framework for decoding transcriptional regulation at single-cell resolution. Genome Biology, 2025.
Acknowledgements
Metadata
Release files for cisformer 1.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cisformer-1.1.2.tar.gz | 10.3 MB | Without provenance | Details for cisformer-1.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cisformer-1.1.2-py3-none-any.whl | Python 3 | none | any | Details for cisformer-1.1.2-py3-none-any.whl |
Total release size: 20.5 MB
Release files / cisformer-1.1.2.tar.gz
| Download URL | cisformer-1.1.2.tar.gz |
|---|---|
| Size | 10.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a17379ca6bf22069468f97ce38aa414bf4973e30f416a58eef738a318998cc25
|
|
BLAKE2b-256 checksum How to use checksums |
d6341c17ecdb14be3ef2f729918047932b52ddcf1c5d414e2fe8c10402204014
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|
Release files / cisformer-1.1.2-py3-none-any.whl
| Download URL | cisformer-1.1.2-py3-none-any.whl |
|---|---|
| Size | 10.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b39f9e2d09b83b1ae52652e746e17de969005ba533a527dc4561ea1cd5e49035
|
|
BLAKE2b-256 checksum How to use checksums |
13a37e122299d2c2f1d67e18e351c1969fcfeb43006ba86ed9f03fbafbff5f49
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|
Security for cisformer 1.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.