Metadata-Version: 2.4
Name: SpaceTravLR
Version: 0.1.21
Summary: Spatially perturbing Transcription factors, Ligands & Receptors
Keywords: spatial transcriptomics,microniche identification,cell-cell communication
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: setuptools<81
Requires-Dist: networkx
Requires-Dist: pysal>=24.01
Requires-Dist: scanpy>=1.10.2
Requires-Dist: torchvision
Requires-Dist: pyarrow
Requires-Dist: enlighten
Requires-Dist: pyro-ppl
Requires-Dist: group-lasso
Requires-Dist: pqdm
Requires-Dist: magic-impute
Requires-Dist: wordcloud
Requires-Dist: easydict
Requires-Dist: torch
Requires-Dist: ipykernel
Requires-Dist: simple-slurm
Requires-Dist: igraph
Requires-Dist: genomepy
Requires-Dist: pybedtools
Requires-Dist: ipywidgets
Requires-Dist: commot
Requires-Dist: sphinx-rtd-theme
Requires-Dist: nbsphinx
Requires-Dist: furo
Requires-Dist: myst_nb
Requires-Dist: sphinx_copybutton
Requires-Dist: sphinx_design
Requires-Dist: sphinx_tippy
Requires-Dist: sphinx_autodoc_typehints
Requires-Dist: numpy==1.26
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: keywords
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

[![Tests](https://github.com/Koushul/SpaceOracle/actions/workflows/python-package-conda.yml/badge.svg?branch=main)](https://github.com/Koushul/SpaceOracle/actions/workflows/python-package-conda.yml)

**Note:** We ***highly*** recommend following the Rust tutorial. This repo is provided for development purposes only. You can find the tutorial here: https://spacetravlr-rust.readthedocs.io/en/latest/

# Why SpaceTravLR 🌔️ ?

**SpaceTravLR** (**S**patially perturbing **T**ranscription factors, **L**igands & **R**eceptors)


<p align="center">
  <img src="./assets/overview.svg" alt="overview" style="width:1200px"/>
</p>

SpaceTravLR leverages convolutional neural networks to generate a sparse graph with differentiable edges. This enables signals to propagate both within cells through regulatory edges and between cells through ligand–mediated connections.

<p align="center">
  <img src="./assets/model.svg" alt="overview" style="width:1200px"/>
</p>


## Core Features
- predicting niche-specific perturbation outcome at single cell resolution
- inferring functional cell-cell communications events
- identifying spatial domains and functional microniches and their driver genes


##  Quick start

**Note:** Again, we ***highly*** recommend following the Rust tutorial. This repo is provided for development purposes only.

```bash
conda create -n spacetravlr python=3.11
conda activate spacetravlr
pip install uv 
uv pip install SpaceTravLR==0.1.21
```


## Installing from Source
```bash
uv venv
source .venv/bin/activate
uv pip install -e .
```


Load the example [Slide-tags]((https://www.nature.com/articles/s41586-023-06837-4)) Human Tonsil data.

```python
adata = sc.read_h5ad('data/snrna_germinal_center.h5ad')
```

Create a SpaceShip
```python
from SpaceTravLR.spaceship import SpaceShip

spacetravlr = SpaceShip(name='myTonsil').setup_(adata)

assert spacetravlr.is_everything_ok()

spacetravlr.spawn_worker(
    python_path='.venv/bin/python',
    partition='preempt'
)
```

SpaceTravLR generates a queue of genes that each worker consumes in parallel. spacetravlr.spawn_worker submits a new job to the clusters.


##  Outputs
<pre>
output/
├── input_data/
│   ├── _adata.h5ad
│   ├── celloracle_links.pkl
│   ├── communication.pkl
│   ├── LRs.parquet
├── betadata/
│   ├── PAX5_betadata.parquet
│   ├── FOXO1_betadata.parquet
│   ├── CD79A_betadata.parquet
│   ├── ...
│   ├── IL21_betadata.parquet
│   ├── IL4_betadata.parquet
│   ├── CCR4_betadata.parquet
├── logs/
│   ├── training_TIMESTAMP.log

</pre>

##  Results

<p align="center">
  <img src="./assets/GC_FOXO1_KO.svg" alt="overview" style="width:1200px"/>
</p>



## Citation

If you find SpaceTravLR useful in your research or projects, please cite our paper:
```
