Skip to main content

Optimal transport-based tools for data integration.

Project description

Transmorph (anciently WOTi)

PyPI version

Transmorph is a python toolbox dedicated to transportation theory-based data analysis. Originally consisting in a data integration pipeline based on optimal transport and correcting for density, we are now adding extra features relevant in single-cell data analysis such as label transfer (already implemented), applications of Wasserstein barycenters, trajectory analysis and more.

Warning: This package is still in a very early stage of its development. Feel free to open an issue in case of unexpected behvior.

Installation

Requirements

These packages should be installed automatically by pip.

  • numpy
  • scipy
  • osqp (quadratic program solver)
  • POT (optimal transport in python)

Install from source (latest version)

git clone https://github.com/Risitop/transmorph
pip install ./transmorph

Install from PyPi (recommended, latest stable version)

pip install transmorph

Usage

Model fitting

We choose to adopt a philosophy similar to sklearn's package, with a numerical method encapsulated in a python object. The main class here is the Transmorph, and should be fitted prior to any analysis. First, you need to create a Transmorph object, selecting its parameters (transportation technique, entropic regularization, density correction...).

import transmorph as tr

t = tr.Transmorph(method='ot')

You can then load your two datasets and fit the Transmorph. You can provide extra arguments such as custom cost matrix (default is Euclidean distance).

X, Y = ... # datasets, np.ndarrays
t.fit(X, Y)

Data integration

Once the Transmorph is fitted, data integration is very straightforward through the transform method, following (Ferradans 2013) methodology.

X_integrated = t.transform()

Label transfer

Label transfer can be carried out to transfer labels from a dataset to the other in a semi-supervised fashion according to the optimal transport plan, following (Taherkhani 2020).

lY = ... # Gathering labels from Y dataset 
lX = t.label_transfer(lY)

Examples

See three example notebooks in examples/ directory.

Reference

https://www.biorxiv.org/content/10.1101/2021.05.12.443561v1

Documentation

Work in progress.

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

transmorph-0.0.7.tar.gz (11.4 kB view hashes)

Uploaded Source

Built Distribution

transmorph-0.0.7-py3-none-any.whl (11.7 kB view hashes)

Uploaded Python 3

Supported by

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