dynverse / dyno

Inferring, interpreting and visualising trajectories using a streamlined set of packages 🦕
https://dynverse.github.io/dyno
Other
166 stars 32 forks source link

error running slingshot #34

Open friedue opened 5 years ago

friedue commented 5 years ago

Hi,

I've tried my hands at slingshot via dynwrap and that didn't pan out.

> library(dynwrap)
> assayNames(sce)
[1] "counts"    "logcounts"
> dataset <- wrap_expression(counts = counts(sce),
                             +   expression =logcounts(sce)
                             + )
> model <- infer_trajectory(dataset,"slingshot")
Loading required namespace: dynmethods
Using default tag: latest
latest: Pulling from dynverse/ti_slingshot
bc9ab73e5b14: Pulling fs layer
846568129ac2: Pulling fs layer
85acc287e507: Pulling fs layer
1815dfbed2cb: Pulling fs layer
f340461deaa1: Pulling fs layer
1f59c4d5538f: Pulling fs layer
c902428c9782: Pulling fs layer
dfec0a49fb3b: Pulling fs layer
138cd0e8b92c: Pulling fs layer
94d2b05985da: Pulling fs layer
af230cdeb663: Pulling fs layer
b9ae738f1559: Pulling fs layer
96270503d443: Pulling fs layer
5ce5e3b13e39: Pulling fs layer
c3d16d17d155: Pulling fs layer
95406573f667: Pulling fs layer
e642cfd8a979: Pulling fs layer
1815dfbed2cb: Waiting
f340461deaa1: Waiting
1f59c4d5538f: Waiting
c902428c9782: Waiting
dfec0a49fb3b: Waiting
138cd0e8b92c: Waiting
94d2b05985da: Waiting
af230cdeb663: Waiting
b9ae738f1559: Waiting
96270503d443: Waiting
5ce5e3b13e39: Waiting
c3d16d17d155: Waiting
95406573f667: Waiting
e642cfd8a979: Waiting
bc9ab73e5b14: Retrying in 5 seconds
bc9ab73e5b14: Retrying in 4 seconds
bc9ab73e5b14: Retrying in 3 seconds
bc9ab73e5b14: Retrying in 2 seconds
bc9ab73e5b14: Retrying in 1 second
bc9ab73e5b14: Verifying Checksum
bc9ab73e5b14: Download complete
1815dfbed2cb: Verifying Checksum
1815dfbed2cb: Download complete
f340461deaa1: Verifying Checksum
f340461deaa1: Download complete
1f59c4d5538f: Verifying Checksum
1f59c4d5538f: Download complete
bc9ab73e5b14: Pull complete
c902428c9782: Verifying Checksum
c902428c9782: Download complete
85acc287e507: Verifying Checksum
85acc287e507: Download complete
138cd0e8b92c: Retrying in 5 seconds
138cd0e8b92c: Retrying in 4 seconds
138cd0e8b92c: Retrying in 3 seconds
138cd0e8b92c: Retrying in 2 seconds
138cd0e8b92c: Retrying in 1 second
138cd0e8b92c: Verifying Checksum
138cd0e8b92c: Download complete
94d2b05985da: Download complete
846568129ac2: Download complete
846568129ac2: Pull complete
b9ae738f1559: Verifying Checksum
b9ae738f1559: Download complete
96270503d443: Verifying Checksum
96270503d443: Download complete
85acc287e507: Pull complete
1815dfbed2cb: Pull complete
f340461deaa1: Pull complete
1f59c4d5538f: Pull complete
c902428c9782: Pull complete
5ce5e3b13e39: Verifying Checksum
5ce5e3b13e39: Download complete
c3d16d17d155: Verifying Checksum
c3d16d17d155: Download complete
af230cdeb663: Retrying in 4 seconds
af230cdeb663: Retrying in 3 seconds
af230cdeb663: Retrying in 2 seconds
af230cdeb663: Retrying in 1 second
af230cdeb663: Verifying Checksum
af230cdeb663: Download complete
e642cfd8a979: Verifying Checksum
e642cfd8a979: Download complete
95406573f667: Verifying Checksum
95406573f667: Download complete
dfec0a49fb3b: Verifying Checksum
dfec0a49fb3b: Download complete
dfec0a49fb3b: Pull complete
138cd0e8b92c: Pull complete
94d2b05985da: Pull complete
af230cdeb663: Pull complete
b9ae738f1559: Pull complete
96270503d443: Pull complete
5ce5e3b13e39: Pull complete
c3d16d17d155: Pull complete
95406573f667: Pull complete
e642cfd8a979: Pull complete
Digest: sha256:9408fbc09ce683f658344fcda7c2590928f4ff577098123d883c7039f324e5c5
Status: Downloaded newer image for dynverse/ti_slingshot:latest
Error traceback:
  1: 
  Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

  filter, lag

The following objects are masked from ‘package:base’:

  intersect, setdiff, setequal, union

Attaching package: ‘purrr’

The following object is masked from ‘package:jsonlite’:

  flatten

Warning messages:
  1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
Killed

Error: $ operator is invalid for atomic vectors
In addition: Warning message:
  In babelwhale::get_label(container_id, "version") : 

  Error: No such image: dynverse/ti_slingshot
rcannood commented 5 years ago

Hey Friederike! Thanks for trying out dyno. This is a known bug that I should really look into urgently. The first time you download a TI method, you get a error message. The solution is to simply try again :)

Could you try running it again and see if it works? If it does, don't close this ticket yet, that'll remind me to take a look at this problem.

Robrecht

friedue commented 5 years ago

tried it again:

Error traceback:
1: 
Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

    filter, lag

The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union

Attaching package: ‘purrr’

The following object is masked from ‘package:jsonlite’:

    flatten

Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
Killed

Error: $ operator is invalid for atomic vectors

EDIT: realized I had forgotten to actually include the error...

rcannood commented 5 years ago

Are you still at the conference? Do you have time at 8 to show me your problem?

friedue commented 5 years ago

Sure!

friedue commented 5 years ago

just for reference:

 dim(counts)
[1] 15520  7263
friedue commented 5 years ago

and more reference:

 model <- infer_trajectory(dataset,"projected_paga")
Error traceback:
1: Killed

Error: $ operator is invalid for atomic vectors
friedue commented 5 years ago

In regard to the problem that may occur because of the normalization step that slingshot suggests -- maybe you could use the slot from your dataset file that contains the expression as is assuming that the submitter has normalized those values the way they want them to be normalized?

abhaduri commented 5 years ago

Hi There! I am getting the same problem with the

Error: $ operator is invalid for atomic vectors

Is there a solution for this? It has happened with every TI method I have tried using dyno, and with slingshot it is also accompanied by the same error in this thread:

Warning messages: 1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display 2: 'rgl_init' failed, running with rgl.useNULL = TRUE Killed

Happy to show errors etc but its the same thing - any solution suggestions?

rcannood commented 5 years ago

Hi Friederike,

The new version of dyno should be able to handle sparse matrices much better. Only the software of the individual TI methods might not support sparse matrices. Could you install the latest version of dyno and try again?

Robrecht

rcannood commented 5 years ago

@abhaduri You are likely having a different issue. There was a time where dyno was not forwarding errors generated within containers correctly, but this has since been fixed. Could you reinstall and try again? If the problem persists, feel free to create a new issue.

friedue commented 5 years ago

congrats on the publication!

I've re-installed dyno, this is what's happening now:

> library(dyno)
> dataset <- wrap_expression(counts = cts,
                            expression = logcounts(sf))
> model <- infer_trajectory(dataset,"slingshot", verbose = TRUE)
Executing 'slingshot' on '20190403_232308__data_wrapper__2g1fBJWQ6V'
With parameters: list(shrink = 1L, reweight = TRUE, reassign = TRUE, thresh = 0.001,     maxit = 10L, stretch = 2L, smoother = "smooth.spline", shrink.method = "cosine"),
inputs: counts, and
priors : 
Input saved to /tmp/folders/xw/962yzh952d1_jhtnnf435j5r0000h2/T//RtmpyxWO9m/filea97d72393a51/ti
Running /usr/local/bin/docker run -e 'TMPDIR=/tmp2' --workdir /ti/workspace -v '/tmp/folders/xw/962yzh952d1_jhtnnf435j5r0000h2/T//RtmpyxWO9m/filea97d72393a51/ti:/ti' -v \
  '/tmp/folders/xw/962yzh952d1_jhtnnf435j5r0000h2/T//RtmpyxWO9m/filea97db23d66d/tmp:/tmp2' 'dynverse/ti_slingshot:v0.9.9' --dataset /ti/input.h5 --output /ti/output.h5
Loading required package: dynutils
Error: Error during trajectory inference 
Loading required package: dynutils

> str(logcounts(sf))
 num [1:17281, 1:13011] 0.8 0.8 1.31 0.8 0.8 ...
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:17281] "ENSMUSG00000033845" "ENSMUSG00000025903" "ENSMUSG00000033793" "ENSMUSG00000025907" ...
  ..$ : chr [1:13011] "DB1" "DB2" "DB3" "DB4" ...
> str(cts)
 num [1:17281, 1:13011] 1 1 2 1 1 1 3 17 1 3 ...
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:17281] "ENSMUSG00000033845" "ENSMUSG00000025903" "ENSMUSG00000033793" "ENSMUSG00000025907" ...
  ..$ : chr [1:13011] "DB1" "DB2" "DB3" "DB4" ...
> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS  10.14

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] parallel  stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] dyno_0.9.9                  dynwrap_1.0.0               dynplot_1.0.0               dynmethods_1.0.0            dynguidelines_1.0.0         dynfeature_1.0.0            magrittr_1.5               
 [8] scater_1.9.23               ggplot2_3.1.0               SingleCellExperiment_1.3.11 SummarizedExperiment_1.10.1 DelayedArray_0.6.6          BiocParallel_1.14.2         matrixStats_0.54.0         
[15] Biobase_2.40.0              GenomicRanges_1.32.6        GenomeInfoDb_1.16.0         IRanges_2.14.12             S4Vectors_0.18.3            BiocGenerics_0.26.0        

loaded via a namespace (and not attached):
  [1] drat_0.1.4               ggbeeswarm_0.6.0         colorspace_1.4-1         rprojroot_1.3-2          dynparam_1.0.0           htmlTable_1.13.1         XVector_0.20.0          
  [8] base64enc_0.1-3          rje_1.9                  rstudioapi_0.9.0         farver_1.1.0             dynutils_1.0.2           bit64_0.9-7              ggrepel_0.8.0           
 [15] ranger_0.11.2            codetools_0.2-15         splines_3.5.1            knitr_1.22               Formula_1.2-3            jsonlite_1.6             cluster_2.0.7-1         
 [22] ggforce_0.1.3            shiny_1.2.0              readr_1.3.1              compiler_3.5.1           backports_1.1.3          assertthat_0.2.0         Matrix_1.2-14           
 [29] lazyeval_0.2.1           cli_1.1.0                later_0.7.5              tweenr_1.0.1             acepack_1.4.1            htmltools_0.3.6          tools_3.5.1             
 [36] igraph_1.2.4             gtable_0.2.0             glue_1.3.1               GenomeInfoDbData_1.1.0   reshape2_1.4.3           dplyr_0.8.0.1            Rcpp_1.0.1              
 [43] GA_3.2                   iterators_1.0.10         DelayedMatrixStats_1.2.0 ggraph_1.0.2             xfun_0.5                 stringr_1.4.0            ps_1.3.0                
 [50] testthat_2.0.1           mime_0.6                 devtools_1.13.6          zlibbioc_1.26.0          MASS_7.3-50              scales_1.0.0             tidygraph_1.1.2         
 [57] babelwhale_0.0.0.9000    hms_0.4.2                promises_1.0.1           RColorBrewer_1.1-2       yaml_2.2.0               memoise_1.1.0            gridExtra_2.3           
 [64] dyndimred_1.0.0          rpart_4.1-13             latticeExtra_0.6-28      stringi_1.4.3            desc_1.2.0               foreach_1.4.4            checkmate_1.9.1         
 [71] shades_1.3.1             rlang_0.3.1              pkgconfig_2.0.2          bitops_1.0-6             lattice_0.20-35          purrr_0.3.2              patchwork_0.0.1         
 [78] htmlwidgets_1.3          bit_1.1-14               cowplot_0.9.4            pdist_1.2                processx_3.3.0           tidyselect_0.2.5         plyr_1.8.4              
 [85] R6_2.4.0                 Hmisc_4.2-0              pillar_1.3.1             foreign_0.8-71           carrier_0.1.0            withr_2.1.2              units_0.6-2             
 [92] survival_2.42-6          RCurl_1.95-4.11          nnet_7.3-12              tibble_2.1.1             hdf5r_1.0.1              crayon_1.3.4             viridis_0.5.1           
 [99] grid_3.5.1               data.table_1.12.0        digest_0.6.18            xtable_1.8-3             tidyr_0.8.3              httpuv_1.4.5.1           munsell_0.5.0           
[106] beeswarm_0.2.3           viridisLite_0.3.0        vipor_0.4.5  

EDIT: I added the verbose=TRUE result. Based on other issues I've seen it may have to do with the memory issues. Unfortunately, I cannot test it on the server due to docker restrictions, but I may try it out with a smaller data set in the future. If you have any other leads, fire away.

zouter commented 5 years ago

Hi @friedue This might be related to a memory issue. We do use sparse matrices internally now, but slingshot cannot handle these... Looking at the dimensions of your data, slingshot would use 6GB at max and run for 2 hours (as estimated by our guidelines app).

Could you perhaps first try to run this with a smaller dataset, so that we can be sure it is related to the dimensions of the dataset? Alternatively, you could also try to run it with paga, which will use an estimated 2 GB of memory.

Thanks!