Skip to content

Conversation

@mossishahi
Copy link
Collaborator

IMPORTANT: Please search among the Pull requests before creating one.

Description

How has this been tested?

Closes

mossishahi and others added 5 commits November 20, 2024 19:20
… to minimize the partial uncovered area

- aligned_min_x and aligned_min_y added to _calculate_window_corners function to remove partial regions at the beginning of the slides
- max_n_cells, n_splits, and split_line parameters added to the sliding_window function
%(library_key)s
coord_columns: Tuple[str, str]
Tuple of column names in `adata.obs` that specify the coordinates (x, y), e.i. ('globalX', 'globalY')
window_size: int
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please adjust the description: include option of tuple

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall there are some function parameters that are not described in the doctoring. Please make sure to include documentation for all.

if isinstance(adata, SpatialData):
adata = adata.table

assert max_n_cells is None or n_splits is None, (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also: assert that not all window_size, max_n_cells and n_splits are None.

Copy link
Contributor

@FrancescaDr FrancescaDr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mossishahi, thanks for the implementation. Please don't forget to add tests for all the functions that you added. I also recommend to check out the squidpy contribution guidelines to make sure the code and docstrings are correctly formatted.

raise ValueError(f"Library key '{library_key}' not found in adata.obs")

libraries = [None] if library_key is None else adata.obs[library_key].unique()
if library_key is None and "fov" not in adata.obs.columns:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe call it temp_fov for temporal_fov and remove it at the end of the code.

window_sizes = []

if window_size is None:
if max_n_cells is None and n_splits is None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Earlier you added a check that this case does not exists, so I suggest to remove this.

n_splits=None,
drop_partial_windows: bool = False,
square: bool = False,
window_size_per_library_key: str = "equal",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add explanation to code string.

sliding_window_df.loc[obs_indices, col_name] = True
sliding_window_df.loc[:, col_name].fillna(False, inplace=True)

if overlap == 0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also enable drop_partial_windows for the case of no overlap.



def _optimize_tile_size(L, W, A_min=None, A_max=None, square=False, split_line="v"):
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjust doctoring to squidpy/scverse style guide.

@timtreis timtreis marked this pull request as draft March 6, 2025 14:46
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

Successfully merging this pull request may close these issues.

3 participants