From 74c1281be998dca53fcb32737c68699c94926c76 Mon Sep 17 00:00:00 2001 From: lcolladotor Date: Fri, 26 Jul 2024 19:38:25 -0400 Subject: [PATCH] auto-styled code --- R/add_array_coords.R | 2 +- tests/testthat/test-add_array_coords.R | 4 ++-- vignettes/visiumStitched.Rmd | 11 ++++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/R/add_array_coords.R b/R/add_array_coords.R index d7c7809..099ede9 100644 --- a/R/add_array_coords.R +++ b/R/add_array_coords.R @@ -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() diff --git a/tests/testthat/test-add_array_coords.R b/tests/testthat/test-add_array_coords.R index f205ff7..b3b963c 100644 --- a/tests/testthat/test-add_array_coords.R +++ b/tests/testthat/test-add_array_coords.R @@ -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 ) } diff --git a/vignettes/visiumStitched.Rmd b/vignettes/visiumStitched.Rmd index 42405a9..4844977 100644 --- a/vignettes/visiumStitched.Rmd +++ b/vignettes/visiumStitched.Rmd @@ -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" ) @@ -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) ] @@ -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() |> @@ -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,