scverse / squidpy

Spatial Single Cell Analysis in Python
https://squidpy.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
436 stars 79 forks source link

Infer parameters in `sq.gr.spatial_neighbors` when only one choice #876

Open timtreis opened 2 months ago

timtreis commented 2 months ago

I'm working on tutorial notebooks right now and ran into a minor hiccup when running sq.gr.spatial_neighbors(). @giovp already ported the function to work with spatialdata (thanks!) but the function requires manual input of the parameters elements_to_coordinate_systems and table_key, even if those are the only options.

I propose to automatically infer these instead when there are no other choices anyway and just notify the user of that fact. Any objections?

sq.gr.spatial_neighbors(
    sdata_merfish,
    elements_to_coordinate_systems={"cells": "global"},
    table_key="table"
)
giovp commented 2 months ago

sounds great! defaults are convenient