Skip to main content

Pytorch implementation of Harmony algorithm on single-cell sequencing data integration

Project description

This is a Pytorch implementation of Harmony algorithm on single-cell sequencing data integration. Please see [Ilya Korsunsky et al., 2019](https://www.nature.com/articles/s41592-019-0619-0) for details.

Installation

This package is published on PyPI:

pip install harmony-pytorch

Usage

General Case

Given an embedding X as a N-by-d matrix (N for number of cells, d for embedding components) and cell attributes as a Data Frame df_metadata, use Harmony for data integration as the following:

from harmony import harmonize
Z = harmonize(X, df_metadata, batch_key = 'Channel')

where Channel is the attribute in df_metadata for batches.

Alternatively, if there are multiple attributes for batches, write:

Z = harmonize(X, df_metadata, batch_key = ['Lab', 'Date'])

Input as AnnData Object

It’s easy for Harmony-pytorch to work with annotated count matrix data structure from anndata package. Let adata be an AnnData object in Python:

from harmony import harmonize
Z = harmonize(adata.obsm['X_pca'], adata.obs, batch_key = 'Channel')
adata.obsm['X_harmony'] = Z

For details about AnnData data structure, please refer to its documentation.

Project details


Download files

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

Files for harmony-pytorch, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size harmony_pytorch-0.1.1-py3-none-any.whl (7.8 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size harmony-pytorch-0.1.1.tar.gz (25.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page