Can't run selectK
f6v opened this issue · 4 comments
I'd appreciate if you could help me out with running selectK
. Here's my code:
LIB_PATH = "./R_libs/R-4.0.0/"
library(Seurat)
library(ggplot2)
library(scAI, lib.loc = LIB_PATH)
library(swne, lib.loc = LIB_PATH)
data <- Read10X_h5("./data/multiome_human_brain_3k/human_brain_3k_filtered_feature_bc_matrix.h5")
rna_counts <- data$`Gene Expression`
atac_counts <- data$Peaks
labels <- data.frame(foo = rep(1, dim(atac_counts)[2]))
scAI_outs <- create_scAIobject(raw.data = list("RNA" = rna_counts, "ATAC" = atac_counts), do.sparse = F)
scAI_outs@options$paras$nrun <- 5
scAI_outs <- preprocessing(scAI_outs, assay = NULL)
scAI_outs <- addpData(scAI_outs, pdata = labels, pdata.name = "Cell types")
k_plot <- selectK(scAI_outs)
ggsave("./results/k_plot.pdf", k_plot)
It fails with following:
Error in { : task 1 failed - "invalid arguments"
Calls: selectK -> run_scAI -> %dopar% -> <Anonymous>
I guess I'm doing something wrong, but I didn't find an example for selecting k
, maybe you could point me to it? Also I had to add scAI_outs@options$paras$nrun <- 5
, otherwise it fails when referencing nrun
somewhere in the library.
Thanks in advance!
Hi @f6v , I just check the details of the function selectK
, and found that it uses the parameters such as nrun
that was previously set when running run_scAI
. In another word, you should first run run_scAI
by presetting a k
. If you set a larger k (e.g., k = 20, k= 30), it is ok if you only have 15 clusters. Thus you can try a relative larger K to run the analysis. The selectK
step often take a while.
Hi @f6v , it is a bug. I just deleted labs(title = feature.name)
. You can re-install the package to fix the issue. Thanks!
Thanks a lot! I can run selectK
now.