Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide min and max distance to gr.co_occurence() #942

Closed
MeyerBender opened this issue Jan 23, 2025 · 1 comment
Closed

Provide min and max distance to gr.co_occurence() #942

MeyerBender opened this issue Jan 23, 2025 · 1 comment

Comments

@MeyerBender
Copy link

Description

The computation of the co-occurrence gr.co_occurrence() currently automatically computes a min and max value (_find_min_max(spatial) in squidpy.gr._ppatterns). If I understand the code correctly, the minimum distance is computed by looking at the two cells with the lowest coordinate sums (x+y coordinate) and taking the Euclidean distance between the two. This method works fine as long as the cells fill out a rectangular image. However, it breaks when considering other shapes, such as TMA cores (see attached image).

Image

In this specific case, the methodology returns a minimum threshold of 413 (see co-occurence plot), presumably due to some of the cells detected outside of the core (could also be a result of the core not being perfectly centered).

Image

Naturally, I am interested in interactions below a distance of 400 as well. So, as a fix, I would propose to add a min_dist and max_dist parameter to gr.co_occurrence(), to give users full flexibility over the distance range they look at. The existing computation could still be used as a default.

@MeyerBender
Copy link
Author

Nevermind, just found that this is already implemented with the interval keyword. Sorry for the confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant