causarray is a Python module for simultaneous causal inference with an array of outcomes.
Project description
causarray
Advances in single-cell sequencing and CRISPR technologies have enabled detailed case-control comparisons and experimental perturbations at single-cell resolution. However, uncovering causal relationships in observational genomic data remains challenging due to selection bias and inadequate adjustment for unmeasured confounders, particularly in heterogeneous datasets. To address these challenges, we introduce causarray [Du25], a doubly robust causal inference framework for analyzing array-based genomic data at both bulk-cell and single-cell levels. causarray integrates a generalized confounder adjustment method to account for unmeasured confounders and employs semiparametric inference with flexible machine learning techniques to ensure robust statistical estimation of treatment effects.
Usage
We recommend using causarray in a conda environment:
# create a new conda environment and install the necessary packages
conda create -n causarray python=3.12 -y
# activate the environment
conda activate causarray
The module can be installed via PyPI:
pip install causarray
For optimal parallel performance, we recommend installing llvm-openmp if using conda:
conda install -c conda-forge llvm-openmp
For R users, reticulate can be used to call causarray from R.
The documentation and tutorials using both Python and R are available at causarray.readthedocs.io.
Batch fitting for large-scale screens
For screens with hundreds to thousands of perturbations, use the batch API so that peak memory is bounded by one batch at a time:
from causarray import gcate_lfc_batch
df_res = gcate_lfc_batch(
Y, X, A, r,
batch_size=10, # perturbations per batch (or use n_batches= for a fixed count)
max_cells=2000, # max pert cells per batch (ctrl added on top)
n_ctrl=2000, # fixed ctrl subsample shared across batches
cache_path='results.h5', # resume if interrupted
verbose=True,
)
See the Replogle-E-K562 tutorial for a demonstration on 200 perturbations from a genome-wide CRISPRi screen.
Changelog
- (2025-01-30) Python package released on PyPI
- (2025-02-01) Code for reproducing figures in paper
- (2025-02-02) Tutorial for Python and R
- (2026-05-31) Batch fitting API (
gcate_lfc_batch) for large-scale screens - (2026-05-31) Documentation at causarray.readthedocs.io
References
[Du25] Jin-Hong Du, Maya Shen, Hansruedi Mathys, and Kathryn Roeder (2025). Causal differential expression analysis under unmeasured confounders with causarray. bioRxiv, 2025-01.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file causarray-0.0.6.tar.gz.
File metadata
- Download URL: causarray-0.0.6.tar.gz
- Upload date:
- Size: 46.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba4791fd9b2f0e8be5e63571aa0da617e98033838bea9fa18ea3394d80846a37
|
|
| MD5 |
de162fb4e71d14b5b15eea2ed7d0b531
|
|
| BLAKE2b-256 |
289cf96b66dcf728466200c077aedcd4d49866eb24b103fbed0282fb09e561f5
|
Provenance
The following attestation bundles were made for causarray-0.0.6.tar.gz:
Publisher:
publish-to-pypi.yml on jaydu1/causarray
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
causarray-0.0.6.tar.gz -
Subject digest:
ba4791fd9b2f0e8be5e63571aa0da617e98033838bea9fa18ea3394d80846a37 - Sigstore transparency entry: 1692250268
- Sigstore integration time:
-
Permalink:
jaydu1/causarray@da5832dd992a5b7f5f164ea51875c3d71cd3c425 -
Branch / Tag:
refs/tags/v0.0.6 - Owner: https://github.com/jaydu1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@da5832dd992a5b7f5f164ea51875c3d71cd3c425 -
Trigger Event:
push
-
Statement type:
File details
Details for the file causarray-0.0.6-py3-none-any.whl.
File metadata
- Download URL: causarray-0.0.6-py3-none-any.whl
- Upload date:
- Size: 51.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ef83a42fbc194857e8f82748aa12968f0ade88205d8e940a3169d0762465067
|
|
| MD5 |
efb0d19b57ea4f7e4a19e9afec7262ee
|
|
| BLAKE2b-256 |
172e0e4558b3bdfa0f1509b3413ff02b19bb8ec235b026ac4a01beed3853d50c
|
Provenance
The following attestation bundles were made for causarray-0.0.6-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on jaydu1/causarray
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
causarray-0.0.6-py3-none-any.whl -
Subject digest:
8ef83a42fbc194857e8f82748aa12968f0ade88205d8e940a3169d0762465067 - Sigstore transparency entry: 1692250332
- Sigstore integration time:
-
Permalink:
jaydu1/causarray@da5832dd992a5b7f5f164ea51875c3d71cd3c425 -
Branch / Tag:
refs/tags/v0.0.6 - Owner: https://github.com/jaydu1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@da5832dd992a5b7f5f164ea51875c3d71cd3c425 -
Trigger Event:
push
-
Statement type: