diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index af3eb03..93daa98 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 @@ -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"] diff --git a/README.md b/README.md index ffc3143..81a7582 100644 --- a/README.md +++ b/README.md @@ -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(