Hi,
In the scanpy, has anyone tried implementing jackstraw using anndata? If anyone has written a code to find the significant PCs in scanpy, please do share or any guide to perform it would be greatly appreciated! Thanks so much
Hi! Can you motivate this? What is it good for, why would we want it, would it be something super essential or something for scanpy.external?
It's a more central preprocessing method for selection PCs for further analysis. It's an automated alternative to just using the elbow of the PC variance explained plot.
We’re just using n_pcs=50 by default right? not even the elbow…
yes... so this method would augment scanpy, but it's probably not crucial to make an analysis script work.
I’m a big fan of good heuristics providing defaults. Would it be a useful default for that or where would it be used?
Tbh I haven't compared enough to make a call on whether it should be default. It is definitely a more sophisticated approach than just taking top 50. But top 50 has worked okay for us so far. I would say: include it if it's not too much work. Let's discuss defaults later.
There is another related paper which focus on how to chose the number of PCs and clusters, I have tried it yet, but failed to tell whether it makes sense.
https://academic.oup.com/gigascience/article/8/10/giz121/5579995
This sounds interesting. If the performance is acceptable, it might make a good addition.
It's more along the line of selecting number of PCs for denoising but MCV (https://github.com/czbiohub/molecular-cross-validation) is also interesting here. It helps with hyperparameter selection based on reconstruction loss on the hold out "molecules".
Yeah, I assumed it might be useful for other algorithms that use a variable number of PCs as input as well.
From the methods of the paper mentioned by @wangjiawen2013:
our results were not sensitive to the default values of nPC_max
which reinforces my thinking that overshooting the number of PCs isn't a problem for typical clustering and visualization purposes. For interpreting the variable loadings, some selection might be helpful. I'd definitely be interested in having methods like these for use with other latent variable methods.
Also that MCV paper's Figure 2b should probably have the APOE axis share a scale, maybe by removing the cell that has ~twice the APOE log expression of any others. I'd be interested in seeing how different the plots look after that.
Guess there is no magic deciding the right number for PCs.
I recently had a discussion with @LisaSikkema about how much you can overshoot here. The suggestion was made to use 100 PCs. Can we robustly compute that many or do the numerical methods break down when too little variance is represented by a PC? I recall @falexwolf mentioning this at some point.
Another solution is to use Seurat to do jackstraw and clustering and then import into Scanpy for other analysis
Most helpful comment
It's more along the line of selecting number of PCs for denoising but MCV (https://github.com/czbiohub/molecular-cross-validation) is also interesting here. It helps with hyperparameter selection based on reconstruction loss on the hold out "molecules".