diff --git a/404.html b/404.html index d1eaa24..299cb66 100644 --- a/404.html +++ b/404.html @@ -5,8 +5,8 @@ -Page not found (404) • spatialNAcUtils - +Page not found (404) • visiumStitched + @@ -19,8 +19,6 @@ - -
- - -
- Content not found. Please use links in the navbar. -
- -
- - - - - - - - - diff --git a/CODE_OF_CONDUCT.html b/CODE_OF_CONDUCT.html index 8678510..1907bc4 100644 --- a/CODE_OF_CONDUCT.html +++ b/CODE_OF_CONDUCT.html @@ -1,10 +1,8 @@ -NA • spatialNAcUtilsNA • visiumStitched - -
- - -
- -

The Bioconductor community values

In order to uphold these values, members of the Bioconductor community are required to follow the Code of Conduct.The latest version of Bioconductor project Code of Conduct is available at http://bioconductor.org/about/code-of-conduct/. Please read the Code of Conduct before contributing to this project.

Thank you!

- -
- -
- - - - - - - - - diff --git a/CONTRIBUTING.html b/CONTRIBUTING.html index 2f25925..bbea0d0 100644 --- a/CONTRIBUTING.html +++ b/CONTRIBUTING.html @@ -1,10 +1,8 @@ -Contributing to spatialNAcUtils • spatialNAcUtilsContributing to spatialNAcUtils • visiumStitched - -
- - -
-
-

This outlines how to propose a change to spatialNAcUtils. For a detailed discussion on contributing to this and other tidyverse packages, please see the development contributing guide and our code review principles.

Fixing typos

@@ -73,31 +70,17 @@

Code of ConductPlease note that the spatialNAcUtils project is released with a Contributor Code of Conduct. By contributing to this project you agree to abide by its terms.

-
- -
- - - - - - - - - diff --git a/articles/index.html b/articles/index.html index 303b0d7..fa681cc 100644 --- a/articles/index.html +++ b/articles/index.html @@ -1,10 +1,8 @@ -Articles • spatialNAcUtilsArticles • visiumStitched - -
- - -
-
- - - - - - - - diff --git a/articles/visiumStitched.html b/articles/visiumStitched.html new file mode 100644 index 0000000..5ba82be --- /dev/null +++ b/articles/visiumStitched.html @@ -0,0 +1,322 @@ + + + + + + + +Introduction to visiumStitched • visiumStitched + + + + + + + + + + + +
+
+ +
+
+ +
+

Basics +

+
+

Install visiumStitched +

+

visiumStitched +is a R package available from GitHub. It +can be installed with the following commands in your R +session:

+
+if (!requireNamespace("remotes", quietly = TRUE)) {
+    install.packages("remotes")
+}
+
+remotes::install("LieberInstitute/visiumStitched")
+
+
+

Other documentation +

+

For now, visiumStitched +doesn’t have a demonstrative vignette as documentation. Please refer to +the Reference +for info about how to use its functions, and examples.

+
+
+

Citing visiumStitched +

+

We hope that visiumStitched +will be useful for your research. Please use the following information +to cite the package and the overall approach. Thank you!

+
+## Citation info
+citation("visiumStitched")
+#> To cite package 'visiumStitched' in publications use:
+#> 
+#>   Eagles N (2024). _visiumStitched: Helper package for working with
+#>   stitched overlapping Visium capture areas_. R package version 0.99.0,
+#>   <https://github.com/LieberInstitute/visiumStitched>.
+#> 
+#> A BibTeX entry for LaTeX users is
+#> 
+#>   @Manual{,
+#>     title = {visiumStitched: Helper package for working with stitched overlapping Visium capture areas},
+#>     author = {Nicholas J. Eagles},
+#>     year = {2024},
+#>     note = {R package version 0.99.0},
+#>     url = {https://github.com/LieberInstitute/visiumStitched},
+#>   }
+
+
+
+

Reproducibility +

+

The visiumStitched +package (Eagles, 2024) was made possible thanks to:

+
    +
  • R (R Core Team, 2024)
  • +
  • +BiocStyle +(Oleś, 2024)
  • +
  • +knitr (Xie, +2024)
  • +
  • +RefManageR +(McLean, 2017)
  • +
  • +rmarkdown +(Allaire, Xie, Dervieux, McPherson, Luraschi, Ushey, Atkins, Wickham, +Cheng, Chang, and Iannone, 2024)
  • +
  • +sessioninfo +(Wickham, Chang, Flight, Müller, and Hester, 2021)
  • +
  • +testthat +(Wickham, 2011)
  • +
+

This package was developed using biocthis.

+

Code for creating the vignette

+
+## Create the vignette
+library("rmarkdown")
+system.time(render("visiumStitched.Rmd", "BiocStyle::html_document"))
+
+## Extract the R code
+library("knitr")
+knit("visiumStitched.Rmd", tangle = TRUE)
+

Date the vignette was generated.

+
#> [1] "2024-05-22 20:22:05 UTC"
+

Wallclock time spent generating the vignette.

+
#> Time difference of 0.701 secs
+

R session information.

+
#> ─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────
+#>  setting  value
+#>  version  R version 4.4.0 (2024-04-24)
+#>  os       Ubuntu 22.04.4 LTS
+#>  system   x86_64, linux-gnu
+#>  ui       X11
+#>  language en
+#>  collate  en_US.UTF-8
+#>  ctype    en_US.UTF-8
+#>  tz       UTC
+#>  date     2024-05-22
+#>  pandoc   3.2 @ /usr/bin/ (via rmarkdown)
+#> 
+#> ─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────
+#>  package     * version    date (UTC) lib source
+#>  backports     1.4.1      2021-12-13 [1] RSPM (R 4.4.0)
+#>  bibtex        0.5.1      2023-01-26 [1] RSPM (R 4.4.0)
+#>  BiocManager   1.30.23    2024-05-04 [2] CRAN (R 4.4.0)
+#>  BiocStyle   * 2.33.0     2024-05-01 [1] Bioconductor 3.20 (R 4.4.0)
+#>  bookdown      0.39       2024-04-15 [1] RSPM (R 4.4.0)
+#>  bslib         0.7.0      2024-03-29 [2] RSPM (R 4.4.0)
+#>  cachem        1.1.0      2024-05-16 [2] RSPM (R 4.4.0)
+#>  cli           3.6.2      2023-12-11 [2] RSPM (R 4.4.0)
+#>  desc          1.4.3      2023-12-10 [2] RSPM (R 4.4.0)
+#>  digest        0.6.35     2024-03-11 [2] RSPM (R 4.4.0)
+#>  evaluate      0.23       2023-11-01 [2] RSPM (R 4.4.0)
+#>  fastmap       1.2.0      2024-05-15 [2] RSPM (R 4.4.0)
+#>  fs            1.6.4      2024-04-25 [2] RSPM (R 4.4.0)
+#>  generics      0.1.3      2022-07-05 [1] RSPM (R 4.4.0)
+#>  glue          1.7.0      2024-01-09 [2] RSPM (R 4.4.0)
+#>  htmltools     0.5.8.1    2024-04-04 [2] RSPM (R 4.4.0)
+#>  htmlwidgets   1.6.4      2023-12-06 [2] RSPM (R 4.4.0)
+#>  httr          1.4.7      2023-08-15 [2] RSPM (R 4.4.0)
+#>  jquerylib     0.1.4      2021-04-26 [2] RSPM (R 4.4.0)
+#>  jsonlite      1.8.8      2023-12-04 [2] RSPM (R 4.4.0)
+#>  knitr         1.46       2024-04-06 [2] RSPM (R 4.4.0)
+#>  lifecycle     1.0.4      2023-11-07 [2] RSPM (R 4.4.0)
+#>  lubridate     1.9.3      2023-09-27 [1] RSPM (R 4.4.0)
+#>  magrittr      2.0.3      2022-03-30 [2] RSPM (R 4.4.0)
+#>  memoise       2.0.1      2021-11-26 [2] RSPM (R 4.4.0)
+#>  pkgdown       2.0.9.9000 2024-05-22 [1] Github (r-lib/pkgdown@36db657)
+#>  plyr          1.8.9      2023-10-02 [1] RSPM (R 4.4.0)
+#>  R6            2.5.1      2021-08-19 [2] RSPM (R 4.4.0)
+#>  ragg          1.3.2      2024-05-15 [2] RSPM (R 4.4.0)
+#>  Rcpp          1.0.12     2024-01-09 [2] RSPM (R 4.4.0)
+#>  RefManageR  * 1.4.0      2022-09-30 [1] RSPM (R 4.4.0)
+#>  rlang         1.1.3      2024-01-10 [2] RSPM (R 4.4.0)
+#>  rmarkdown     2.27       2024-05-17 [2] RSPM (R 4.4.0)
+#>  sass          0.4.9      2024-03-15 [2] RSPM (R 4.4.0)
+#>  sessioninfo * 1.2.2      2021-12-06 [2] RSPM (R 4.4.0)
+#>  stringi       1.8.4      2024-05-06 [2] RSPM (R 4.4.0)
+#>  stringr       1.5.1      2023-11-14 [2] RSPM (R 4.4.0)
+#>  systemfonts   1.1.0      2024-05-15 [2] RSPM (R 4.4.0)
+#>  textshaping   0.3.7      2023-10-09 [2] RSPM (R 4.4.0)
+#>  timechange    0.3.0      2024-01-18 [1] RSPM (R 4.4.0)
+#>  xfun          0.44       2024-05-15 [2] RSPM (R 4.4.0)
+#>  xml2          1.3.6      2023-12-04 [2] RSPM (R 4.4.0)
+#>  yaml          2.3.8      2023-12-11 [2] RSPM (R 4.4.0)
+#> 
+#>  [1] /__w/_temp/Library
+#>  [2] /usr/local/lib/R/site-library
+#>  [3] /usr/local/lib/R/library
+#> 
+#> ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
+
+
+

Bibliography +

+

This vignette was generated using BiocStyle +(Oleś, 2024) with knitr (Xie, +2024) and rmarkdown +(Allaire, Xie, Dervieux et al., 2024) running behind the scenes.

+

Citations made with RefManageR +(McLean, 2017).

+

+[1] +J. Allaire, Y. Xie, C. Dervieux, et al. rmarkdown: Dynamic Documents +for R. R package version 2.27. 2024. URL: +https://github.com/rstudio/rmarkdown. +

+

+[2] +N. Eagles. visiumStitched: Helper package for working with stitched +overlapping Visium capture areas. R package version 0.99.0. 2024. +URL: +https://github.com/LieberInstitute/visiumStitched. +

+

+[3] +M. W. McLean. “RefManageR: Import and Manage BibTeX and BibLaTeX +References in R”. In: The Journal of Open Source Software +(2017). DOI: +10.21105/joss.00338. +

+

+[4] +A. Oleś. BiocStyle: Standard styles for vignettes and other +Bioconductor documents. R package version 2.33.0. 2024. URL: +https://github.com/Bioconductor/BiocStyle. +

+

+[5] +R Core Team. R: A Language and Environment for Statistical +Computing. R Foundation for Statistical Computing. Vienna, Austria, +2024. URL: +https://www.R-project.org/. +

+

+[6] +H. Wickham. “testthat: Get Started with Testing”. In: The R +Journal 3 (2011), pp. 5–10. URL: +https://journal.r-project.org/archive/2011-1/RJournal_2011-1_Wickham.pdf. +

+

+[7] +H. Wickham, W. Chang, R. Flight, et al. sessioninfo: R Session +Information. R package version 1.2.2, https://r-lib.github.io/sessioninfo/. 2021. URL: +https://github.com/r-lib/sessioninfo#readme. +

+

+[8] +Y. Xie. knitr: A General-Purpose Package for Dynamic Report +Generation in R. R package version 1.46. 2024. URL: +https://yihui.org/knitr/. +

+
+
+ +
+ +
+ + diff --git a/authors.html b/authors.html index 853158d..afd3bc3 100644 --- a/authors.html +++ b/authors.html @@ -1,10 +1,8 @@ -Authors and Citation • spatialNAcUtilsAuthors and Citation • visiumStitched - -
- - -
- -
  • Nicholas J. Eagles. Author, maintainer.

  • +
  • +

    Leonardo Collado-Torres. Contributor. +

    +

Citation

- + Source: DESCRIPTION
- -

Eagles N (2024). -spatialNAcUtils: Functions Useful for the spatial_NAc Project. -R package version 0.99.1. +visiumStitched: Helper package for working with stitched overlapping Visium capture areas. +R package version 0.99.0, https://github.com/LieberInstitute/visiumStitched.

@Manual{,
-  title = {spatialNAcUtils: Functions Useful for the spatial_NAc Project},
+  title = {visiumStitched: Helper package for working with stitched overlapping Visium capture areas},
   author = {Nicholas J. Eagles},
   year = {2024},
-  note = {R package version 0.99.1},
+  note = {R package version 0.99.0},
+  url = {https://github.com/LieberInstitute/visiumStitched},
 }
-
-
- - - - - - - - - diff --git a/index.html b/index.html index d8c1da0..700bc5c 100644 --- a/index.html +++ b/index.html @@ -5,25 +5,21 @@ -Functions Useful for the spatial_NAc Project • spatialNAcUtils - +Helper package for working with stitched overlapping Visium capture areas • visiumStitched + - - + + - -
- - -
-

Citation

-

Below is the citation output from using citation('spatialNAcUtils') in R. Please run this yourself to check for any updates on how to cite spatialNAcUtils.

+

Below is the citation output from using citation('visiumStitched') in R. Please run this yourself to check for any updates on how to cite visiumStitched.

-print(citation("spatialNAcUtils"), bibtex = TRUE)
-#> Warning in citation("spatialNAcUtils"): could not determine year for
-#> 'spatialNAcUtils' from package DESCRIPTION file
-#> To cite package 'spatialNAcUtils' in publications use:
+print(citation("visiumStitched"), bibtex = TRUE)
+#> To cite package 'visiumStitched' in publications use:
 #> 
-#>   Eagles N (????). _spatialNAcUtils: Functions Useful for the
-#>   spatial_NAc Project_. R package version 0.99.0.
+#>   Eagles N (2024). _visiumStitched: Helper package for working with
+#>   stitched overlapping Visium capture areas_. R package version 0.99.0.
 #> 
 #> A BibTeX entry for LaTeX users is
 #> 
 #>   @Manual{,
-#>     title = {spatialNAcUtils: Functions Useful for the spatial_NAc Project},
+#>     title = {visiumStitched: Helper package for working with stitched overlapping Visium capture areas},
 #>     author = {Nicholas J. Eagles},
+#>     year = {2024},
 #>     note = {R package version 0.99.0},
 #>   }
-

Please note that the spatialNAcUtils was only made possible thanks to many other R and bioinformatics software authors, which are cited either in the vignettes and/or the paper(s) describing this package.

+

Please note that the visiumStitched was only made possible thanks to many other R and bioinformatics software authors, which are cited either in the vignettes and/or the paper(s) describing this package.

Code of Conduct

-

Please note that the spatialNAcUtils project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

+

Please note that the visiumStitched project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Development tools

For more details, check the dev directory.

-

This package was developed using biocthis.

+

This package was developed using biocthis.

- - -
- - - - - - diff --git a/news/index.html b/news/index.html index f9d9ba0..41e664c 100644 --- a/news/index.html +++ b/news/index.html @@ -1,10 +1,8 @@ -Changelog • spatialNAcUtilsChangelog • visiumStitched - -
- - -
-
- +

BUG FIXES

  • spot_plot() correctly receives colors parameter when is_discrete is FALSE, and documentation describing this was fixed
- +

NEW FEATURES

  • Added a NEWS.md file to track changes to the package.

SIGNIFICANT USER-VISIBLE CHANGES

  • Your main changes to a function foo() or parameter param.
- -
- - - - - - - - diff --git a/pkgdown.yml b/pkgdown.yml index 56f7e1b..f605973 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -1,7 +1,7 @@ -pandoc: 3.1.1 -pkgdown: 2.0.7 -pkgdown_sha: ~ +pandoc: '3.2' +pkgdown: 2.0.9.9000 +pkgdown_sha: 36db6570616631aabae3f9c4cc71588489519f7f articles: - spatialNAcUtils: spatialNAcUtils.html -last_built: 2024-03-15T16:34Z + visiumStitched: visiumStitched.html +last_built: 2024-05-22T20:21Z diff --git a/reference/add_array_coords.html b/reference/add_array_coords.html new file mode 100644 index 0000000..d8af7e6 --- /dev/null +++ b/reference/add_array_coords.html @@ -0,0 +1,131 @@ + +Add transformed array and pixel coordinates to a SpatialExperiment — add_array_coords • visiumStitched +
+
+
+
+ +
+

Given a SpatialExperiment, sample information, and coordinates +produced from the Samui refinement workflow, add array and pixel coordinates +appropriate for the linearly transformed capture areas making up each group +present in the SpatialExperiment.

+
+
+
add_array_coords(spe, sample_info, coords_dir, overwrite = TRUE)
+
+
+

Arguments

+
spe
+

A SpatialExperiment

+
sample_info
+

A tibble with columns capture_area, +group, and spaceranger_dir

+
coords_dir
+

A character(1) vector giving the directory +containing sample directories each with tissue_positions.csv, +scalefactors_json.json, and tissue_lowres_image.png files +produced from refinement with Samui

+
overwrite
+

A logical(1) vector indicating whether to overwrite +spatialCoords(spe), and colData(spe) columns array_row, +array_col, pixel_row_in_fullres, and +pixel_col_in_fullres with the transformed values. Note that the +original values are preserved even when TRUE, in versions of +colData(spe) columns ending in _original.

+
+
+

Value

+

A SpatialExperiment object with modified colData

+

columns array_row, array_col, pixel_row_in_fullres, and +pixel_col_in_fullres, and additional corresponding columns ending in +_original and (for pixel coordinates only) _rounded

+
+
+

Details

+

Array coordinates are determined via an algorithm that fits each spot to +the nearest spot on a new, imaginary, Visium-like capture area. The imaginary +capture area differs from a real capture area only in its extent; array +coordinates still start at 0 but may extend arbitrarily beyond the normal +maximum indices of 77 and 127 to fit every capture area in each group +defined in the SpatialExperiment. The goal is to return well-defined +array coordinates in a consistent spatial orientation for each group, such +that downstream applications, such as clustering with BayesSpace, can +process each group as if it really were one capture area in the first place.

+
+
+

Author

+

Nicholas J. Eagles

+
+
+

Examples

+
#   For internal testing
+if (FALSE) {
+library("HDF5Array")
+spe <- loadHDF5SummarizedExperiment("dev/test_data/spe_filtered")
+sample_info <- readr::read_csv("dev/test_data/sample_info.csv")
+coords_dir <- "dev/test_data"
+spe_new <- add_array_coords(spe, sample_info, coords_dir, overwrite = TRUE)
+}
+
+## TODO: add working examples
+args(add_array_coords)
+#> function (spe, sample_info, coords_dir, overwrite = TRUE) 
+#> NULL
+
+
+
+ +
+
+
+

Site built with pkgdown 2.0.9.9000.

+
+
+ + diff --git a/reference/add_overlap_info.html b/reference/add_overlap_info.html new file mode 100644 index 0000000..7c346ab --- /dev/null +++ b/reference/add_overlap_info.html @@ -0,0 +1,124 @@ + +Add info about how spots overlap among capture areas — add_overlap_info • visiumStitched +
+
+
+
+ +
+

Given a SpatialExperiment and column name in its colData, +return a modified copy of the SpatialExperiment with additional colData +columns: spe$exclude_overlapping and spe$overlap_key

+
+
+
add_overlap_info(spe, metric_name)
+
+
+

Arguments

+
spe
+

A SpatialExperiment with colData columns exclude_overlapping, +array_row_transformed, array_col_transformed, key, and +sample_id_original

+
metric_name
+

character(1) in colnames(colData(spe)), where +spots belonging to the capture area with highest average value for the metric +take precedence over other spots

+
+
+

Value

+

A SpatialExperiment object with additional colData

+

columns spe$exclude_overlapping and spe$overlap_capture_area

+
+
+

Details

+

spe$exclude_overlapping is TRUE for spots with a higher-quality overlapping +capture area and FALSE otherwise. spot_plot only displays FALSE spots to +prevent overplotting in regions of overlap. spe$overlap_key gives comma- +separated strings containing the keys of any overlapping spots, and is the empty +string otherwise.

+
+
+

Author

+

Nicholas J. Eagles

+
+
+

Examples

+
#   For internal testing
+if (FALSE) {
+library("HDF5Array")
+spe <- loadHDF5SummarizedExperiment("dev/test_data/spe_filtered")
+spe_new <- add_overlap_info(spe, metric_name = "sum_umi")
+p_old <- spot_plot(
+    spe,
+    sample_id = "Br8492", var_name = "sample_id_original",
+    is_discrete = TRUE
+)
+p_new <- spot_plot(
+    spe_new,
+    sample_id = "Br8492", var_name = "sample_id_original",
+    is_discrete = TRUE
+)
+print(p_old)
+print(p_new)
+}
+
+## TODO: add working examples
+args(add_overlap_info)
+#> function (spe, metric_name) 
+#> NULL
+
+
+
+ +
+
+
+

Site built with pkgdown 2.0.9.9000.

+
+
+ + diff --git a/reference/build_spe.html b/reference/build_spe.html new file mode 100644 index 0000000..72cc128 --- /dev/null +++ b/reference/build_spe.html @@ -0,0 +1,121 @@ + +Build stitched SpatialExperiment — build_spe • visiumStitched +
+
+
+
+ +
+

First, read in capture-area-level spaceranger outputs. Then, overwrite +spatial coordinates and images to represent group-level samples using +sample_info$group (though keep original coordinates in +colData columns ending in "_original"). Next, add info about +overlaps (via spe$exclude_overlapping and spe$overlap_key). +Ultimately, return a SpatialExperiment ready for visualization or +downstream analysis.

+
+
+
build_spe(sample_info, coords_dir, metric_name, count_type = "sparse")
+
+
+

Arguments

+
sample_info
+

A tibble with columns capture_area, +group, and spaceranger_dir

+
coords_dir
+

A character(1) vector giving the directory +containing sample directories each with tissue_positions.csv, +scalefactors_json.json, and tissue_lowres_image.png files +produced from refinement with Samui

+
metric_name
+

character(1) in colnames(colData(spe)), where +spots belonging to the capture area with highest average value for the metric +take precedence over other spots

+
count_type
+

A character(1) vector passed to type from +SpatialExperiment::read10xVisium, defaulting to "sparse"

+
+
+

Value

+

A SpatialExperiment object with one sample per group specified +in sample_info using transformed pixel and array coordinates (including +in the spatialCoords).

+
+
+

Author

+

Nicholas J. Eagles

+
+
+

Examples

+
#   For internal testing
+if (FALSE) {
+sample_info <- readr::read_csv("dev/test_data/sample_info.csv")
+coords_dir <- "dev/test_data"
+metric_name <- "sum_umi"
+spe <- build_spe(sample_info, coords_dir, metric_name)
+}
+
+## TODO: add working examples
+args(build_spe)
+#> function (sample_info, coords_dir, metric_name, count_type = "sparse") 
+#> NULL
+
+
+
+ +
+
+
+

Site built with pkgdown 2.0.9.9000.

+
+
+ + diff --git a/reference/dot-clean_round.html b/reference/dot-clean_round.html new file mode 100644 index 0000000..69a288d --- /dev/null +++ b/reference/dot-clean_round.html @@ -0,0 +1,80 @@ + +Round to the nearest integer, always rounding up at 0.5 — .clean_round • visiumStitched +
+
+
+
+ +
+

This consistent behavior is favorable for our application, where we want to +minimize duplicate mappings of spots to new array coordinates

+
+
+
.clean_round(x)
+
+
+

Arguments

+
x
+

numeric() vector.

+
+
+

Value

+

A numeric() vector rounded to the nearest integer.

+
+
+

Author

+

Nicholas J. Eagles

+
+
+ +
+
+
+

Site built with pkgdown 2.0.9.9000.

+
+
+ + diff --git a/reference/dot-fit_to_array.html b/reference/dot-fit_to_array.html new file mode 100644 index 0000000..4e631f3 --- /dev/null +++ b/reference/dot-fit_to_array.html @@ -0,0 +1,106 @@ + +Fit spots to a new Visium-like array — .fit_to_array • visiumStitched +
+
+
+
+ +
+

Given transformed pixel coordinates, modify the 'array_row' and +'array_col' columns to represent a larger Visium capture area containing +all capture areas in a common coordinate system. The number of +array rows/cols generally changes from the Visium standards of 78 and 128 +(and even may change in ratio between num rows and num cols).

+
+
+
.fit_to_array(coords, inter_spot_dist_px)
+
+
+

Arguments

+
coords
+

A tibble() whose rows represent capture areas of the +same group, and containing columns 'array_row', 'array_col', +'pxl_row_in_fullres', and 'pxl_col_in_fullres'.

+
inter_spot_dist_px
+

numeric(1) vector giving the pixel distance +between any 2 spots in the new coordinates.

+
INTERVAL_X
+

numeric(1) giving pixel distance between coordinate +units used for x (e.g. if x represents ideal array_col values, +INTERVAL_X represents pixel distance between spot columns).

+
INTERVAL_Y
+

numeric(1) giving pixel distance between coordinate +units used for y.

+
+
+

Value

+

A tibble() with modified 'array_row' + 'array_col' columns, as +well as new 'pxl_row_in_fullres_rounded' and 'pxl_col_in_fullres_rounded' +columns representing the pixel coordinates rounded to the nearest exact array +coordinates.

+
+
+

Details

+

Runtime is O(n) with the number of spots, making it much faster than say, +a distance-matrix-based approach running at O(n^2).

+
+
+

Author

+

Nicholas J. Eagles

+
+
+ +
+
+
+

Site built with pkgdown 2.0.9.9000.

+
+
+ + diff --git a/reference/dot-refine_fit.html b/reference/dot-refine_fit.html new file mode 100644 index 0000000..c67ed61 --- /dev/null +++ b/reference/dot-refine_fit.html @@ -0,0 +1,99 @@ + +Return array coordinates fit to nearest spot with associated error — .refine_fit • visiumStitched +
+
+
+
+ +
+

First, values of x are rounded to the nearest integer. Then, values +of y are rounded to the nearest valid integer under the constraint +that coordinates for x and y must be both odd or both even. These rounded +values are returned, along with the Euclidean distance needed to move x and +y from their original, non-integer values to their rounded values.

+
+
+
.refine_fit(x, y, INTERVAL_X, INTERVAL_Y)
+
+
+

Arguments

+
x
+

numeric() vector giving "ideal" array coordinates given every +spot's transformed pixel coordinates.

+
y
+

Same as x, though y must represent ideal array columns iff x +represents array rows, and vice versa.

+
INTERVAL_X
+

numeric(1) giving pixel distance between coordinate +units used for x (e.g. if x represents ideal array_col values, +INTERVAL_X represents pixel distance between spot columns).

+
INTERVAL_Y
+

numeric(1) giving pixel distance between coordinate +units used for y.

+
+
+

Value

+

A list consisting of 3 unnamed numeric() vectors: +rounded x, rounded y, and the Euclidean distance in pixels from +rounding both x and y.

+
+
+

Author

+

Nicholas J. Eagles

+
+
+ +
+
+
+

Site built with pkgdown 2.0.9.9000.

+
+
+ + diff --git a/reference/dot-validate_array.html b/reference/dot-validate_array.html new file mode 100644 index 0000000..d63e426 --- /dev/null +++ b/reference/dot-validate_array.html @@ -0,0 +1,79 @@ + +Check if coordinates are Visium-like — .validate_array • visiumStitched +
+
+
+
+ +
+

Sanity check designed to catch unforeseen bugs: halt if the tibble-like +coords, expected to contain columns 'array_row' and 'array_col', +represents an invalid Visium array

+
+
+
.validate_array(coords)
+
+
+

Arguments

+
coords
+

A tibble containing 'array_row' and 'array_col' columns +calculated internally by add_array_coords()

+
+
+

Author

+

Nicholas J. Eagles

+
+
+ +
+
+
+

Site built with pkgdown 2.0.9.9000.

+
+
+ + diff --git a/reference/index.html b/reference/index.html index f610428..b32395e 100644 --- a/reference/index.html +++ b/reference/index.html @@ -1,10 +1,8 @@ -Function reference • spatialNAcUtilsPackage index • visiumStitched - -
- - -
- + + + + + + - +

All functions

+

add_array_coords()

+

Add transformed array and pixel coordinates to a SpatialExperiment

+

add_overlap_info()

+

Add info about how spots overlap among capture areas

+

build_spe()

+

Build stitched SpatialExperiment

spe_to_seurat()

Convert a SpatialExperiment object to a Seurat object

spot_plot()

Spatial plots of discrete or continuous features for stitched-together -capture areas.

Spatial plots of discrete or continuous features for stitched-together capture areas.

-
- - - - - - - - diff --git a/reference/spe_to_seurat.html b/reference/spe_to_seurat.html index c59a9d5..f58fa5b 100644 --- a/reference/spe_to_seurat.html +++ b/reference/spe_to_seurat.html @@ -1,13 +1,11 @@ -Convert a SpatialExperiment object to a Seurat object — spe_to_seurat • spatialNAcUtilsConvert a SpatialExperiment object to a Seurat object — spe_to_seurat • visiumStitched - -
- - -
-

Given a SpatialExperiment object, first as.Seurat() is run, which operates on SingleCellExperiment objects. The remaining components (images, spatial coordinates) are added manually. The actual appearance of images are buggy for now.

-
spe_to_seurat(spe, verbose = TRUE)
-

Arguments

-
spe
+
spe

A SpatialExperiment with colData columns in_tissue, array_row_transformed, array_col_transformed, pxl_row_in_fullres_transformed, and pxl_col_in_fullres_transformed

- - -
verbose
+
verbose

A logical(1) vector. If true, print status updates about the conversion process

-

Value

- -

A Seurat object

Author

Nicholas J. Eagles

-

Examples


-#   Grab an example SpatialExperiment and add dummy "transformed" versions of
-#   spatial coordinates, which are to be converted
+## Grab an example SpatialExperiment and add dummy "transformed" versions of
+## spatial coordinates, which are to be converted
 spe <- if (!exists("spe")) {
     spatialLIBD::fetch_data(type = "spatialDLPFC_Visium_example_subset")
 }
-#> 2024-03-15 16:34:45.844656 loading file /github/home/.cache/R/BiocFileCache/942654b5232_spatialDLPFC_spe_subset_example.rds%3Fdl%3D1
+#> 2024-05-22 20:21:44.53917 loading file /github/home/.cache/R/BiocFileCache/2c69132a1f8e_spatialDLPFC_spe_subset_example.rds%3Fdl%3D1
 spe$array_row_transformed <- spe$array_row
 spe$array_col_transformed <- spe$array_col
 spe$pxl_row_in_fullres_transformed <- SpatialExperiment::spatialCoords(spe)[, "pxl_row_in_fullres"]
 spe$pxl_col_in_fullres_transformed <- SpatialExperiment::spatialCoords(spe)[, "pxl_col_in_fullres"]
 colnames(spe) <- spe$key
 
-#   Convert
+## Convert from a SpatialExperiment to a Seurat object
 seur <- spe_to_seurat(spe)
 #> Running 'as.Seurat(spe)'...
 #> Warning: Keys should be one or more alphanumeric characters followed by an underscore, setting key from pc. to pc_
@@ -113,6 +103,13 @@ 

Examples

#> Adding spot coordinates and images for sample Br6522_ant... #> Adding spot coordinates and images for sample Br8667_mid... #> Returning converted object... +seur +#> An object of class Seurat +#> 28916 features across 12107 samples within 1 assay +#> Active assay: originalexp (28916 features, 0 variable features) +#> 2 layers present: counts, data +#> 8 dimensional reductions calculated: X10x_pca, X10x_tsne, X10x_umap, PCA, UMAP, TSNE_perplexity80, HARMONY, UMAP.HARMONY +#> 3 images present: Br6432_ant, Br6522_ant, Br8667_mid
@@ -120,22 +117,12 @@

Examples

- - - - - - - - diff --git a/reference/spot_plot.html b/reference/spot_plot.html index 8037c57..370e811 100644 --- a/reference/spot_plot.html +++ b/reference/spot_plot.html @@ -1,7 +1,5 @@ -Spatial plots of discrete or continuous features for stitched-together -capture areas. — spot_plot • spatialNAcUtilsSpatial plots of discrete or continuous features for stitched-together capture areas. — spot_plot • visiumStitched - -
- - -
-
-

This function is essentially a wrapper around spatialLIBD::vis_clus and -spatialLIBD::vis_gene, suitable for merged samples (each sample in the +

This function is essentially a wrapper around spatialLIBD::vis_clus and +spatialLIBD::vis_gene, suitable for merged samples (each sample in the SpatialExperiment 'spe' is a donor consisting of multiple capture areas, with colData column 'exclude_overlapping' indicating overlapping spots to drop (to prevent overplotting).

-
spot_plot(
   spe,
@@ -76,75 +70,49 @@ 

Spatial plots of discrete or continuous features for stitched-together spatial = FALSE )

-

Arguments

-
spe
+
spe

A SpatialExperiment with colData column exclude_overlapping, passed to spatialLIBD::vis_gene or spatialLIBD::vis_clus

- - -
sample_id
+
sample_id

character(1) passed to sampleid in spatialLIBD::vis_gene or spatialLIBD::vis_clus. Assumed to be a donor, possibly consisting of several capture areas to plot at once

- - -
image_id
+
image_id

character(1) giving the name of the image (e.g. "lowres") to plot, used both to determine an appropriate spot size and passed to spatialLIBD::vis_gene or spatialLIBD::vis_clus

- - -
title
+
title

character(1) giving the title of the plot

- - -
var_name
+
var_name

character() passed to geneid for spatialLIBD::vis_gene or character(1) passed to clustervar for spatialLIBD::vis_clus

- - -
multi_gene_method
+
multi_gene_method

A character(1): either "pca", "sparsity", or "z_score". This parameter controls how multiple continuous variables are combined for visualization, and only applies when var_name has length > 1 and is_discrete is FALSE

- - -
include_legend
+
include_legend

logical(1): if FALSE, remove the plot legend

- - -
is_discrete
+
is_discrete

logical(1): if TRUE, use spatialLIBD::vis_clus; otherwise, use spatialLIBD::vis_gene

- - -
colors
+
colors

character() of colors passed to colors for spatialLIBD::vis_clus if is_discrete or otherwise to cont_colors for spatialLIBD::vis_gene

- - -
assayname
+
assayname

character(1) passed to spatialLIBD::vis_gene if not is_discrete

- - -
minCount
+
minCount

numeric(1) passed to passed to spatialLIBD::vis_gene if not is_discrete

- - -
spatial
+
spatial

logical(1) passed to sampleid in spatialLIBD::vis_gene or spatialLIBD::vis_clus

-

Value

- -

A ggplot object containing a "spot plot" of the specified sample

@@ -159,7 +127,6 @@

Details

Author

Nicholas J. Eagles

-

Examples


@@ -169,7 +136,7 @@ 

Examples

spe <- if (!exists("spe")) { spatialLIBD::fetch_data(type = "spatialDLPFC_Visium_example_subset") } -#> 2024-03-15 16:34:59.821618 loading file /github/home/.cache/R/BiocFileCache/942654b5232_spatialDLPFC_spe_subset_example.rds%3Fdl%3D1 +#> 2024-05-22 20:22:00.011856 loading file /github/home/.cache/R/BiocFileCache/2c69132a1f8e_spatialDLPFC_spe_subset_example.rds%3Fdl%3D1 spe$exclude_overlapping <- FALSE # Plot age spatially for the first sample @@ -208,22 +175,12 @@

Examples

- -
-
-

Site built with pkgdown 2.0.7.

+

Site built with pkgdown 2.0.9.9000.

-
- - - - - - diff --git a/sitemap.xml b/sitemap.xml index 9e59261..45922f0 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -13,7 +13,7 @@ /articles/index.html - /articles/spatialNAcUtils.html + /articles/visiumStitched.html /authors.html @@ -24,6 +24,27 @@ /news/index.html + + /reference/add_array_coords.html + + + /reference/add_overlap_info.html + + + /reference/build_spe.html + + + /reference/dot-clean_round.html + + + /reference/dot-fit_to_array.html + + + /reference/dot-refine_fit.html + + + /reference/dot-validate_array.html + /reference/index.html