scImpute icon indicating copy to clipboard operation
scImpute copied to clipboard

Error in pca$x[, 1:npc] : subscript out of bounds

Open 1213812138zqc opened this issue 3 years ago • 1 comments

Hello, I obtained the following error when running the imputation on my dataset. Could you please advise what's the reason for this error? Thanks.

[1] "reading in raw count matrix ..." [1] "number of genes in raw count matrix 180253" [1] "number of cells in raw count matrix 60" [1] "reading finished!" [1] "imputation starts ..." [1] "searching candidate neighbors ... " [1] "calculating cell distances ..." Error in pca$x[, 1:npc] : subscript out of bounds Calls: scimpute ... imputation_wlabel_model8 -> find_neighbors -> lapply -> FUN -> t Execution halted

1213812138zqc avatar May 26 '21 13:05 1213812138zqc

I had the same problem. Not sure if this is your case, but in mine, I had too few cells in one of the groups marked by labels I passed to scimpute().

The workaround for me is to not pass the labels, but let scimpute() do the clustering. So previously I had

scimpute(..., labels=labels, labeled=T)

Now I have:

scimpute(..., labels=NULL, labeled=F, Kcluster=length(unique(labels)))

The grouping is a little bit different than ours, but it worked somehow.

pwwang avatar Dec 09 '21 04:12 pwwang