Winnie09 / Lamian

48 stars 11 forks source link

'mc.cores' > 1 is not supported on Windows error with infer_tree_structure() #3

Closed jmitchell81 closed 3 years ago

jmitchell81 commented 3 years ago

Hello,

I'm working on using Lamian on Windows 10, and I have been able to run through the tutorials in your vignette without issue. I am now trying to use the infer_tree_structure() on my own data with the first two principal components, the scaled normalized-log expression matrix, and a dataframe with columns for each cell_id, the samples, and the annotated cell types. Upon trying to run infer_tree_structure(), I receive this error:

> cell_type_anno <- data.frame(barcode = pat4@assays$RNA@data@Dimnames[2], timepoint = pat4@meta.data$timepoint,
+                              cell_type = pat4@meta.data$cell_type)
> colnames(cell_type_anno) <- c('barcode', 'timepoint', 'cell_type')
> set.seed(12345)
> result = infer_tree_structure(pca = pat4@reductions$pca@cell.embeddings[,1:2], 
+                            expression = pat4@assays$RNA@scale.data, 
+                            cellanno = cell_type_anno, 
+                            xlab='PC 1', 
+                            ylab = 'PC 2')
Error in mclapply(seq_len(maxclunum), function(clunum) { : 
  'mc.cores' > 1 is not supported on Windows

In the vignette, I also encountered this error with the lamian.test() function, but was able to rectify it by adding the argument

ncores = 1

infer_tree_structure() will not allow me to use this ncores argument. Are there any other changes I can make on my local windows system to avoid this error? I am also trying to use Lamian on a Linux-based computing cluster to see if this is just a Windows incompatibility problem, but I'm having trouble installing the Cairo package that ComplexHeatmap and Lamian are dependent upon. Thank you for your help!

> sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

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

other attached packages:
[1] SeuratObject_4.0.2 Seurat_4.0.4       Lamian_0.99.0     
jmitchell81 commented 3 years ago

As a follow-up, I do not encounter the 'mc.cores' error if I pass a number.cluster argument. However, I am now receiving an error saying:

Error in if (is.numeric(v) && any(v < 0)) { : 
  missing value where TRUE/FALSE needed
In addition: Warning message:
did not converge in 10 iterations 

This is likely a problem with my inputs to the function and not a Windows-specific problem as my colleague tried to run the same code and data on their Mac and receiving the same error. Do you have any ideas about which part of the input is faulty based on this error message? Please let me know if you need more claification about this problem. I will update this thread as I try other approaches.

jmitchell81 commented 3 years ago

I was able to get results and a plot by including the origin.marker argument for this function. I used CCR7 as I am focusing on T cells in a dataset of PBMCs.

set.seed(12345)
result = infer_tree_structure(pca = pat4@reductions$umap@cell.embeddings, 
                           expression = mat_normlog, 
                           cellanno = cell_type_anno, 
                           xlab='UMAP 1', 
                           ylab = 'UMAP 2',
                           number.cluster = 17,
                           origin.marker = 'CCR7')
plotmclust(result, cell_point_size = 0.5, 
           x.lab = 'UMAP 1', 
           y.lab = 'UMAP 2')

c644aa06-b105-4f57-ae4b-0b664db42c02