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.5.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

transmorph-0.0.5-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file transmorph-0.0.5.tar.gz.

File metadata

  • Download URL: transmorph-0.0.5.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.9.5

File hashes

Hashes for transmorph-0.0.5.tar.gz
Algorithm Hash digest
SHA256 362e8f3c279b1cba34b2bccad484d7d265e485a31a38cc194e1449971f40c736
MD5 1e213a66db74d7b7e1c5242b323c4552
BLAKE2b-256 c27b2725a7e0b930188a27a583b31fb8002291c4b1571ab22cc5bb149a950db9

See more details on using hashes here.

File details

Details for the file transmorph-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: transmorph-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.9.5

File hashes

Hashes for transmorph-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 acfa919b9e0d6b88da65857bcdbd87dce6eef4846a16282f9f3ea0b96a448446
MD5 18e378d3f606bf551cb16e6a465bd028
BLAKE2b-256 47b00a0024f1b56e80528740166d2e848d0a7170e2aba328513b6b88a35b4ee0

See more details on using hashes here.

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