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. 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.7.tar.gz (52.7 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.7-py3-none-any.whl (58.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for causarray-0.0.7.tar.gz
Algorithm Hash digest
SHA256 a2e34795ec298127da7198b3fc048d1f11a4806341341d61fbbeb89448b643c2
MD5 53af715ed3ce969883c4e7dcb7daf908
BLAKE2b-256 b1dc72f566a7fc976f2076f4a7c26e8ee8c6d1145c07d6fc6f1fc4478364cb94

See more details on using hashes here.

Provenance

The following attestation bundles were made for causarray-0.0.7.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.7-py3-none-any.whl.

File metadata

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

File hashes

Hashes for causarray-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 c9cca0e2f09c146a710ff8aa0a0fddb862847cb2381766d33b8b8b8987564cae
MD5 6e35eba392f99d879499605163973a0f
BLAKE2b-256 a8cd97de87bc562afafc0259ee54f5684079cf9dcb38c4b6df6e32a9cc362a80

See more details on using hashes here.

Provenance

The following attestation bundles were made for causarray-0.0.7-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

0.0.8

2 files

This release

0.0.7 This release

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