Winnie09 / Lamian

47 stars 11 forks source link

Error when running Lamian on UMAP dimensions #9

Closed HumzaHemani closed 1 year ago

HumzaHemani commented 2 years ago

Hi,

I am interested in applying Lamian to UMAP dimensions. However, I ran into an error that I don’t see when using PCA. I am copying my code below, which follows the tutorial at https://winnie09.github.io/Wenpin_Hou/pages/Lamian.html closely:

seu_obj <- RunUMAP(seu_obj, reduction.name = "umap50",
                   dims=1:50, n.components = 50)
saveRDS(seu_obj, file.path(out_dir, "seu_with_50_umap.Rds"))

umap_50 <- seu_obj@reductions$umap50@cell.embeddings
expression <- seu_obj[["integrated"]]@data
cellanno <- data.frame(cell=colnames(seu_obj),
                       sample=seu_obj$sam,
                       subset=seu_obj$subset_2)
rownames(cellanno) <- colnames(seu_obj)

man_tree_data <- list()
man_tree_data[["umap"]] <- umap_50
man_tree_data[["expression"]] <- expression
man_tree_data[["cellanno"]] <- cellanno

res <- infer_tree_structure(pca = man_tree_data[['umap']], 
                           expression = man_tree_data[['expression']], 
                           cellanno = man_tree_data[['cellanno']], 
                           origin.marker = c('IGHD'), 
                           number.cluster = 5,
                           xlab='UMAP 1', 
                           ylab = 'UMAP 2',
                           plotdir = out_dir)

Running this gives the following error when running infer_tree_structure: Error in branchcomb[tmpcombid, 2] : subscript out of bounds

Do you know why this error might be arising, and how I can fix it? Thank you!

Winnie09 commented 1 year ago

Hi @HumzaHemani Thank you for your interest in this package! Sorry that I didn't reply sooner. It seems that the branch combination does not have results. One way to try is to increase the number of clusters by setting a larger number.cluster. For example, try number.cluster = 20. Please let me know whether that would work.