Skip to main content

Documentation Status PyPI PyPI-Downloads

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 [Du26], 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 while keeping NumPy >2 in the Python environment. Create the separate R environment with a current NumPy-2-compatible reticulate build:

conda env create -f environment-r.yaml

The R tutorial runs from causarray-r and connects to the Python package in the causarray environment. The documentation and tutorials using both Python and R are available at causarray.readthedocs.io.

Tutorials

Tutorial Language Description Link
Perturb-seq [Jin20] Python CRISPR screen analysis on excitatory neurons Notebook
Perturb-seq [Jin20] R Same analysis using reticulate Notebook
Genome-wide CRISPRi screen [Replogle22] Python Batch fitting on 200 perturbations from a K562 genome-wide CRISPRi screen Notebook
Case-control: SEA-AD [Gabitto24] Python Causal inference on observational single-cell data (Alzheimer's disease) Notebook

Batch fitting API

For screens with hundreds to thousands of perturbations, use gcate_lfc_batch 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

See CHANGELOG for a full version history.

References

[Du26] Jin-Hong Du, Maya Shen, Hansruedi Mathys, and Kathryn Roeder. "Uncovering causal relationships in single cell omic studies with causarray". In: Briefings in Bioinformatics (2026).

[Gabitto24] Mariano I. Gabitto et al. "Integrated multimodal cell atlas of Alzheimer's disease". In: Nature Neuroscience (2024).

[Jin20] Xin Jin et al. "In vivo Perturb-seq reveals neuronal and glial abnormalities associated with autism risk genes". In: Nature Neuroscience (2020).

[Replogle22] Joseph M. Replogle et al. "Mapping information-rich genotype-phenotype landscapes with genome-scale Perturb-seq". In: Cell (2022).

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

causarray-0.0.8.tar.gz (53.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

causarray-0.0.8-py3-none-any.whl (58.9 kB view details)

Uploaded Python 3

File details

Details for the file causarray-0.0.8.tar.gz.

File metadata

  • Download URL: causarray-0.0.8.tar.gz
  • Upload date:
  • Size: 53.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for causarray-0.0.8.tar.gz
Algorithm Hash digest
SHA256 539cb21c3595b9d023949b5279b11bdef12466dcaccd2304fdbbba0e75494410
MD5 dade9a424102b203265a836230fbdadc
BLAKE2b-256 a8aec0e5709364295dcf4d7cbce97b55d790cf3f6237cdeb0b4510b746f4d099

See more details on using hashes here.

Provenance

The following attestation bundles were made for causarray-0.0.8.tar.gz:

Publisher: publish-to-pypi.yml on jaydu1/causarray

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file causarray-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: causarray-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 58.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for causarray-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 d6e1c4695f24d018b99196be25df967a9bfe3bb85c150c2833eee6f8340e850b
MD5 b83e6ddfa3c93a76ee52e532d6b906e7
BLAKE2b-256 ac4290ff2ac1a5ab490a19b400d3732672680cde46330671333bdbc276fff9b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for causarray-0.0.8-py3-none-any.whl:

Publisher: publish-to-pypi.yml on jaydu1/causarray

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.0.9

2 files

This release

0.0.8 This release

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page