https://github.com/brianhie/trajectorama

Multi-study integration of cellular trajectories

https://github.com/brianhie/trajectorama

Science Score: 33.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
    Links to: biorxiv.org
  • Committers with academic emails
    2 of 4 committers (50.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.3%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Multi-study integration of cellular trajectories

Basic Info
Statistics
  • Stars: 19
  • Watchers: 3
  • Forks: 3
  • Open Issues: 1
  • Releases: 0
Archived
Created almost 7 years ago · Last pushed about 6 years ago
Metadata Files
Readme License

README.md

Trajectorama

Trajectorama is an algorithm that implements coexpression-based integration of multi-study single-cell trajectories. Trajectorama is described in the paper "Coexpression enables multi-study cellular trajectories of development and disease" by Brian Hie, Hyunghoon Cho, Bryan Bryson, and Bonnie Berger.

Installation

The most import dependency is on a custom implementation of Louvain clustering, which can be installed with the below commands: ```

Binary dependency (for Ubuntu/Debian).

sudo apt-get install bison flex

git clone https://github.com/brianhie/louvain-igraph cd louvain-igraph python setup.py install ```

Troubleshooting: To avoid conflicts with the main version of louvain-igraph, install the custom Louvain package first in a new conda environment prior to installation of any downstream dependencies (like scanpy and trajectorama).

Installing Trajectorama can then be done by: python -m pip install trajectorama

API and example usage

We provide a basic API around the core algorithm that takes an expression matrix augmented with study information and returns a list of coexpression matrices, with corresponding indices into the original data: ```python import trajectorama

X = [ ... ] # Sample-by-gene expression matrix. studies = [ ... ] # Study identifiers, one for each row of X.

Xscoexpr, sampleidxs = trajectorama.transform( X, studies, corrcutoff=0.7, corrmethod='spearman', clustermethod='louvain', mincluster_samples=500, ) ```

The coexpression matrix Xs_coexpr[i] is defined over the subset of cells X[sample_idxs[i], :]. See the documentation string under the transform() function at the top of trajectorama/trajectorama.py for the full list of parameters and default values.

This list of coexpression matrices can then be used in further analysis, e.g., you can flatten the matrices and use Scanpy to visualize the matrices as a KNN graph based on distance in coexpression space: ```python from anndata import AnnData import numpy as np import scanpy as sc from scipy.sparse import csr_matrix

Save upper triangle and flatten.

nfeatures = X.shape[1] triuidx = np.triuindices(nfeatures) # Indices of upper triangle. Xcoexpr = np.concatenate([ Xcoexpri[triuidx].flatten() for Xcoexpri in Xcoexprs ]) Xcoexpr = csrmatrix(Xcoexpr)

Plot KNN graph in coexpression space.

adata = AnnData(Xcoexpr) sc.pp.neighbors(adata) sc.tl.drawgraph(adata) sc.pl.draw_graph(adata)

```

The example scripts below show more detailed usage of Trajectorama, which was used to generate the paper results.

Examples

Trajectorama for mouse neuronal development

Trajectorama analyzes five large-scale studies of mouse neurons over multiple points in development.

Data can be found at http://trajectorama.csail.mit.edu/data.tar.gz and can be downloaded as: wget http://trajectorama.csail.mit.edu/data.tar.gz tar xvf data.tar.gz

To preprocess the data, run the command: python bin/process.py conf/mouse_develop.txt This preprocessing step only needs to be done once. Then, we perform panclustering and coexpression matrix computation using the command: bash python bin/mouse_develop.py > mouse_develop.log This will save each coexpression matrix as a .npz file to a directory under target/sparse_correlations/. Computing all coexpression matrices should complete in around an hour when running on a single core.

The downstream analysis can then be performed on these cached matrices using the commands: bash python bin/mouse_develop_cached.py >> mouse_develop.log python bin/mouse_develop_dictionary.py >> mouse_develop.log This will log some relevant statistics and save visualizations under the figures/ directory.

Trajectorama for human hematopoiesis

We can perform a similar workflow for human hematopoiesis by running the commands: ```bash

Download (if not done so for mouse data).

wget http://trajectorama.csail.mit.edu/data.tar.gz tar xvf data.tar.gz

Preprocess.

python bin/process.py conf/hematopoiesis.txt

Analyze.

python bin/hematopoiesis.py > hematopoiesis.log python bin/hematopoiesiscached.py >> hematopoiesis.log python bin/hematopoiesisdictionary.py >> hematopoiesis.log ```

Trajectorama for microglia

We can perform a similar workflow for mouse and human microglia in various conditions by running the commands: ```bash

Download (if not done so for mouse data).

wget http://trajectorama.csail.mit.edu/data.tar.gz tar xvf data.tar.gz

Preprocess.

python bin/process.py conf/microglia.txt

Analyze.

python bin/microglia.py > microglia.log python bin/microglia_cached.py >> microglia.log ```

Questions

Create an issue in the repository or contact brianhie@mit.edu for any pertinent questions or concerns. We will do our best to answer promptly and feel free to create a pull request and contribute!

Owner

  • Name: Brian Hie
  • Login: brianhie
  • Kind: user
  • Location: San Francisco

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Committers

Last synced: over 3 years ago

All Time
  • Total Commits: 54
  • Total Committers: 4
  • Avg Commits per committer: 13.5
  • Development Distribution Score (DDS): 0.315
Top Committers
Name Email Commits
Brian Hie b****e@m****u 37
Brian Hie h****e@g****m 11
brianhie b****1@g****m 5
Samuel Sledzieski s****l@m****u 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 7
  • Total pull requests: 6
  • Average time to close issues: 5 days
  • Average time to close pull requests: about 1 hour
  • Total issue authors: 5
  • Total pull request authors: 2
  • Average comments per issue: 2.14
  • Average comments per pull request: 0.17
  • Merged pull requests: 6
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • TheInfamousWayne (2)
  • emdann (2)
  • faniafeby (1)
  • BenxiaHu (1)
  • frenkiboy (1)
Pull Request Authors
  • brianhie (5)
  • samsledje (1)
Top Labels
Issue Labels
bug (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 8 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 2
  • Total maintainers: 1
pypi.org: trajectorama

Single-cell trajectory integration

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 8 Last month
Rankings
Dependent packages count: 10.1%
Stargazers count: 14.0%
Forks count: 16.9%
Dependent repos count: 21.6%
Average: 27.8%
Downloads: 76.3%
Maintainers (1)
Last synced: 10 months ago

Dependencies

setup.py pypi
  • anndata >=0.6.22
  • geosketch >=1.0
  • joblib >=0.13.2
  • numpy >=1.12.0
  • scanpy >=1.4.5.1
  • scikit-learn >=0.20rc1
  • scipy >=1.0.0