kstreet13 / slingshot

Functions for identifying and characterizing continuous developmental trajectories in single-cell data.
259 stars 42 forks source link

Error: there is no package called ‘DelayedMatrixStats’ #178

Closed HenrikBengtsson closed 2 years ago

HenrikBengtsson commented 2 years ago

Hi. There's a missing dependency (Imports or Suggests) on DelayedMatrixStats in this package;

data('slingshotExample', package = "slingshot")
rd <- slingshotExample$rd
cl <- slingshotExample$cl
condition <- factor(rep(c('A','B'), length.out = nrow(rd)))
condition[110:139] <- 'A'
sds <- slingshot::slingshot(rd, cl)
#> Error in loadNamespace(x) : 
#> there is no package called ‘DelayedMatrixStats’
> traceback()
20: stop(cond)
19: doWithOneRestart(return(expr), restart)
18: withOneRestart(expr, restarts[[1L]])
17: withRestarts(stop(cond), retry_loadNamespace = function() NULL)
16: loadNamespace(x)
15: .rowstats_w(DelayedArray::DelayedArray(x), group, FUN = DelayedMatrixStats::colWeightedMeans)
14: FUN(x, clusters)
13: .local(x, ...)
12: createClusterMST(x = X, clusters = clusterLabels, outgroup = omega, 
        outscale = omega_scale, endpoints = end.clus, dist.method = dist.method, 
        use.median = use.median, ...)
11: createClusterMST(x = X, clusters = clusterLabels, outgroup = omega, 
        outscale = omega_scale, endpoints = end.clus, dist.method = dist.method, 
        use.median = use.median, ...)
10: .local(data, clusterLabels, ...)
9: getLineages(data = data, clusterLabels = clusWeight, ...)
8: getLineages(data = data, clusterLabels = clusWeight, ...)
7: getLineages(data, clusterLabels, reducedDim = reducedDim, start.clus = start.clus, 
       end.clus = end.clus, dist.method = dist.method, use.median = use.median, 
       omega = omega, omega_scale = omega_scale, times = times)
6: getLineages(data, clusterLabels, reducedDim = reducedDim, start.clus = start.clus, 
       end.clus = end.clus, dist.method = dist.method, use.median = use.median, 
       omega = omega, omega_scale = omega_scale, times = times)
5: .local(data, clusterLabels, ...)
4: slingshot(data = data, clusterLabels = as.character(clusterLabels), 
       ...)
3: slingshot(data = data, clusterLabels = as.character(clusterLabels), 
       ...)
2: slingshot::slingshot(rd, cl)
1: slingshot::slingshot(rd, cl)
> sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS:   /software/c4/cbi/software/R-4.1.3-gcc8/lib64/R/lib/libRblas.so
LAPACK: /software/c4/cbi/software/R-4.1.3-gcc8/lib64/R/lib/libRlapack.so

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

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

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.8.3                igraph_1.2.11              
 [3] XVector_0.34.0              magrittr_2.0.2             
 [5] GenomicRanges_1.46.1        BiocGenerics_0.40.0        
 [7] zlibbioc_1.40.0             rappdirs_0.3.3             
 [9] IRanges_2.28.0              lattice_0.20-45            
[11] GenomeInfoDb_1.30.0         tools_4.1.3                
[13] SummarizedExperiment_1.24.0 grid_4.1.3                 
[15] Biobase_2.54.0              matrixStats_0.61.0-9003    
[17] crayon_1.5.0                Matrix_1.4-0               
[19] GenomeInfoDbData_1.2.7      TrajectoryUtils_1.2.0      
[21] S4Vectors_0.32.3            bitops_1.0-7               
[23] RCurl_1.98-1.6              SingleCellExperiment_1.16.0
[25] princurve_2.1.6             DelayedArray_0.20.0        
[27] compiler_4.1.3              MatrixGenerics_1.6.0       
[29] stats4_4.1.3                slingshot_2.2.0            
[31] pkgconfig_2.0.3

See also

This is an old problem, cf. https://github.com/HectorRDB/condiments/issues/2

HenrikBengtsson commented 2 years ago

I'm quite sure you have to declare this dependency to this package, at least as a 'Suggest':ed package, otherwise R CMD check won't pick it up as a dependency that is needed in order to successfully check the package.

FWIW, TrajectoryUtils 'Suggest':s it, which means it optional there, and have to be declared as such also here.

kstreet13 commented 2 years ago

Thanks Henrik! I haven't been able to reproduce this error, but I went ahead and added DelayedMatrixStats to the list of suggested packages (currently just on the develop branch), so hopefully that takes care of it! Let me know if there are still problems once this change has filtered through.

HenrikBengtsson commented 2 years ago

You can reproduce it with:

R CMD check --as-cran ...

That'll check in a sandbox where only declared dependencies are on the library path, which means DelayedMatrixStats will be missing. This emulates what a user with a fresh R setup has.