-
Notifications
You must be signed in to change notification settings - Fork 85
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
Add function for calculating niches #831
base: main
Are you sure you want to change the base?
Conversation
…into niche_definitions
for more information, see https://pre-commit.ci
…into niche_definitions
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
@giovp @timtreis PR is ready for review! Some additional questions that came up, which you could have a look at:
|
Hey @LLehner
You mean a scenario where the user is just storing multiple slides in the same sdata object, like the
Do you have some rough numbers? We could give the user the option to define
Could it be that the OS has some of the compiled bytecode or data in cache? 🤔
What runtime are we speaking here about? I tend to be a fan of some intermediate output (if one can also shut it up, f.e. with some verbosity level) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that looks great @LLehner , I think it would benefit from a refactoring to take out the single implementation, validate arguments, and then run the functions. We discussed about potentially even doing separate modules, e.g.
squidpy.gr.niches.utag
...
but I'm not sure it is necessary, what do you and @timtreis think?
Keeping it like this would be also fine, but then the arguments should be handled a bit better (e.g. check whether the passed arguments are fit for the single implementation/flavour required, and otherwise fail right away). Also how each argument maps to each implementation could be documented in the docs.
Also some work to be done in the docs more generally.
Restrict niche calculation to a subset of the data. | ||
table_key | ||
Key in `spatialdata.tables` to specify an 'anndata' table. Only necessary if 'sdata' is passed. | ||
mask |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the use case for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to make use of all existing connectivities but still want to ignore some cells during niche assignment. It's based on the 'mask' parameter here: https://monkeybread.readthedocs.io/en/latest/generated/monkeybread.calc.cellular_niches.html#monkeybread.calc.cellular_niches. The difference to subsetting is: if you subset you also cut the connectivities. With a mask you keep the connectivities but avoid labeling the masked cells.
also on this question
yes, and yes. If neighbor calculation is run with multiple slides, then a block diagonal matrix of the spatial neighbor is returned, in fact treating the slides to be independent.
yes agree! You can take a look at the
absolutely please log everything you see fit! |
for more information, see https://pre-commit.ci
Description
Adds a function that calculates niches using different strategies. The initial function calculates niches based on neighborhood profiles similar to here.
This PR will get updated with methods discussed in #789.