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

Add parameter to sliding_window to end up with windows of (approximately) same number of cells #908

Open
timtreis opened this issue Nov 4, 2024 · 2 comments
Labels
enhancement ✨ New feature or request feature PR introduces a new feature graph 🕸️ squidpy2.0 Everything releated to a Squidpy 2.0 release

Comments

@timtreis
Copy link
Member

timtreis commented Nov 4, 2024

Could add a heuristic that tries to optimise the number of cells per window (and unassigned cells) so that on average, most windows have a number of cells assigned that is as close as possible to what the user specified.

@timtreis timtreis added enhancement ✨ New feature or request feature PR introduces a new feature graph 🕸️ squidpy2.0 Everything releated to a Squidpy 2.0 release labels Nov 4, 2024
@FrancescaDr
Copy link
Contributor

Hi Tim, I agree this would be a really useful feature. More specifically, we could add the following parameters:

  • max_nr_cells: int = None.
    • If not None, it calculates the window_size such that the number of cells in a sliding window is <= max_nr_cells (e.i. 1k).

Considering that given multiple library_key's the FOVs have different sizes or densities we could introduce a separate parameter that differentiates between whether the window sizes should be equal across all library_key's or not. For example:

  • window_size_per_library_key: 'equal', 'unique'
    • 'equal': calculate one window size for all library_keys
    • 'unique': calculate a unique window size for all library keys

@mossishahi
Copy link

Hi @timtreis and @FrancescaDr , I'll work on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request feature PR introduces a new feature graph 🕸️ squidpy2.0 Everything releated to a Squidpy 2.0 release
Projects
None yet
Development

No branches or pull requests

3 participants