Metadata-Version: 2.4
Name: gset
Version: 0.1.2
Summary: GSET: Gene Signals from Embedding Trajectories select compact contexts for mechanistic GRN inference
Author: Zeev Weizmann, Elias Ventre
Project-URL: Repository, https://github.com/ZeevWeizmann/gset
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: numpy
Requires-Dist: scipy
Requires-Dist: pandas
Requires-Dist: scikit-learn
Requires-Dist: torch
Requires-Dist: torch_geometric
Requires-Dist: pot

# gset

GSET (Gene Signals from Embedding Trajectories) selects a compact set of genes from time-resolved single-cell data.

The selected genes are bridges between consecutive gene programs and the core genes of the programs. They can be
given to a network inference method such as CardamomOT.

## Installation

```bash
pip install gset
```

Python 3.11 or newer.

## Use

```python
import anndata as ad
from gset import select_genes

adata = ad.read_h5ad("my_data.h5ad")    # raw counts in X, the time of every cell in adata.obs["time"]
genes = adata.var_names[select_genes(adata, budget=30, n_programs=3)]
```

`select_genes` returns the indices of the selected genes. By default a third of the budget goes to the cores and two
thirds to the bridges, and the programs are found by clustering, with their number given. Other settings:

```python
# the numbers of cores and bridges (the budget is their sum), and of the two channels of the bridges
genes = select_genes(adata, n_cores=10, n_bridges=20, n_kl=14, n_ot=6, n_programs=3)

# programs built around one query gene each, in the order in which the programs become active.
# The program of a query gene is the gene and its program_size - 1 nearest genes.
queries = [adata.var_names.get_loc("Lox"), adata.var_names.get_loc("Birc5")]
genes = select_genes(adata, budget=30, query_genes=queries, program_size=10)

# programs of your own: the program of every gene (0, 1, 2, ...) and the order of the programs
genes = select_genes(adata, budget=30, labels=labels, order=[0, 1, 2])

# the co-expression encoder of the experiments on the real data, for thousands of genes
genes = select_genes(adata, budget=30, n_programs=3, coexpr_encoder="real_data")

# the data as a list of count matrices (cells x genes), one per timepoint, instead of an AnnData object
genes = select_genes([X_t0, X_t1, X_t2], budget=30, n_programs=3)
```

With several replicates, pass a list of such lists. All the settings are described in `help(select_genes)`.

The co-expression embedding, which gives the KL signal, has two encoders. The default one (`"simulation"`) is meant for
panels of tens to a few hundred genes. The other one (`"real_data"`) is for thousands of genes.
