Allow customization of suffix separator when concatenating SpatialData objects
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 394
- Forks
- 95
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 7
Description
Hi, I would like to request a small customization option for spatialdata.concatenate() when passing a dictionary of SpatialData objects.
Currently, when a dictionary is passed, element names are made unique by appending the dictionary key as a suffix using - as the separator. For example:
concatenate({
"sample1": sdata1,
"sample2": sdata2,
})
renames spatial elements like:
cell_boundaries-sample1
cell_boundaries-sample2
The same -suffix convention is also applied to table region metadata, values in the region_key column, observation names, coordinate systems, and table names when applicable.
Would it be possible to add a parameter to control the separator used before the suffix?
For example:
concatenate(
{
"sample1": sdata1,
"sample2": sdata2,
},
suffix_separator="_",
)
would produce:
cell_boundaries_sample1
cell_boundaries_sample2
Motivation
In some workflows, element names are later parsed or matched according to project-specific naming conventions. In these cases, underscores may be preferred over hyphens, or hyphens may conflict with downstream tools and naming rules.
At the moment, changing this behavior requires copying and modifying the internal _fix_ensure_unique_element_names() helper. This is inconvenient because the suffixing logic appears in several places within that function, so even a simple change to the separator requires multiple coordinated edits.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with spatialdata.concatenate() and the internal _fix_ensure_unique_element_names() helper, tracing each place where the separator is applied to element names, table metadata, observation names, coordinate systems, and table names. Add the requested suffix_separator option and verify that the default remains '-' while custom separators produce consistent names across all affected outputs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100