scverse / squidpy

Spatial Single Cell Analysis in Python
https://squidpy.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
428 stars 79 forks source link

Parameters of squidpy.gr.spatial_neighbors() #783

Closed Qirongmao97 closed 3 months ago

Qirongmao97 commented 9 months ago

Dear Squidpy developers:

I'm not quite sure some of the parameters in squidpy.gr.spatial_neighbors() function.

I noticed that there are parameters of n_neighs and radius for the generic coordinates data, what's the differences between them? I tried to input them both in the fuction and no matter how many time I changed n_neighs, the result still remain the same, does that mean radius suppress n_neighs ?

Thanks!

giovp commented 5 months ago

radius suppress n_neighs exactly, however only if all the neighbors have distance < radius. If you select n_neighs high enough so that some neighs have distance > radius, than they will be preserved.