MCPcopy Index your code
hub / github.com/caokai1073/uniPort

github.com/caokai1073/uniPort @v1.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.3 ↗ · + Follow
56 symbols 151 edges 12 files 36 documented · 64% updated 21mo agov1.3 · 2024-10-01★ 398 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

license-badge PyPI version docs-badge Downloads Downloads

The original paper: A unified single-cell data integration framework with optimal transport

Website and documentation: https://uniport.readthedocs.io

Source Code (MIT): https://github.com/caokai1073/uniport

Author's Homepage: www.caokai.site

Overview

Installation

The uniport package can be installed via pip3:

pip3 install uniport

Tutorials

Please checkout the documentations and tutorials for more information at uniport.readthedocs.io.

Main function: uniport.Run()

Key parameters includes:

  • adatas: List of AnnData matrices for each dataset.
  • adata_cm: AnnData matrix containing common genes from different datasets.
  • mode: Choose from ['h', 'v', 'd'] If 'mode=h', integrate data with common genes (Horizontal integration). If 'mode=v', integrate data profiled from the same cells (Vertical integration). If 'mode=d', inetrgate data without common genes (Diagonal integration). Default: 'h'.
  • lambda_s: balanced parameter for common and specific genes. Default: 0.5
  • lambda_recon: balanced parameter for reconstruct term. Default: 1.0
  • lambda_kl: balanced parameter for KL divergence. Default: 0.5
  • lambda_ot: balanced parameter for OT. Default: 1.0
  • iteration: max iterations for training. Training one batch_size samples is one iteration. Default: 30000
  • ref_id: id of reference dataset. Default: The domain_id of last dataset
  • save_OT: if True, output a global OT plan. Need more memory. Default: False
  • out: output of uniPort. Choose from ['latent', 'project', 'predict']. If out=='latent', train the network and output cell embeddings. If out=='project', project data into the latent space and output cell embeddings. If out=='predict', project data into the latent space and output cell embeddings through a specified decoder. Default: 'latent'

Data

Example

import uniport as up
import scanpy as sc

# HVG: highly variable genes
adata1 = sc.read_h5ad('adata1.h5ad') # preprocessed data with data1 specific HVG
adata2 = sc.read_h5ad('adata2.h5ad') # preprocessed data with data2 specific HVG, as reference data
adata_cm = sc.read_h5ad('adata_cm.h5ad') # preprocesssed data with common HVG

# integration with both common and dataset-specific genes
# latent representation are stored in adata.obs['latent']
adata = up.Run(adatas=[adata1, adata2], adata_cm=adata_cm)
# save global optimal transport matrix: adata, OT = up.Run(adatas=[adata1, adata2], adata_cm=adata_cm, save_OT=True)
# integration with only common genes: adata = up.Run(adata_cm=adata_cm)

Citation

@Article{Cao2022,
author={Cao, Kai and Gong, Qiyu and Hong, Yiguang and Wan, Lin},
title={A unified computational framework for single-cell data integration with optimal transport},
journal={Nature Communications},
year={2022},
month={Dec},
day={01},
volume={13},
number={1},
pages={7419},
issn={2041-1723},
doi={10.1038/s41467-022-35094-8}}

Contact via caokai1073@gmail.com

Core symbols most depended-on inside this repo

Shape

Method 27
Function 20
Class 9

Languages

Python100%

Modules by API surface

uniport/model/layer.py19 symbols
uniport/function.py9 symbols
uniport/data_loader.py9 symbols
uniport/model/vae.py5 symbols
uniport/model/utils.py5 symbols
uniport/model/loss.py4 symbols
uniport/metrics.py4 symbols
uniport/logger.py1 symbols

For agents

$ claude mcp add uniPort \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page