Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/KrishnaswamyLab/TrajectoryNet
TrajectoryNet: A Dynamic Optimal Transport Network for Modeling Cellular Dynamics
https://github.com/KrishnaswamyLab/TrajectoryNet
Last synced: 27 days ago
JSON representation
TrajectoryNet: A Dynamic Optimal Transport Network for Modeling Cellular Dynamics
- Host: GitHub
- URL: https://github.com/KrishnaswamyLab/TrajectoryNet
- Owner: KrishnaswamyLab
- License: mit
- Created: 2020-02-09T20:47:44.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-03-30T00:22:26.000Z (about 1 year ago)
- Last Synced: 2024-05-14T00:16:10.454Z (about 1 month ago)
- Language: Jupyter Notebook
- Homepage:
- Size: 36.4 MB
- Stars: 92
- Watchers: 10
- Forks: 13
- Open Issues: 6
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Lists
- awesome-stars - KrishnaswamyLab/TrajectoryNet - TrajectoryNet: A Dynamic Optimal Transport Network for Modeling Cellular Dynamics (Jupyter Notebook)
README
Pytorch Implementation of TrajectoryNet
=======================================This library runs code associated with the TrajectoryNet paper [1].
In brief, TrajectoryNet is a Continuous Normalizing Flow model which can
perform dynamic optimal transport using energy regularization and / or a
combination of velocity, density, and growth regularizations to better match
cellular trajectories.Our setting is similar to that of `WaddingtonOT
`_. In that we have access to a bunch of
population measurements of cells over time and would like to model the dynamics
of cells over that time period. TrajectoryNet is trained end-to-end and is
continuous both in gene space and in time.Installation
------------TrajectoryNet is available in `pypi`. Install by running the following
.. code-block:: bash
pip install TrajectoryNet
This code was tested with python 3.7 and 3.8.
Example
-------.. image:: figures/eb_high_quality.png
:alt: EB PHATE Scatterplot
:height: 300.. image:: figures/EB-Trajectory.gif
:alt: Trajectory of density over time
:height: 300Basic Usage
-----------Run with
.. code-block:: bash
python -m TrajectoryNet.main --dataset SCURVE
To run TrajectoryNet on the `S Curve` example in the paper. To use a
custom dataset expose the coordinates and timepoint information according
to the example jupyter notebooks in the `/notebooks/` folder.If you have an `AnnData `_ object then take a look at
`notebooks/Example_Anndata_to_TrajectoryNet.ipynb
`_,
which shows how to load one of the example `scvelo `_ anndata objects into
TrajectoryNet. Alternatively you can use the custom (compressed) format for
TrajectoryNet as described below.For this format TrajectoryNet requires the following:
1. An embedding matrix titled `[embedding_name]` (Cells x Dimensions)
2. A sample labels array titled `sample_labels` (Cells)To run TrajectoryNet with a custom dataset use:
.. code-block:: bash
python -m TrajectoryNet.main --dataset [PATH_TO_NPZ_FILE] --embedding_name [EMBEDDING_NAME]
python -m TrajectoryNet.eval --dataset [PATH_TO_NPZ_FILE] --embedding_name [EMBEDDING_NAME]See `notebooks/EB-Eval.ipynb` for an example on how to use TrajectoryNet on
a PCA embedding to get trajectories in the gene space.References
----------
[1] Tong, A., Huang, J., Wolf, G., van Dijk, D., and Krishnaswamy, S. TrajectoryNet: A Dynamic Optimal Transport Network for Modeling Cellular Dynamics. In International Conference on Machine Learning, 2020. `arxiv `_ `ICML `_---
If you found this library useful, please consider citing::
@inproceedings{tong2020trajectorynet,
title = {TrajectoryNet: A Dynamic Optimal Transport Network for Modeling Cellular Dynamics},
shorttitle = {TrajectoryNet},
booktitle = {Proceedings of the 37th International Conference on Machine Learning},
author = {Tong, Alexander and Huang, Jessie and Wolf, Guy and {van Dijk}, David and Krishnaswamy, Smita},
year = {2020}
}