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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: transmorph-0.0.7.tar.gz
  • Upload date:
  • Size: 11.4 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.7.tar.gz
Algorithm Hash digest
SHA256 c97256b2cf39405fc5dc045d272c6104ce5b9ce7fe04364845b2c0143eab09ff
MD5 55bf22c007016735d193c83c52a272be
BLAKE2b-256 8d34ba27d0e859fdf6fff23b54c1946e5ea561a87a12a07691b7169161f626d4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: transmorph-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 11.7 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 6c04bada0b89d884571fe6fd3f2b8748846a2c0df0704d794946f040e4b60402
MD5 d68a4dd93e4a40e90c1a99bca5620523
BLAKE2b-256 3e73a6639d33f23fa369f19495e278c6d26687e66ef18ca80fa37885edea9117

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