scverse / scverse/spatialdata

`join_sdata_spatialelement_table()` fails with non-unique `AnnData` obs

Open
#494 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
394
Forks
95
Avg merge
4d 3h
Merged PRs (30d)
7

Description

When the AnnData object has obs that are not unique the join will fail because code like this table[joined_indices, :] require unique indices.

I think we should

  • modify the function _get_joined_table_indices() to return numerical indices
  • in general modify the loc in dataframes and the use of obs indices in anndata to use iloc and numerical indices instead

To test:

  1. make a table with some rows and obs.index not unique
  2. compute a left join

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with join_sdata_spatialelement_table() and _get_joined_table_indices(), then reproduce the failure using a table whose AnnData obs.index contains duplicates. Run a left join and add coverage showing that non-unique obs works; done means the join no longer fails for that case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.