Skip to content

Commit

Permalink
auto-styled code
Browse files Browse the repository at this point in the history
  • Loading branch information
lcolladotor committed Jul 26, 2024
1 parent 473bcec commit 74c1281
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion R/add_array_coords.R
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ add_array_coords <- function(spe, sample_info, coords_dir) {
cbind(
coords |>
# Don't add transformed pixel coordinates to colData
select(-matches('^pxl_(row|col)_in_fullres$'))
select(-matches("^pxl_(row|col)_in_fullres$"))
) |>
S4Vectors::DataFrame()

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-add_array_coords.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ test_that(
expect_identical(spe$array_row, spe_new$array_row_original)
expect_identical(spe$array_col, spe_new$array_col_original)
expect_identical(
spatialCoords(spe)[, 'pxl_row_in_fullres'],
spatialCoords(spe)[, "pxl_row_in_fullres"],
spe_new$pxl_row_in_fullres_original
)
expect_identical(
spatialCoords(spe)[, 'pxl_col_in_fullres'],
spatialCoords(spe)[, "pxl_col_in_fullres"],
spe_new$pxl_col_in_fullres_original
)
}
Expand Down
11 changes: 6 additions & 5 deletions vignettes/visiumStitched.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ with `spatialLIBD::fetch_data()`.
## Download example SpaceRanger output files
sr_dir <- tempdir()
temp <- unzip(spatialLIBD::fetch_data("visiumStitched_brain_spaceranger"),
exdir = sr_dir)
exdir = sr_dir
)
sample_info$spaceranger_dir <- file.path(
sr_dir, sample_info$capture_area, "outs", "spatial"
)
Expand Down Expand Up @@ -286,7 +287,7 @@ we'll use `spatialLIBD::vis_gene(is_stitched = TRUE)` (version 1.17.8 or newer)
spatially. For more context on human brain white matter spatial marker genes, check [our previous work on this subject](https://doi.org/10.1038/s41593-020-00787-0).

```{r "explore_coords", fig.height = 4}
## Show combined raw expression of white-matter marker genes
## Show combined raw expression of white-matter marker genes
wm_genes <- rownames(spe)[
match(c("MBP", "GFAP", "PLP1", "AQP4"), rowData(spe)$gene_name)
]
Expand Down Expand Up @@ -315,8 +316,8 @@ the overlap among capture areas:
```{r "array_plot_orig"}
## Plot positions of default array coordinates, before overwriting with more
## meaningful values. Use custom colors for each capture area
ca_colors = c("#A33B20", "#e7bb41", "#3d3b8e")
names(ca_colors) = c("V13B23-283_C1", "V13B23-283_D1", "V13B23-283_A1")
ca_colors <- c("#A33B20", "#e7bb41", "#3d3b8e")
names(ca_colors) <- c("V13B23-283_C1", "V13B23-283_D1", "V13B23-283_A1")
colData(spe) |>
as_tibble() |>
Expand Down Expand Up @@ -401,7 +402,7 @@ wm_genes_ens <- rownames(spe_norm)[
match(c("MBP", "GFAP", "PLP1", "AQP4"), rowData(spe_norm)$gene_name)
]
## Plot combination of normalized counts for some white-matter genes
## Plot combination of normalized counts for some white-matter genes
vis_gene(
spe_norm,
geneid = wm_genes_ens,
Expand Down

0 comments on commit 74c1281

Please sign in to comment.