seasamgo / rescue

Bootstrap imputation for scRNAseq data
12 stars 2 forks source link

doesn't work #12

Closed wanlinjuan closed 1 year ago

wanlinjuan commented 1 year ago

newdata=bootstrapImputation(data,snn_resolution = 0.1,bootstrap_samples = 10)

Error in base::rowMeans(x, na.rm = na.rm, dims = dims, ...) : 'x' must be an array of at least two dimensions In addition: Warning message: In if (class(expression_matrix) != "dgCMatrix") expression_matrix <- methods::as(expression_matrix, : the condition has length > 1 and only the first element will be used

I try different parameters but it still doesn't work. Any reply will be appreciated.

seasamgo commented 1 year ago

Hi! Thank you for using the rescue package.

Do you have an example data matrix? It's difficult to tell without an example, but I was able to obtain the same error if I used the example in the ReadMe with that low of a value for snn_resolution. verbose = TRUE shows that this error occurs during one of the sampled clustering steps and stems from a very large number of clusters relative to such a small data set. I recommend using a larger resolution.

wanlinjuan commented 1 year ago

data.csv

Hi!

Thank you so much for your reply! The attached file is the data matrix I use. I tried resolution from 0.1 to 2, but it still doesn't work. Could you please help me check this data?

Wanlin

seasamgo commented 1 year ago

Ah, the first column is the gene names and the data set is only 100 cells; this is quite small to borrow information across clusters. Are you running with this exact data frame? Converting the first column to row names addressed this for me, though snn_resolution = 0.1 will still explode as it results in far too many clusters for such a small data set. I had success with $\geq 1$ though I'd consider whether an imputation method using explicit modeling techniques may be more appropriate.

It may also be worth us implementing a catch for when this occurs.