MarioniLab / StabMap

Mosaic single cell data integration using non-overlapping features
https://MarioniLab.github.io/StabMap/
34 stars 0 forks source link

Error using stabMap #6

Closed ccruizm closed 1 year ago

ccruizm commented 1 year ago

Good day!

I want to apply your tool to my own data using the indirect mosaic data integration. However after setting up the objects as indicated in the tutorial I get the next error when running stabMap

Loading required package: scater

Loading required package: ggplot2

treating "Multiome" as reference

generating embedding for path with reference "Multiome": "Multiome"

generating embedding for path with reference "Multiome": "RNA" -> "Multiome"

generating embedding for path with reference "Multiome": "ATAC" -> "Multiome"

more input features than maxFeatures, subsetting features using variance ranking

Error in density.default(x, adjust = adjust, from = min(x), to = max(x)): need at least 2 points to select a bandwidth automatically
Traceback:

1. stabMap(assay_list_indirect, reference_list = c("Multiome"), 
 .     plot = FALSE)
2. modelGeneVar(assay_list[[path_current[1]]][features_current, 
 .     ])
3. modelGeneVar(assay_list[[path_current[1]]][features_current, 
 .     ])
4. .local(x, ...)
5. .decompose_log_exprs(x.stats$means, x.stats$vars, fit.stats$means, 
 .     fit.stats$vars, x.stats$ncells, ...)
6. fitTrendVar(fm, fv, ...)
7. .inverse_density_weights(m, adjust = 1)
8. density(x, adjust = adjust, from = min(x), to = max(x))
9. density.default(x, adjust = adjust, from = min(x), to = max(x))
10. stop("need at least 2 points to select a bandwidth automatically")

What do you think the problem is? Please let me know if you need any more info!

Thanks in advance!

shazanfar commented 1 year ago

Hi Christian,

Thanks for your message and for including these information! I have found this issue recently too, the error is coming from the step:

more input features than maxFeatures, subsetting features using variance ranking

where StabMap attempts to automatically perform some feature selection to generate the reference PC scores.

A workaround is to set the argument for maxFeatures to a value higher than the number of input features in your datasets, which in your case might be 10,000 or so, or even if you set to maxFeatures = Inf this would work.

Could you try this out and let me know how you go? Meanwhile I'll look into fixing this bug,

Best wishes, Shila

ccruizm commented 1 year ago

Hello Shila! thanks for the reply. Yes, I tested it, and can confirm that setting maxFeatures = Inf gets rid of the error :)