kstreet13 / slingshot Goto Github PK
View Code? Open in Web Editor NEWFunctions for identifying and characterizing continuous developmental trajectories in single-cell data.
Functions for identifying and characterizing continuous developmental trajectories in single-cell data.
Hi all,
I installed slingshot using the command BiocManager::install("slingshot")
with
Bioconductor version 3.8 (BiocManager 1.30.4) and R 3.5.1 (2018-07-02). This seemed to work without issues. However, when loading slingshot with library(slingshot)
nothing happens and R gets stuck without error messages or any chance to cancel the process without force quitting R. Any ideas?
Cheers,
Jonas
R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS 10.14.1
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
loaded via a namespace (and not attached):
[1] compiler_3.5.1 tools_3.5.1 yaml_2.2.0 ```
Hi,
I have been using slingshot on several datasets. On the last dataset I used, however, the lineage returned by the algorithm has a reversed order (ie. start.clus
cells have the highest values in pseudotime).
The returned lineage is linear, and composed by 3 clusters. The method works fine but the cluster provided as start.clus
ends up at the end of the lineage.
Is it something that may happen with linear lineages?
My sessionInfo()
follows.
Thanks,
Francesco
> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-apple-darwin18.5.0 (64-bit)
Running under: macOS Mojave 10.14.4
Matrix products: default
BLAS/LAPACK: /usr/local/Cellar/openblas/0.3.6_1/lib/libopenblasp-r0.3.6.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] slingshot_1.2.0 Biobase_2.44.0 BiocGenerics_0.30.0
[4] princurve_2.1.3
loaded via a namespace (and not attached):
[1] colorspace_1.4-1 XVector_0.24.0
[3] GenomicRanges_1.36.0 gsl_2.1-6
[5] bit64_0.9-7 AnnotationDbi_1.46.0
[7] RSpectra_0.14-0 mvtnorm_1.0-10
[9] xml2_1.2.0 codetools_0.2-16
[11] splines_3.6.0 doParallel_1.0.14
[13] knitr_1.23 ade4_1.7-13
[15] jsonlite_1.6 locfdr_1.1-8
[17] phylobase_0.8.6 gridBase_0.4-7
[19] annotate_1.62.0 cluster_2.0.9
[21] kernlab_0.9-27 stabledist_0.7-1
[23] copula_0.999-19.1 shiny_1.3.2
[25] HDF5Array_1.12.1 compiler_3.6.0
[27] httr_1.4.0 assertthat_0.2.1
[29] Matrix_1.2-17 lazyeval_0.2.2
[31] limma_3.40.2 later_0.8.0
[33] htmltools_0.3.6 prettyunits_1.0.2
[35] tools_3.6.0 igraph_1.2.4.1
[37] gtable_0.3.0 glue_1.3.1
[39] GenomeInfoDbData_1.2.1 reshape2_1.4.3
[41] dplyr_0.8.1 Rcpp_1.0.1
[43] softImpute_1.4 zinbwave_1.6.0
[45] NMF_0.21.0 ape_5.3
[47] nlme_3.1-140 iterators_1.0.10
[49] crosstalk_1.0.0 xfun_0.7
[51] stringr_1.4.0 miniUI_0.1.1.1
[53] mime_0.6 rngtools_1.3.1.1
[55] XML_3.98-1.19 edgeR_3.26.3
[57] zlibbioc_1.30.0 MASS_7.3-51.4
[59] scales_1.0.0 promises_1.0.1
[61] hms_0.4.2 SummarizedExperiment_1.14.0
[63] rhdf5_2.28.0 RColorBrewer_1.1-2
[65] SingleCellExperiment_1.6.0 memoise_1.1.0
[67] ggplot2_3.1.1 pkgmaker_0.27
[69] stringi_1.4.3 RSQLite_2.1.1
[71] genefilter_1.66.0 S4Vectors_0.22.0
[73] pcaPP_1.9-73 foreach_1.4.4
[75] clusterExperiment_2.4.2 manipulateWidget_0.10.0
[77] BiocParallel_1.18.0 bibtex_0.4.2
[79] GenomeInfoDb_1.20.0 rlang_0.3.4
[81] pkgconfig_2.0.2 matrixStats_0.54.0
[83] bitops_1.0-6 rgl_0.100.19
[85] rncl_0.8.3 lattice_0.20-38
[87] purrr_0.3.2 Rhdf5lib_1.6.0
[89] htmlwidgets_1.3 bit_1.1-14
[91] tidyselect_0.2.5 plyr_1.8.4
[93] magrittr_1.5 R6_2.4.0
[95] IRanges_2.18.0 ADGofTest_0.3
[97] DelayedArray_0.10.0 DBI_1.0.0
[99] pillar_1.4.0 withr_2.1.2
[101] survival_2.44-1.1 RCurl_1.95-4.12
[103] tibble_2.1.1 pspline_1.0-18
[105] crayon_1.3.4 uuid_0.1-2
[107] howmany_0.3-1 progress_1.2.2
[109] RNeXML_2.3.0 locfit_1.5-9.1
[111] grid_3.6.0 blob_1.1.1
[113] webshot_0.5.1 digest_0.6.19
[115] xtable_1.8-4 httpuv_1.5.1
[117] tidyr_0.8.3 numDeriv_2016.8-1
[119] stats4_3.6.0 munsell_0.5.0
[121] glmnet_2.0-18 registry_0.5-1
Hi,
I created a diffusion map on 123.000 cells, based on 9 parameters (its a flow cytometry dataset). Now I am using Slingshot to calculate the pseudotime, however the curve is really dependent on the cluster definitions (which on its turn is sensitive to the number of dimensions as input). For instance:
2 diffusion components, clusters calculated by mclust (=9)
4 diffusion components, clusters calculated by mclust (=9)
4 diffusion components, clusters calculated manually (=10)
4 diffusion components, clusters calculated by mclust (=10)
I was wondering whether you could give me some advice, on how many components and clusters to include for the slingshot calculation, in case of 123000 cells with 9 parameters?
Thanks!
Hello!
I am using slingshot to try and find the lineage tree in a simulated dataset. When I reach the getLineages
step I get an error.
getLineages
uses the full covariance matrix, runs without error, and returns a result.
getLineages
uses the full covariance matrix but returns an error:
Error in solve.default(s1 + s2) :
system is computationally singular: reciprocal condition number = 3.05774e-18
The script goes as follows:
suppressPackageStartupMessages(library(slingshot))
suppressPackageStartupMessages(library(mclust))
library(destiny)
# read file
filein <- "path/to/sim98_destiny_log_k"
dimensions <- 10
input_data <- readRDS(filein)
CellCoordinates <- input_data@eigenvectors[,1:dimensions]
# find number of clusters and perform clustering with mclust
mclusters <- mclustBIC(CellCoordinates, G = 5:50)
mod1 <- Mclust(CellCoordinates, x = mclusters)
# get lineages
sds <- getLineages(CellCoordinates, mod1$classification, start.clus = mod1$classification[1])
R 3.6.0
from sessionInfo()
:
Matrix products: default
BLAS: /usr/lib/atlas-base/atlas/libblas.so.3.0
LAPACK: /usr/lib/atlas-base/atlas/liblapack.so.3.0
Random number generation:
RNG: Mersenne-Twister
Normal: Inversion
Sample: Rounding
other attached packages:
destiny_2.13.0
mclust_5.4.3
slingshot_1.1.3
Biobase_2.43.1
BiocGenerics_0.29.2
princurve_2.1.3
For what it's worth, if I add a little bit of Gaussian noise to the diffusion map coordinates I have no problems:
span <- range(CellCoordinates)[2] - range(CellCoordinates)[1]
N <- dim(CellCoordinates)[1]
K <- dim(CellCoordinates)[2]
noise <- rnorm(N*K, mean = 0, sd = span/100)
dim(noise) <- c(N, K)
getLineages(CellCoordinates+noise, mod1$classification, start.clus = mod1$classification[1])
I suspect that under all of this the problem is that there are cells that are very similar to each other (each cell is supposed to have 10 biological "replicates"), so I suppose that after size normalization, log-transformation and projection on the diffusion map some of the cells might have coordinates that are similar below some threshold - however any(duplicated(CellCoordinates))
returns FALSE
. Any ideas?
Hey,
I run the code and dataset you provided in the tutorial(just copy and paste), but get this error when I tried to run zinbwve function. The only thing I changed was the number of cores. I set NCORES <- detectCores()-1. So I used 23 cores at the end otherwise it is too slow. Would you please have a look for my error and give me some suggestion to fix it?
Error in checkSlotAssignment(object, name, value) :
assignment of an object of class “NULL” is not valid for slot ‘NAMES’ in an object of class “SingleCellExperiment”; is(value, "characterORNULL") is not TRUE
In addition: Warning message:
In simpute.als(x, J, thresh, lambda, maxit, trace.it, warm.start, :
Convergence not achieved by 100 iterations
When running slingshot()
with the approx_points
argument set on a SingleCellExperiment
created from a Seurat
object, smooth.spline
throws an error saying approx_points
is an unused argument:
scrna.sce <- as.SingleCellExperiment(scrna)
sce <- slingshot(scrna.sce, clusterLabels = "seurat_clusters", reducedDim = "PCA", approx_points = 100, start.clus = "1")
Using diagonal covariance matrix
Error in smooth.spline(lambda, xj, w = w, ..., df = df, tol = tol, keep.data = FALSE, : unused argument (approx_points = 100)
Traceback:
1. slingshot(scrna.sce, clusterLabels = "seurat_clusters", reducedDim = "PCA",
. approx_points = 100, start.clus = "1")
2. slingshot(scrna.sce, clusterLabels = "seurat_clusters", reducedDim = "PCA",
. approx_points = 100, start.clus = "1")
3. .local(data, clusterLabels, ...)
4. slingshot(data = rd, clusterLabels = cl, reducedDim = NULL, start.clus = start.clus,
. end.clus = end.clus, dist.fun = dist.fun, omega = omega,
. shrink = shrink, extend = extend, reweight = reweight, reassign = reassign,
. thresh = thresh, maxit = maxit, stretch = stretch, smoother = smoother,
. shrink.method = shrink.method, allow.breaks = allow.breaks,
. ...)
5. slingshot(data = rd, clusterLabels = cl, reducedDim = NULL, start.clus = start.clus,
. end.clus = end.clus, dist.fun = dist.fun, omega = omega,
. shrink = shrink, extend = extend, reweight = reweight, reassign = reassign,
. thresh = thresh, maxit = maxit, stretch = stretch, smoother = smoother,
. shrink.method = shrink.method, allow.breaks = allow.breaks,
. ...)
6. .local(data, clusterLabels, ...)
7. slingshot(data = data, clusterLabels = as.character(clusterLabels),
. reducedDim = reducedDim, start.clus = start.clus, end.clus = end.clus,
. dist.fun = dist.fun, omega = omega, shrink = shrink, extend = extend,
. reweight = reweight, reassign = reassign, thresh = thresh,
. maxit = maxit, stretch = stretch, smoother = smoother, shrink.method = shrink.method,
. allow.breaks = allow.breaks, ...)
8. slingshot(data = data, clusterLabels = as.character(clusterLabels),
. reducedDim = reducedDim, start.clus = start.clus, end.clus = end.clus,
. dist.fun = dist.fun, omega = omega, shrink = shrink, extend = extend,
. reweight = reweight, reassign = reassign, thresh = thresh,
. maxit = maxit, stretch = stretch, smoother = smoother, shrink.method = shrink.method,
. allow.breaks = allow.breaks, ...)
9. .local(data, clusterLabels, ...)
10. getCurves(sds, shrink = shrink, extend = extend, reweight = reweight,
. reassign = reassign, thresh = thresh, maxit = maxit, stretch = stretch,
. smoother = smoother, shrink.method = shrink.method, allow.breaks = allow.breaks,
. ...)
11. getCurves(sds, shrink = shrink, extend = extend, reweight = reweight,
. reassign = reassign, thresh = thresh, maxit = maxit, stretch = stretch,
. smoother = smoother, shrink.method = shrink.method, allow.breaks = allow.breaks,
. ...)
12. .local(sds, ...)
13. smootherFcn(pcurve$lambda, X[, jj], w = pcurve$w, ...)
14. tryCatch({
. smooth.spline(lambda, xj, w = w, ..., df = df, tol = tol,
. keep.data = FALSE)
. }, error = function(e) {
. smooth.spline(lambda, xj, w = w, ..., df = df, tol = tol,
. keep.data = FALSE, spar = 1)
. })
15. tryCatchList(expr, classes, parentenv, handlers)
16. tryCatchOne(expr, names, parentenv, handlers[[1L]])
17. value[[3L]](cond)
Hi Kelly,
I am using slingshot to construct the cell trajectory among cells at 10hpf and 13hpf. I find that the MST algorithm will connect some clusters at the same time point. But I mean it may be impossible that in a certain time point, cells can convert from one type to another? What should I suppose to do?
Is there a way to plot one lineage or curve and color cells according to their corresponding pseudo time values in the reduced XY space?
Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘SlingshotDataSet’ for signature ‘‘"SlingshotDataSet"’
after running SlingshotDataSet(sce)
.
This is straight out of the vignette updated February 2019.
> crv <- get_curves(xy, cell.data$Cluster, l3)
Error in storage.mode(x) <- "double" :
(list) object cannot be coerced to type 'double'
EDIT:
> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12.4
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggplot2_2.2.1 gdata_2.17.0 slingshot_0.0.3-4 princurve_1.1-12 Biobase_2.34.0 BiocGenerics_0.20.0 BiocInstaller_1.24.0
loaded via a namespace (and not attached):
[1] Rcpp_0.12.10 RColorBrewer_1.1-2 git2r_0.18.0 plyr_1.8.4 tools_3.3.2 digest_0.6.12 tibble_1.3.0
[8] jsonlite_1.4 memoise_1.1.0 nlme_3.1-131 gtable_0.2.0 lattice_0.20-35 igraph_1.0.1 shiny_1.0.3
[15] curl_2.6 withr_1.0.2 httr_1.2.1 knitr_1.15.1 htmlwidgets_0.8 gtools_3.5.0 devtools_1.12.0
[22] grid_3.3.2 R6_2.2.0 rgl_0.98.1 magrittr_1.5 scales_0.4.1 htmltools_0.3.6 mime_0.5
[29] ape_4.1 xtable_1.8-2 colorspace_1.3-2 httpuv_1.3.3 labeling_0.3 lazyeval_0.2.0 munsell_0.4.3
EDIT2: Debugging has pointed me to the source of the issue may be in the .get_lam
function.
Hi Kelly!
Hope you are well. We've had some folks asking how to do branch point analysis with slingshot. My plan is pretty simple, I'm planning on taking whatever Mcluster-identified cluster is close to the branch points and then doing a differential expression of that cluster vs all of the other clusters to come up with a set of genes up or down in the branch-point-associated cluster. Is there anything else you would suggest? Thanks!
Hi!
When I was using DiffusionMap, I got the warning message
In dataset_extract_doublematrix(data, vars) :
Duplicate rows removed from data. Consider explicitly using df[!duplicated(df), ]
And when I was doing reduceDims, I got the error message:
Error in validObject(x) : invalid class “SingleCellExperiment” object:
each element of 'reducedDims' must be a matrix-like object with nrow equal to 'ncol(object)'
So, I suppose the error is related with the fact that duplicated rows remove from data. I want to know how to handle it. Many thanks!
hey,
the tutorial you put on bioconductor seems out of date, it took me 2 hours to find these functions....
https://www.bioconductor.org/help/course-materials/2016/BioC2016/ConcurrentWorkshops1/Risso/slingshot.html
Hi,
Here I met a problem about the installation.
I use the newest R 3.5.0 and meet the error.
> source("https://bioconductor.org/biocLite.R")
Bioconductor version 3.8 (BiocInstaller 1.31.1), ?biocLite for help
> biocLite("kstreet13/slingshot")
BioC_mirror: https://bioconductor.org
Using Bioconductor 3.8 (BiocInstaller 1.31.1), R 3.5.0 (2018-04-23).
Installing github package(s) ‘kstreet13/slingshot’
Downloading GitHub repo kstreet13/slingshot@master
Error in utils::download.file(url, path, method = download_method(), quiet = quiet, :
Cannot open URL'https://api.github.com/repos/kstreet13/slingshot/zipball/master'
I don't know what's the problem.
In fact, I used R 3.4.3 to do the installation. This error doesn't appear. But the installation is failed. Because it said it need the newest version of R, such like 3.5.0 or higher.
So I'm a little confused now.
Is there anyone to help me with this "sample" problem?
Thanks very much.
BJ
Hey!
Thank you for the help last time, got slingshot working with my data up to a point..
In brief, my approach has been to use merge my datasets using Seurat's CCA approach, and I've identified cell types through DE. Next I'm hoping to split the seurat object into the individual datasets, and observe whether lineages change between datasets.
I've tried this for one of the datasets below, however, quite clearly, the lineages are not being calculated or displayed as expected.
Here's the code:
`
#############
.## Subset full seurat object into sample specific seurat objects
wt_UT.combined <- SubsetData(sample.combined, subset.name = "orig.ident", accept.value="wt_UT")
.## Convert seurat object to SingleCellExpreiment (sce) object (required for slingshot)
wt_UT.combined.sce <- as.SingleCellExperiment(wt_UT.combined)
.## Perform slingshot analysis
wt_UT.combined.sling <- slingshot(wt_UT.combined.sce, clusterLabels = 'ident', reducedDim = 'PCA')
.## Plot UMAP colored by Slingshot pseudotime w/lineage map overlayed
colors <- rainbow(50, alpha = 1)
plot(reducedDims(wt_UT.combined.sling)$UMAP, col = colors[cut(wt_UT.combined.sling$slingPseudotime_1,breaks=50)], pch=16, asp = 1)
lines(SlingshotDataSet(wt_UT.combined.sling), lwd = 2, type = 'lineages', col = 'black')
`
Hi,
First of all, Slingshot is a great package!
In the documentation, the shrink parameter is described as follows:
shrink: logical or numeric between 0 and 1, determines whether and how much to shrink branching lineages toward their average prior to the split.
However, when I try shrink = 0.1
, it produces the same result as shrink = TRUE
. Looking at the code, I don't see how a numeric shrink is used. Is there another way to set the strength of shrink? Thanks!
After running slingshot
, I got lots of NA value for pseudotime. For some clusters, even > 95% of cells got NAs which significantly effect downstream analysis.
Hey!
New to slingshot, looking forward to getting to grips with it! But getting this error first off:
Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘slingshot’ for signature ‘"Seurat", "character"’
From the code
sample.combined.sling <- slingshot(sample.combined, clusterLabels = 'seurat_clusters', reducedDim = 'PCA')
I'm wondering whether it's something related to the seurat object as it's gone through some processing, I'll paste the code for it below
Thanks!
`data_dir <- './wt_UT/'
list.files(data_dir) # Should show barcodes.tsv, genes.tsv, and matrix.mtx
wt_UT_expression <- Read10X(data.dir = data_dir)
wt_UT = CreateSeuratObject(counts = wt_UT_expression, project = "wt_UT", min.cells = 5)
wt_UT <- subset(wt_UT, subset = nFeature_RNA > 500)
wt_UT <- NormalizeData(wt_UT, verbose = FALSE)
wt_UT <- FindVariableFeatures(wt_UT, selection.method = "vst", nfeatures = 2000)
data_dir <- './wt_aCT/'
list.files(data_dir) # Should show barcodes.tsv, genes.tsv, and matrix.mtx
wt_aCT_expression <- Read10X(data.dir = data_dir)
wt_aCT = CreateSeuratObject(counts = wt_aCT_expression, project = "wt_aCT", min.cells = 5)
wt_aCT <- subset(wt_aCT, subset = nFeature_RNA > 500)
wt_aCT <- NormalizeData(wt_aCT, verbose = FALSE)
wt_aCT <- FindVariableFeatures(wt_aCT, selection.method = "vst", nfeatures = 2000)
data_dir <- './tbet_UT/'
list.files(data_dir) # Should show barcodes.tsv, genes.tsv, and matrix.mtx
tbet_UT_expression <- Read10X(data.dir = data_dir)
tbet_UT = CreateSeuratObject(counts = tbet_UT_expression, project = "tbet_UT", min.cells = 5)
tbet_UT <- subset(tbet_UT, subset = nFeature_RNA > 500)
tbet_UT <- NormalizeData(tbet_UT, verbose = FALSE)
tbet_UT <- FindVariableFeatures(tbet_UT, selection.method = "vst", nfeatures = 2000)
data_dir <- './tbet_aCT/'
list.files(data_dir) # Should show barcodes.tsv, genes.tsv, and matrix.mtx
tbet_aCT_expression <- Read10X(data.dir = data_dir)
tbet_aCT = CreateSeuratObject(counts = tbet_aCT_expression, project = "tbet_aCT", min.cells = 5)
tbet_aCT <- subset(tbet_aCT, subset = nFeature_RNA > 500)
tbet_aCT <- NormalizeData(tbet_aCT, verbose = FALSE)
tbet_aCT <- FindVariableFeatures(tbet_aCT, selection.method = "vst", nfeatures = 2000)
##Perform CCA
sample.anchors <- FindIntegrationAnchors(object.list = list(wt_UT, wt_aCT, tbet_UT, tbet_aCT), dims = 1:20)
sample.combined <- IntegrateData(anchorset = sample.anchors, dims = 1:20)
DefaultAssay(sample.combined) <- "integrated"
`## Run the standard workflow for visualization and clustering
sample.combined <- ScaleData(sample.combined, verbose = FALSE)
sample.combined <- RunPCA(sample.combined, npcs = 30, verbose = FALSE)
`## UMAP and Clustering
sample.combined <- RunUMAP(sample.combined, reduction = "pca", dims = 1:20)
sample.combined <- FindNeighbors(sample.combined, reduction = "pca", dims = 1:20)
sample.combined <- FindClusters(sample.combined, resolution = 0.5)
## Re-name clusters sample.combined <- RenameIdents(sample.combined,
0= "Unknown A",
1= "Cytoxic CD4/CD8",
2= "Helper-like CD4",
3= "Tregs",
4= "Cytoxic/active CD8",
5= "Type I INF",
6= "CD8 activated",
7= "CC CD8",
8= "CC CD4/CD8 ",
9= "Unknown B",
10= "CD8 differentiating",
11= "Unknown C",
12= "Gd T",
13= "Myeloid",
14= "Unknown D")
`
I just tried to install slingshot
but I run in the error Installation failed: error in running command
. The full output is:
> source("https://bioconductor.org/biocLite.R")
Bioconductor version 3.6 (BiocInstaller 1.28.0), ?biocLite for help
A new version of Bioconductor is available after installing the most recent
version of R; see http://bioconductor.org/install
> biocLite("kstreet13/slingshot")
BioC_mirror: https://bioconductor.org
Using Bioconductor 3.6 (BiocInstaller 1.28.0), R 3.4.1 (2017-06-30).
Installing github package(s) ‘kstreet13/slingshot’
Downloading GitHub repo kstreet13/slingshot@master
from URL https://api.github.com/repos/kstreet13/slingshot/zipball/master
Installation failed: error in running command
Old packages: 'destiny', 'lmtest', 'proxy', 'scatterplot3d', 'weights',
'bbmle', 'beachmat', 'bindrcpp', 'bit64', 'car', 'checkmate', 'cluster',
'data.table', 'DBI', 'ddalpha', 'digest', 'edgeR', 'fastICA', 'foreign',
'Formula', 'futile.options', 'GenomicAlignments', 'ggrepel', 'ggsci',
'glmnet', 'Hmisc', 'hms', 'htmlTable', 'htmlwidgets', 'httpuv', 'kernlab',
'lambda.r', 'lattice', 'lme4', 'magic', 'MASS', 'Matrix', 'matrixStats',
'mgcv', 'microbenchmark', 'modelr', 'monocle', 'mvtnorm', 'nlme', 'packrat',
'pbdZMQ', 'pcaPP', 'pillar', 'PKI', 'plogr', 'psych', 'qlcMatrix',
'quantmod', 'quantreg', 'R.oo', 'randomForest', 'Rcpp', 'RcppArmadillo',
'RCurl', 'rgl', 'rjson', 'RMySQL', 'robustbase', 'rsconnect', 'RSQLite',
'rtracklayer', 'SC3', 'scater', 'scran', 'selectr', 'sfsmisc',
'shinydashboard', 'slam', 'sourcetools', 'SparseM', 'stringi', 'stringr',
'SummarizedExperiment', 'survival', 'tidyverse', 'timeDate', 'topGO', 'TTR',
'VGAM', 'viridis', 'viridisLite', 'withr', 'XML', 'xml2', 'xts', 'yaml'
Update all/some/none? [a/s/n]: n
>
I have separate trajectories built for two conditions, and the paths are visually different. I'm curious if you have recommendations on how to make quantitative claims about how the two trajectories differ. Neither are a clean line/curve though- there are some branches. We'd be interested in extracting the proportion of cells falling along a certain path and showing how those differ, and perhaps extracting full distance matrices or something like that so we can look at correlations. Do you have any experience or a vignette on how to do something like this?
error:
Error in as.vector(x, mode = "numeric") :
no method for coercing this S4 class to a vector
commands used:
sce <- slingshot(sim, clusterLabels = 'GMM', reducedDim = 'PCA')
plot3d(sce)
Hello, I have a scRNA-seq data from a tissue (with 2 conditions, with a really small batch effect so I merged data sets in Seurat instead of doing batch correction) that have different type of cells. I identified cell types and I want to use slingshot on only one specific cell type (both of the conditions) to do trajectory analysis.
I can create a subset in Seurat and convert it to SingleCellExperiment object.
Should I start the analysis on slingshot from the scratch like it is a raw data set with normalization, dimension reduction, clustering etc. steps?
Thank you in advance.
I was expecting to be able to plot the labels of each line in order to know which pseudotime progression I am looking at.
Is such thing possible?
THanks!
Hi, Thank you for developing this great package. I am trying to apply this package to do pseudotime for a single cell experiment in two conditions. I used Seurat for filtering and data merge. Then I converted the result to a SingleCellExperiment. The script went smoothly but I found that I lost some dots in the pseudotime plot.
Here is my script:
Obj <- as.SingleCellExperiment(seuratobj)
sce <- slingshot(Obj, clusterLabels = 'seurat_clusters', reducedDim = 'PCA')
colors <- colorRampPalette(brewer.pal(11,'Spectral')[-6])(100)
plotcol <- colors[cut(sce$slingPseudotime_1, breaks=100)]
plot(reducedDims(sce)$PCA, col = plotcol, pch=16, asp = 1)
lines(SlingshotDataSet(sce), lwd=2, col='black')
plot(reducedDims(sce)$PCA, col = brewer.pal(12,'Set3')[sce$seurat_clusters], pch=16, asp = 1)
lines(SlingshotDataSet(sce), lwd=2, type = 'lineages', col = 'black')
But I have 6000 cells and the plot should look like this if it's not colored. The above plots showed only part of the cells.
Is there anything I can do for it to get the correct plots? Thank you.
An error is reported when I try to use the function "getLineages":
spangler.sce <- getLineages(spangler.sce, cl)
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘getLineages’ for signature ‘"SingleCellExperiment", "factor"’
spangler.sce is a SingleCellExperiment data converted from Seurat
cl is a list of factor (including numbers 0-9 in the form of characters)
The same problem occurs when I change cl into a vector:
spangler.sce <- getLineages(spangler.sce, c("0","1","2","3","4","5","6","7","8","9"))
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘getLineages’ for signature ‘"SingleCellExperiment", "character"’
The function slingshot can work very well with the same SingleCellExperiment data:
spangler.sce <- slingshot(spangler.sce,clusterLabels = "seurat_clusters", reducedDim = "PCA")
I get this error when attempting to install slingshot. Seems to be an issue with how the dendextend package is run in R 3.6 possibly? Any ideas how to fix this?
Thanks!
Alyssa
source("http://bioconductor.org/biocLite.R")
Bioconductor version 3.7 (BiocInstaller 1.30.0), ?biocLite for help
A newer version of Bioconductor is available for this version of R, ?BiocUpgrade for help
biocLite("kstreet13/slingshot")
BioC_mirror: https://bioconductor.org
Using Bioconductor 3.7 (BiocInstaller 1.30.0), R 3.6.0 (2019-04-26).
Installing github package(s) ‘kstreet13/slingshot’
Downloading GitHub repo kstreet13/slingshot@master
Skipping 18 packages ahead of CRAN: Biobase, BiocGenerics, BiocParallel, clusterExperiment, DelayedArray, GenomeInfoDb, GenomeInfoDbData, GenomicRanges, HDF5Array, IRanges, limma, rhdf5, Rhdf5lib, S4Vectors, SingleCellExperiment, SummarizedExperiment, XVector, zlibbioc
√ checking for file 'C:\Users\Alyssa\AppData\Local\Temp\RtmpYVEQew\remotes113c560b7dc6\kstreet13-slingshot-d6df7c6/DESCRIPTION' ...
Installing package into ‘C:/Users/Alyssa/Documents/R/win-library/3.6’
(as ‘lib’ is unspecified)
plot_curves
function has default threeD=FALSE
;
help suggests default argument threeD=TRUE
The default value for 'col' in both plot functions is NA and I check for is.na(col), which returns an error when the user specifies a color vector because it has length > 1.
I'm trying to load data from a Seurat objection using v3 of that software. I need to use v3 because I am combining datasets and demultiplex by using HTO barcoding.
My question is how to apply all clusters from Seurat to directly import into slingshot to analyze the lineage tracing.
Hi,
I am running slingshot on a dataset of 25000 cells that has 4 distinct timepoints. I have a few questions.
It is taking more than 8 hours to run slingshot. This is what I am running.
kidney_cc_2.4.sce <- slingshot(kidney_cc_2.4.sce, clusterLabels = 'ident', reducedDim = 'PCA')
Can this time be reduced somehow? I am running on a computer with 16 cores and 64GB memory.
Slignshot is calculating 10 Slingshot_Pseudotime and there are multiple NA values in each of them. Which ones are relevant and how can I plot all of them on one plot?
Is there a way to integrate real timepoints in sligshot to increase the accuracy of the trajectories?
Warning message:
failed to assign RegisteredNativeSymbol for deepcopy to deepcopy since deepcopy is already defined in the ‘lme4’ namespace
From running get_lineages:
Error in colMeans(x.sub) :
'x' must be an array of at least two dimensions
The previous line calculates x.sub <- X[clus.labels == clID,]
When a cluster contains only one cell, this returns a vector, not a matrix, and thus colMeans returns an error.
Possible solution: rewrite as colMeans(as.matrix(x.sub)), though it would probably be good to at least return a warning to the user (even better if it says which clID).
Hello,
I tried installing the package, but I wasn't able to (see below for the whole output). Do you know why?
Best,
Eric
BioC_mirror: https://bioconductor.org
Using Bioconductor 3.7 (BiocInstaller 1.30.0), R 3.5.1 (2018-07-02).
Installing github package(s) ‘kstreet13/slingshot’
Downloading GitHub repo kstreet13/slingshot@master
Skipping 2 packages not available: DelayedArray, GenomeInfoDbData
Installing 2 packages: robustbase, stringi
There are binary versions available (and will be installed) but the source
versions are later:
binary source
robustbase 0.93-1 0.93-1.1
stringi 1.1.7 1.2.3
package ‘robustbase’ successfully unpacked and MD5 sums checked
Warning: cannot remove prior installation of package ‘robustbase’
package ‘stringi’ successfully unpacked and MD5 sums checked
Warning: cannot remove prior installation of package ‘stringi’
Installing package into ‘C:/Users/Eric/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
installing source package 'slingshot' ...
** R
** data
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called 'stringi'
ERROR: lazy loading failed for package 'slingshot'
removing 'C:/Users/Eric/Documents/R/win-library/3.5/slingshot'
In R CMD INSTALL
installation path not writeable, unable to update packages: foreign, survival
Old packages: 'gam', 'httpuv'
Update all/some/none? [a/s/n]:
a
There are binary versions available but the source versions are later:
binary source needs_compilation
gam 1.15 1.16 TRUE
httpuv 1.4.4.2 1.4.5 TRUE
Binaries will be installed
Warning: package ‘gam’ is in use and will not be installed
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/httpuv_1.4.4.2.zip'
Content type 'application/zip' length 1181678 bytes (1.1 MB)
downloaded 1.1 MB
package ‘httpuv’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Eric\AppData\Local\Temp\RtmpQTRCWV\downloaded_packages
Warning message:
In i.p(...) :
installation of package ‘C:/Users/Eric/AppData/Local/Temp/RtmpQTRCWV/remotes3c3c12ee50c8/kstreet13-slingshot-6cab2ee’ had non-zero exit status
I was able to run slingshot successfully on all my data once, after which I installed some other packages related to gene set enrichment. To the best of my knowledge, that is all that changed but subsequently I have not been able to get slingshot to run on one of my data sets. It works fine on the second as well as on the sample data set that is provided with data("slingshotExample")
. Details about the data, R session info, and code/error are below. I've also attached a compressed
RDS file of a list including the PC data and cluster IDs. If I can provide any other info that will help please let me know!
Thanks,
Chris
> str(PCData)
num [1:2323, 1:50] -11.91 -8.79 -11.95 -15.55 -19.52 ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:2323] "1_AAACCTGAGCGCCTTG-1" "1_AAAGCAATCTATCCCG-1" "1_AACCGCGGTGTTCGAT-1" "1_AACTCCCTCAGGCAAG-1" ...
..$ : chr [1:50] "PC1" "PC2" "PC3" "PC4" ...
> str(idents)
Factor w/ 5 levels "R1","R2","R3",..: 1 1 1 1 1 1 1 1 1 1 ...
- attr(*, "names")= chr [1:2323] "1_AAACCTGAGCGCCTTG-1" "1_AAAGCAATCTATCCCG-1" "1_AACCGCGGTGTTCGAT-1" "1_AACTCCCTCAGGCAAG-1" ...
> lineages = getLineages(PCData, clusterLabels = idents)
Using full covariance matrix
> curves = getCurves(lineages)
Error in smooth.spline(lambda, xj, w = w, ..., df = df, tol = tol, keep.data = FALSE, :
missing or infinite values in inputs are not allowed
sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04 LTS
Matrix products: default
BLAS: /opt/R/3.5.1/lib/R/lib/libRblas.so
LAPACK: /opt/R/3.5.1/lib/R/lib/libRlapack.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] parallel stats4 splines stats graphics grDevices utils
[8] datasets methods base
other attached packages:
[1] slingshot_0.99.11 princurve_2.0.4
[3] clusterExperiment_2.0.2 SingleCellExperiment_1.2.0
[5] SummarizedExperiment_1.10.1 DelayedArray_0.6.1
[7] BiocParallel_1.14.2 matrixStats_0.53.1
[9] Biobase_2.40.0 GenomicRanges_1.32.3
[11] GenomeInfoDb_1.16.0 IRanges_2.14.10
[13] S4Vectors_0.18.3 BiocGenerics_0.26.0
[15] gam_1.15 foreach_1.4.4
[17] Seurat_2.3.3 Matrix_1.2-14
[19] cowplot_0.9.2 ggplot2_3.0.0
loaded via a namespace (and not attached):
[1] uuid_0.1-2 snow_0.4-2 backports_1.1.2
[4] Hmisc_4.1-1 NMF_0.21.0 plyr_1.8.4
[7] igraph_1.2.1 lazyeval_0.2.1 crosstalk_1.0.0
[10] rncl_0.8.2 gridBase_0.4-7 digest_0.6.15
[13] htmltools_0.3.6 viridis_0.5.1 lars_1.2
[16] gdata_2.18.0 magrittr_1.5 checkmate_1.8.5
[19] cluster_2.0.7-1 doParallel_1.0.11 mixtools_1.1.0
[22] ROCR_1.0-7 limma_3.36.2 R.utils_2.6.0
[25] prettyunits_1.0.2 colorspace_1.3-2 dplyr_0.7.6
[28] crayon_1.3.4 RCurl_1.95-4.10 jsonlite_1.5
[31] bindr_0.1.1 phylobase_0.8.4 survival_2.42-4
[34] zoo_1.8-2 iterators_1.0.9 ape_5.1
[37] glue_1.2.0 registry_0.5 gtable_0.2.0
[40] zlibbioc_1.26.0 XVector_0.20.0 webshot_0.5.0
[43] kernlab_0.9-26 Rhdf5lib_1.2.1 HDF5Array_1.8.1
[46] prabclus_2.2-6 DEoptimR_1.0-8 scales_0.5.0
[49] mvtnorm_1.0-8 rngtools_1.3.1 bibtex_0.4.2
[52] miniUI_0.1.1.1 Rcpp_0.12.17 metap_0.9
[55] dtw_1.20-1 progress_1.2.0 viridisLite_0.3.0
[58] xtable_1.8-2 htmlTable_1.12 reticulate_1.9
[61] foreign_0.8-70 bit_1.1-14 proxy_0.4-22
[64] mclust_5.4.1 SDMTools_1.1-221 Formula_1.2-3
[67] tsne_0.1-3 htmlwidgets_1.2 httr_1.3.1
[70] gplots_3.0.1 RColorBrewer_1.1-2 fpc_2.1-11
[73] acepack_1.4.1 modeltools_0.2-21 ica_1.0-2
[76] pkgconfig_2.0.1 XML_3.98-1.11 R.methodsS3_1.7.1
[79] flexmix_2.3-14 nnet_7.3-12 manipulateWidget_0.10.0
[82] later_0.7.3 howmany_0.3-1 tidyselect_0.2.4
[85] rlang_0.2.1 reshape2_1.4.3 munsell_0.5.0
[88] tools_3.5.1 ade4_1.7-11 ggridges_0.5.0
[91] stringr_1.3.1 knitr_1.20 bit64_0.9-7
[94] fitdistrplus_1.0-9 robustbase_0.93-1 rgl_0.99.16
[97] caTools_1.17.1 purrr_0.2.5 RANN_2.5.1
[100] dendextend_1.8.0 bindrcpp_0.2.2 pbapply_1.3-4
[103] nlme_3.1-137 mime_0.5 whisker_0.3-2
[106] R.oo_1.22.0 xml2_1.2.0 hdf5r_1.0.0
[109] compiler_3.5.1 rstudioapi_0.7 png_0.1-7
[112] tibble_1.4.2 RNeXML_2.1.1 stringi_1.2.3
[115] RSpectra_0.13-1 lattice_0.20-35 trimcluster_0.1-2
[118] diffusionMap_1.1-0 pillar_1.2.3 lmtest_0.9-36
[121] data.table_1.11.4 bitops_1.0-6 irlba_2.3.2
[124] httpuv_1.4.4.2 R6_2.2.2 latticeExtra_0.6-28
[127] promises_1.0.1 KernSmooth_2.23-15 gridExtra_2.3
[130] codetools_0.2-15 MASS_7.3-50 gtools_3.8.1
[133] assertthat_0.2.0 rhdf5_2.24.0 pkgmaker_0.27
[136] withr_2.1.2 GenomeInfoDbData_1.1.0 locfdr_1.1-8
[139] hms_0.4.2 diptest_0.75-7 doSNOW_1.0.16
[142] grid_3.5.1 rpart_4.1-13 tidyr_0.8.1
[145] class_7.3-14 segmented_0.5-3.0 Rtsne_0.13
[148] shiny_1.1.0 scatterplot3d_0.3-41 base64enc_0.1-3
Actually, I wonder what's the main difference between slingshot and TSCAN?
It seems you both clustering and MST and smoothing...
Except for the preprocessing procedures.
In line 333 of the slingshot vignette you are using Gam to identify diff expressed genes. Looks like you are extracting the pvalue for the linear effect instead of the nonlinear one. Is that right? If so, why?
Hi!
I've got a question regarding the attribution of the cell to a lineage.
I ran slingshot on a diffusion map (dimension 1 to 3), and obtained two lineages. as you can see below.
Here is exactly the same graph but colored if the cells are found in 1 or 2 lineages (retrieved from "no NA" values in the pseudotime list).
I can clearly see cells quite far from the root lineage belonging to two lineages on the right and on the left. I agree the cells in the middle are ambiguous but I am afraid the method to attribute the cell to one lineage is a bit too loose.
It references bioRxiv, but it could be replaced by the article in BMC Genomics instead.
It's really a cool work to illustrate the relationship between cell clusters by "pseudo-curve". But recently we analysis a big data (more than 20,000 cells and 4,000 genes) to discover the pseudo-relationship, we find this key function ,getCurves() and slingshot(), do need so much time. Especially, the downstream analysis function which used GAM with a loess term for pseudotime to fit our data, codes like this:
gam.pval <- apply(Y,1,function(z){
d <- data.frame(z=z, t=t)
tmp <- gam(z ~ lo(t), data=d)
p <- summary(tmp)[4][[1]][1,5]
p
})
So, we really want to know how to speed up the key function and hope we could find more interesting things with slingshot' help.
Appreciated your working!
Good news @kstreet13 !
princurve 2.0.2 has just been released. The functions principal.curve
and get.lam
have been renamed to principal_curve
and project_to_curve
. But more importantly, I modified project_to_curve
such that it will now also return dist_ind
(see here). This way, you don't need to call princurve
's Fortran code, and you will be able to remove 1 more NOTE from your R CMD check :)
Do take into account that the tag
output variable has been renamed to ord
.
Have a nice day,
Robrecht
Hi,
I just updated a lot of bioconductor packages and also princurve in the process (to version 2.1.3). When I tried to rerun a slingshot script I got the error:
Error in project_to_curve(X, s, pcurve$ord, stretch = stretch) :
unused argument (pcurve$ord)
I noticed that this error has previously been discussed in: Bioconductor/BiocWorkshops#22. However, none of the solutions worked for me. I have updated slingshot to 0.99.12 from 0.99.8 and tried this with princurve versions 2.1.0 and 2.0.4 without any luck. Do you have any suggestions what I could do to fix this?
Thanks!
Hi,
I have built the trajectory successfully. But I am wondering how I can add a color legend that indicates pseudotime on the graph? I haven't found any parameter that controls it. Thanks!
Hi, so I have a single cell data and I do know there is only one possible directed linear lineage. Is there anyway that I can fix the lineage number in the slingshot? Thanks,
Hi,
I just finished some seurat analysis. I converted the seurat object into single cell experiment. I cant seem to load it into slingshot as is or via an rds file.
I have the message:
Error in round(nsc_sce) : non-numeric argument to mathematical function
Any ideas how i can have it running?
Thanks a lot.
sessioninfo():
R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252
attached base packages:
[1] splines stats4 parallel stats graphics grDevices utils
[8] datasets methods base
other attached packages:
[1] Seurat_2.3.4 cowplot_0.9.4
[3] gam_1.16 foreach_1.4.4
[5] clusterExperiment_2.2.0 GenoGAM_2.0.3
[7] data.table_1.12.2 Matrix_1.2-17
[9] HDF5Array_1.10.1 rhdf5_2.26.2
[11] RColorBrewer_1.1-2 mclust_5.4.3
[13] destiny_2.12.0 splatter_1.6.1
[15] SingleCellExperiment_1.4.1 SummarizedExperiment_1.12.0
[17] DelayedArray_0.8.0 BiocParallel_1.16.6
[19] matrixStats_0.54.0 GenomicRanges_1.34.0
[21] GenomeInfoDb_1.18.2 IRanges_2.16.0
[23] S4Vectors_0.20.1 slingshot_1.0.0
[25] Biobase_2.42.0 BiocGenerics_0.28.0
[27] princurve_2.1.3 dplyr_0.8.0.1
[29] ggplot2_3.1.1 readr_1.3.1
Hi,
Thanks for this great package!
I am starting to use slingshot just recently. One issue that I see is a connection between a group of T cells and B cells that are fairly separated by umap. I am using Umap with 2 dim with slingshot. Would you recommend me to separate all cells that are known to not have a direct relationship? Or there is a way of avoiding such connections? Thanks!
Hi there,
I'm curious is it a suitable tool for using single cell DNA methylation as input for trajectory analysis?
I really like the plotGenePseudotime function but I am unsure of how to color the cells according to their cluster identity or any other "metadata" type of information.
Is there a way to color the plot the function produces or is it not supported at this time?
I suspect it's possible that I'm misreading this, but I think cl
may be introduced in L550 of slingshot.R without being defined. In any case, when I try to provide a SingleCellExperiment object plus a separate clustering vector, I get
Error in .local(data, clusterLabels, ...) : object 'cl' not found
Traceback:
3: .local(data, clusterLabels, ...)
2: slingshot(sce, clusterLabels = clus.labels)
1: slingshot(sce, clusterLabels = clus.labels)
Hi,
I would like to try out slingshot with some scRNAseq data generated on the 10x Genomics platform. I was wondering if you could help me with how to load in that data into R for use with slingshot? I also have it as a Seurat or Monocle object, if there is an easier way to cross convert into the SingleCellExperiment class.
Many thanks,
Leonard
It would be nice to be able to draw each curve / lineage trajectory in a different color, with a user-defined color palette that is separate from the one used to color points by cluster. (John has asked for this.)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.