Giter Club home page Giter Club logo

tspace's Introduction

tSpace algorithm for unsupervised determination of multiple developmental branches in single cell data

By Denis Dermadi

Description

tSpace is the main function for trajectory inference. The algorithm is described in the publication (https://doi.org/10.1016/j.isci.2020.100842)

Originally, it was developed for single cell analysis, however it can be applied on any type of large data.

Installation

To install tSpace you need devtools package, which can be installed by running code:

install.packages("devtools")

If devtools are already installed, or after devtools installation please run code:

devtools::install_github('hylasD/tSpace', build = TRUE, build_opts = c("--no-resave-data", "--no-manual"), force = T)

tSpace depends on several packages, at the present moment igraph installation has some issues on iOS and Linux, probably related to gcc compilers. If you run in to installation issues, try to install older versions of igraph prior to tSpace installation.

How to use the algorithm

Vignette with a demo data is included in the package.

To open tutorial on tSpace from R please use function

vignette(package = 'tSpace', topic = 'introduction')

or online

If using the algorithm please cite:

Dermadi D, Bscheider M, Bjegovic K, et al. Exploration of Cell Development Pathways through High-Dimensional Single Cell Analysis in Trajectory Space. iScience. 2020;23(2):100842. doi:10.1016/j.isci.2020.100842

tspace's People

Contributors

hylasd avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

gjhanchem

tspace's Issues

Running tSPACE on large datasets. Issues with igraph: Weight vector must be non-negative

Hi,

Thanks a lot for your great work. I'm trying to run tSpace on a dataset of 200'000 cells x 15 PCs (on Mac iOS). However I get the following error [Error in { :
task 1 failed - "At structural_properties.c:4295 : Weight vector must be non-negative, Invalid value"], which I believe is a problem with the igraph dependency. When I run tSpace on a downsample of the dataset (2'000 cells x 15 PCs), I'm able to obtain my ts_file. I tried to install previous version of igraph (1.1.2) as suggested, but I still get the same error. Thank you very much!

How to convert seurat object to ts file?

hi team, I try to build a ts file by
ts <- tSpace(df = your_data, K = 20, L = 15, D = 'pearson_correlation', graph = 5, trajectories = 200, wp = 15, dr = 'pca', core_no = 2)
However, how to create the "your_data" from a seurat object? I try the following two ways:

  1. data.table<- as.matrix(GetAssayData(seurat_object, slot = "data"))

ts <- tSpace(df = data.table,

  •          K = 20, L = 15, 
    
  •          D = 'pearson_correlation', 
    
  •          graph = 5, 
    
  •          trajectories = 200, 
    
  •          wp = 15, dr = 'pca', core_no = 8)
    

Step 1:Finding graphError in graph.adjacency.sparse(adjmatrix, mode = mode, weighted = weighted, :
not a square matrix

  1. data.table<- as.matrix(GetAssayData(seurat_object, slot = "data"))
    data.table <- as(data.table, 'sparseMatrix')

ts <- tSpace(df = data.table,

  •          K = 20, L = 15, 
    
  •          D = 'pearson_correlation', 
    
  •          graph = 5, 
    
  •          trajectories = 200, 
    
  •          wp = 15, dr = 'pca', core_no = 8)
    

Step 1:Finding graphError in { :
task 1 failed - "unable to find an inherited method for function ‘[’ for signature ‘"dgCMatrix"’"

How to create an eligible "your_data" file? Thanks a lot!

Installation (mac) and R version 3.6.

Hi,

I have a problem wit installing tSpace.

Error: (converted from warning) package ‘foreach’ was built under R version 3.6.2
Execution halted
ERROR: lazy loading failed for package ‘tSpace’

  • removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/tSpace’
    Error: Failed to install 'tSpace' from GitHub:
    (converted from warning) installation of package ‘/var/folders/46/yxc2wz6n091738r0rv_55jm40000gn/T//RtmpqiW6AZ/file1069849dc0658/tSpace_0.1.0.tar.gz’ had non-zero exit status

Can you help me with that?

Error in the graphfinder function

Thank you for the great work. I was trying to run tSpace on my dataset - 50 PCs of around 11000 cells. However, tSpace failed with error '"Error in -rem : invalid argument to unary operator"'. I debugged and traced the error to line 64 of the graphfinder function

temp <- temp[-rem,]

Turns out in my case 'rem' list is empty - it just contains 50 NULL objects. Because of this empty list the step mentioned above fails. The 'rem' object is created a few lines before in a parallel process I cannot debug further, so I'm not sure which line exactly is causing the problem.

Could you please assist me in solving this issue?

issue about calculation in tSPACE

Hi Denis,

Thanks for the beautiful tool tSPACE, I have been trying to use it to build reasonable trajectories for a bunch of developmental single cell data.
Here I have got some issue:

  I first ran a small dataset with about 3k cells and 1.5k variable genes, it took 15h to run on a 64G local PC, the trajectory output seems pretty good.

  then I wanted to run a bigger one with about tens of thosands of cells and same parameters, but it was terminated by me after 100h without an end.

  then I chose to use the top PCs as input, though it could be completed in just a few hours, the tSPACE output result becomes very similar to my old UMAP calculated using the same PCs. It seems like the existing PCs have been determined a lot by custom pre-normalization/-integration. Additionally, if a few datasets have to run individually, it might be hard to keep the consistensy.

So my question is: if there is a way to extract the tPC formula, as getting PCA coefficient from seur.obj@reductions$[email protected] ?
Then I could run tSPACE on a standard and relatively small dataset at first, then extract the formula for each tPC, after that, I could do the calculation using those pre-built tPC-formulas on any new and bigger datasets with similar celltypes and same pre-normalization.

Kind Wishes,

Shaorui

Cluster setup failed. 2 of 2 workers failed to connect.

hi, I am going to build a ts file from a matrix. It has 7274 cells with 22457 genes. It is running in rstudio server with 8 CPU and 64G RAM.
Code:
library(tSpace)
Idents(scRNA) <- "orig.ident"
df <- subset(scRNA, idents = 'day5')
df <- GetAssayData(df,slot="data",assay="RNA")
ts <- tSpace(df = df,
K = 20, L = 15,
D = 'pearson_correlation',
graph = 5,
trajectories = 200,
wp = 15, dr = 'pca', core_no = 2)
It shown error like below:
Step 1:Finding graphError in makePSOCKcluster(names = spec, ...) : Cluster setup failed. 2 of 2 workers failed to connect.
In addition: Warning messages: 1: In system(cmd, wait = FALSE) : system call failed: Cannot allocate memory 2: In system(cmd, wait = FALSE) : error in running command Error in save(list = names(.GlobalEnv), file = outfile, version = version, : error writing to connection Error saving session (search_path): R code execution error Error in system(paste(which, shQuote(names[i])), intern = TRUE, ignore.stderr = TRUE) : cannot popen '/usr/bin/which 'pdflatex' 2>/dev/null', probable reason 'Cannot allocate memory' Error in system(paste(which, shQuote(names[i])), intern = TRUE, ignore.stderr = TRUE) : cannot popen '/usr/bin/which 'pdflatex' 2>/dev/null', probable reason 'Cannot allocate memory'

Hope some one would give me some suggestion!
Best!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.