Skip to main content

Revealing the biological utility of gene imputation in spatial transcriptomics

Project description

Run Gene Imputation Methods

PyPI version Downloads

spagim is a package for gene imputation of spatial transcriptomics data from single-cell RNA sequencing data. It provides a unified interface for various imputation methods, making it easy to apply them to your data.

Installation

Create a conda environment

conda create -n spagim-env python=3.9
conda activate spagim-env

Install JAX via pip:

pip install -U "jax[cuda12]"

Install spagim via pip:

pip install spagim

Usage

Here is a simple example of how to use spagim:

import spagim.benchmark as benchmark
import scanpy as sc
import torch

# Load your spatial transcriptomics data
adata_sp = sc.read_h5ad("path/to/your/spatial_data")

# Load your single-cell RNA sequencing data
adata_sc = sc.read_h5ad("path/to/your/single_cell_data")

# Initialize the imputation model
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
models = benchmark.Imputation(device=device, seed=42)

# Run imputation
adata_impute = models.forward(
    adata_sc,
    adata_sp,
    # choose your method among ['Pearson','Spearman','Cosine','KNN','SpaGE','Harmony','Tangram','ENVI','GIMVI']
    method='Pearson',
    # n_split is the number of splits for the data for ['Tangram','Pearson','Spearman','Cosine'] only
    n_split=1,
    # batch_size is the number of samples per gradient update, for 'GIMVI' only
    batch_size=1024,
    # k is the number of nearest neighbors for ['KNN','Pearson','Spearman','Cosine','Harmony'] only
    k=100
)

Project details


Download files

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

Source Distribution

spagim-1.0.2.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

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

spagim-1.0.2-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file spagim-1.0.2.tar.gz.

File metadata

  • Download URL: spagim-1.0.2.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.15

File hashes

Hashes for spagim-1.0.2.tar.gz
Algorithm Hash digest
SHA256 8cc964543aecad5913c6d24765af8ca0bd5511f6b451c16e6451221bf52e6820
MD5 c7f25d89ff141cfd1cbecffa0380eff5
BLAKE2b-256 a62f98efcc0badef3fa8e52d6db8f0b170314bf1413a371df1d6d5e03b5d7bbb

See more details on using hashes here.

File details

Details for the file spagim-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: spagim-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.15

File hashes

Hashes for spagim-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2bbe816c24045d26fbc5e7abba5cda10eb4a1030c4a7dc835a18f1040e9658d0
MD5 0d05f33ab633b6773dbe5c8feebf6829
BLAKE2b-256 c51b873892c478707da649b46aa1bcb5ff28d6d25b115c98cc3aa9ac2ba1eeba

See more details on using hashes here.

Supported by

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