Skip to content

Commit

Permalink
Update tests for spe_to_seurat() based on the new structure of the fu…
Browse files Browse the repository at this point in the history
  • Loading branch information
lcolladotor committed Jul 19, 2024
1 parent a6d88ca commit 9e4c9c5
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions tests/testthat/test-spe_to_seurat.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,28 @@ test_that(
{
spe <- fetch_data(type = "spatialDLPFC_Visium_example_subset")

# Should be missing several "transformed" colData columns
expect_error(
spe_to_seurat(spe, verbose = FALSE),
"Expected the following columns"
"Seurat requires colnames\\(spe\\) to be unique"
)

# Add the required transformed columns
spe$array_row_transformed <- spe$array_row
spe$array_col_transformed <- spe$array_col
spe$pxl_row_in_fullres_transformed <- spatialCoords(spe)[, "pxl_row_in_fullres"]
spe$pxl_col_in_fullres_transformed <- spatialCoords(spe)[, "pxl_col_in_fullres"]
## Make the column names unique
colnames(spe) <- spatialLIBD::add_key(spe)$key

# Should be missing several "transformed" colData columns
expect_error(
spe_to_seurat(spe, verbose = FALSE),
"Seurat requires colnames\\(spe\\) to be unique"
spe_to_seurat(
spe,
spatial_cols = c(
"tissue" = "in_tissue",
"row" = "array_row_transformed",
"col" = "array_col_transformed",
"imagerow" = "pxl_row_in_fullres_transformed",
"imagecol" = "pxl_col_in_fullres_transformed"
),
verbose = FALSE
),
"Expected the following columns"
)

# Now (apparently) remove low-res images
Expand Down

0 comments on commit 9e4c9c5

Please sign in to comment.