Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.16.2
rev: v0.16.10
hooks:
# Run the linter.
- id: ruff-check
Expand All @@ -55,7 +55,7 @@ repos:
# - id: codespell

- repo: https://github.com/PyCQA/bandit
rev: 1.7.9
rev: 1.9.4
hooks:
- id: bandit
args: ["-c", "pyproject.toml"]
Expand Down
50 changes: 26 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,36 +51,38 @@ ncols = 500 # Number of spots/cells
counts = np.random.rand(nrows, ncols)

# Create feature annotations
row_data = BiocFrame({
"gene_ids": [f"gene_{i}" for i in range(nrows)],
"gene_names": [f"Gene_{i}" for i in range(nrows)]
})
row_data = BiocFrame(
{"gene_ids": [f"gene_{i}" for i in range(nrows)], "gene_names": [f"Gene_{i}" for i in range(nrows)]}
)

# Create spot/cell annotations
col_data = BiocFrame({
"n_genes": [50, 200] * int(ncols / 2),
"condition": ["healthy", "tumor"] * int(ncols / 2),
"cell_id": [f"spot_{i}" for i in range(ncols)],
"sample_id": ["sample_1"] * int(ncols / 2) + ["sample_2"] * int(ncols / 2),
})
col_data = BiocFrame(
{
"n_genes": [50, 200] * int(ncols / 2),
"condition": ["healthy", "tumor"] * int(ncols / 2),
"cell_id": [f"spot_{i}" for i in range(ncols)],
"sample_id": ["sample_1"] * int(ncols / 2) + ["sample_2"] * int(ncols / 2),
}
)

# Generate spatial coordinates
spatial_coords = BiocFrame({
"x": np.random.uniform(low=0.0, high=100.0, size=ncols),
"y": np.random.uniform(low=0.0, high=100.0, size=ncols)
})
spatial_coords = BiocFrame(
{"x": np.random.uniform(low=0.0, high=100.0, size=ncols), "y": np.random.uniform(low=0.0, high=100.0, size=ncols)}
)

# Create image data
img_data = BiocFrame({
"sample_id": ["sample_1", "sample_1", "sample_2"],
"image_id": ["aurora", "dice", "desert"],
"data": [
construct_spatial_image_class("tests/images/sample_image1.jpg"),
construct_spatial_image_class("tests/images/sample_image2.png"),
construct_spatial_image_class("tests/images/sample_image3.jpg"),
],
"scale_factor": [1, 1, 1],
})
img_data = BiocFrame(
{
"sample_id": ["sample_1", "sample_1", "sample_2"],
"image_id": ["aurora", "dice", "desert"],
"data": [
construct_spatial_image_class("tests/images/sample_image1.jpg"),
construct_spatial_image_class("tests/images/sample_image2.png"),
construct_spatial_image_class("tests/images/sample_image3.jpg"),
],
"scale_factor": [1, 1, 1],
}
)

# Create SpatialExperiment object
spe = SpatialExperiment(
Expand Down
Loading