bandwith in multiple samples
SopjudeS opened this issue · 4 comments
Hi,Thank you very much for developing this excellent tool! I am currently using it to analyze 10X Visium data and have encountered a bit of confusion regarding the bandwidth setting when merging multiple samples. When analyzing single samples with a bandwidth of 200, the neighbors remain consistent across different samples. However, when I merge these samples using the same bandwidth, the number of neighbors varies. Below are the images illustrating this issue.Thank you for your assistance!
Hi @SopjudeS,
It seems like the image below is the image of a single 10X visium slide, and this step-wise pattern is anticipated since you have a hexagonal grid with quite some distance between neighbours in visium. You can also see the steps at each ~6 neighbors as you increase the bandwidth.
Regarding merging of the data and computing distances across slides. I'm not 100% sure in what setting you are doing this, but this would only work if your coordinates are somehow merged to represent a continuous patch of images.
Given how fast your # of neighbors is rising across slides there might be something off - likely you are considering the coordinates across slides as the meaningful distances. However, this will not work because you are essentially treating them as if they are the same sample.
Unless this is indeed somehow a continuous patch of images, I would instead recommend calculating LIANA+'s bivariate scores per sample - e.g. using Cosine similarity which is bound between -1 and +1, and is hence comparable across samples. Then you can merge the local LR scores and do NMF on those. This is in fact how I use local scores across conditions in the LIANA+ manuscript.
Let me know if this helps.
Maybe this notebook would help: https://github.com/saezlab/lianaplus_manuscript/blob/main/notebooks/kuppe/1.Pre_x_NMF.ipynb
It is not the cleanest but it should give you an idea how you could merge LR scores across slides and do NMF on all observations.
Maybe this notebook would help: https://github.com/saezlab/lianaplus_manuscript/blob/main/notebooks/kuppe/1.Pre_x_NMF.ipynb
It is not the cleanest but it should give you an idea how you could merge LR scores across slides and do NMF on all observations.
Got it! Thank you very much for your help!
I will close the issue as resolved. Feel free to open new ones :)