Git Product home page Git Product logo

Comments (10)

kstreet13 avatar kstreet13 commented on July 21, 2024

Hi @j-andrews7

I can't tell for sure, but my best guess is that you are using a version of Slingshot in which this feature is not available. The approx_points argument is fairly new and it's currently only available on Bioconductor's devel branch and from this repo (so if you installed Slingshot the usual way, with BiocManager::install, it won't be available and would get passed to smooth.spline, probably causing this error).

from slingshot.

j-andrews7 avatar j-andrews7 commented on July 21, 2024

I tried installing both from this repo and the dev branch of Bioconductor:

R version 3.6.0 (2019-04-26)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.2 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8       
 [4] LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
 [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C          
[10] LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   

attached base packages:
[1] stats4    parallel  stats     graphics  grDevices utils     datasets 
[8] methods   base     

other attached packages:
 [1] RColorBrewer_1.1-2          slingshot_1.3.1            
 [3] princurve_2.1.4             dplyr_0.8.3                
 [5] scran_1.12.1                SingleCellExperiment_1.6.0 
 [7] SummarizedExperiment_1.14.0 DelayedArray_0.10.0        
 [9] BiocParallel_1.18.0         matrixStats_0.54.0         
[11] Biobase_2.44.0              GenomicRanges_1.36.0       
[13] GenomeInfoDb_1.20.0         IRanges_2.18.1             
[15] S4Vectors_0.22.0            BiocGenerics_0.30.0        
[17] future_1.14.0               doParallel_1.0.14          
[19] iterators_1.0.10            foreach_1.4.4              
[21] ggplot2_3.2.0               sctransform_0.2.0          
[23] repr_1.0.1                  Seurat_3.0.3.9015          
[25] cowplot_1.0.0              

loaded via a namespace (and not attached):
  [1] reticulate_1.12          R.utils_2.9.0            tidyselect_0.2.5        
  [4] RSQLite_2.1.1            AnnotationDbi_1.46.0     htmlwidgets_1.3         
  [7] grid_3.6.0               Rtsne_0.15               RNeXML_2.3.0            
 [10] munsell_0.5.0            codetools_0.2-16         ica_1.0-2               
 [13] statmod_1.4.32           miniUI_0.1.1.1           pbdZMQ_0.3-3            
 [16] withr_2.1.2              colorspace_1.4-1         knitr_1.23              
 [19] uuid_0.1-2               zinbwave_1.6.0           pspline_1.0-18          
 [22] ROCR_1.0-7               gbRd_0.4-11              listenv_0.7.0           
 [25] NMF_0.21.0               labeling_0.3             Rdpack_0.11-0           
 [28] GenomeInfoDbData_1.2.1   bit64_0.9-7              rhdf5_2.28.0            
 [31] vctrs_0.2.0              xfun_0.8                 R6_2.4.0                
 [34] ggbeeswarm_0.6.0         rsvd_1.0.1               locfit_1.5-9.1          
 [37] manipulateWidget_0.10.0  bitops_1.0-6             assertthat_0.2.1        
 [40] promises_1.0.1           SDMTools_1.1-221.1       scales_1.0.0            
 [43] beeswarm_0.2.3           gtable_0.3.0             phylobase_0.8.6         
 [46] npsurv_0.4-0             globals_0.12.4           rlang_0.4.0             
 [49] zeallot_0.1.0            genefilter_1.66.0        splines_3.6.0           
 [52] lazyeval_0.2.2           rgl_0.100.24             reshape2_1.4.3          
 [55] backports_1.1.4          crosstalk_1.0.0          httpuv_1.5.1            
 [58] tools_3.6.0              gridBase_0.4-7           gplots_3.0.1.1          
 [61] dynamicTreeCut_1.63-1    stabledist_0.7-1         ggridges_0.5.1          
 [64] Rcpp_1.0.1               plyr_1.8.4               base64enc_0.1-3         
 [67] progress_1.2.2           zlibbioc_1.30.0          purrr_0.3.2             
 [70] RCurl_1.95-4.12          prettyunits_1.0.2        pbapply_1.4-1           
 [73] viridis_0.5.1            zoo_1.8-6                ggrepel_0.8.1           
 [76] cluster_2.0.9            magrittr_1.5             data.table_1.12.2       
 [79] RSpectra_0.15-0          lmtest_0.9-37            RANN_2.6.1              
 [82] mvtnorm_1.0-11           fitdistrplus_1.0-14      gsl_2.1-6               
 [85] mime_0.7                 hms_0.4.2                lsei_1.2-0              
 [88] evaluate_0.14            xtable_1.8-4             XML_3.98-1.20           
 [91] gridExtra_2.3            compiler_3.6.0           scater_1.12.2           
 [94] tibble_2.1.3             KernSmooth_2.23-15       crayon_1.3.4            
 [97] R.oo_1.22.0              htmltools_0.3.6          later_0.8.0             
[100] pcaPP_1.9-73             tidyr_0.8.3              howmany_0.3-1           
[103] DBI_1.0.0                MASS_7.3-51.1            Matrix_1.2-17           
[106] ade4_1.7-13              R.methodsS3_1.7.1        gdata_2.18.0            
[109] metap_1.1                igraph_1.2.4.1           pkgconfig_2.0.2         
[112] rncl_0.8.3               registry_0.5-1           numDeriv_2016.8-1.1     
[115] locfdr_1.1-8             IRdisplay_0.7.0          plotly_4.9.0            
[118] xml2_1.2.0               annotate_1.62.0          vipor_0.4.5             
[121] dqrng_0.2.1              rngtools_1.3.1.1         webshot_0.5.1           
[124] pkgmaker_0.27            XVector_0.24.0           bibtex_0.4.2            
[127] stringr_1.4.0            digest_0.6.20            RcppAnnoy_0.0.12        
[130] tsne_0.1-3               copula_0.999-19.1        ADGofTest_0.3           
[133] softImpute_1.4           edgeR_3.26.5             DelayedMatrixStats_1.6.0
[136] kernlab_0.9-27           shiny_1.3.2              gtools_3.8.1            
[139] nlme_3.1-140             jsonlite_1.6             Rhdf5lib_1.6.0          
[142] clusterExperiment_2.4.4  BiocNeighbors_1.2.0      viridisLite_0.3.0       
[145] limma_3.40.2             pillar_1.4.2             lattice_0.20-38         
[148] httr_1.4.0               survival_2.43-3          glue_1.3.1              
[151] png_0.1-7                glmnet_2.0-18            bit_1.1-14              
[154] HDF5Array_1.12.1         stringi_1.4.3            blob_1.1.1              
[157] BiocSingular_1.0.0       caTools_1.17.1.2         memoise_1.1.0           
[160] IRkernel_1.0.1           irlba_2.3.3              future.apply_1.3.0      
[163] ape_5.3  

from slingshot.

kstreet13 avatar kstreet13 commented on July 21, 2024

Oh, sorry! Thanks for bringing this to my attention! This is indeed an issue.

Looking through the code, I can't seem to figure out what's going on, but it looks like the approx_points argument is not being passed explicitly to the specific slingshot methods (it should show up in the list of arguments, rather than being part of the ...).

I'm also not able to reproduce this error on my end. Is there any chance you could share a small Seurat object on which you get this error? (in case it's related to the Seurat -> SCE conversion).

Thanks!

from slingshot.

j-andrews7 avatar j-andrews7 commented on July 21, 2024

After restarting my R session and loading the SCE from disk, it seems to work fine ¯_(ツ)_/¯, so it's not a consistent breakage. It may have been due to the sheer amount of crap I had in the environment/loaded at the time.

But on a related note, is it possible to use UMAP for the reduced dimensions? Trying to do so throws an error, but given that the docs don't mention anything about it, I figured I'd ask explicitly.

Call and error

sce <- slingshot(scrna.sce, clusterLabels = "seurat_clusters", reducedDim = "UMAP", approx_points = 100, start.clus = "1")

Warning message in avg.jj * pct:longer object length is not a multiple of shorter object lengthWarning message in orig.jj * (1 - pct):longer object length is not a multiple of shorter object lengthError in vapply(seq_len(p), function(jj) {: values must be length 100,
 but FUN(X[[1]]) result is length 23555
Traceback:

1. slingshot(scrna.sce, clusterLabels = "seurat_clusters", reducedDim = "UMAP", 
 .     approx_points = 100, start.clus = "1")
2. slingshot(scrna.sce, clusterLabels = "seurat_clusters", reducedDim = "UMAP", 
 .     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, approx_points = approx_points, 
 .     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, approx_points = approx_points, 
 .     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, approx_points = approx_points, 
 .     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, approx_points = approx_points, 
 .     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, approx_points = approx_points, 
  .     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, approx_points = approx_points, 
  .     stretch = stretch, smoother = smoother, shrink.method = shrink.method, 
  .     allow.breaks = allow.breaks, ...)
12. .local(sds, ...)
13. lapply(seq_along(ns), function(jj) {
  .     crv <- to.shrink[[jj]]
  .     return(.shrink_to_avg(crv, avg, pct.shrink[[j]][[jj]] * shrink, 
  .         X, approx_points = approx_points, stretch = stretch))
  . })
14. FUN(X[[i]], ...)
15. .shrink_to_avg(crv, avg, pct.shrink[[j]][[jj]] * shrink, X, approx_points = approx_points, 
  .     stretch = stretch)
16. vapply(seq_len(p), function(jj) {
  .     orig.jj <- pcurve$s[, jj]
  .     avg.jj <- approx(x = avlam, y = avg.curve$s[, jj], xout = lam, 
  .         rule = 2, ties = mean)$y
  .     return(avg.jj * pct + orig.jj * (1 - pct))
  . }, rep(0, n))

from slingshot.

kstreet13 avatar kstreet13 commented on July 21, 2024

Hm, ok well if it comes up again, please let me know!

And yeah, it should be possible to use any matrix of values as the dimensionality reduction, so I'm not sure why it would work with PCA and not UMAP. This one's buried pretty deep, so I don't have much of a guess as to what might be going on. Again, if you could share a small-ish dataset on which this error can be reproduced, I would greatly appreciate it!

from slingshot.

j-andrews7 avatar j-andrews7 commented on July 21, 2024

I'm trying, but when I downsample, it works 😕

If I manage to get a reproducible set that's not 10k+ cells, I will find a way to send it to you.

from slingshot.

kstreet13 avatar kstreet13 commented on July 21, 2024

Hm, that is pretty strange. Thanks very much for pointing it out!

from slingshot.

j-andrews7 avatar j-andrews7 commented on July 21, 2024

I am still running into this issue, even when downsampling. A small(ish) subset of my seurat object can be found in this Box folder as an rds file so you can try to reproduce if you want.

scrna <- readRDS("sample.rds")
sce <- as.SingleCellExperiment(scrna, assay = "SCT")
sling.umap <- slingshot(sce, clusterLabels = "order", reducedDim = "UMAP", 
    start.clus = "1", end.clus = "3", approx.points = 200)
sessionInfo R version 3.6.0 (2019-04-26) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 18.04.2 LTS

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
[4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
[7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] parallel stats4 splines stats graphics grDevices utils
[8] datasets methods base

other attached packages:
[1] BiocSingular_1.1.7 pheatmap_1.0.12
[3] RColorBrewer_1.1-2 Seurat_3.1.1
[5] SingleCellExperiment_1.7.11 SummarizedExperiment_1.15.9
[7] DelayedArray_0.11.7 BiocParallel_1.19.3
[9] matrixStats_0.55.0 Biobase_2.45.1
[11] GenomicRanges_1.37.16 GenomeInfoDb_1.21.2
[13] IRanges_2.19.16 S4Vectors_0.23.25
[15] BiocGenerics_0.31.6 gam_1.16.1
[17] foreach_1.4.7 slingshot_1.3.2
[19] princurve_2.1.4

loaded via a namespace (and not attached):
[1] Rtsne_0.15 colorspace_1.4-1 ggridges_0.5.1
[4] IRdisplay_0.7.0 XVector_0.25.0 base64enc_0.1-3
[7] leiden_0.3.1 listenv_0.7.0 npsurv_0.4-0
[10] ggrepel_0.8.1 codetools_0.2-16 R.methodsS3_1.7.1
[13] lsei_1.2-0 zeallot_0.1.0 IRkernel_1.0.2
[16] jsonlite_1.6 ica_1.0-2 cluster_2.0.9
[19] png_0.1-7 R.oo_1.22.0 uwot_0.1.4
[22] sctransform_0.2.0 compiler_3.6.0 httr_1.4.1
[25] backports_1.1.5 assertthat_0.2.1 Matrix_1.2-17
[28] lazyeval_0.2.2 htmltools_0.4.0 tools_3.6.0
[31] rsvd_1.0.2 igraph_1.2.4.1 gtable_0.3.0
[34] glue_1.3.1 GenomeInfoDbData_1.2.1 RANN_2.6.1
[37] reshape2_1.4.3 dplyr_0.8.3 Rcpp_1.0.2
[40] vctrs_0.2.0 gdata_2.18.0 ape_5.3
[43] nlme_3.1-140 iterators_1.0.12 gbRd_0.4-11
[46] lmtest_0.9-37 stringr_1.4.0 globals_0.12.4
[49] lifecycle_0.1.0 irlba_2.3.3 gtools_3.8.1
[52] future_1.14.0 zlibbioc_1.31.0 MASS_7.3-51.1
[55] zoo_1.8-6 scales_1.0.0 reticulate_1.13
[58] pbapply_1.4-2 gridExtra_2.3 ggplot2_3.2.1
[61] stringi_1.4.3 caTools_1.17.1.2 bibtex_0.4.2
[64] repr_1.0.1 Rdpack_0.11-0 SDMTools_1.1-221.1
[67] rlang_0.4.0 pkgconfig_2.0.3 bitops_1.0-6
[70] evaluate_0.14 lattice_0.20-38 ROCR_1.0-7
[73] purrr_0.3.2 labeling_0.3 htmlwidgets_1.5.1
[76] cowplot_1.0.0 tidyselect_0.2.5 RcppAnnoy_0.0.13
[79] plyr_1.8.4 magrittr_1.5 R6_2.4.0
[82] gplots_3.0.1.1 pbdZMQ_0.3-3 pillar_1.4.2
[85] fitdistrplus_1.0-14 survival_2.43-3 RCurl_1.95-4.12
[88] tibble_2.1.3 future.apply_1.3.0 tsne_0.1-3
[91] crayon_1.3.4 uuid_0.1-2 KernSmooth_2.23-15
[94] plotly_4.9.0 grid_3.6.0 data.table_1.12.4
[97] metap_1.1 digest_0.6.21 tidyr_1.0.0
[100] R.utils_2.9.0 RcppParallel_4.4.4 munsell_0.5.0
[103] viridisLite_0.3.0

from slingshot.

kstreet13 avatar kstreet13 commented on July 21, 2024

Thanks very much for following up on this!

I tried it out and the above code does produce an error for me, but it went away when I changed approx.points to approx_points. Do you still get the same error in that case?

from slingshot.

j-andrews7 avatar j-andrews7 commented on July 21, 2024

Oh, I'm a moron. Sorry for that. Works fine, even on my full dataset. Mixing "_" and "." does feel a bit gross, but I don't know if it's just being passed directly to a function you don't have control over.

Cheers, closing this, as I feel it's been addressed.

from slingshot.

Related Issues (20)

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.