seasamgo / rescue

Bootstrap imputation for scRNAseq data
12 stars 2 forks source link

Can't change number of PCs #13

Open wanlinjuan opened 12 months ago

wanlinjuan commented 12 months ago

While using bootstrapImputation, I would like to change number of PCs. If I try a large number like 30 or 50, the error will happen: Warning in irlba::irlba(A = my_small_matrix_scaled, nv = pcs_compute) : You're computing too large a percentage of total singular values, use a standard svd instead. Warning in irlba::irlba(A = my_small_matrix_scaled, nv = pcs_compute) : did not converge--results might be invalid!; try increasing work or maxit Error in fixupDN.if.valid(value, x@Dim) : length of Dimnames[[2]] (50) is not equal to Dim[2] (16)

If I try 10 PCs, there will still be warnings for multiple times: Warning in irlba::irlba(A = my_small_matrix_scaled, nv = pcs_compute) : You're computing too large a percentage of total singular values, use a standard svd instead.

I think the default is 8. Wonder why it cannot be changed. Thank you!

seasamgo commented 11 months ago

Hi! Thanks for using our package. Do you have a reproducible example? It's difficult to understand what you're seeing without one, but the warnings seem to indicate it may be related to the size of the data set.

On rows 89-90 of imputation.R, we do force the number of PCs considered to be less than the number of samples:

pcs_compute <- min(number_pcs, nrow(x = my_small_matrix_scaled)-1)
pca_results <- irlba::irlba(A = my_small_matrix_scaled, nv = pcs_compute)