Skip to main content

DIRAC (Domain Invariant Respresentation through Adversatial Calibration)

stars-badge pypi-badge docs-badge build-badge coverage-badge license-badge

Spatially resolved integration of multi-omics with DIRAC highlights cell-specific remodeling

DIRAC is a Python package, written in PyTorch and based on Scanpy.

DIRAC is a graph neural network to integrate spatial multi-omic data into a unified domain-invariant embedding space and to automate cell-type annotation by transferring labels from reference spatial or single-cell multi-omic data.

DIRAC primarily includes two integration paradigms: vertical integration and horizontal integration, which differ in their selection of anchors. In vertical integration, multiple data modalities from the same cells are jointly analyzed, using cell correspondences in single-cell data or spot correspondences in spatial data as anchors for alignment. In horizontal integration, the same data modality from distinct groups of cells is aligned using genomic features as anchors. The best way to familiarize yourself with DIRAC is to check out our tutorial, our notebook and our documentation.

Model architecture

For more details, please check out our publication.

Directory structure

.
├── sodirac                 # Main Python package
├── data                    # Data files
├── docs                    # Documentation files
├── environment.yaml        # Reproducible Python environment via conda
├── requirements.yaml       # Python packages required for issuing DIRAC
├── LICENSE
└── README.md

How to install DIRAC

To install DIRAC, make sure you have PyTorch and PyG installed. For more details on dependencies, refer to the environment.yml file.

Step 1: Set Up Conda Environment

conda create -n dirac-env python=3.9 r-base=4.3.1 rpy2 r-mclust r-yarrr

Step 2: Install PyTorch and PyG

Activate the environment and install PyTorch and PyG. Adjust the installation commands based on your CUDA version or choose the CPU version if necessary.

  • General Installation Command
conda activate dirac-env
pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 --index-url https://download.pytorch.org/whl/cu118
pip install pyg_lib==0.3.1+pt21cu118 torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.1.0+cu118.html
pip install torch_geometric==2.3.1
  • Tips for selecting the correct CUDA version
    • Run the following command to verify CUDA version:
    nvcc --version
    
    • Alternatively, use:
    nvidia-smi
    
  • Modify installation commands based on CUDA
    • For CUDA 12.1
      pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 --index-url https://download.pytorch.org/whl/cu121
      pip install pyg_lib==0.3.1+pt21cu121 torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.1.0+cu121.html
      pip install torch_geometric==2.3.1
      
    • For CPU-only
      pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 --index-url https://download.pytorch.org/whl/cpu
      pip install pyg_lib==0.3.1+pt21cpu torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.1.0+cpu.html
      pip install torch_geometric==2.3.1
      

Step 3: Install dirac from shell

    pip install sodirac

Step 4: Import DIRAC in your jupyter notebooks or/and scripts

    import sodirac as sd

Installing within a conda environment is recommended.

Usage

Please checkout the documentations and tutorials at dirac.readthedocs.io.

Metadata

Release files for sodirac 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sodirac 0.1.8
File Size Uploaded Provenance Actions
sodirac-0.1.8.tar.gz 55.1 kB Without provenance Details for sodirac-0.1.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sodirac 0.1.8
File Interpreter ABI Platform Actions
sodirac-0.1.8-py3-none-any.whl Python 3 none any Details for sodirac-0.1.8-py3-none-any.whl

Total release size: 111.4 kB

Release files / sodirac-0.1.8.tar.gz

Download URL sodirac-0.1.8.tar.gz
Size 55.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f975040858d7f83c0868b75da233420acd9ca7d8f4f04abca080fbd38a4de73a
BLAKE2b-256 checksum
How to use checksums
de8eb358f44406267d8e36270e36d6120d108bb5b58e246ee6f34217df32987d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / sodirac-0.1.8-py3-none-any.whl

Download URL sodirac-0.1.8-py3-none-any.whl
Size 56.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25b27bfc2ceb5394643c18fbf22740e7e314e043d13a643cd6ed2ba95af7b65e
BLAKE2b-256 checksum
How to use checksums
22c671f98c52b619b97c276a487b710d170e2a6e54f93fcc27efabc26a729acc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for sodirac 0.1.8

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page