-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #227 from scverse/update_seqfish
Update seqfish reader
- Loading branch information
Showing
4 changed files
with
188 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import math | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
from spatialdata_io.readers.seqfish import seqfish | ||
from tests._utils import skip_if_below_python_version | ||
|
||
|
||
# See https://github.com/scverse/spatialdata-io/blob/main/.github/workflows/prepare_test_data.yaml for instructions on | ||
# how to download and place the data on disk | ||
@skip_if_below_python_version() | ||
@pytest.mark.parametrize( | ||
"dataset,expected", [("seqfish-2-test-dataset/instrument 2 official", "{'y': (0, 108), 'x': (0, 108)}")] | ||
) | ||
@pytest.mark.parametrize("rois", [[1], None]) | ||
@pytest.mark.parametrize("cells_as_circles", [False, True]) | ||
def test_example_data(dataset: str, expected: str, rois: list[int] | None, cells_as_circles: bool) -> None: | ||
f = Path("./data") / dataset | ||
assert f.is_dir() | ||
sdata = seqfish(f, cells_as_circles=cells_as_circles, rois=rois) | ||
from spatialdata import get_extent | ||
|
||
extent = get_extent(sdata, exact=False) | ||
extent = {ax: (math.floor(extent[ax][0]), math.ceil(extent[ax][1])) for ax in extent} | ||
if cells_as_circles: | ||
# manual correction required to take into account for the circle radii | ||
expected = "{'y': (-2, 109), 'x': (-2, 109)}" | ||
assert str(extent) == expected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters