scverse / scverse/spatialdata-io

Wrong file loaded when building new SpatialData

Open
#147 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
103
Forks
65
Avg merge
1h 8m
Merged PRs (30d)
3

Description

I am working with some data with many .h5ad files stored in the same directory. Whenever I create a new SpatialData object I specify the path to the correct AnnData counts file.
I noticed that the file that is loaded is typically the wrong one and the first .h5ad in the directory is loaded instead. I believe this is because the first element of a list is considered here

https://github.com/scverse/spatialdata-io/blob/e3c53b5d6789bbaec49181f33dfe368170747ce4/src/spatialdata_io/readers/dbit.py#L282

I guess the same happens for the barcodes that are specified in the line below

https://github.com/scverse/spatialdata-io/blob/e3c53b5d6789bbaec49181f33dfe368170747ce4/src/spatialdata_io/readers/dbit.py#L285

The only workaround right now is to have multiple paths for different files.

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 in src/spatialdata_io/readers/dbit.py at the referenced lines 282 and 285, where the first elements of the file lists are selected. Reproduce the issue with multiple .h5ad files and verify that the explicitly specified counts and barcode paths are used; done means the requested files are loaded rather than the directory's first entries.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.