Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Okay so this PR unfortunately doesn't completely follow the template restrictions yet. The reason is that there needs to be done some checks to set one part of the script.
So for the metric calculation we first need to compute connected components based on the spatial domains and connectivities between cells.
In the script I added these steps. The problem is that it's unclear how well the current component computation generalizes over different datasets/tissues/domains. The script is now organised in such a way that it optionally generates a plot where you can see the domains, I would check this for a few datasets and connectivity calculation settings, and then decide on the connectivity computation based on these outputs. (I attached 3 plots of examples that were run with
connectivity="neighs"
)Besides that, note that all other parameters that are set in the script are fairly well double checked to generalise well (clarified this with Marco Varrone), also implemented some additional heuristic for the boundary computation of the components.
So there are three things to adjust in the script:
Additional possibilities
I think with the current form of the script it's not too difficult to take it on from here and finalise it after having more datasets/outputs for generated spatial domains.
some plots of examples runs