livnatje / DIALOGUE

DIALOGUE is a dimensionality reduction method that uses cross-cell-type associations to identify multicellular programs (MCPs) and map the cell transcriptome as a function of its environment.
Other
103 stars 16 forks source link

Trouble running DIALOGUE Example #43

Closed axelalmet closed 7 months ago

axelalmet commented 10 months ago

Hello!

I am currently trying to get DIALOGUE working for the toy example, as described here.

The package installs run and I am able to read in the cell type list via

rA<-readRDS(system.file("Data", "test.example.rds", package = "DIALOGUE"))

After which, I can run param<-DLG.get.param(k = 2,results.dir = "~/Desktop/DLG/Results/", conf = "cellQ",pheno = "pathology"), which works fine too.

The issue arises when I run the main command: R<-DIALOGUE.run(rA = rA,main = "toyExample",param = param, plot.flag = T)

For which I get the output:

[1] "#************DIALOGUE Step I: PMD ************#"
[1] "A: Removing 0 of 30 features."
[1] "B: Removing 0 of 30 features."
[1] "C: Removing 0 of 30 features."

Then there is a lot of white space, after which I get the output:

[1] "#************DIALOGUE Step II: HLM ************#"
[1] "y ~ (1 | samples) + x + cellQ + tme.qc"
[1] "#************DIALOGUE Step II (multilevel modeling): A vs. B ************#"
[1] "2 MCPs identified for these cell types."
Error in names(top.l) <- paste0(main, colnames(m)) : 
  'names' attribute [10] must be the same length as the vector [0]
In addition: Warning messages:
1: In dir.create(param$results.dir) :
  '/Users/axelalmet/Desktop' already exists
2: In dir.create(paste0(param$results.dir, "/DIALOGUE2_", main)) :
  '/Users/axelalmet/Desktop//DIALOGUE2_toyExample' already exists
3: In min(p[p > 0], na.rm = T) :
  no non-missing arguments to min; returning Inf
4: In min(p[p > 0], na.rm = T) :
  no non-missing arguments to min; returning Inf
5: In min(p[p > 0], na.rm = T) :
  no non-missing arguments to min; returning Inf
6: In min(p[p > 0], na.rm = T) :
  no non-missing arguments to min; returning Inf

If there is any advice you could give to help me solve this error, I would greatly appreciate it. Thank you!

Best wishes, Axel.

massonix commented 9 months ago

Hi,

I'm experiencing a very similar error:

[1] "#************DIALOGUE Step I: PMD ************#"
[1] "CXCR4loCD27hiMUT: Removing 0 of 10 features."
[1] "CXCR4hiCD27loMUT: Removing 0 of 10 features."
[1] "CXCR4hiCD27loWT: Removing 0 of 10 features."
[1] "CXCR4loCD27hiWT: Removing 0 of 10 features."

And after a lot of blank space:

Error in names(top.l) <- paste0(main, colnames(m)) : 
  'names' attribute [6] must be the same length as the vector [0]

@livnatje I would be super grateful if you could help with this issue!

Best

Ramon

QiangShiPKU commented 9 months ago

I faced the same problem. After some troubleshooting, I found out it's related to the Matrix package. Just follow the steps in the link below – it's easy. Good luck! https://stackoverflow.com/questions/77481539/error-in-initializeptr-function-cholmod-factor-ldeta-not-provided-by-pack

massonix commented 9 months ago

Thanks @QiangShiPKU for the suggestion. I'm still facing this issue, even after reinstalling Matrix and lme4. This is my sessionInfo()

R version 4.3.2 (2023-10-31)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /gpfs/commons/home/rmassoni/.conda/envs/seurat_test/lib/libopenblasp-r0.3.24.so;  LAPACK version 3.11.0

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

time zone: America/New_York
tzcode source: system (glibc)

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

other attached packages:
 [1] here_1.0.1         lubridate_1.9.3    forcats_1.0.0      stringr_1.5.1      dplyr_1.1.4        purrr_1.0.2        readr_2.1.4       
 [8] tidyr_1.3.0        tibble_3.2.1       tidyverse_2.0.0    DIALOGUE_1.0       UpSetR_1.4.0       beanplot_1.3.1     Hmisc_5.1-1       
[15] ppcor_1.1          MASS_7.3-60        ggplot2_3.4.4      reshape2_1.4.4     unikn_0.9.0        RColorBrewer_1.1-3 stringi_1.8.3     
[22] psych_2.3.12       matrixStats_1.2.0  plyr_1.8.9         PMA_1.2-2          lmerTest_3.1-3     lme4_1.1-35.1      Matrix_1.6-5      
[29] Seurat_5.0.1       SeuratObject_5.0.1 sp_2.1-1          

loaded via a namespace (and not attached):
  [1] rstudioapi_0.15.0      jsonlite_1.8.8         magrittr_2.0.3         spatstat.utils_3.0-4   farver_2.1.1           rmarkdown_2.25        
  [7] nloptr_2.0.3           vctrs_0.6.5            ROCR_1.0-11            minqa_1.2.6            spatstat.explore_3.2-5 base64enc_0.1-3       
 [13] htmltools_0.5.7        Formula_1.2-5          sctransform_0.4.1      parallelly_1.36.0      KernSmooth_2.23-22     htmlwidgets_1.6.4     
 [19] ica_1.0-3              plotly_4.10.3          zoo_1.8-12             igraph_1.5.1           mime_0.12              lifecycle_1.0.4       
 [25] pkgconfig_2.0.3        R6_2.5.1               fastmap_1.1.1          fitdistrplus_1.1-11    future_1.33.0          shiny_1.8.0           
 [31] digest_0.6.34          numDeriv_2016.8-1.1    colorspace_2.1-0       patchwork_1.1.3        rprojroot_2.0.4        tensor_1.5            
 [37] RSpectra_0.16-1        irlba_2.3.5.1          labeling_0.4.3         progressr_0.14.0       timechange_0.2.0       fansi_1.0.6           
 [43] spatstat.sparse_3.0-3  httr_1.4.7             polyclip_1.10-6        abind_1.4-5            compiler_4.3.2         withr_2.5.2           
 [49] backports_1.4.1        htmlTable_2.4.2        fastDummies_1.7.3      tools_4.3.2            foreign_0.8-85         lmtest_0.9-40         
 [55] httpuv_1.6.12          future.apply_1.11.0    nnet_7.3-19            goftest_1.2-3          glue_1.7.0             nlme_3.1-163          
 [61] promises_1.2.1         checkmate_2.3.1        Rtsne_0.16             cluster_2.1.4          generics_0.1.3         gtable_0.3.4          
 [67] spatstat.data_3.0-3    tzdb_0.4.0             hms_1.1.3              data.table_1.14.10     utf8_1.2.4             spatstat.geom_3.2-7   
 [73] RcppAnnoy_0.0.21       ggrepel_0.9.4          RANN_2.6.1             pillar_1.9.0           spam_2.10-0            RcppHNSW_0.5.0        
 [79] later_1.3.1            splines_4.3.2          lattice_0.22-5         survival_3.5-7         deldir_1.0-9           tidyselect_1.2.0      
 [85] miniUI_0.1.1.1         pbapply_1.7-2          knitr_1.45             gridExtra_2.3          scattermore_1.2        xfun_0.41             
 [91] lazyeval_0.2.2         boot_1.3-28.1          evaluate_0.23          codetools_0.2-19       cli_3.6.2              rpart_4.1.21          
 [97] uwot_0.1.16            xtable_1.8-4           reticulate_1.34.0      munsell_0.5.0          Rcpp_1.0.12            globals_0.16.2        
[103] spatstat.random_3.2-1  png_0.1-8              parallel_4.3.2         ellipsis_0.3.2         assertthat_0.2.1       dotCall64_1.1-0       
[109] listenv_0.9.0          viridisLite_0.4.2      scales_1.3.0           ggridges_0.5.4         leiden_0.4.3.1         rlang_1.1.3           
[115] cowplot_1.1.1          mnormt_2.1.1

I tried both this first option

install.packages("lme4", type = "source")

And this one:

oo <- options(repos = "https://cran.r-project.org/")
install.packages("Matrix")
install.packages("lme4")
options(oo)

Do you have any idea what might be the issue? Thanks a ton!

livnatje commented 9 months ago

@QiangShiPKU - thank you for helping with this!

Hi @massonix and @axelalmet!

Sorry for the late response. I think this may be some edge case, so let's see if we can figure this out. First, I made a small change which may solve the problem. Second, were you able to run the toy example here and get the same output? Third, do you have the gene expression matrix with the cells and genes all labeled?

Thanks all!

axelalmet commented 9 months ago

Hi @livnatje,

Thanks for getting back to us! With @QiangShiPKU's suggestion, I was able to get DIALOGUE working for the Toy Example and the Spatial Lung Cancer results.

For my own datasets, I am able to construct a list of DIALOGUE cell.type objects. However, I do run into further issues.

For example, for one dataset (from this study), I get the error:

> dialogue.burkhardt.param <- DLG.get.param(k = 3,
                       conf = c("cellQ"),
                       results.dir = DLG.get.file("DLG_Results/"),
                       pheno="pheno")
> R<-DIALOGUE.run(rA = dialogue.burkhardt.cell.type, # list of cell.type objects
+                 main = "burkhardt21_run",
+                 param = dialogue.burkhardt.param,
+                 plot.flag = T)
[1] "#************DIALOGUE Step I: PMD ************#"
[1] "Alpha: Removing 1 of 50 features."
[1] "Beta1: Removing 11 of 50 features."
[1] "Beta2: Removing 22 of 50 features."
[1] "Delta: Removing 6 of 50 features."
Error in X1[samplesU, ] : incorrect number of dimensions

And from another (from this study by Kang et al.), I get this error:

> dialogue.kang.param <- DLG.get.param(k = 5,
+                                           conf = c("cellQ"),
+                                           results.dir = DLG.get.file("DLG_Results/"),
+                                           pheno="pheno")
> R<-DIALOGUE.run(rA = dialogue.kang.cell.type, # list of cell.type objects
+                 main = "kang18_run",
+                 param = dialogue.kang.param,
+                 plot.flag = T)
[1] "#************DIALOGUE Step I: PMD ************#"
[1] "CD14: Removing 0 of 30 features."
[1] "CD4T: Removing 0 of 30 features."
[1] "DCs: Removing 0 of 30 features."
[1] "NK: Removing 3 of 30 features."
[1] "CD8T: Removing 0 of 30 features."
[1] "B: Removing 0 of 30 features."
[1] "FGR3: Removing 0 of 30 features."
Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : 
  contrasts can be applied only to factors with 2 or more levels

I am not fully convinced it's a bug with DIALOGUE and may be more to do with how I have set up the data, so I will keep investigating.

Thank you for your patience!

Best wishes, Axel.

livnatje commented 9 months ago

Thank you for the update @axelalmet !

massonix commented 9 months ago

Thanks so much @livnatje ! I'll try reinstalling everything in a new environment and let you know if it works

Ramon

livnatje commented 9 months ago

Thank you @massonix ! Fingers crossed

massonix commented 9 months ago

Reinstalling the package solved the previous issue, but I'm now obtaining the following error

Error in names(v) <- c(colnames(m.pos), colnames(m.neg)) : 
  'names' attribute [6] must be the same length as the vector [0]

I'll keep digging into it!

axelalmet commented 8 months ago

Hi @livnatje,

Sorry for the long times in between responses, but I think I have DIALOGUE working and producing sensible and interesting output! One of the main issues was that my dataset had a cell type that was not present in all samples. Removing this cell type from the DIALOGUE object allowed things to run smoothly.

Thank you so much for your patience and time! Unless someone else wants to keep this issue opened, I'm happy for you to close it :).

Best wishes, Axel.

livnatje commented 7 months ago

Thank you Axel! We will add an error message or internal fixing to cover that case too. Glad to hear it worked and was useful.

soniyalama commented 6 months ago

Hi, these are the packages I have installed in R. For me I don't see any problem r-askpass 1.2.0 r43h76d94ec_0 r r-assertthat 0.2.1 r43hc72bb7e_4 conda-forge r-backports 1.4.1 r43h76d94ec_0 r r-base 4.3.1 h1ae530e_0 r r-base64enc 0.1_3 r43h76d94ec_4 r r-bit 4.0.5 r43h76d94ec_0 r r-bit64 4.0.5 r43h76d94ec_0 r r-blob 1.2.4 r43hc72bb7e_1 conda-forge r-boot 1.3_30 r43hc72bb7e_0 conda-forge r-broom 1.0.5 r43hc72bb7e_1 conda-forge r-bslib 0.5.1 r43hc72bb7e_0 conda-forge r-cachem 1.0.8 r43h76d94ec_0 r r-callr 3.7.6 r43hc72bb7e_0 conda-forge r-caret 6.0_94 r43h76d94ec_0 r r-cellranger 1.1.0 r43hc72bb7e_1006 conda-forge r-class 7.3_22 r43h76d94ec_0 r r-cli 3.6.1 r43h884c59f_0 r r-clipr 0.8.0 r43hc72bb7e_2 conda-forge r-clock 0.7.0 r43h884c59f_0 r r-cluster 2.1.4 r43h640688f_0 r r-codetools 0.2_20 r43hc72bb7e_0 conda-forge r-colorspace 2.1_0 r43h76d94ec_0 r r-commonmark 1.9.0 r43h76d94ec_0 r r-conflicted 1.2.0 r43h785f33e_1 conda-forge r-cpp11 0.4.7 r43hc72bb7e_0 conda-forge r-crayon 1.5.2 r43hc72bb7e_2 conda-forge r-curl 5.1.0 r43h76d94ec_0 r r-data.table 1.14.8 r43h76d94ec_0 r r-dbi 1.2.2 r43hc72bb7e_0 conda-forge r-dbplyr 2.4.0 r43hc72bb7e_0 conda-forge r-diagram 1.6.5 r43ha770c72_2 conda-forge r-digest 0.6.33 r43h884c59f_0 r r-dplyr 1.1.3 r43h884c59f_0 r r-dtplyr 1.3.1 r43hc72bb7e_1 conda-forge r-e1071 1.7_13 r43h884c59f_0 r r-ellipsis 0.3.2 r43h76d94ec_0 r r-essentials 4.3.1 r43_0 r r-evaluate 0.23 r43hc72bb7e_0 conda-forge r-fansi 1.0.5 r43h76d94ec_0 r r-farver 2.1.1 r43h884c59f_0 r r-fastmap 1.1.1 r43h884c59f_0 r r-fontawesome 0.5.2 r43hc72bb7e_0 conda-forge r-forcats 1.0.0 r43hc72bb7e_1 conda-forge r-foreach 1.5.2 r43hc72bb7e_2 conda-forge r-foreign 0.8_85 r43h76d94ec_0 r r-formatr 1.14 r43hc72bb7e_1 conda-forge r-fs 1.6.3 r43h884c59f_0 r r-future 1.33.2 r43h785f33e_0 conda-forge r-future.apply 1.11.2 r43hc72bb7e_0 conda-forge r-gargle 1.5.2 r43h785f33e_0 conda-forge r-generics 0.1.3 r43hc72bb7e_2 conda-forge r-ggplot2 3.5.0 r43hc72bb7e_0 conda-forge r-glmnet 4.1_8 r43hb5eb8f6_0 r r-globals 0.16.3 r43hc72bb7e_0 conda-forge r-glue 1.6.2 r43h76d94ec_0 r r-googledrive 2.1.1 r43hc72bb7e_1 conda-forge r-googlesheets4 1.1.1 r43h785f33e_1 conda-forge r-gower 1.0.1 r43h76d94ec_0 r r-gtable 0.3.4 r43hc72bb7e_0 conda-forge r-hardhat 1.3.1 r43hc72bb7e_0 conda-forge r-haven 2.5.3 r43h884c59f_0 r r-highr 0.10 r43hc72bb7e_1 conda-forge r-hms 1.1.3 r43hc72bb7e_1 conda-forge r-htmltools 0.5.6.1 r43h76d94ec_0 r r-httpuv 1.6.11 r43h884c59f_0 r r-httr 1.4.7 r43hc72bb7e_0 conda-forge r-ids 1.0.1 r43hc72bb7e_3 conda-forge r-ipred 0.9_14 r43h76d94ec_0 r r-irdisplay 1.1 r43hd8ed1ab_2 conda-forge r-isoband 0.2.7 r43h884c59f_0 r r-iterators 1.0.14 r43hc72bb7e_2 conda-forge r-jquerylib 0.1.4 r43hc72bb7e_2 conda-forge r-jsonlite 1.8.7 r43h76d94ec_0 r r-kernsmooth 2.23_22 r43h640688f_0 r r-knitr 1.46 r43hc72bb7e_0 conda-forge r-labeling 0.4.3 r43hc72bb7e_0 conda-forge r-later 1.3.1 r43h884c59f_0 r r-lattice 0.21_9 r43h76d94ec_0 r r-lava 1.7.3 r43hc72bb7e_0 conda-forge r-lifecycle 1.0.4 r43hc72bb7e_0 conda-forge r-listenv 0.9.1 r43hc72bb7e_0 conda-forge r-lme4 1.1_35.2 r43ha503ecb_0 conda-forge r-lmertest 3.1_3 r43hc72bb7e_2 conda-forge r-lubridate 1.9.3 r43h57805ef_0 conda-forge r-magrittr 2.0.3 r43h76d94ec_0 r r-mass 7.3_60 r43h76d94ec_0 r r-matrix 1.6_5 r43h316c678_0 conda-forge r-memoise 2.0.1 r43hc72bb7e_2 conda-forge r-mgcv 1.9_0 r43h76d94ec_0 r r-mime 0.12 r43h76d94ec_0 r r-minqa 1.2.6 r43hcf54a89_0 conda-forge r-modelmetrics 1.2.2.2 r43h884c59f_0 r r-modelr 0.1.11 r43hc72bb7e_1 conda-forge r-munsell 0.5.1 r43hc72bb7e_0 conda-forge r-nlme 3.1_163 r43h640688f_0 r r-nloptr 2.0.3 r43hcf54a89_2 conda-forge r-nnet 7.3_19 r43h76d94ec_0 r r-numderiv 2016.8_1.1 r43hc72bb7e_5 conda-forge r-openssl 2.1.1 r43h76d94ec_0 r r-parallelly 1.37.1 r43h57805ef_0 conda-forge r-pbdzmq 0.3_10 r43h884c59f_0 r r-pillar 1.9.0 r43hc72bb7e_1 conda-forge r-pkgconfig 2.0.3 r43hc72bb7e_3 conda-forge r-plyr 1.8.9 r43h884c59f_0 r r-prettyunits 1.2.0 r43hc72bb7e_0 conda-forge r-proc 1.18.4 r43h884c59f_0 r r-processx 3.8.2 r43h76d94ec_0 r r-prodlim 2023.08.28 r43h884c59f_0 r r-progress 1.2.3 r43hc72bb7e_0 conda-forge r-progressr 0.14.0 r43hc72bb7e_0 conda-forge r-promises 1.2.1 r43h884c59f_0 r r-proxy 0.4_27 r43h76d94ec_0 r r-ps 1.7.5 r43h76d94ec_0 r r-purrr 1.0.2 r43h76d94ec_0 r r-quantmod 0.4.26 r43hc72bb7e_0 conda-forge r-r6 2.5.1 r43hc72bb7e_2 conda-forge r-ragg 1.2.6 r43h884c59f_0 r r-randomforest 4.7_1.1 r43h640688f_0 r r-rappdirs 0.3.3 r43h76d94ec_0 r r-rcolorbrewer 1.1_3 r43h785f33e_2 conda-forge r-rcpp 1.0.11 r43h884c59f_0 r r-rcppeigen 0.3.4.0.0 r43h08d816e_0 conda-forge r-readr 2.1.4 r43h884c59f_0 r r-readxl 1.4.3 r43h884c59f_0 r r-recipes 1.0.10 r43hc72bb7e_0 conda-forge r-recommended 4.3.1 r43_0
r-rematch 2.0.0 r43hc72bb7e_0 conda-forge r-rematch2 2.1.2 r43hc72bb7e_3 conda-forge r-repr 1.1.7 r43h785f33e_0 conda-forge r-reprex 2.1.0 r43hc72bb7e_0 conda-forge r-reshape2 1.4.4 r43h884c59f_0 r r-rlang 1.1.1 r43h884c59f_0 r r-rmarkdown 2.26 r43hc72bb7e_0 conda-forge r-rodbc 1.3_21 r43h76d94ec_0 r r-rpart 4.1.19 r43h76d94ec_0 r r-rstudioapi 0.16.0 r43hc72bb7e_0 conda-forge r-rvest 1.0.4 r43hc72bb7e_0 conda-forge r-sass 0.4.9 r43ha503ecb_0 conda-forge r-scales 1.3.0 r43hc72bb7e_0 conda-forge r-selectr 0.4_2 r43hc72bb7e_3 conda-forge r-shape 1.4.6.1 r43ha770c72_0 conda-forge r-shiny 1.8.1.1 r43h785f33e_0 conda-forge r-sourcetools 0.1.7_1 r43ha503ecb_1 conda-forge r-spatial 7.3_17 r43h57805ef_0 conda-forge r-squarem 2021.1 r43hc72bb7e_2 conda-forge r-stringi 1.8.3 r43h9facbd6_0 conda-forge r-stringr 1.5.1 r43h785f33e_0 conda-forge r-survival 3.5_8 r43h57805ef_0 conda-forge r-sys 3.4.2 r43h57805ef_1 conda-forge r-systemfonts 1.0.5 r43haf97adc_0 conda-forge r-textshaping 0.3.7 r43hd87b9d6_0 conda-forge r-tibble 3.2.1 r43h57805ef_2 conda-forge r-tidyr 1.3.1 r43ha503ecb_0 conda-forge r-tidyselect 1.2.0 r43hc72bb7e_1 conda-forge r-tidyverse 2.0.0 r43h785f33e_1 conda-forge r-timechange 0.3.0 r43ha503ecb_0 conda-forge r-timedate 4032.109 r43hc72bb7e_0 conda-forge r-tinytex 0.50 r43hc72bb7e_0 conda-forge r-ttr 0.24.4 r43h57805ef_0 conda-forge r-tzdb 0.4.0 r43ha503ecb_1 conda-forge r-utf8 1.2.4 r43h57805ef_0 conda-forge r-uuid 1.2_0 r43h57805ef_0 conda-forge r-vctrs 0.6.5 r43ha503ecb_0 conda-forge r-viridislite 0.4.2 r43hc72bb7e_1 conda-forge r-vroom 1.6.5 r43ha503ecb_0 conda-forge r-withr 3.0.0 r43hc72bb7e_0 conda-forge r-xfun 0.43 r43ha503ecb_0 conda-forge r-xml2 1.3.6 r43hbfba7a4_1 conda-forge r-xtable 1.8_4 r43hc72bb7e_5 conda-forge r-xts 0.13.2 r43h57805ef_0 conda-forge r-yaml 2.3.8 r43h57805ef_0 conda-forge r-zoo