From a9ee5b8465350a52d588289fb81cbb5e74201e63 Mon Sep 17 00:00:00 2001 From: MicTott <32395683+MicTott@users.noreply.github.com> Date: Tue, 24 Dec 2024 15:16:25 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20MicTott/?= =?UTF-8?q?SpotSweeper@d39575fee1577cfeca3359b4306007688baa65b6=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 404.html | 2 +- CODE_OF_CONDUCT.html | 2 +- CONTRIBUTING.html | 2 +- LICENSE-text.html | 2 +- LICENSE.html | 2 +- SUPPORT.html | 2 +- articles/getting_started.html | 4 ++-- articles/index.html | 2 +- authors.html | 6 +++--- index.html | 2 +- news/index.html | 2 +- pkgdown.yml | 2 +- reference/DLPFC_artifact.html | 2 +- reference/biased_spots.html | 2 +- reference/findArtifacts.html | 2 +- reference/flagVisiumOutliers.html | 2 +- reference/index.html | 2 +- reference/localOutliers.html | 2 +- reference/localVariance.html | 2 +- reference/plotQCmetrics.html | 2 +- reference/plotQCpdf.html | 2 +- search.json | 2 +- 22 files changed, 25 insertions(+), 25 deletions(-) diff --git a/404.html b/404.html index a35b0d6..0c6763e 100644 --- a/404.html +++ b/404.html @@ -20,7 +20,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/CODE_OF_CONDUCT.html b/CODE_OF_CONDUCT.html index d6d3dd2..3c6d308 100644 --- a/CODE_OF_CONDUCT.html +++ b/CODE_OF_CONDUCT.html @@ -7,7 +7,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/CONTRIBUTING.html b/CONTRIBUTING.html index 1871be4..0aca786 100644 --- a/CONTRIBUTING.html +++ b/CONTRIBUTING.html @@ -7,7 +7,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/LICENSE-text.html b/LICENSE-text.html index 63e86f7..fe4714e 100644 --- a/LICENSE-text.html +++ b/LICENSE-text.html @@ -7,7 +7,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/LICENSE.html b/LICENSE.html index 9a1fef3..0a1731f 100644 --- a/LICENSE.html +++ b/LICENSE.html @@ -7,7 +7,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/SUPPORT.html b/SUPPORT.html index 2021b2c..50cc73d 100644 --- a/SUPPORT.html +++ b/SUPPORT.html @@ -7,7 +7,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/articles/getting_started.html b/articles/getting_started.html index a1df821..bd342a6 100644 --- a/articles/getting_started.html +++ b/articles/getting_started.html @@ -20,7 +20,7 @@ SpotSweeper - 1.3.2 + 1.3.3 @@ -358,7 +358,7 @@ Visualizing artifacts## [13] matrixStats_1.4.1 ExperimentHub_2.14.0 ## [15] AnnotationHub_3.14.0 BiocFileCache_2.14.0 ## [17] dbplyr_2.5.0 BiocGenerics_0.52.0 -## [19] SpotSweeper_1.3.2 BiocStyle_2.34.0 +## [19] SpotSweeper_1.3.3 BiocStyle_2.34.0 ## ## loaded via a namespace (and not attached): ## [1] DBI_1.2.3 rlang_1.1.4 magrittr_2.0.3 diff --git a/articles/index.html b/articles/index.html index a8ab2cf..3b48a65 100644 --- a/articles/index.html +++ b/articles/index.html @@ -7,7 +7,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/authors.html b/authors.html index 3632f4f..b555858 100644 --- a/authors.html +++ b/authors.html @@ -7,7 +7,7 @@ SpotSweeper - 1.3.2 + 1.3.3 @@ -58,14 +58,14 @@ Citation Totty M (2024). SpotSweeper: spatially-aware quality control for spatial transcriptomics. -doi:10.18129/B9.bioc.SpotSweeper, https://github.com/MicTott/SpotSweeper/SpotSweeper - R package version 1.3.2, http://www.bioconductor.org/packages/SpotSweeper. +doi:10.18129/B9.bioc.SpotSweeper, https://github.com/MicTott/SpotSweeper/SpotSweeper - R package version 1.3.3, http://www.bioconductor.org/packages/SpotSweeper. @Manual{, title = {SpotSweeper: spatially-aware quality control for spatial transcriptomics}, author = {Michael Totty}, year = {2024}, url = {http://www.bioconductor.org/packages/SpotSweeper}, - note = {https://github.com/MicTott/SpotSweeper/SpotSweeper - R package version 1.3.2}, + note = {https://github.com/MicTott/SpotSweeper/SpotSweeper - R package version 1.3.3}, doi = {10.18129/B9.bioc.SpotSweeper}, } Totty M, Hicks S, Guo B (2024). diff --git a/index.html b/index.html index 73710cb..2e8867c 100644 --- a/index.html +++ b/index.html @@ -22,7 +22,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/news/index.html b/news/index.html index c55c632..d41b3f9 100644 --- a/news/index.html +++ b/news/index.html @@ -7,7 +7,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/pkgdown.yml b/pkgdown.yml index fe7ff3b..21f587c 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -3,7 +3,7 @@ pkgdown: 2.1.1 pkgdown_sha: ~ articles: getting_started: getting_started.html -last_built: 2024-12-24T15:09Z +last_built: 2024-12-24T15:13Z urls: reference: https://mictott.github.io/SpotSweeper/reference article: https://mictott.github.io/SpotSweeper/articles diff --git a/reference/DLPFC_artifact.html b/reference/DLPFC_artifact.html index 479cdbf..cfd515a 100644 --- a/reference/DLPFC_artifact.html +++ b/reference/DLPFC_artifact.html @@ -17,7 +17,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/reference/biased_spots.html b/reference/biased_spots.html index 5064028..c52ea85 100644 --- a/reference/biased_spots.html +++ b/reference/biased_spots.html @@ -17,7 +17,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/reference/findArtifacts.html b/reference/findArtifacts.html index 412b7f5..9578f48 100644 --- a/reference/findArtifacts.html +++ b/reference/findArtifacts.html @@ -13,7 +13,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/reference/flagVisiumOutliers.html b/reference/flagVisiumOutliers.html index 86bebd3..50f5a66 100644 --- a/reference/flagVisiumOutliers.html +++ b/reference/flagVisiumOutliers.html @@ -13,7 +13,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/reference/index.html b/reference/index.html index 0bc998c..070a22e 100644 --- a/reference/index.html +++ b/reference/index.html @@ -7,7 +7,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/reference/localOutliers.html b/reference/localOutliers.html index dd24188..7b4bd58 100644 --- a/reference/localOutliers.html +++ b/reference/localOutliers.html @@ -15,7 +15,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/reference/localVariance.html b/reference/localVariance.html index 505ce41..e4c0389 100644 --- a/reference/localVariance.html +++ b/reference/localVariance.html @@ -7,7 +7,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/reference/plotQCmetrics.html b/reference/plotQCmetrics.html index c2d1bda..4082802 100644 --- a/reference/plotQCmetrics.html +++ b/reference/plotQCmetrics.html @@ -13,7 +13,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/reference/plotQCpdf.html b/reference/plotQCpdf.html index 36758d4..4888b8f 100644 --- a/reference/plotQCpdf.html +++ b/reference/plotQCpdf.html @@ -13,7 +13,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/search.json b/search.json index 70193e4..79ab742 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to SpotSweeper","title":"Contributing to SpotSweeper","text":"outlines propose change SpotSweeper. detailed discussion contributing tidyverse packages, please see development contributing guide code review principles.","code":""},{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":"fixing-typos","dir":"","previous_headings":"","what":"Fixing typos","title":"Contributing to SpotSweeper","text":"can fix typos, spelling mistakes, grammatical errors documentation directly using GitHub web interface, long changes made source file. generally means ’ll need edit roxygen2 comments .R, .Rd file. can find .R file generates .Rd reading comment first line.","code":""},{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":"bigger-changes","dir":"","previous_headings":"","what":"Bigger changes","title":"Contributing to SpotSweeper","text":"want make bigger change, ’s good idea first file issue make sure someone team agrees ’s needed. ’ve found bug, please file issue illustrates bug minimal reprex (also help write unit test, needed). See guide create great issue advice.","code":""},{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"Bigger changes","what":"Pull request process","title":"Contributing to SpotSweeper","text":"Fork package clone onto computer. haven’t done , recommend using usethis::create_from_github(\"MicTott/SpotSweeper\", fork = TRUE). Install development dependencies devtools::install_dev_deps(), make sure package passes R CMD check running devtools::check(). R CMD check doesn’t pass cleanly, ’s good idea ask help continuing. Create Git branch pull request (PR). recommend using usethis::pr_init(\"brief-description--change\"). Make changes, commit git, create PR running usethis::pr_push(), following prompts browser. title PR briefly describe change. body PR contain Fixes #issue-number. user-facing changes, add bullet top NEWS.md (.e. just first header). Follow style described https://style.tidyverse.org/news.html.","code":""},{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":"code-style","dir":"","previous_headings":"Bigger changes","what":"Code style","title":"Contributing to SpotSweeper","text":"New code follow tidyverse style guide. can use styler package apply styles, please don’t restyle code nothing PR. use roxygen2, Markdown syntax, documentation. use testthat unit tests. Contributions test cases included easier accept.","code":""},{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to SpotSweeper","text":"Please note SpotSweeper project released Contributor Code Conduct. contributing project agree abide terms.","code":""},{"path":"https://mictott.github.io/SpotSweeper/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 SpotSweeper authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://mictott.github.io/SpotSweeper/SUPPORT.html","id":null,"dir":"","previous_headings":"","what":"Getting help with SpotSweeper","title":"Getting help with SpotSweeper","text":"Thank using SpotSweeper! filing issue, things know make process smooth possible parties.","code":""},{"path":"https://mictott.github.io/SpotSweeper/SUPPORT.html","id":"make-a-reprex","dir":"","previous_headings":"","what":"Make a reprex","title":"Getting help with SpotSweeper","text":"Start making minimally reproducible example, also known ‘reprex’. may use reprex R package create one, though necessary help. make R-question-asking endeavors easier. Learning use takes 5 10 minutes. tips make minimally reproducible example, see StackOverflow link.","code":""},{"path":"https://mictott.github.io/SpotSweeper/SUPPORT.html","id":"where-to-post-it","dir":"","previous_headings":"","what":"Where to post it?","title":"Getting help with SpotSweeper","text":"Bioconductor help web page gives overview places may help answer question. Bioconductor software related questions, bug reports feature requests, addressed appropriate Bioconductor/SpotSweeper GitHub repository. Follow bug report feature request templates GitHub. package GitHub repository, see next bullet point. Bioconductor software usage questions addressed Bioconductor Support Website. Make sure use appropriate package tag, otherwise package authors get notification. General R questions can posed StackOverflow RStudio Community website especially pertain tidyverse RStudio GUI related products.","code":""},{"path":"https://mictott.github.io/SpotSweeper/SUPPORT.html","id":"issues-or-feature-requests","dir":"","previous_headings":"","what":"Issues or Feature Requests","title":"Getting help with SpotSweeper","text":"opening new issue feature request, sure search issues pull requests ensure one already exist implemented development version. Note. can remove :open search term issues page search open closed issues. See link learn modifying search.","code":""},{"path":"https://mictott.github.io/SpotSweeper/SUPPORT.html","id":"what-happens-next","dir":"","previous_headings":"","what":"What happens next?","title":"Getting help with SpotSweeper","text":"Bioconductor maintainers limited resources strive responsive possible. Please forget tag appropriate maintainer issue GitHub username (e.g., @username). order make easy possible Bioconductor core developers remediate issue. Provide accurate, brief, reproducible report outlined issue templates. Thank trusting Bioconductor.","code":""},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Getting started with 'SpotSweeper'","text":"SpotSweeper R package spatial transcriptomics data quality control (QC). provides functions detecting visualizing spot-level local outliers artifacts using spatially-aware methods. package designed work SpatialExperiment objects, compatible data 10X Genomics Visium spatial transcriptomics platforms.","code":""},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"installation","dir":"Articles","previous_headings":"","what":"Installation","title":"Getting started with 'SpotSweeper'","text":"Currently, way install SpotSweeper downloading development version can installed GitHub using following: accepted Bioconductor, SpotSweeper installable using:","code":"if (!require(\"devtools\")) install.packages(\"devtools\") remotes::install_github(\"MicTott/SpotSweeper\") if (!requireNamespace(\"BiocManager\", quietly = TRUE)) { install.packages(\"BiocManager\") } BiocManager::install(\"SpotSweeper\")"},{"path":[]},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"loading-example-data","dir":"Articles","previous_headings":"Spot-level local outlier detection","what":"Loading example data","title":"Getting started with 'SpotSweeper'","text":"’ll walk standard workflow using ‘SpotSweeper’ detect visualize local outliers spatial transcriptomics data. ’ll use Visium_humanDLPFC dataset STexampleData package, SpatialExperiment object. local outliers saved colData SpatialExperiment object, ’ll first view colData drop --tissue spots calculating quality control (QC) metrics running SpotSweeper.","code":"library(SpotSweeper) ## Error in get(paste0(generic, \".\", class), envir = get_method_env()) : ## object 'type_sum.accel' not found # load Maynard et al DLPFC daatset spe <- STexampleData::Visium_humanDLPFC() ## see ?STexampleData and browseVignettes('STexampleData') for documentation ## loading from cache # show column data before SpotSweeper colnames(colData(spe)) ## [1] \"barcode_id\" \"sample_id\" \"in_tissue\" \"array_row\" \"array_col\" ## [6] \"ground_truth\" \"reference\" \"cell_count\" # drop out-of-tissue spots spe <- spe[, spe$in_tissue == 1]"},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"calculating-qc-metrics-using-scuttle","dir":"Articles","previous_headings":"Spot-level local outlier detection","what":"Calculating QC metrics using scuttle","title":"Getting started with 'SpotSweeper'","text":"’ll use scuttle package calculate QC metrics. , ’ll need first change rownames gene id gene names. ’ll get mitochondrial transcripts calculate QC metrics spot using scuttle::addPerCellQCMetrics.","code":"# change from gene id to gene names rownames(spe) <- rowData(spe)$gene_name # identifying the mitochondrial transcripts is.mito <- rownames(spe)[grepl(\"^MT-\", rownames(spe))] # calculating QC metrics for each spot using scuttle spe <- scuttle::addPerCellQCMetrics(spe, subsets = list(Mito = is.mito)) colnames(colData(spe)) ## [1] \"barcode_id\" \"sample_id\" \"in_tissue\" ## [4] \"array_row\" \"array_col\" \"ground_truth\" ## [7] \"reference\" \"cell_count\" \"sum\" ## [10] \"detected\" \"subsets_Mito_sum\" \"subsets_Mito_detected\" ## [13] \"subsets_Mito_percent\" \"total\""},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"identifying-local-outliers-using-spotsweeper","dir":"Articles","previous_headings":"Spot-level local outlier detection","what":"Identifying local outliers using SpotSweeper","title":"Getting started with 'SpotSweeper'","text":"can now use SpotSweeper identify local outliers spatial transcriptomics data. ’ll use localOutliers function detect local outliers based unique detected genes, total library size, percent total reads mitochondrial. methods assume normal distribution, ’ll use log-transformed sum counts log-transformed number detected genes. mitochondrial percent, ’ll use raw mitochondrial percentage. localOutlier function automatically outputs results colData naming convention X_outliers, X name input colData. can combine outliers single column called local_outliers colData SpatialExperiment object.","code":"# library size spe <- localOutliers(spe, metric = \"sum\", direction = \"lower\", log = TRUE ) # unique genes spe <- localOutliers(spe, metric = \"detected\", direction = \"lower\", log = TRUE ) # mitochondrial percent spe <- localOutliers(spe, metric = \"subsets_Mito_percent\", direction = \"higher\", log = FALSE ) # combine all outliers into \"local_outliers\" column spe$local_outliers <- as.logical(spe$sum_outliers) | as.logical(spe$detected_outliers) | as.logical(spe$subsets_Mito_percent_outliers)"},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"visualizing-local-outliers","dir":"Articles","previous_headings":"Spot-level local outlier detection","what":"Visualizing local outliers","title":"Getting started with 'SpotSweeper'","text":"can visualize local outliers using plotQCmetrics function. function creates scatter plot specified metric highlights local outliers red using escheR package. , ’ll visualize local outliers library size, unique genes, mitochondrial percent, finally, local outliers. ’ll arrange plots grid using ggpubr::arrange.","code":"library(escheR) ## Loading required package: ggplot2 # all local outliers plotQCmetrics(spe, metric = \"sum_log\", outliers = \"local_outliers\", point_size = 1.1, stroke = 0.75) + ggtitle(\"All Local Outliers\")"},{"path":[]},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"loading-example-data-1","dir":"Articles","previous_headings":"Removing technical artifacts using SpotSweeper","what":"Loading example data","title":"Getting started with 'SpotSweeper'","text":"","code":"# load in DLPFC sample with hangnail artifact data(DLPFC_artifact) spe <- DLPFC_artifact # inspect colData before artifact detection colnames(colData(spe)) ## [1] \"sample_id\" \"in_tissue\" \"array_row\" ## [4] \"array_col\" \"key\" \"sum_umi\" ## [7] \"sum_gene\" \"expr_chrM\" \"expr_chrM_ratio\" ## [10] \"ManualAnnotation\" \"subject\" \"region\" ## [13] \"sex\" \"age\" \"diagnosis\" ## [16] \"sample_id_complete\" \"count\" \"sizeFactor\""},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"visualizing-technical-artifacts","dir":"Articles","previous_headings":"Removing technical artifacts using SpotSweeper","what":"Visualizing technical artifacts","title":"Getting started with 'SpotSweeper'","text":"Technical artifacts can commonly visualized standard QC metrics, including library size, unique genes, mitochondrial percentage. can first visualize technical artifacts using plotQCmetrics function. sample, can clearly see hangnail artifact right side tissue section mitochondrial ratio plot.","code":"plotQCmetrics(spe, metric = \"expr_chrM_ratio\", outliers = NULL, point_size = 1.1 ) + ggtitle(\"Mitochondrial Percent\")"},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"identifying-artifacts-using-spotsweeper","dir":"Articles","previous_headings":"Removing technical artifacts using SpotSweeper","what":"Identifying artifacts using SpotSweeper","title":"Getting started with 'SpotSweeper'","text":"can use findArtifacts function identify artifacts spatial transcriptomics (data. function identifies technical artifacts based first principle component local variance specified QC metric (mito_percent) numerous neighorhood sizes (n_order=5). Currently, kmeans clustering used cluster technical artifact vs high-quality Visium spots. Similar localOutliers, findArtifacts function outputs results colData.","code":"# find artifacts using SpotSweeper spe <- findArtifacts(spe, mito_percent = \"expr_chrM_ratio\", mito_sum = \"expr_chrM\", n_order = 5, name = \"artifact\" ) # check that \"artifact\" is now in colData colnames(colData(spe)) ## [1] \"sample_id\" \"in_tissue\" \"array_row\" ## [4] \"array_col\" \"key\" \"sum_umi\" ## [7] \"sum_gene\" \"expr_chrM\" \"expr_chrM_ratio\" ## [10] \"ManualAnnotation\" \"subject\" \"region\" ## [13] \"sex\" \"age\" \"diagnosis\" ## [16] \"sample_id_complete\" \"count\" \"sizeFactor\" ## [19] \"expr_chrM_ratio_log\" \"coords\" \"k6\" ## [22] \"k18\" \"k36\" \"k60\" ## [25] \"k90\" \"artifact\""},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"visualizing-artifacts","dir":"Articles","previous_headings":"Removing technical artifacts using SpotSweeper","what":"Visualizing artifacts","title":"Getting started with 'SpotSweeper'","text":"can visualize artifacts using escheR package. , ’ll visualize artifacts using plotQCmetrics function arrange plots using ggpubr::arrange. # Session information","code":"plotQCmetrics(spe, metric = \"expr_chrM_ratio\", outliers = \"artifact\", point_size = 1.1 ) + ggtitle(\"Hangnail artifact\") utils::sessionInfo() ## R version 4.4.2 (2024-10-31) ## Platform: x86_64-pc-linux-gnu ## Running under: Ubuntu 24.04.1 LTS ## ## Matrix products: default ## BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 ## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so; LAPACK version 3.12.0 ## ## locale: ## [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 ## [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 ## [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C ## [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C ## ## time zone: UTC ## tzcode source: system (glibc) ## ## attached base packages: ## [1] stats4 stats graphics grDevices utils datasets methods ## [8] base ## ## other attached packages: ## [1] escheR_1.6.0 ggplot2_3.5.1 ## [3] STexampleData_1.14.0 SpatialExperiment_1.16.0 ## [5] SingleCellExperiment_1.28.1 SummarizedExperiment_1.36.0 ## [7] Biobase_2.66.0 GenomicRanges_1.58.0 ## [9] GenomeInfoDb_1.42.1 IRanges_2.40.1 ## [11] S4Vectors_0.44.0 MatrixGenerics_1.18.0 ## [13] matrixStats_1.4.1 ExperimentHub_2.14.0 ## [15] AnnotationHub_3.14.0 BiocFileCache_2.14.0 ## [17] dbplyr_2.5.0 BiocGenerics_0.52.0 ## [19] SpotSweeper_1.3.2 BiocStyle_2.34.0 ## ## loaded via a namespace (and not attached): ## [1] DBI_1.2.3 rlang_1.1.4 magrittr_2.0.3 ## [4] spatialEco_2.0-2 compiler_4.4.2 RSQLite_2.3.9 ## [7] png_0.1-8 systemfonts_1.1.0 vctrs_0.6.5 ## [10] pkgconfig_2.0.3 crayon_1.5.3 fastmap_1.2.0 ## [13] magick_2.8.5 XVector_0.46.0 labeling_0.4.3 ## [16] scuttle_1.16.0 rmarkdown_2.29 UCSC.utils_1.2.0 ## [19] ragg_1.3.3 purrr_1.0.2 bit_4.5.0.1 ## [22] xfun_0.49 zlibbioc_1.52.0 cachem_1.1.0 ## [25] beachmat_2.22.0 jsonlite_1.8.9 blob_1.2.4 ## [28] DelayedArray_0.32.0 BiocParallel_1.40.0 terra_1.8-5 ## [31] parallel_4.4.2 R6_2.5.1 bslib_0.8.0 ## [34] jquerylib_0.1.4 Rcpp_1.0.13-1 bookdown_0.41 ## [37] knitr_1.49 Matrix_1.7-1 tidyselect_1.2.1 ## [40] abind_1.4-8 yaml_2.3.10 codetools_0.2-20 ## [43] curl_6.0.1 lattice_0.22-6 tibble_3.2.1 ## [46] withr_3.0.2 KEGGREST_1.46.0 evaluate_1.0.1 ## [49] desc_1.4.3 Biostrings_2.74.1 pillar_1.10.0 ## [52] BiocManager_1.30.25 filelock_1.0.3 generics_0.1.3 ## [55] BiocVersion_3.20.0 munsell_0.5.1 scales_1.3.0 ## [58] glue_1.8.0 tools_4.4.2 BiocNeighbors_2.0.1 ## [61] fs_1.6.5 grid_4.4.2 AnnotationDbi_1.68.0 ## [64] colorspace_2.1-1 GenomeInfoDbData_1.2.13 cli_3.6.3 ## [67] rappdirs_0.3.3 textshaping_0.4.1 viridisLite_0.4.2 ## [70] S4Arrays_1.6.0 dplyr_1.1.4 gtable_0.3.6 ## [73] sass_0.4.9 digest_0.6.37 SparseArray_1.6.0 ## [76] farver_2.1.2 rjson_0.2.23 memoise_2.0.1 ## [79] htmltools_0.5.8.1 pkgdown_2.1.1 lifecycle_1.0.4 ## [82] httr_1.4.7 mime_0.12 bit64_4.5.2 ## [85] MASS_7.3-61"},{"path":"https://mictott.github.io/SpotSweeper/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Michael Totty. Author, maintainer. Stephanie Hicks. Author. Boyi Guo. Author.","code":""},{"path":"https://mictott.github.io/SpotSweeper/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Totty M (2024). SpotSweeper: spatially-aware quality control spatial transcriptomics. doi:10.18129/B9.bioc.SpotSweeper, https://github.com/MicTott/SpotSweeper/SpotSweeper - R package version 1.3.2, http://www.bioconductor.org/packages/SpotSweeper. Totty M, Hicks S, Guo B (2024). “SpotSweeper: spatially-aware quality control spatial transcriptomics.” bioRxiv. doi:10.1101/2024.06.06.597765, https://doi.org/10.1101/2024.06.06.597765.","code":"@Manual{, title = {SpotSweeper: spatially-aware quality control for spatial transcriptomics}, author = {Michael Totty}, year = {2024}, url = {http://www.bioconductor.org/packages/SpotSweeper}, note = {https://github.com/MicTott/SpotSweeper/SpotSweeper - R package version 1.3.2}, doi = {10.18129/B9.bioc.SpotSweeper}, } @Article{, title = {SpotSweeper: spatially-aware quality control for spatial transcriptomics}, author = {Michael Totty and Stephanie Hicks and Boyi Guo}, journal = {bioRxiv}, year = {2024}, doi = {10.1101/2024.06.06.597765}, url = {https://doi.org/10.1101/2024.06.06.597765}, }"},{"path":"https://mictott.github.io/SpotSweeper/index.html","id":"spotsweeper-","dir":"","previous_headings":"","what":"Spatially-aware quality control for spatial transcriptomics","title":"Spatially-aware quality control for spatial transcriptomics","text":"SpotSweeper package developed spatially-aware quality control (QC) methods detection, visualization, removal local outliers regional artifacts spot-based spatial transcriptomics data, 10x Genomics Visium, using standard QC metrics. experience issues using package like make suggestion, please open issue GitHub repository. find information, please visit documentation website.","code":""},{"path":"https://mictott.github.io/SpotSweeper/index.html","id":"installation-instructions","dir":"","previous_headings":"","what":"Installation instructions","title":"Spatially-aware quality control for spatial transcriptomics","text":"can install latest version SpotSweeper Bioconductor following code: latest development version can installed GitHub using following:","code":"if (!requireNamespace(\"BiocManager\", quietly = TRUE)) { install.packages(\"BiocManager\") } BiocManager::install(\"SpotSweeper\") if (!require(\"devtools\")) install.packages(\"devtools\") remotes::install_github(\"MicTott/SpotSweeper\")"},{"path":"https://mictott.github.io/SpotSweeper/index.html","id":"tutorials","dir":"","previous_headings":"","what":"Tutorials","title":"Spatially-aware quality control for spatial transcriptomics","text":"detailed tutorial available package vignette Bioconductor. direct link tutorial / package vignette available .","code":""},{"path":"https://mictott.github.io/SpotSweeper/index.html","id":"development-tools","dir":"","previous_headings":"","what":"Development tools","title":"Spatially-aware quality control for spatial transcriptomics","text":"Continuous code testing possible thanks GitHub actions BiocStyle::Biocpkg('biocthis'). documentation website automatically updated thanks BiocStyle::CRANpkg('pkgdown'). code styled automatically thanks BiocStyle::CRANpkg('styler'). documentation formatted thanks BiocStyle::CRANpkg('devtools') BiocStyle::CRANpkg('roxygen2'). package developed using BiocStyle::Biocpkg('biocthis').","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":null,"dir":"Reference","previous_headings":"","what":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"DLPFC_artifact dataset SpatialExperiment object containing single-sample subset human dorsolateral prefrontal cortex (DLPFC) dataset Hukki-Myers et al. 2023. particular sample ('Br2743_ant') included demonstrate identification removal technical artifacts within spatial transcriptomics data. dataset serves example artifact detection using 'SpotSweeper' workflow.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"","code":"data(DLPFC_artifact)"},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"SpatialExperiment object.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"spatialLIBD","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"Hukki-Myers et al. (2023) bioRxiv (bioRxiv)","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"","code":"data(DLPFC_artifact)"},{"path":"https://mictott.github.io/SpotSweeper/reference/biased_spots.html","id":null,"dir":"Reference","previous_headings":"","what":"Biased Spots Data — biased_spots","title":"Biased Spots Data — biased_spots","text":"biased_spots dataset data.frame containing information specific spatial spots identified technical outliers spatial transcriptomics experiments. entry represents biased spot characterized spatial coordinates (row column) unique barcode. dataset utilized flagVisiumOutliers function flag exclude outlier spots downstream analyses, thereby enhancing data quality reliability.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/biased_spots.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Biased Spots Data — biased_spots","text":"","code":"data(biased_spots)"},{"path":"https://mictott.github.io/SpotSweeper/reference/biased_spots.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Biased Spots Data — biased_spots","text":"data.frame following columns: row Integer. row position biased spot within spatial grid. col Integer. column position biased spot within spatial grid. barcode Character. unique identifier corresponding spatial transcriptomics barcode biased spot.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/biased_spots.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Biased Spots Data — biased_spots","text":"biased_spots.rds file generated analysis local outliers. See https://github.com/boyiguo1/Manuscript-SpotSweeper/blob/main/code/03_Visium/figure_3.R details.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/biased_spots.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Biased Spots Data — biased_spots","text":"","code":"data(biased_spots)"},{"path":"https://mictott.github.io/SpotSweeper/reference/findArtifacts.html","id":null,"dir":"Reference","previous_headings":"","what":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","title":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","text":"function identifies annotates potential artifacts spatial transcriptomics data. Artifacts detected based local mito variance, results added original SpatialExperiment (sce) object.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/findArtifacts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","text":"","code":"findArtifacts( spe, mito_percent = \"expr_chrM_ratio\", mito_sum = \"expr_chrM\", samples = \"sample_id\", n_order = 5, shape = \"hexagonal\", log = TRUE, name = \"artifact\", var_output = TRUE )"},{"path":"https://mictott.github.io/SpotSweeper/reference/findArtifacts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","text":"spe SingleCellExperiment object. mito_percent column name representing mitochondrial percent. Default 'expr_chrM_ratio'. mito_sum column name representing sum mitochondrial expression. Default 'expr_chrM'. samples column name representing sample IDs. Default 'sample_id'. n_order number orders local mito variance calculation. Default 5. shape shape neighborhood local variance calculation. Can either 'hexagonal' 'square'. Default 'hexagonal'. log Logical, indicating whether log1p transform mito_percent. Default TRUE. name Prefix local variance column names. Default 'artifact'. var_output Logical, indicating whether include local variances output. Default TRUE.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/findArtifacts.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","text":"Returns modified SingleCellExperiment object artifact annotations.","code":""},{"path":[]},{"path":"https://mictott.github.io/SpotSweeper/reference/findArtifacts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","text":"","code":"library(SpotSweeper) library(SpatialExperiment) #> Loading required package: SingleCellExperiment #> Loading required package: SummarizedExperiment #> Loading required package: MatrixGenerics #> Loading required package: matrixStats #> #> Attaching package: ‘MatrixGenerics’ #> The following objects are masked from ‘package:matrixStats’: #> #> colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse, #> colCounts, colCummaxs, colCummins, colCumprods, colCumsums, #> colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs, #> colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats, #> colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds, #> colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads, #> colWeightedMeans, colWeightedMedians, colWeightedSds, #> colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet, #> rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods, #> rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps, #> rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins, #> rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks, #> rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars, #> rowWeightedMads, rowWeightedMeans, rowWeightedMedians, #> rowWeightedSds, rowWeightedVars #> Loading required package: GenomicRanges #> Loading required package: stats4 #> Loading required package: BiocGenerics #> #> Attaching package: ‘BiocGenerics’ #> The following objects are masked from ‘package:stats’: #> #> IQR, mad, sd, var, xtabs #> The following objects are masked from ‘package:base’: #> #> Filter, Find, Map, Position, Reduce, anyDuplicated, aperm, append, #> as.data.frame, basename, cbind, colnames, dirname, do.call, #> duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted, #> lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin, #> pmin.int, rank, rbind, rownames, sapply, saveRDS, setdiff, table, #> tapply, union, unique, unsplit, which.max, which.min #> Loading required package: S4Vectors #> #> Attaching package: ‘S4Vectors’ #> The following object is masked from ‘package:utils’: #> #> findMatches #> The following objects are masked from ‘package:base’: #> #> I, expand.grid, unname #> Loading required package: IRanges #> Loading required package: GenomeInfoDb #> Loading required package: Biobase #> Welcome to Bioconductor #> #> Vignettes contain introductory material; view with #> 'browseVignettes()'. To cite Bioconductor, see #> 'citation(\"Biobase\")', and for packages 'citation(\"pkgname\")'. #> #> Attaching package: ‘Biobase’ #> The following object is masked from ‘package:MatrixGenerics’: #> #> rowMedians #> The following objects are masked from ‘package:matrixStats’: #> #> anyMissing, rowMedians library(escheR) #> Loading required package: ggplot2 data(DLPFC_artifact) spe <- DLPFC_artifact # find artifacts spe <- findArtifacts(spe, mito_percent = \"expr_chrM_ratio\", mito_sum = \"expr_chrM\", n_order = 2, # 5 recommended, using 2 for time shape = \"hexagonal\", name = \"artifact\" )"},{"path":"https://mictott.github.io/SpotSweeper/reference/flagVisiumOutliers.html","id":null,"dir":"Reference","previous_headings":"","what":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","title":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","text":"flagVisiumoutliers function identifies flags Visium systematic outlier spots SpatialExperiment object based barcodes. outliers marked colData SpatialExperiment object, allowing users exclude downstream analyses enhance data quality reliability.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/flagVisiumOutliers.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","text":"","code":"flagVisiumOutliers(spe)"},{"path":"https://mictott.github.io/SpotSweeper/reference/flagVisiumOutliers.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","text":"spe SpatialExperiment object containing spatial transcriptomics data. object must include array_row array_col columns colData specify spatial coordinates spot.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/flagVisiumOutliers.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","text":"SpatialExperiment object identical input spe additional logical column systematic_outliers colData. column indicates whether spot flagged technical outlier (TRUE) (FALSE).","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/flagVisiumOutliers.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","text":"","code":"library(SpotSweeper) library(SpatialExperiment) # load example data spe <- STexampleData::Visium_humanDLPFC() #> see ?STexampleData and browseVignettes('STexampleData') for documentation #> downloading 1 resources #> retrieving 1 resource #> loading from cache # Flag outlier spots spe <- flagVisiumOutliers(spe) # drop outlier spots spe <- spe[, !colData(spe)$systematic_outliers]"},{"path":"https://mictott.github.io/SpotSweeper/reference/localOutliers.html","id":null,"dir":"Reference","previous_headings":"","what":"localOutliers Function — localOutliers","title":"localOutliers Function — localOutliers","text":"function detects local outliers spatial transcriptomics data based standard quality control metrics, library size, unique genes, mitochondrial ratio. Local outliers defined spots low/high quality metrics compared surrounding neighbors, based modified z-score statistic.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localOutliers.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"localOutliers Function — localOutliers","text":"","code":"localOutliers( spe, metric = \"detected\", direction = \"lower\", n_neighbors = 36, samples = \"sample_id\", log = TRUE, cutoff = 3, workers = 1 )"},{"path":"https://mictott.github.io/SpotSweeper/reference/localOutliers.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"localOutliers Function — localOutliers","text":"spe SpatialExperiment SingleCellExperiment object metric colData QC metric use outlier detection direction Direction outlier detection (higher, lower, ) n_neighbors Number nearest neighbors use outlier detection samples Column name colData use sample IDs log Logical indicating whether log1p transform features (default TRUE) cutoff Cutoff outlier detection (default 3) workers Number workers parallel processing (default 1)","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localOutliers.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"localOutliers Function — localOutliers","text":"SpatialExperiment SingleCellExperiment object updated colData containing outputs","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localOutliers.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"localOutliers Function — localOutliers","text":"","code":"library(SpotSweeper) library(SpatialExperiment) # load example data spe <- STexampleData::Visium_humanDLPFC() #> see ?STexampleData and browseVignettes('STexampleData') for documentation #> loading from cache # change from gene id to gene names rownames(spe) <- rowData(spe)$gene_name # drop out-of-tissue spots spe <- spe[, spe$in_tissue == 1] spe <- spe[, !is.na(spe$ground_truth)] # Identifying the mitochondrial transcripts in our SpatialExperiment. is.mito <- rownames(spe)[grepl(\"^MT-\", rownames(spe))] # Calculating QC metrics for each spot using scuttle spe <- scuttle::addPerCellQCMetrics(spe, subsets = list(Mito = is.mito)) colnames(colData(spe)) #> [1] \"barcode_id\" \"sample_id\" \"in_tissue\" #> [4] \"array_row\" \"array_col\" \"ground_truth\" #> [7] \"reference\" \"cell_count\" \"sum\" #> [10] \"detected\" \"subsets_Mito_sum\" \"subsets_Mito_detected\" #> [13] \"subsets_Mito_percent\" \"total\" # Identifying local outliers using SpotSweeper spe <- localOutliers(spe, metric = \"sum\", direction = \"lower\", log = TRUE )"},{"path":"https://mictott.github.io/SpotSweeper/reference/localVariance.html","id":null,"dir":"Reference","previous_headings":"","what":"localVariance Function — localVariance","title":"localVariance Function — localVariance","text":"function calculates local variance based kNN.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localVariance.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"localVariance Function — localVariance","text":"","code":"localVariance( spe, n_neighbors = 36, metric = c(\"expr_chrM_ratio\"), samples = \"sample_id\", log = FALSE, name = NULL, workers = 1 )"},{"path":"https://mictott.github.io/SpotSweeper/reference/localVariance.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"localVariance Function — localVariance","text":"spe SpatialExperiment object following columns colData: sample_id, sum_umi, sum_gene n_neighbors Number nearest neighbors use variance calculation metric Metric use variance calculation samples Column colData use sample ID log Whether log1p transform metric name Name new column add colData workers Number workers use parallel computation","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localVariance.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"localVariance Function — localVariance","text":"SpatialExperiment object metric variance added colData","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localVariance.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"localVariance Function — localVariance","text":"","code":"# for more details see extended example in vignettes library(SpotSweeper) library(SpatialExperiment) library(escheR) # load example data spe <- STexampleData::Visium_humanDLPFC() #> see ?STexampleData and browseVignettes('STexampleData') for documentation #> loading from cache # change from gene id to gene names rownames(spe) <- rowData(spe)$gene_name # show column data before SpotSweepR colnames(colData(spe)) #> [1] \"barcode_id\" \"sample_id\" \"in_tissue\" \"array_row\" \"array_col\" #> [6] \"ground_truth\" \"reference\" \"cell_count\" # drop out-of-tissue spots spe <- spe[, spe$in_tissue == 1] spe <- spe[, !is.na(spe$ground_truth)] # Identifying the mitochondrial transcripts in our SpatialExperiment. is.mito <- rownames(spe)[grepl(\"^MT-\", rownames(spe))] # Calculating QC metric for each spot using scuttle spe <- scuttle::addPerCellQCMetrics(spe, subsets = list(Mito = is.mito)) colnames(colData(spe)) #> [1] \"barcode_id\" \"sample_id\" \"in_tissue\" #> [4] \"array_row\" \"array_col\" \"ground_truth\" #> [7] \"reference\" \"cell_count\" \"sum\" #> [10] \"detected\" \"subsets_Mito_sum\" \"subsets_Mito_detected\" #> [13] \"subsets_Mito_percent\" \"total\" spe <- localVariance(spe, metric = \"subsets_Mito_percent\", n_neighbors = 36, name = \"local_mito_variance_k36\", workers = 1 )"},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCmetrics.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","title":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","text":"function generates plot specified sample within SpatialExperiment object, highlighting outliers based specified metric. plot visualizes metric interest indicates outliers distinct color.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCmetrics.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","text":"","code":"plotQCmetrics( spe, sample_id = \"sample_id\", sample = unique(spe$sample_id)[1], metric = \"detected\", outliers = NULL, point_size = 2, colors = c(\"white\", \"black\"), stroke = 1 )"},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCmetrics.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","text":"spe SpatialExperiment object containing data plotted. sample_id character string specifying column name colData(spe) contains unique sample identifiers. Default \"sample_id\". sample character string numeric value specifying sample plotted. default, plots first unique sample found spe$sample_id. metric character string specifying metric visualized plot. metric column name colData(spe). outliers character string specifying column name colData(spe) indicates whether data point considered outlier. Default NULL. point_size numeric value specifying size points plot. Default 2. colors character vector specifying colors used gradient scale. length 2, gradient single color gradient. stroke numeric value specifying border thickness outlier points. Default 1.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCmetrics.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","text":"function returns plot object created make_escheR modified additional layers visualizing specified metric outliers. plot explicitly printed function printed caller.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCmetrics.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","text":"","code":"library(SpotSweeper) library(SpatialExperiment) library(escheR) # load example data spe <- STexampleData::Visium_humanDLPFC() #> see ?STexampleData and browseVignettes('STexampleData') for documentation #> loading from cache # change from gene id to gene names rownames(spe) <- rowData(spe)$gene_name # drop out-of-tissue spots spe <- spe[, spe$in_tissue == 1] spe <- spe[, !is.na(spe$ground_truth)] # Identifying the mitochondrial transcripts in our SpatialExperiment. is.mito <- rownames(spe)[grepl(\"^MT-\", rownames(spe))] # Calculating QC metrics for each spot using scuttle spe <- scuttle::addPerCellQCMetrics(spe, subsets = list(Mito = is.mito)) colnames(colData(spe)) #> [1] \"barcode_id\" \"sample_id\" \"in_tissue\" #> [4] \"array_row\" \"array_col\" \"ground_truth\" #> [7] \"reference\" \"cell_count\" \"sum\" #> [10] \"detected\" \"subsets_Mito_sum\" \"subsets_Mito_detected\" #> [13] \"subsets_Mito_percent\" \"total\" # Identifying local outliers using SpotSweeper spe <- localOutliers(spe, metric = \"sum\", direction = \"lower\", log = TRUE ) plotQCmetrics(spe, metric=\"sum\", outliers=\"sum_outliers\")"},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCpdf.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot Outlier Metrics to PDF — plotQCpdf","title":"Plot Outlier Metrics to PDF — plotQCpdf","text":"function generates PDF file containing plots sample SpatialExperiment object, highlighting outliers based specified metrics. plot visualizes outlier metrics single sample, allowing easy comparison analysis across samples.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCpdf.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot Outlier Metrics to PDF — plotQCpdf","text":"","code":"plotQCpdf( spe, sample_id = \"sample_id\", metric = \"detected\", outliers = \"local_outliers\", colors = c(\"white\", \"black\"), stroke = 1, point_size = 2, width = 5, height = 5, fname )"},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCpdf.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot Outlier Metrics to PDF — plotQCpdf","text":"spe SpatialExperiment object containing data plotted. sample_id character string specifying column name colData(spe) contains unique sample identifiers. Default 'sample_id'. metric character string specifying metric visualized plot. metric column name colData(spe). outliers character string specifying column name colData(spe) indicates whether data point considered outlier. Default local_outliers'. colors character vector specifying colors used gradient scale. length 2, gradient single color gradient stroke numeric value specifying border thickness outlier points. Default 1. point_size numeric value specifying size points plot. Default 2. width numeric value indicating width plot. Default 5. height numeric value indicating height plot. Default 5. fname character string specifying path name output PDF file.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCpdf.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot Outlier Metrics to PDF — plotQCpdf","text":"ggplot object specified. Generates plot otherwise.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCpdf.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot Outlier Metrics to PDF — plotQCpdf","text":"","code":"library(SpotSweeper) library(SpatialExperiment) library(escheR) # load example data spe <- STexampleData::Visium_humanDLPFC() #> see ?STexampleData and browseVignettes('STexampleData') for documentation #> loading from cache tempFilePath <- file.path(tempdir(), \"examplePlot.pdf\") # change from gene id to gene names rownames(spe) <- rowData(spe)$gene_name # drop out-of-tissue spots spe <- spe[, spe$in_tissue == 1] spe <- spe[, !is.na(spe$ground_truth)] # Identifying the mitochondrial transcripts in our SpatialExperiment. is.mito <- rownames(spe)[grepl(\"^MT-\", rownames(spe))] # Calculating QC metrics for each spot using scuttle spe <- scuttle::addPerCellQCMetrics(spe, subsets = list(Mito = is.mito)) colnames(colData(spe)) #> [1] \"barcode_id\" \"sample_id\" \"in_tissue\" #> [4] \"array_row\" \"array_col\" \"ground_truth\" #> [7] \"reference\" \"cell_count\" \"sum\" #> [10] \"detected\" \"subsets_Mito_sum\" \"subsets_Mito_detected\" #> [13] \"subsets_Mito_percent\" \"total\" # Identifying local outliers using SpotSweeper spe <- localOutliers(spe, metric = \"sum\", direction = \"lower\", log = TRUE ) plotQCpdf(spe, metric=\"sum\", outliers=\"sum_outliers\", fname=tempFilePath) #> Warning: 'plotQC' is deprecated. #> Use 'plotQCmetrics' instead. #> See help(\"Deprecated\") #> pdf #> 2"},{"path":[]},{"path":"https://mictott.github.io/SpotSweeper/news/index.html","id":"major-changes-1-3-1","dir":"Changelog","previous_headings":"","what":"Major Changes","title":"Version 1.3.1","text":"Function Renaming: function plotQC renamed plotQCmetrics better reflect purpose. new function plotQCmetrics used moving forward. change improves clarity package’s API specifying function designed plotting QC metrics.","code":""},{"path":"https://mictott.github.io/SpotSweeper/news/index.html","id":"new-features-and-enhancements-1-3-1","dir":"Changelog","previous_headings":"","what":"New Features and Enhancements","title":"Version 1.3.1","text":"shape argument: Added shape argument findArtifacts, allowing users specify neighborhood shape either \"hexagonal\" \"square\" local variance calculations. enhancement provides flexibility different spatial arrangements spatial transcriptomics data. Updated n_order parameter: Renamed n_rings parameter n_order findArtifacts function better describe purpose specifying N-order neighbors local mitochondrial variance calculations. Parallelization: Added workers argument parallel processing using BiocParallel localOutlier localVariance functions. allows faster computation, particularly larger datasets.","code":""},{"path":"https://mictott.github.io/SpotSweeper/news/index.html","id":"deprecations-1-3-1","dir":"Changelog","previous_headings":"","what":"Deprecations","title":"Version 1.3.1","text":"plotQC Function Deprecated: plotQC function now deprecated. remains available backward compatibility, users encouraged transition plotQCmetrics. Calling plotQC display warning, reminding users deprecation. change backward compatible; existing code using plotQC still work show warning. recommend updating code use plotQCmetrics avoid issues future versions plotQC may removed.","code":""}] +[{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to SpotSweeper","title":"Contributing to SpotSweeper","text":"outlines propose change SpotSweeper. detailed discussion contributing tidyverse packages, please see development contributing guide code review principles.","code":""},{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":"fixing-typos","dir":"","previous_headings":"","what":"Fixing typos","title":"Contributing to SpotSweeper","text":"can fix typos, spelling mistakes, grammatical errors documentation directly using GitHub web interface, long changes made source file. generally means ’ll need edit roxygen2 comments .R, .Rd file. can find .R file generates .Rd reading comment first line.","code":""},{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":"bigger-changes","dir":"","previous_headings":"","what":"Bigger changes","title":"Contributing to SpotSweeper","text":"want make bigger change, ’s good idea first file issue make sure someone team agrees ’s needed. ’ve found bug, please file issue illustrates bug minimal reprex (also help write unit test, needed). See guide create great issue advice.","code":""},{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"Bigger changes","what":"Pull request process","title":"Contributing to SpotSweeper","text":"Fork package clone onto computer. haven’t done , recommend using usethis::create_from_github(\"MicTott/SpotSweeper\", fork = TRUE). Install development dependencies devtools::install_dev_deps(), make sure package passes R CMD check running devtools::check(). R CMD check doesn’t pass cleanly, ’s good idea ask help continuing. Create Git branch pull request (PR). recommend using usethis::pr_init(\"brief-description--change\"). Make changes, commit git, create PR running usethis::pr_push(), following prompts browser. title PR briefly describe change. body PR contain Fixes #issue-number. user-facing changes, add bullet top NEWS.md (.e. just first header). Follow style described https://style.tidyverse.org/news.html.","code":""},{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":"code-style","dir":"","previous_headings":"Bigger changes","what":"Code style","title":"Contributing to SpotSweeper","text":"New code follow tidyverse style guide. can use styler package apply styles, please don’t restyle code nothing PR. use roxygen2, Markdown syntax, documentation. use testthat unit tests. Contributions test cases included easier accept.","code":""},{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to SpotSweeper","text":"Please note SpotSweeper project released Contributor Code Conduct. contributing project agree abide terms.","code":""},{"path":"https://mictott.github.io/SpotSweeper/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 SpotSweeper authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://mictott.github.io/SpotSweeper/SUPPORT.html","id":null,"dir":"","previous_headings":"","what":"Getting help with SpotSweeper","title":"Getting help with SpotSweeper","text":"Thank using SpotSweeper! filing issue, things know make process smooth possible parties.","code":""},{"path":"https://mictott.github.io/SpotSweeper/SUPPORT.html","id":"make-a-reprex","dir":"","previous_headings":"","what":"Make a reprex","title":"Getting help with SpotSweeper","text":"Start making minimally reproducible example, also known ‘reprex’. may use reprex R package create one, though necessary help. make R-question-asking endeavors easier. Learning use takes 5 10 minutes. tips make minimally reproducible example, see StackOverflow link.","code":""},{"path":"https://mictott.github.io/SpotSweeper/SUPPORT.html","id":"where-to-post-it","dir":"","previous_headings":"","what":"Where to post it?","title":"Getting help with SpotSweeper","text":"Bioconductor help web page gives overview places may help answer question. Bioconductor software related questions, bug reports feature requests, addressed appropriate Bioconductor/SpotSweeper GitHub repository. Follow bug report feature request templates GitHub. package GitHub repository, see next bullet point. Bioconductor software usage questions addressed Bioconductor Support Website. Make sure use appropriate package tag, otherwise package authors get notification. General R questions can posed StackOverflow RStudio Community website especially pertain tidyverse RStudio GUI related products.","code":""},{"path":"https://mictott.github.io/SpotSweeper/SUPPORT.html","id":"issues-or-feature-requests","dir":"","previous_headings":"","what":"Issues or Feature Requests","title":"Getting help with SpotSweeper","text":"opening new issue feature request, sure search issues pull requests ensure one already exist implemented development version. Note. can remove :open search term issues page search open closed issues. See link learn modifying search.","code":""},{"path":"https://mictott.github.io/SpotSweeper/SUPPORT.html","id":"what-happens-next","dir":"","previous_headings":"","what":"What happens next?","title":"Getting help with SpotSweeper","text":"Bioconductor maintainers limited resources strive responsive possible. Please forget tag appropriate maintainer issue GitHub username (e.g., @username). order make easy possible Bioconductor core developers remediate issue. Provide accurate, brief, reproducible report outlined issue templates. Thank trusting Bioconductor.","code":""},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Getting started with 'SpotSweeper'","text":"SpotSweeper R package spatial transcriptomics data quality control (QC). provides functions detecting visualizing spot-level local outliers artifacts using spatially-aware methods. package designed work SpatialExperiment objects, compatible data 10X Genomics Visium spatial transcriptomics platforms.","code":""},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"installation","dir":"Articles","previous_headings":"","what":"Installation","title":"Getting started with 'SpotSweeper'","text":"Currently, way install SpotSweeper downloading development version can installed GitHub using following: accepted Bioconductor, SpotSweeper installable using:","code":"if (!require(\"devtools\")) install.packages(\"devtools\") remotes::install_github(\"MicTott/SpotSweeper\") if (!requireNamespace(\"BiocManager\", quietly = TRUE)) { install.packages(\"BiocManager\") } BiocManager::install(\"SpotSweeper\")"},{"path":[]},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"loading-example-data","dir":"Articles","previous_headings":"Spot-level local outlier detection","what":"Loading example data","title":"Getting started with 'SpotSweeper'","text":"’ll walk standard workflow using ‘SpotSweeper’ detect visualize local outliers spatial transcriptomics data. ’ll use Visium_humanDLPFC dataset STexampleData package, SpatialExperiment object. local outliers saved colData SpatialExperiment object, ’ll first view colData drop --tissue spots calculating quality control (QC) metrics running SpotSweeper.","code":"library(SpotSweeper) ## Error in get(paste0(generic, \".\", class), envir = get_method_env()) : ## object 'type_sum.accel' not found # load Maynard et al DLPFC daatset spe <- STexampleData::Visium_humanDLPFC() ## see ?STexampleData and browseVignettes('STexampleData') for documentation ## loading from cache # show column data before SpotSweeper colnames(colData(spe)) ## [1] \"barcode_id\" \"sample_id\" \"in_tissue\" \"array_row\" \"array_col\" ## [6] \"ground_truth\" \"reference\" \"cell_count\" # drop out-of-tissue spots spe <- spe[, spe$in_tissue == 1]"},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"calculating-qc-metrics-using-scuttle","dir":"Articles","previous_headings":"Spot-level local outlier detection","what":"Calculating QC metrics using scuttle","title":"Getting started with 'SpotSweeper'","text":"’ll use scuttle package calculate QC metrics. , ’ll need first change rownames gene id gene names. ’ll get mitochondrial transcripts calculate QC metrics spot using scuttle::addPerCellQCMetrics.","code":"# change from gene id to gene names rownames(spe) <- rowData(spe)$gene_name # identifying the mitochondrial transcripts is.mito <- rownames(spe)[grepl(\"^MT-\", rownames(spe))] # calculating QC metrics for each spot using scuttle spe <- scuttle::addPerCellQCMetrics(spe, subsets = list(Mito = is.mito)) colnames(colData(spe)) ## [1] \"barcode_id\" \"sample_id\" \"in_tissue\" ## [4] \"array_row\" \"array_col\" \"ground_truth\" ## [7] \"reference\" \"cell_count\" \"sum\" ## [10] \"detected\" \"subsets_Mito_sum\" \"subsets_Mito_detected\" ## [13] \"subsets_Mito_percent\" \"total\""},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"identifying-local-outliers-using-spotsweeper","dir":"Articles","previous_headings":"Spot-level local outlier detection","what":"Identifying local outliers using SpotSweeper","title":"Getting started with 'SpotSweeper'","text":"can now use SpotSweeper identify local outliers spatial transcriptomics data. ’ll use localOutliers function detect local outliers based unique detected genes, total library size, percent total reads mitochondrial. methods assume normal distribution, ’ll use log-transformed sum counts log-transformed number detected genes. mitochondrial percent, ’ll use raw mitochondrial percentage. localOutlier function automatically outputs results colData naming convention X_outliers, X name input colData. can combine outliers single column called local_outliers colData SpatialExperiment object.","code":"# library size spe <- localOutliers(spe, metric = \"sum\", direction = \"lower\", log = TRUE ) # unique genes spe <- localOutliers(spe, metric = \"detected\", direction = \"lower\", log = TRUE ) # mitochondrial percent spe <- localOutliers(spe, metric = \"subsets_Mito_percent\", direction = \"higher\", log = FALSE ) # combine all outliers into \"local_outliers\" column spe$local_outliers <- as.logical(spe$sum_outliers) | as.logical(spe$detected_outliers) | as.logical(spe$subsets_Mito_percent_outliers)"},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"visualizing-local-outliers","dir":"Articles","previous_headings":"Spot-level local outlier detection","what":"Visualizing local outliers","title":"Getting started with 'SpotSweeper'","text":"can visualize local outliers using plotQCmetrics function. function creates scatter plot specified metric highlights local outliers red using escheR package. , ’ll visualize local outliers library size, unique genes, mitochondrial percent, finally, local outliers. ’ll arrange plots grid using ggpubr::arrange.","code":"library(escheR) ## Loading required package: ggplot2 # all local outliers plotQCmetrics(spe, metric = \"sum_log\", outliers = \"local_outliers\", point_size = 1.1, stroke = 0.75) + ggtitle(\"All Local Outliers\")"},{"path":[]},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"loading-example-data-1","dir":"Articles","previous_headings":"Removing technical artifacts using SpotSweeper","what":"Loading example data","title":"Getting started with 'SpotSweeper'","text":"","code":"# load in DLPFC sample with hangnail artifact data(DLPFC_artifact) spe <- DLPFC_artifact # inspect colData before artifact detection colnames(colData(spe)) ## [1] \"sample_id\" \"in_tissue\" \"array_row\" ## [4] \"array_col\" \"key\" \"sum_umi\" ## [7] \"sum_gene\" \"expr_chrM\" \"expr_chrM_ratio\" ## [10] \"ManualAnnotation\" \"subject\" \"region\" ## [13] \"sex\" \"age\" \"diagnosis\" ## [16] \"sample_id_complete\" \"count\" \"sizeFactor\""},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"visualizing-technical-artifacts","dir":"Articles","previous_headings":"Removing technical artifacts using SpotSweeper","what":"Visualizing technical artifacts","title":"Getting started with 'SpotSweeper'","text":"Technical artifacts can commonly visualized standard QC metrics, including library size, unique genes, mitochondrial percentage. can first visualize technical artifacts using plotQCmetrics function. sample, can clearly see hangnail artifact right side tissue section mitochondrial ratio plot.","code":"plotQCmetrics(spe, metric = \"expr_chrM_ratio\", outliers = NULL, point_size = 1.1 ) + ggtitle(\"Mitochondrial Percent\")"},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"identifying-artifacts-using-spotsweeper","dir":"Articles","previous_headings":"Removing technical artifacts using SpotSweeper","what":"Identifying artifacts using SpotSweeper","title":"Getting started with 'SpotSweeper'","text":"can use findArtifacts function identify artifacts spatial transcriptomics (data. function identifies technical artifacts based first principle component local variance specified QC metric (mito_percent) numerous neighorhood sizes (n_order=5). Currently, kmeans clustering used cluster technical artifact vs high-quality Visium spots. Similar localOutliers, findArtifacts function outputs results colData.","code":"# find artifacts using SpotSweeper spe <- findArtifacts(spe, mito_percent = \"expr_chrM_ratio\", mito_sum = \"expr_chrM\", n_order = 5, name = \"artifact\" ) # check that \"artifact\" is now in colData colnames(colData(spe)) ## [1] \"sample_id\" \"in_tissue\" \"array_row\" ## [4] \"array_col\" \"key\" \"sum_umi\" ## [7] \"sum_gene\" \"expr_chrM\" \"expr_chrM_ratio\" ## [10] \"ManualAnnotation\" \"subject\" \"region\" ## [13] \"sex\" \"age\" \"diagnosis\" ## [16] \"sample_id_complete\" \"count\" \"sizeFactor\" ## [19] \"expr_chrM_ratio_log\" \"coords\" \"k6\" ## [22] \"k18\" \"k36\" \"k60\" ## [25] \"k90\" \"artifact\""},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"visualizing-artifacts","dir":"Articles","previous_headings":"Removing technical artifacts using SpotSweeper","what":"Visualizing artifacts","title":"Getting started with 'SpotSweeper'","text":"can visualize artifacts using escheR package. , ’ll visualize artifacts using plotQCmetrics function arrange plots using ggpubr::arrange. # Session information","code":"plotQCmetrics(spe, metric = \"expr_chrM_ratio\", outliers = \"artifact\", point_size = 1.1 ) + ggtitle(\"Hangnail artifact\") utils::sessionInfo() ## R version 4.4.2 (2024-10-31) ## Platform: x86_64-pc-linux-gnu ## Running under: Ubuntu 24.04.1 LTS ## ## Matrix products: default ## BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 ## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so; LAPACK version 3.12.0 ## ## locale: ## [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 ## [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 ## [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C ## [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C ## ## time zone: UTC ## tzcode source: system (glibc) ## ## attached base packages: ## [1] stats4 stats graphics grDevices utils datasets methods ## [8] base ## ## other attached packages: ## [1] escheR_1.6.0 ggplot2_3.5.1 ## [3] STexampleData_1.14.0 SpatialExperiment_1.16.0 ## [5] SingleCellExperiment_1.28.1 SummarizedExperiment_1.36.0 ## [7] Biobase_2.66.0 GenomicRanges_1.58.0 ## [9] GenomeInfoDb_1.42.1 IRanges_2.40.1 ## [11] S4Vectors_0.44.0 MatrixGenerics_1.18.0 ## [13] matrixStats_1.4.1 ExperimentHub_2.14.0 ## [15] AnnotationHub_3.14.0 BiocFileCache_2.14.0 ## [17] dbplyr_2.5.0 BiocGenerics_0.52.0 ## [19] SpotSweeper_1.3.3 BiocStyle_2.34.0 ## ## loaded via a namespace (and not attached): ## [1] DBI_1.2.3 rlang_1.1.4 magrittr_2.0.3 ## [4] spatialEco_2.0-2 compiler_4.4.2 RSQLite_2.3.9 ## [7] png_0.1-8 systemfonts_1.1.0 vctrs_0.6.5 ## [10] pkgconfig_2.0.3 crayon_1.5.3 fastmap_1.2.0 ## [13] magick_2.8.5 XVector_0.46.0 labeling_0.4.3 ## [16] scuttle_1.16.0 rmarkdown_2.29 UCSC.utils_1.2.0 ## [19] ragg_1.3.3 purrr_1.0.2 bit_4.5.0.1 ## [22] xfun_0.49 zlibbioc_1.52.0 cachem_1.1.0 ## [25] beachmat_2.22.0 jsonlite_1.8.9 blob_1.2.4 ## [28] DelayedArray_0.32.0 BiocParallel_1.40.0 terra_1.8-5 ## [31] parallel_4.4.2 R6_2.5.1 bslib_0.8.0 ## [34] jquerylib_0.1.4 Rcpp_1.0.13-1 bookdown_0.41 ## [37] knitr_1.49 Matrix_1.7-1 tidyselect_1.2.1 ## [40] abind_1.4-8 yaml_2.3.10 codetools_0.2-20 ## [43] curl_6.0.1 lattice_0.22-6 tibble_3.2.1 ## [46] withr_3.0.2 KEGGREST_1.46.0 evaluate_1.0.1 ## [49] desc_1.4.3 Biostrings_2.74.1 pillar_1.10.0 ## [52] BiocManager_1.30.25 filelock_1.0.3 generics_0.1.3 ## [55] BiocVersion_3.20.0 munsell_0.5.1 scales_1.3.0 ## [58] glue_1.8.0 tools_4.4.2 BiocNeighbors_2.0.1 ## [61] fs_1.6.5 grid_4.4.2 AnnotationDbi_1.68.0 ## [64] colorspace_2.1-1 GenomeInfoDbData_1.2.13 cli_3.6.3 ## [67] rappdirs_0.3.3 textshaping_0.4.1 viridisLite_0.4.2 ## [70] S4Arrays_1.6.0 dplyr_1.1.4 gtable_0.3.6 ## [73] sass_0.4.9 digest_0.6.37 SparseArray_1.6.0 ## [76] farver_2.1.2 rjson_0.2.23 memoise_2.0.1 ## [79] htmltools_0.5.8.1 pkgdown_2.1.1 lifecycle_1.0.4 ## [82] httr_1.4.7 mime_0.12 bit64_4.5.2 ## [85] MASS_7.3-61"},{"path":"https://mictott.github.io/SpotSweeper/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Michael Totty. Author, maintainer. Stephanie Hicks. Author. Boyi Guo. Author.","code":""},{"path":"https://mictott.github.io/SpotSweeper/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Totty M (2024). SpotSweeper: spatially-aware quality control spatial transcriptomics. doi:10.18129/B9.bioc.SpotSweeper, https://github.com/MicTott/SpotSweeper/SpotSweeper - R package version 1.3.3, http://www.bioconductor.org/packages/SpotSweeper. Totty M, Hicks S, Guo B (2024). “SpotSweeper: spatially-aware quality control spatial transcriptomics.” bioRxiv. doi:10.1101/2024.06.06.597765, https://doi.org/10.1101/2024.06.06.597765.","code":"@Manual{, title = {SpotSweeper: spatially-aware quality control for spatial transcriptomics}, author = {Michael Totty}, year = {2024}, url = {http://www.bioconductor.org/packages/SpotSweeper}, note = {https://github.com/MicTott/SpotSweeper/SpotSweeper - R package version 1.3.3}, doi = {10.18129/B9.bioc.SpotSweeper}, } @Article{, title = {SpotSweeper: spatially-aware quality control for spatial transcriptomics}, author = {Michael Totty and Stephanie Hicks and Boyi Guo}, journal = {bioRxiv}, year = {2024}, doi = {10.1101/2024.06.06.597765}, url = {https://doi.org/10.1101/2024.06.06.597765}, }"},{"path":"https://mictott.github.io/SpotSweeper/index.html","id":"spotsweeper-","dir":"","previous_headings":"","what":"Spatially-aware quality control for spatial transcriptomics","title":"Spatially-aware quality control for spatial transcriptomics","text":"SpotSweeper package developed spatially-aware quality control (QC) methods detection, visualization, removal local outliers regional artifacts spot-based spatial transcriptomics data, 10x Genomics Visium, using standard QC metrics. experience issues using package like make suggestion, please open issue GitHub repository. find information, please visit documentation website.","code":""},{"path":"https://mictott.github.io/SpotSweeper/index.html","id":"installation-instructions","dir":"","previous_headings":"","what":"Installation instructions","title":"Spatially-aware quality control for spatial transcriptomics","text":"can install latest version SpotSweeper Bioconductor following code: latest development version can installed GitHub using following:","code":"if (!requireNamespace(\"BiocManager\", quietly = TRUE)) { install.packages(\"BiocManager\") } BiocManager::install(\"SpotSweeper\") if (!require(\"devtools\")) install.packages(\"devtools\") remotes::install_github(\"MicTott/SpotSweeper\")"},{"path":"https://mictott.github.io/SpotSweeper/index.html","id":"tutorials","dir":"","previous_headings":"","what":"Tutorials","title":"Spatially-aware quality control for spatial transcriptomics","text":"detailed tutorial available package vignette Bioconductor. direct link tutorial / package vignette available .","code":""},{"path":"https://mictott.github.io/SpotSweeper/index.html","id":"development-tools","dir":"","previous_headings":"","what":"Development tools","title":"Spatially-aware quality control for spatial transcriptomics","text":"Continuous code testing possible thanks GitHub actions BiocStyle::Biocpkg('biocthis'). documentation website automatically updated thanks BiocStyle::CRANpkg('pkgdown'). code styled automatically thanks BiocStyle::CRANpkg('styler'). documentation formatted thanks BiocStyle::CRANpkg('devtools') BiocStyle::CRANpkg('roxygen2'). package developed using BiocStyle::Biocpkg('biocthis').","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":null,"dir":"Reference","previous_headings":"","what":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"DLPFC_artifact dataset SpatialExperiment object containing single-sample subset human dorsolateral prefrontal cortex (DLPFC) dataset Hukki-Myers et al. 2023. particular sample ('Br2743_ant') included demonstrate identification removal technical artifacts within spatial transcriptomics data. dataset serves example artifact detection using 'SpotSweeper' workflow.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"","code":"data(DLPFC_artifact)"},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"SpatialExperiment object.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"spatialLIBD","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"Hukki-Myers et al. (2023) bioRxiv (bioRxiv)","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"","code":"data(DLPFC_artifact)"},{"path":"https://mictott.github.io/SpotSweeper/reference/biased_spots.html","id":null,"dir":"Reference","previous_headings":"","what":"Biased Spots Data — biased_spots","title":"Biased Spots Data — biased_spots","text":"biased_spots dataset data.frame containing information specific spatial spots identified technical outliers spatial transcriptomics experiments. entry represents biased spot characterized spatial coordinates (row column) unique barcode. dataset utilized flagVisiumOutliers function flag exclude outlier spots downstream analyses, thereby enhancing data quality reliability.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/biased_spots.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Biased Spots Data — biased_spots","text":"","code":"data(biased_spots)"},{"path":"https://mictott.github.io/SpotSweeper/reference/biased_spots.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Biased Spots Data — biased_spots","text":"data.frame following columns: row Integer. row position biased spot within spatial grid. col Integer. column position biased spot within spatial grid. barcode Character. unique identifier corresponding spatial transcriptomics barcode biased spot.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/biased_spots.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Biased Spots Data — biased_spots","text":"biased_spots.rds file generated analysis local outliers. See https://github.com/boyiguo1/Manuscript-SpotSweeper/blob/main/code/03_Visium/figure_3.R details.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/biased_spots.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Biased Spots Data — biased_spots","text":"","code":"data(biased_spots)"},{"path":"https://mictott.github.io/SpotSweeper/reference/findArtifacts.html","id":null,"dir":"Reference","previous_headings":"","what":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","title":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","text":"function identifies annotates potential artifacts spatial transcriptomics data. Artifacts detected based local mito variance, results added original SpatialExperiment (sce) object.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/findArtifacts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","text":"","code":"findArtifacts( spe, mito_percent = \"expr_chrM_ratio\", mito_sum = \"expr_chrM\", samples = \"sample_id\", n_order = 5, shape = \"hexagonal\", log = TRUE, name = \"artifact\", var_output = TRUE )"},{"path":"https://mictott.github.io/SpotSweeper/reference/findArtifacts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","text":"spe SingleCellExperiment object. mito_percent column name representing mitochondrial percent. Default 'expr_chrM_ratio'. mito_sum column name representing sum mitochondrial expression. Default 'expr_chrM'. samples column name representing sample IDs. Default 'sample_id'. n_order number orders local mito variance calculation. Default 5. shape shape neighborhood local variance calculation. Can either 'hexagonal' 'square'. Default 'hexagonal'. log Logical, indicating whether log1p transform mito_percent. Default TRUE. name Prefix local variance column names. Default 'artifact'. var_output Logical, indicating whether include local variances output. Default TRUE.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/findArtifacts.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","text":"Returns modified SingleCellExperiment object artifact annotations.","code":""},{"path":[]},{"path":"https://mictott.github.io/SpotSweeper/reference/findArtifacts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","text":"","code":"library(SpotSweeper) library(SpatialExperiment) #> Loading required package: SingleCellExperiment #> Loading required package: SummarizedExperiment #> Loading required package: MatrixGenerics #> Loading required package: matrixStats #> #> Attaching package: ‘MatrixGenerics’ #> The following objects are masked from ‘package:matrixStats’: #> #> colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse, #> colCounts, colCummaxs, colCummins, colCumprods, colCumsums, #> colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs, #> colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats, #> colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds, #> colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads, #> colWeightedMeans, colWeightedMedians, colWeightedSds, #> colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet, #> rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods, #> rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps, #> rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins, #> rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks, #> rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars, #> rowWeightedMads, rowWeightedMeans, rowWeightedMedians, #> rowWeightedSds, rowWeightedVars #> Loading required package: GenomicRanges #> Loading required package: stats4 #> Loading required package: BiocGenerics #> #> Attaching package: ‘BiocGenerics’ #> The following objects are masked from ‘package:stats’: #> #> IQR, mad, sd, var, xtabs #> The following objects are masked from ‘package:base’: #> #> Filter, Find, Map, Position, Reduce, anyDuplicated, aperm, append, #> as.data.frame, basename, cbind, colnames, dirname, do.call, #> duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted, #> lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin, #> pmin.int, rank, rbind, rownames, sapply, saveRDS, setdiff, table, #> tapply, union, unique, unsplit, which.max, which.min #> Loading required package: S4Vectors #> #> Attaching package: ‘S4Vectors’ #> The following object is masked from ‘package:utils’: #> #> findMatches #> The following objects are masked from ‘package:base’: #> #> I, expand.grid, unname #> Loading required package: IRanges #> Loading required package: GenomeInfoDb #> Loading required package: Biobase #> Welcome to Bioconductor #> #> Vignettes contain introductory material; view with #> 'browseVignettes()'. To cite Bioconductor, see #> 'citation(\"Biobase\")', and for packages 'citation(\"pkgname\")'. #> #> Attaching package: ‘Biobase’ #> The following object is masked from ‘package:MatrixGenerics’: #> #> rowMedians #> The following objects are masked from ‘package:matrixStats’: #> #> anyMissing, rowMedians library(escheR) #> Loading required package: ggplot2 data(DLPFC_artifact) spe <- DLPFC_artifact # find artifacts spe <- findArtifacts(spe, mito_percent = \"expr_chrM_ratio\", mito_sum = \"expr_chrM\", n_order = 2, # 5 recommended, using 2 for time shape = \"hexagonal\", name = \"artifact\" )"},{"path":"https://mictott.github.io/SpotSweeper/reference/flagVisiumOutliers.html","id":null,"dir":"Reference","previous_headings":"","what":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","title":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","text":"flagVisiumoutliers function identifies flags Visium systematic outlier spots SpatialExperiment object based barcodes. outliers marked colData SpatialExperiment object, allowing users exclude downstream analyses enhance data quality reliability.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/flagVisiumOutliers.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","text":"","code":"flagVisiumOutliers(spe)"},{"path":"https://mictott.github.io/SpotSweeper/reference/flagVisiumOutliers.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","text":"spe SpatialExperiment object containing spatial transcriptomics data. object must include array_row array_col columns colData specify spatial coordinates spot.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/flagVisiumOutliers.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","text":"SpatialExperiment object identical input spe additional logical column systematic_outliers colData. column indicates whether spot flagged technical outlier (TRUE) (FALSE).","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/flagVisiumOutliers.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","text":"","code":"library(SpotSweeper) library(SpatialExperiment) # load example data spe <- STexampleData::Visium_humanDLPFC() #> see ?STexampleData and browseVignettes('STexampleData') for documentation #> downloading 1 resources #> retrieving 1 resource #> loading from cache # Flag outlier spots spe <- flagVisiumOutliers(spe) # drop outlier spots spe <- spe[, !colData(spe)$systematic_outliers]"},{"path":"https://mictott.github.io/SpotSweeper/reference/localOutliers.html","id":null,"dir":"Reference","previous_headings":"","what":"localOutliers Function — localOutliers","title":"localOutliers Function — localOutliers","text":"function detects local outliers spatial transcriptomics data based standard quality control metrics, library size, unique genes, mitochondrial ratio. Local outliers defined spots low/high quality metrics compared surrounding neighbors, based modified z-score statistic.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localOutliers.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"localOutliers Function — localOutliers","text":"","code":"localOutliers( spe, metric = \"detected\", direction = \"lower\", n_neighbors = 36, samples = \"sample_id\", log = TRUE, cutoff = 3, workers = 1 )"},{"path":"https://mictott.github.io/SpotSweeper/reference/localOutliers.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"localOutliers Function — localOutliers","text":"spe SpatialExperiment SingleCellExperiment object metric colData QC metric use outlier detection direction Direction outlier detection (higher, lower, ) n_neighbors Number nearest neighbors use outlier detection samples Column name colData use sample IDs log Logical indicating whether log1p transform features (default TRUE) cutoff Cutoff outlier detection (default 3) workers Number workers parallel processing (default 1)","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localOutliers.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"localOutliers Function — localOutliers","text":"SpatialExperiment SingleCellExperiment object updated colData containing outputs","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localOutliers.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"localOutliers Function — localOutliers","text":"","code":"library(SpotSweeper) library(SpatialExperiment) # load example data spe <- STexampleData::Visium_humanDLPFC() #> see ?STexampleData and browseVignettes('STexampleData') for documentation #> loading from cache # change from gene id to gene names rownames(spe) <- rowData(spe)$gene_name # drop out-of-tissue spots spe <- spe[, spe$in_tissue == 1] spe <- spe[, !is.na(spe$ground_truth)] # Identifying the mitochondrial transcripts in our SpatialExperiment. is.mito <- rownames(spe)[grepl(\"^MT-\", rownames(spe))] # Calculating QC metrics for each spot using scuttle spe <- scuttle::addPerCellQCMetrics(spe, subsets = list(Mito = is.mito)) colnames(colData(spe)) #> [1] \"barcode_id\" \"sample_id\" \"in_tissue\" #> [4] \"array_row\" \"array_col\" \"ground_truth\" #> [7] \"reference\" \"cell_count\" \"sum\" #> [10] \"detected\" \"subsets_Mito_sum\" \"subsets_Mito_detected\" #> [13] \"subsets_Mito_percent\" \"total\" # Identifying local outliers using SpotSweeper spe <- localOutliers(spe, metric = \"sum\", direction = \"lower\", log = TRUE )"},{"path":"https://mictott.github.io/SpotSweeper/reference/localVariance.html","id":null,"dir":"Reference","previous_headings":"","what":"localVariance Function — localVariance","title":"localVariance Function — localVariance","text":"function calculates local variance based kNN.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localVariance.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"localVariance Function — localVariance","text":"","code":"localVariance( spe, n_neighbors = 36, metric = c(\"expr_chrM_ratio\"), samples = \"sample_id\", log = FALSE, name = NULL, workers = 1 )"},{"path":"https://mictott.github.io/SpotSweeper/reference/localVariance.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"localVariance Function — localVariance","text":"spe SpatialExperiment object following columns colData: sample_id, sum_umi, sum_gene n_neighbors Number nearest neighbors use variance calculation metric Metric use variance calculation samples Column colData use sample ID log Whether log1p transform metric name Name new column add colData workers Number workers use parallel computation","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localVariance.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"localVariance Function — localVariance","text":"SpatialExperiment object metric variance added colData","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localVariance.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"localVariance Function — localVariance","text":"","code":"# for more details see extended example in vignettes library(SpotSweeper) library(SpatialExperiment) library(escheR) # load example data spe <- STexampleData::Visium_humanDLPFC() #> see ?STexampleData and browseVignettes('STexampleData') for documentation #> loading from cache # change from gene id to gene names rownames(spe) <- rowData(spe)$gene_name # show column data before SpotSweepR colnames(colData(spe)) #> [1] \"barcode_id\" \"sample_id\" \"in_tissue\" \"array_row\" \"array_col\" #> [6] \"ground_truth\" \"reference\" \"cell_count\" # drop out-of-tissue spots spe <- spe[, spe$in_tissue == 1] spe <- spe[, !is.na(spe$ground_truth)] # Identifying the mitochondrial transcripts in our SpatialExperiment. is.mito <- rownames(spe)[grepl(\"^MT-\", rownames(spe))] # Calculating QC metric for each spot using scuttle spe <- scuttle::addPerCellQCMetrics(spe, subsets = list(Mito = is.mito)) colnames(colData(spe)) #> [1] \"barcode_id\" \"sample_id\" \"in_tissue\" #> [4] \"array_row\" \"array_col\" \"ground_truth\" #> [7] \"reference\" \"cell_count\" \"sum\" #> [10] \"detected\" \"subsets_Mito_sum\" \"subsets_Mito_detected\" #> [13] \"subsets_Mito_percent\" \"total\" spe <- localVariance(spe, metric = \"subsets_Mito_percent\", n_neighbors = 36, name = \"local_mito_variance_k36\", workers = 1 )"},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCmetrics.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","title":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","text":"function generates plot specified sample within SpatialExperiment object, highlighting outliers based specified metric. plot visualizes metric interest indicates outliers distinct color.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCmetrics.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","text":"","code":"plotQCmetrics( spe, sample_id = \"sample_id\", sample = unique(spe$sample_id)[1], metric = \"detected\", outliers = NULL, point_size = 2, colors = c(\"white\", \"black\"), stroke = 1 )"},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCmetrics.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","text":"spe SpatialExperiment object containing data plotted. sample_id character string specifying column name colData(spe) contains unique sample identifiers. Default \"sample_id\". sample character string numeric value specifying sample plotted. default, plots first unique sample found spe$sample_id. metric character string specifying metric visualized plot. metric column name colData(spe). outliers character string specifying column name colData(spe) indicates whether data point considered outlier. Default NULL. point_size numeric value specifying size points plot. Default 2. colors character vector specifying colors used gradient scale. length 2, gradient single color gradient. stroke numeric value specifying border thickness outlier points. Default 1.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCmetrics.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","text":"function returns plot object created make_escheR modified additional layers visualizing specified metric outliers. plot explicitly printed function printed caller.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCmetrics.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","text":"","code":"library(SpotSweeper) library(SpatialExperiment) library(escheR) # load example data spe <- STexampleData::Visium_humanDLPFC() #> see ?STexampleData and browseVignettes('STexampleData') for documentation #> loading from cache # change from gene id to gene names rownames(spe) <- rowData(spe)$gene_name # drop out-of-tissue spots spe <- spe[, spe$in_tissue == 1] spe <- spe[, !is.na(spe$ground_truth)] # Identifying the mitochondrial transcripts in our SpatialExperiment. is.mito <- rownames(spe)[grepl(\"^MT-\", rownames(spe))] # Calculating QC metrics for each spot using scuttle spe <- scuttle::addPerCellQCMetrics(spe, subsets = list(Mito = is.mito)) colnames(colData(spe)) #> [1] \"barcode_id\" \"sample_id\" \"in_tissue\" #> [4] \"array_row\" \"array_col\" \"ground_truth\" #> [7] \"reference\" \"cell_count\" \"sum\" #> [10] \"detected\" \"subsets_Mito_sum\" \"subsets_Mito_detected\" #> [13] \"subsets_Mito_percent\" \"total\" # Identifying local outliers using SpotSweeper spe <- localOutliers(spe, metric = \"sum\", direction = \"lower\", log = TRUE ) plotQCmetrics(spe, metric=\"sum\", outliers=\"sum_outliers\")"},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCpdf.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot Outlier Metrics to PDF — plotQCpdf","title":"Plot Outlier Metrics to PDF — plotQCpdf","text":"function generates PDF file containing plots sample SpatialExperiment object, highlighting outliers based specified metrics. plot visualizes outlier metrics single sample, allowing easy comparison analysis across samples.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCpdf.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot Outlier Metrics to PDF — plotQCpdf","text":"","code":"plotQCpdf( spe, sample_id = \"sample_id\", metric = \"detected\", outliers = \"local_outliers\", colors = c(\"white\", \"black\"), stroke = 1, point_size = 2, width = 5, height = 5, fname )"},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCpdf.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot Outlier Metrics to PDF — plotQCpdf","text":"spe SpatialExperiment object containing data plotted. sample_id character string specifying column name colData(spe) contains unique sample identifiers. Default 'sample_id'. metric character string specifying metric visualized plot. metric column name colData(spe). outliers character string specifying column name colData(spe) indicates whether data point considered outlier. Default local_outliers'. colors character vector specifying colors used gradient scale. length 2, gradient single color gradient stroke numeric value specifying border thickness outlier points. Default 1. point_size numeric value specifying size points plot. Default 2. width numeric value indicating width plot. Default 5. height numeric value indicating height plot. Default 5. fname character string specifying path name output PDF file.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCpdf.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot Outlier Metrics to PDF — plotQCpdf","text":"ggplot object specified. Generates plot otherwise.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCpdf.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot Outlier Metrics to PDF — plotQCpdf","text":"","code":"library(SpotSweeper) library(SpatialExperiment) library(escheR) # load example data spe <- STexampleData::Visium_humanDLPFC() #> see ?STexampleData and browseVignettes('STexampleData') for documentation #> loading from cache tempFilePath <- file.path(tempdir(), \"examplePlot.pdf\") # change from gene id to gene names rownames(spe) <- rowData(spe)$gene_name # drop out-of-tissue spots spe <- spe[, spe$in_tissue == 1] spe <- spe[, !is.na(spe$ground_truth)] # Identifying the mitochondrial transcripts in our SpatialExperiment. is.mito <- rownames(spe)[grepl(\"^MT-\", rownames(spe))] # Calculating QC metrics for each spot using scuttle spe <- scuttle::addPerCellQCMetrics(spe, subsets = list(Mito = is.mito)) colnames(colData(spe)) #> [1] \"barcode_id\" \"sample_id\" \"in_tissue\" #> [4] \"array_row\" \"array_col\" \"ground_truth\" #> [7] \"reference\" \"cell_count\" \"sum\" #> [10] \"detected\" \"subsets_Mito_sum\" \"subsets_Mito_detected\" #> [13] \"subsets_Mito_percent\" \"total\" # Identifying local outliers using SpotSweeper spe <- localOutliers(spe, metric = \"sum\", direction = \"lower\", log = TRUE ) plotQCpdf(spe, metric=\"sum\", outliers=\"sum_outliers\", fname=tempFilePath) #> Warning: 'plotQC' is deprecated. #> Use 'plotQCmetrics' instead. #> See help(\"Deprecated\") #> pdf #> 2"},{"path":[]},{"path":"https://mictott.github.io/SpotSweeper/news/index.html","id":"major-changes-1-3-1","dir":"Changelog","previous_headings":"","what":"Major Changes","title":"Version 1.3.1","text":"Function Renaming: function plotQC renamed plotQCmetrics better reflect purpose. new function plotQCmetrics used moving forward. change improves clarity package’s API specifying function designed plotting QC metrics.","code":""},{"path":"https://mictott.github.io/SpotSweeper/news/index.html","id":"new-features-and-enhancements-1-3-1","dir":"Changelog","previous_headings":"","what":"New Features and Enhancements","title":"Version 1.3.1","text":"shape argument: Added shape argument findArtifacts, allowing users specify neighborhood shape either \"hexagonal\" \"square\" local variance calculations. enhancement provides flexibility different spatial arrangements spatial transcriptomics data. Updated n_order parameter: Renamed n_rings parameter n_order findArtifacts function better describe purpose specifying N-order neighbors local mitochondrial variance calculations. Parallelization: Added workers argument parallel processing using BiocParallel localOutlier localVariance functions. allows faster computation, particularly larger datasets.","code":""},{"path":"https://mictott.github.io/SpotSweeper/news/index.html","id":"deprecations-1-3-1","dir":"Changelog","previous_headings":"","what":"Deprecations","title":"Version 1.3.1","text":"plotQC Function Deprecated: plotQC function now deprecated. remains available backward compatibility, users encouraged transition plotQCmetrics. Calling plotQC display warning, reminding users deprecation. change backward compatible; existing code using plotQC still work show warning. recommend updating code use plotQCmetrics avoid issues future versions plotQC may removed.","code":""}]
Totty M (2024). SpotSweeper: spatially-aware quality control for spatial transcriptomics. -doi:10.18129/B9.bioc.SpotSweeper, https://github.com/MicTott/SpotSweeper/SpotSweeper - R package version 1.3.2, http://www.bioconductor.org/packages/SpotSweeper. +doi:10.18129/B9.bioc.SpotSweeper, https://github.com/MicTott/SpotSweeper/SpotSweeper - R package version 1.3.3, http://www.bioconductor.org/packages/SpotSweeper.
@Manual{, title = {SpotSweeper: spatially-aware quality control for spatial transcriptomics}, author = {Michael Totty}, year = {2024}, url = {http://www.bioconductor.org/packages/SpotSweeper}, - note = {https://github.com/MicTott/SpotSweeper/SpotSweeper - R package version 1.3.2}, + note = {https://github.com/MicTott/SpotSweeper/SpotSweeper - R package version 1.3.3}, doi = {10.18129/B9.bioc.SpotSweeper}, }
Totty M, Hicks S, Guo B (2024). diff --git a/index.html b/index.html index 73710cb..2e8867c 100644 --- a/index.html +++ b/index.html @@ -22,7 +22,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/news/index.html b/news/index.html index c55c632..d41b3f9 100644 --- a/news/index.html +++ b/news/index.html @@ -7,7 +7,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/pkgdown.yml b/pkgdown.yml index fe7ff3b..21f587c 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -3,7 +3,7 @@ pkgdown: 2.1.1 pkgdown_sha: ~ articles: getting_started: getting_started.html -last_built: 2024-12-24T15:09Z +last_built: 2024-12-24T15:13Z urls: reference: https://mictott.github.io/SpotSweeper/reference article: https://mictott.github.io/SpotSweeper/articles diff --git a/reference/DLPFC_artifact.html b/reference/DLPFC_artifact.html index 479cdbf..cfd515a 100644 --- a/reference/DLPFC_artifact.html +++ b/reference/DLPFC_artifact.html @@ -17,7 +17,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/reference/biased_spots.html b/reference/biased_spots.html index 5064028..c52ea85 100644 --- a/reference/biased_spots.html +++ b/reference/biased_spots.html @@ -17,7 +17,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/reference/findArtifacts.html b/reference/findArtifacts.html index 412b7f5..9578f48 100644 --- a/reference/findArtifacts.html +++ b/reference/findArtifacts.html @@ -13,7 +13,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/reference/flagVisiumOutliers.html b/reference/flagVisiumOutliers.html index 86bebd3..50f5a66 100644 --- a/reference/flagVisiumOutliers.html +++ b/reference/flagVisiumOutliers.html @@ -13,7 +13,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/reference/index.html b/reference/index.html index 0bc998c..070a22e 100644 --- a/reference/index.html +++ b/reference/index.html @@ -7,7 +7,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/reference/localOutliers.html b/reference/localOutliers.html index dd24188..7b4bd58 100644 --- a/reference/localOutliers.html +++ b/reference/localOutliers.html @@ -15,7 +15,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/reference/localVariance.html b/reference/localVariance.html index 505ce41..e4c0389 100644 --- a/reference/localVariance.html +++ b/reference/localVariance.html @@ -7,7 +7,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/reference/plotQCmetrics.html b/reference/plotQCmetrics.html index c2d1bda..4082802 100644 --- a/reference/plotQCmetrics.html +++ b/reference/plotQCmetrics.html @@ -13,7 +13,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/reference/plotQCpdf.html b/reference/plotQCpdf.html index 36758d4..4888b8f 100644 --- a/reference/plotQCpdf.html +++ b/reference/plotQCpdf.html @@ -13,7 +13,7 @@ SpotSweeper - 1.3.2 + 1.3.3 diff --git a/search.json b/search.json index 70193e4..79ab742 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to SpotSweeper","title":"Contributing to SpotSweeper","text":"outlines propose change SpotSweeper. detailed discussion contributing tidyverse packages, please see development contributing guide code review principles.","code":""},{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":"fixing-typos","dir":"","previous_headings":"","what":"Fixing typos","title":"Contributing to SpotSweeper","text":"can fix typos, spelling mistakes, grammatical errors documentation directly using GitHub web interface, long changes made source file. generally means ’ll need edit roxygen2 comments .R, .Rd file. can find .R file generates .Rd reading comment first line.","code":""},{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":"bigger-changes","dir":"","previous_headings":"","what":"Bigger changes","title":"Contributing to SpotSweeper","text":"want make bigger change, ’s good idea first file issue make sure someone team agrees ’s needed. ’ve found bug, please file issue illustrates bug minimal reprex (also help write unit test, needed). See guide create great issue advice.","code":""},{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"Bigger changes","what":"Pull request process","title":"Contributing to SpotSweeper","text":"Fork package clone onto computer. haven’t done , recommend using usethis::create_from_github(\"MicTott/SpotSweeper\", fork = TRUE). Install development dependencies devtools::install_dev_deps(), make sure package passes R CMD check running devtools::check(). R CMD check doesn’t pass cleanly, ’s good idea ask help continuing. Create Git branch pull request (PR). recommend using usethis::pr_init(\"brief-description--change\"). Make changes, commit git, create PR running usethis::pr_push(), following prompts browser. title PR briefly describe change. body PR contain Fixes #issue-number. user-facing changes, add bullet top NEWS.md (.e. just first header). Follow style described https://style.tidyverse.org/news.html.","code":""},{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":"code-style","dir":"","previous_headings":"Bigger changes","what":"Code style","title":"Contributing to SpotSweeper","text":"New code follow tidyverse style guide. can use styler package apply styles, please don’t restyle code nothing PR. use roxygen2, Markdown syntax, documentation. use testthat unit tests. Contributions test cases included easier accept.","code":""},{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to SpotSweeper","text":"Please note SpotSweeper project released Contributor Code Conduct. contributing project agree abide terms.","code":""},{"path":"https://mictott.github.io/SpotSweeper/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 SpotSweeper authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://mictott.github.io/SpotSweeper/SUPPORT.html","id":null,"dir":"","previous_headings":"","what":"Getting help with SpotSweeper","title":"Getting help with SpotSweeper","text":"Thank using SpotSweeper! filing issue, things know make process smooth possible parties.","code":""},{"path":"https://mictott.github.io/SpotSweeper/SUPPORT.html","id":"make-a-reprex","dir":"","previous_headings":"","what":"Make a reprex","title":"Getting help with SpotSweeper","text":"Start making minimally reproducible example, also known ‘reprex’. may use reprex R package create one, though necessary help. make R-question-asking endeavors easier. Learning use takes 5 10 minutes. tips make minimally reproducible example, see StackOverflow link.","code":""},{"path":"https://mictott.github.io/SpotSweeper/SUPPORT.html","id":"where-to-post-it","dir":"","previous_headings":"","what":"Where to post it?","title":"Getting help with SpotSweeper","text":"Bioconductor help web page gives overview places may help answer question. Bioconductor software related questions, bug reports feature requests, addressed appropriate Bioconductor/SpotSweeper GitHub repository. Follow bug report feature request templates GitHub. package GitHub repository, see next bullet point. Bioconductor software usage questions addressed Bioconductor Support Website. Make sure use appropriate package tag, otherwise package authors get notification. General R questions can posed StackOverflow RStudio Community website especially pertain tidyverse RStudio GUI related products.","code":""},{"path":"https://mictott.github.io/SpotSweeper/SUPPORT.html","id":"issues-or-feature-requests","dir":"","previous_headings":"","what":"Issues or Feature Requests","title":"Getting help with SpotSweeper","text":"opening new issue feature request, sure search issues pull requests ensure one already exist implemented development version. Note. can remove :open search term issues page search open closed issues. See link learn modifying search.","code":""},{"path":"https://mictott.github.io/SpotSweeper/SUPPORT.html","id":"what-happens-next","dir":"","previous_headings":"","what":"What happens next?","title":"Getting help with SpotSweeper","text":"Bioconductor maintainers limited resources strive responsive possible. Please forget tag appropriate maintainer issue GitHub username (e.g., @username). order make easy possible Bioconductor core developers remediate issue. Provide accurate, brief, reproducible report outlined issue templates. Thank trusting Bioconductor.","code":""},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Getting started with 'SpotSweeper'","text":"SpotSweeper R package spatial transcriptomics data quality control (QC). provides functions detecting visualizing spot-level local outliers artifacts using spatially-aware methods. package designed work SpatialExperiment objects, compatible data 10X Genomics Visium spatial transcriptomics platforms.","code":""},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"installation","dir":"Articles","previous_headings":"","what":"Installation","title":"Getting started with 'SpotSweeper'","text":"Currently, way install SpotSweeper downloading development version can installed GitHub using following: accepted Bioconductor, SpotSweeper installable using:","code":"if (!require(\"devtools\")) install.packages(\"devtools\") remotes::install_github(\"MicTott/SpotSweeper\") if (!requireNamespace(\"BiocManager\", quietly = TRUE)) { install.packages(\"BiocManager\") } BiocManager::install(\"SpotSweeper\")"},{"path":[]},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"loading-example-data","dir":"Articles","previous_headings":"Spot-level local outlier detection","what":"Loading example data","title":"Getting started with 'SpotSweeper'","text":"’ll walk standard workflow using ‘SpotSweeper’ detect visualize local outliers spatial transcriptomics data. ’ll use Visium_humanDLPFC dataset STexampleData package, SpatialExperiment object. local outliers saved colData SpatialExperiment object, ’ll first view colData drop --tissue spots calculating quality control (QC) metrics running SpotSweeper.","code":"library(SpotSweeper) ## Error in get(paste0(generic, \".\", class), envir = get_method_env()) : ## object 'type_sum.accel' not found # load Maynard et al DLPFC daatset spe <- STexampleData::Visium_humanDLPFC() ## see ?STexampleData and browseVignettes('STexampleData') for documentation ## loading from cache # show column data before SpotSweeper colnames(colData(spe)) ## [1] \"barcode_id\" \"sample_id\" \"in_tissue\" \"array_row\" \"array_col\" ## [6] \"ground_truth\" \"reference\" \"cell_count\" # drop out-of-tissue spots spe <- spe[, spe$in_tissue == 1]"},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"calculating-qc-metrics-using-scuttle","dir":"Articles","previous_headings":"Spot-level local outlier detection","what":"Calculating QC metrics using scuttle","title":"Getting started with 'SpotSweeper'","text":"’ll use scuttle package calculate QC metrics. , ’ll need first change rownames gene id gene names. ’ll get mitochondrial transcripts calculate QC metrics spot using scuttle::addPerCellQCMetrics.","code":"# change from gene id to gene names rownames(spe) <- rowData(spe)$gene_name # identifying the mitochondrial transcripts is.mito <- rownames(spe)[grepl(\"^MT-\", rownames(spe))] # calculating QC metrics for each spot using scuttle spe <- scuttle::addPerCellQCMetrics(spe, subsets = list(Mito = is.mito)) colnames(colData(spe)) ## [1] \"barcode_id\" \"sample_id\" \"in_tissue\" ## [4] \"array_row\" \"array_col\" \"ground_truth\" ## [7] \"reference\" \"cell_count\" \"sum\" ## [10] \"detected\" \"subsets_Mito_sum\" \"subsets_Mito_detected\" ## [13] \"subsets_Mito_percent\" \"total\""},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"identifying-local-outliers-using-spotsweeper","dir":"Articles","previous_headings":"Spot-level local outlier detection","what":"Identifying local outliers using SpotSweeper","title":"Getting started with 'SpotSweeper'","text":"can now use SpotSweeper identify local outliers spatial transcriptomics data. ’ll use localOutliers function detect local outliers based unique detected genes, total library size, percent total reads mitochondrial. methods assume normal distribution, ’ll use log-transformed sum counts log-transformed number detected genes. mitochondrial percent, ’ll use raw mitochondrial percentage. localOutlier function automatically outputs results colData naming convention X_outliers, X name input colData. can combine outliers single column called local_outliers colData SpatialExperiment object.","code":"# library size spe <- localOutliers(spe, metric = \"sum\", direction = \"lower\", log = TRUE ) # unique genes spe <- localOutliers(spe, metric = \"detected\", direction = \"lower\", log = TRUE ) # mitochondrial percent spe <- localOutliers(spe, metric = \"subsets_Mito_percent\", direction = \"higher\", log = FALSE ) # combine all outliers into \"local_outliers\" column spe$local_outliers <- as.logical(spe$sum_outliers) | as.logical(spe$detected_outliers) | as.logical(spe$subsets_Mito_percent_outliers)"},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"visualizing-local-outliers","dir":"Articles","previous_headings":"Spot-level local outlier detection","what":"Visualizing local outliers","title":"Getting started with 'SpotSweeper'","text":"can visualize local outliers using plotQCmetrics function. function creates scatter plot specified metric highlights local outliers red using escheR package. , ’ll visualize local outliers library size, unique genes, mitochondrial percent, finally, local outliers. ’ll arrange plots grid using ggpubr::arrange.","code":"library(escheR) ## Loading required package: ggplot2 # all local outliers plotQCmetrics(spe, metric = \"sum_log\", outliers = \"local_outliers\", point_size = 1.1, stroke = 0.75) + ggtitle(\"All Local Outliers\")"},{"path":[]},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"loading-example-data-1","dir":"Articles","previous_headings":"Removing technical artifacts using SpotSweeper","what":"Loading example data","title":"Getting started with 'SpotSweeper'","text":"","code":"# load in DLPFC sample with hangnail artifact data(DLPFC_artifact) spe <- DLPFC_artifact # inspect colData before artifact detection colnames(colData(spe)) ## [1] \"sample_id\" \"in_tissue\" \"array_row\" ## [4] \"array_col\" \"key\" \"sum_umi\" ## [7] \"sum_gene\" \"expr_chrM\" \"expr_chrM_ratio\" ## [10] \"ManualAnnotation\" \"subject\" \"region\" ## [13] \"sex\" \"age\" \"diagnosis\" ## [16] \"sample_id_complete\" \"count\" \"sizeFactor\""},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"visualizing-technical-artifacts","dir":"Articles","previous_headings":"Removing technical artifacts using SpotSweeper","what":"Visualizing technical artifacts","title":"Getting started with 'SpotSweeper'","text":"Technical artifacts can commonly visualized standard QC metrics, including library size, unique genes, mitochondrial percentage. can first visualize technical artifacts using plotQCmetrics function. sample, can clearly see hangnail artifact right side tissue section mitochondrial ratio plot.","code":"plotQCmetrics(spe, metric = \"expr_chrM_ratio\", outliers = NULL, point_size = 1.1 ) + ggtitle(\"Mitochondrial Percent\")"},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"identifying-artifacts-using-spotsweeper","dir":"Articles","previous_headings":"Removing technical artifacts using SpotSweeper","what":"Identifying artifacts using SpotSweeper","title":"Getting started with 'SpotSweeper'","text":"can use findArtifacts function identify artifacts spatial transcriptomics (data. function identifies technical artifacts based first principle component local variance specified QC metric (mito_percent) numerous neighorhood sizes (n_order=5). Currently, kmeans clustering used cluster technical artifact vs high-quality Visium spots. Similar localOutliers, findArtifacts function outputs results colData.","code":"# find artifacts using SpotSweeper spe <- findArtifacts(spe, mito_percent = \"expr_chrM_ratio\", mito_sum = \"expr_chrM\", n_order = 5, name = \"artifact\" ) # check that \"artifact\" is now in colData colnames(colData(spe)) ## [1] \"sample_id\" \"in_tissue\" \"array_row\" ## [4] \"array_col\" \"key\" \"sum_umi\" ## [7] \"sum_gene\" \"expr_chrM\" \"expr_chrM_ratio\" ## [10] \"ManualAnnotation\" \"subject\" \"region\" ## [13] \"sex\" \"age\" \"diagnosis\" ## [16] \"sample_id_complete\" \"count\" \"sizeFactor\" ## [19] \"expr_chrM_ratio_log\" \"coords\" \"k6\" ## [22] \"k18\" \"k36\" \"k60\" ## [25] \"k90\" \"artifact\""},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"visualizing-artifacts","dir":"Articles","previous_headings":"Removing technical artifacts using SpotSweeper","what":"Visualizing artifacts","title":"Getting started with 'SpotSweeper'","text":"can visualize artifacts using escheR package. , ’ll visualize artifacts using plotQCmetrics function arrange plots using ggpubr::arrange. # Session information","code":"plotQCmetrics(spe, metric = \"expr_chrM_ratio\", outliers = \"artifact\", point_size = 1.1 ) + ggtitle(\"Hangnail artifact\") utils::sessionInfo() ## R version 4.4.2 (2024-10-31) ## Platform: x86_64-pc-linux-gnu ## Running under: Ubuntu 24.04.1 LTS ## ## Matrix products: default ## BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 ## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so; LAPACK version 3.12.0 ## ## locale: ## [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 ## [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 ## [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C ## [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C ## ## time zone: UTC ## tzcode source: system (glibc) ## ## attached base packages: ## [1] stats4 stats graphics grDevices utils datasets methods ## [8] base ## ## other attached packages: ## [1] escheR_1.6.0 ggplot2_3.5.1 ## [3] STexampleData_1.14.0 SpatialExperiment_1.16.0 ## [5] SingleCellExperiment_1.28.1 SummarizedExperiment_1.36.0 ## [7] Biobase_2.66.0 GenomicRanges_1.58.0 ## [9] GenomeInfoDb_1.42.1 IRanges_2.40.1 ## [11] S4Vectors_0.44.0 MatrixGenerics_1.18.0 ## [13] matrixStats_1.4.1 ExperimentHub_2.14.0 ## [15] AnnotationHub_3.14.0 BiocFileCache_2.14.0 ## [17] dbplyr_2.5.0 BiocGenerics_0.52.0 ## [19] SpotSweeper_1.3.2 BiocStyle_2.34.0 ## ## loaded via a namespace (and not attached): ## [1] DBI_1.2.3 rlang_1.1.4 magrittr_2.0.3 ## [4] spatialEco_2.0-2 compiler_4.4.2 RSQLite_2.3.9 ## [7] png_0.1-8 systemfonts_1.1.0 vctrs_0.6.5 ## [10] pkgconfig_2.0.3 crayon_1.5.3 fastmap_1.2.0 ## [13] magick_2.8.5 XVector_0.46.0 labeling_0.4.3 ## [16] scuttle_1.16.0 rmarkdown_2.29 UCSC.utils_1.2.0 ## [19] ragg_1.3.3 purrr_1.0.2 bit_4.5.0.1 ## [22] xfun_0.49 zlibbioc_1.52.0 cachem_1.1.0 ## [25] beachmat_2.22.0 jsonlite_1.8.9 blob_1.2.4 ## [28] DelayedArray_0.32.0 BiocParallel_1.40.0 terra_1.8-5 ## [31] parallel_4.4.2 R6_2.5.1 bslib_0.8.0 ## [34] jquerylib_0.1.4 Rcpp_1.0.13-1 bookdown_0.41 ## [37] knitr_1.49 Matrix_1.7-1 tidyselect_1.2.1 ## [40] abind_1.4-8 yaml_2.3.10 codetools_0.2-20 ## [43] curl_6.0.1 lattice_0.22-6 tibble_3.2.1 ## [46] withr_3.0.2 KEGGREST_1.46.0 evaluate_1.0.1 ## [49] desc_1.4.3 Biostrings_2.74.1 pillar_1.10.0 ## [52] BiocManager_1.30.25 filelock_1.0.3 generics_0.1.3 ## [55] BiocVersion_3.20.0 munsell_0.5.1 scales_1.3.0 ## [58] glue_1.8.0 tools_4.4.2 BiocNeighbors_2.0.1 ## [61] fs_1.6.5 grid_4.4.2 AnnotationDbi_1.68.0 ## [64] colorspace_2.1-1 GenomeInfoDbData_1.2.13 cli_3.6.3 ## [67] rappdirs_0.3.3 textshaping_0.4.1 viridisLite_0.4.2 ## [70] S4Arrays_1.6.0 dplyr_1.1.4 gtable_0.3.6 ## [73] sass_0.4.9 digest_0.6.37 SparseArray_1.6.0 ## [76] farver_2.1.2 rjson_0.2.23 memoise_2.0.1 ## [79] htmltools_0.5.8.1 pkgdown_2.1.1 lifecycle_1.0.4 ## [82] httr_1.4.7 mime_0.12 bit64_4.5.2 ## [85] MASS_7.3-61"},{"path":"https://mictott.github.io/SpotSweeper/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Michael Totty. Author, maintainer. Stephanie Hicks. Author. Boyi Guo. Author.","code":""},{"path":"https://mictott.github.io/SpotSweeper/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Totty M (2024). SpotSweeper: spatially-aware quality control spatial transcriptomics. doi:10.18129/B9.bioc.SpotSweeper, https://github.com/MicTott/SpotSweeper/SpotSweeper - R package version 1.3.2, http://www.bioconductor.org/packages/SpotSweeper. Totty M, Hicks S, Guo B (2024). “SpotSweeper: spatially-aware quality control spatial transcriptomics.” bioRxiv. doi:10.1101/2024.06.06.597765, https://doi.org/10.1101/2024.06.06.597765.","code":"@Manual{, title = {SpotSweeper: spatially-aware quality control for spatial transcriptomics}, author = {Michael Totty}, year = {2024}, url = {http://www.bioconductor.org/packages/SpotSweeper}, note = {https://github.com/MicTott/SpotSweeper/SpotSweeper - R package version 1.3.2}, doi = {10.18129/B9.bioc.SpotSweeper}, } @Article{, title = {SpotSweeper: spatially-aware quality control for spatial transcriptomics}, author = {Michael Totty and Stephanie Hicks and Boyi Guo}, journal = {bioRxiv}, year = {2024}, doi = {10.1101/2024.06.06.597765}, url = {https://doi.org/10.1101/2024.06.06.597765}, }"},{"path":"https://mictott.github.io/SpotSweeper/index.html","id":"spotsweeper-","dir":"","previous_headings":"","what":"Spatially-aware quality control for spatial transcriptomics","title":"Spatially-aware quality control for spatial transcriptomics","text":"SpotSweeper package developed spatially-aware quality control (QC) methods detection, visualization, removal local outliers regional artifacts spot-based spatial transcriptomics data, 10x Genomics Visium, using standard QC metrics. experience issues using package like make suggestion, please open issue GitHub repository. find information, please visit documentation website.","code":""},{"path":"https://mictott.github.io/SpotSweeper/index.html","id":"installation-instructions","dir":"","previous_headings":"","what":"Installation instructions","title":"Spatially-aware quality control for spatial transcriptomics","text":"can install latest version SpotSweeper Bioconductor following code: latest development version can installed GitHub using following:","code":"if (!requireNamespace(\"BiocManager\", quietly = TRUE)) { install.packages(\"BiocManager\") } BiocManager::install(\"SpotSweeper\") if (!require(\"devtools\")) install.packages(\"devtools\") remotes::install_github(\"MicTott/SpotSweeper\")"},{"path":"https://mictott.github.io/SpotSweeper/index.html","id":"tutorials","dir":"","previous_headings":"","what":"Tutorials","title":"Spatially-aware quality control for spatial transcriptomics","text":"detailed tutorial available package vignette Bioconductor. direct link tutorial / package vignette available .","code":""},{"path":"https://mictott.github.io/SpotSweeper/index.html","id":"development-tools","dir":"","previous_headings":"","what":"Development tools","title":"Spatially-aware quality control for spatial transcriptomics","text":"Continuous code testing possible thanks GitHub actions BiocStyle::Biocpkg('biocthis'). documentation website automatically updated thanks BiocStyle::CRANpkg('pkgdown'). code styled automatically thanks BiocStyle::CRANpkg('styler'). documentation formatted thanks BiocStyle::CRANpkg('devtools') BiocStyle::CRANpkg('roxygen2'). package developed using BiocStyle::Biocpkg('biocthis').","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":null,"dir":"Reference","previous_headings":"","what":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"DLPFC_artifact dataset SpatialExperiment object containing single-sample subset human dorsolateral prefrontal cortex (DLPFC) dataset Hukki-Myers et al. 2023. particular sample ('Br2743_ant') included demonstrate identification removal technical artifacts within spatial transcriptomics data. dataset serves example artifact detection using 'SpotSweeper' workflow.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"","code":"data(DLPFC_artifact)"},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"SpatialExperiment object.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"spatialLIBD","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"Hukki-Myers et al. (2023) bioRxiv (bioRxiv)","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"","code":"data(DLPFC_artifact)"},{"path":"https://mictott.github.io/SpotSweeper/reference/biased_spots.html","id":null,"dir":"Reference","previous_headings":"","what":"Biased Spots Data — biased_spots","title":"Biased Spots Data — biased_spots","text":"biased_spots dataset data.frame containing information specific spatial spots identified technical outliers spatial transcriptomics experiments. entry represents biased spot characterized spatial coordinates (row column) unique barcode. dataset utilized flagVisiumOutliers function flag exclude outlier spots downstream analyses, thereby enhancing data quality reliability.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/biased_spots.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Biased Spots Data — biased_spots","text":"","code":"data(biased_spots)"},{"path":"https://mictott.github.io/SpotSweeper/reference/biased_spots.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Biased Spots Data — biased_spots","text":"data.frame following columns: row Integer. row position biased spot within spatial grid. col Integer. column position biased spot within spatial grid. barcode Character. unique identifier corresponding spatial transcriptomics barcode biased spot.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/biased_spots.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Biased Spots Data — biased_spots","text":"biased_spots.rds file generated analysis local outliers. See https://github.com/boyiguo1/Manuscript-SpotSweeper/blob/main/code/03_Visium/figure_3.R details.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/biased_spots.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Biased Spots Data — biased_spots","text":"","code":"data(biased_spots)"},{"path":"https://mictott.github.io/SpotSweeper/reference/findArtifacts.html","id":null,"dir":"Reference","previous_headings":"","what":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","title":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","text":"function identifies annotates potential artifacts spatial transcriptomics data. Artifacts detected based local mito variance, results added original SpatialExperiment (sce) object.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/findArtifacts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","text":"","code":"findArtifacts( spe, mito_percent = \"expr_chrM_ratio\", mito_sum = \"expr_chrM\", samples = \"sample_id\", n_order = 5, shape = \"hexagonal\", log = TRUE, name = \"artifact\", var_output = TRUE )"},{"path":"https://mictott.github.io/SpotSweeper/reference/findArtifacts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","text":"spe SingleCellExperiment object. mito_percent column name representing mitochondrial percent. Default 'expr_chrM_ratio'. mito_sum column name representing sum mitochondrial expression. Default 'expr_chrM'. samples column name representing sample IDs. Default 'sample_id'. n_order number orders local mito variance calculation. Default 5. shape shape neighborhood local variance calculation. Can either 'hexagonal' 'square'. Default 'hexagonal'. log Logical, indicating whether log1p transform mito_percent. Default TRUE. name Prefix local variance column names. Default 'artifact'. var_output Logical, indicating whether include local variances output. Default TRUE.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/findArtifacts.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","text":"Returns modified SingleCellExperiment object artifact annotations.","code":""},{"path":[]},{"path":"https://mictott.github.io/SpotSweeper/reference/findArtifacts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","text":"","code":"library(SpotSweeper) library(SpatialExperiment) #> Loading required package: SingleCellExperiment #> Loading required package: SummarizedExperiment #> Loading required package: MatrixGenerics #> Loading required package: matrixStats #> #> Attaching package: ‘MatrixGenerics’ #> The following objects are masked from ‘package:matrixStats’: #> #> colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse, #> colCounts, colCummaxs, colCummins, colCumprods, colCumsums, #> colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs, #> colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats, #> colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds, #> colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads, #> colWeightedMeans, colWeightedMedians, colWeightedSds, #> colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet, #> rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods, #> rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps, #> rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins, #> rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks, #> rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars, #> rowWeightedMads, rowWeightedMeans, rowWeightedMedians, #> rowWeightedSds, rowWeightedVars #> Loading required package: GenomicRanges #> Loading required package: stats4 #> Loading required package: BiocGenerics #> #> Attaching package: ‘BiocGenerics’ #> The following objects are masked from ‘package:stats’: #> #> IQR, mad, sd, var, xtabs #> The following objects are masked from ‘package:base’: #> #> Filter, Find, Map, Position, Reduce, anyDuplicated, aperm, append, #> as.data.frame, basename, cbind, colnames, dirname, do.call, #> duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted, #> lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin, #> pmin.int, rank, rbind, rownames, sapply, saveRDS, setdiff, table, #> tapply, union, unique, unsplit, which.max, which.min #> Loading required package: S4Vectors #> #> Attaching package: ‘S4Vectors’ #> The following object is masked from ‘package:utils’: #> #> findMatches #> The following objects are masked from ‘package:base’: #> #> I, expand.grid, unname #> Loading required package: IRanges #> Loading required package: GenomeInfoDb #> Loading required package: Biobase #> Welcome to Bioconductor #> #> Vignettes contain introductory material; view with #> 'browseVignettes()'. To cite Bioconductor, see #> 'citation(\"Biobase\")', and for packages 'citation(\"pkgname\")'. #> #> Attaching package: ‘Biobase’ #> The following object is masked from ‘package:MatrixGenerics’: #> #> rowMedians #> The following objects are masked from ‘package:matrixStats’: #> #> anyMissing, rowMedians library(escheR) #> Loading required package: ggplot2 data(DLPFC_artifact) spe <- DLPFC_artifact # find artifacts spe <- findArtifacts(spe, mito_percent = \"expr_chrM_ratio\", mito_sum = \"expr_chrM\", n_order = 2, # 5 recommended, using 2 for time shape = \"hexagonal\", name = \"artifact\" )"},{"path":"https://mictott.github.io/SpotSweeper/reference/flagVisiumOutliers.html","id":null,"dir":"Reference","previous_headings":"","what":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","title":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","text":"flagVisiumoutliers function identifies flags Visium systematic outlier spots SpatialExperiment object based barcodes. outliers marked colData SpatialExperiment object, allowing users exclude downstream analyses enhance data quality reliability.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/flagVisiumOutliers.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","text":"","code":"flagVisiumOutliers(spe)"},{"path":"https://mictott.github.io/SpotSweeper/reference/flagVisiumOutliers.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","text":"spe SpatialExperiment object containing spatial transcriptomics data. object must include array_row array_col columns colData specify spatial coordinates spot.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/flagVisiumOutliers.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","text":"SpatialExperiment object identical input spe additional logical column systematic_outliers colData. column indicates whether spot flagged technical outlier (TRUE) (FALSE).","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/flagVisiumOutliers.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","text":"","code":"library(SpotSweeper) library(SpatialExperiment) # load example data spe <- STexampleData::Visium_humanDLPFC() #> see ?STexampleData and browseVignettes('STexampleData') for documentation #> downloading 1 resources #> retrieving 1 resource #> loading from cache # Flag outlier spots spe <- flagVisiumOutliers(spe) # drop outlier spots spe <- spe[, !colData(spe)$systematic_outliers]"},{"path":"https://mictott.github.io/SpotSweeper/reference/localOutliers.html","id":null,"dir":"Reference","previous_headings":"","what":"localOutliers Function — localOutliers","title":"localOutliers Function — localOutliers","text":"function detects local outliers spatial transcriptomics data based standard quality control metrics, library size, unique genes, mitochondrial ratio. Local outliers defined spots low/high quality metrics compared surrounding neighbors, based modified z-score statistic.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localOutliers.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"localOutliers Function — localOutliers","text":"","code":"localOutliers( spe, metric = \"detected\", direction = \"lower\", n_neighbors = 36, samples = \"sample_id\", log = TRUE, cutoff = 3, workers = 1 )"},{"path":"https://mictott.github.io/SpotSweeper/reference/localOutliers.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"localOutliers Function — localOutliers","text":"spe SpatialExperiment SingleCellExperiment object metric colData QC metric use outlier detection direction Direction outlier detection (higher, lower, ) n_neighbors Number nearest neighbors use outlier detection samples Column name colData use sample IDs log Logical indicating whether log1p transform features (default TRUE) cutoff Cutoff outlier detection (default 3) workers Number workers parallel processing (default 1)","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localOutliers.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"localOutliers Function — localOutliers","text":"SpatialExperiment SingleCellExperiment object updated colData containing outputs","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localOutliers.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"localOutliers Function — localOutliers","text":"","code":"library(SpotSweeper) library(SpatialExperiment) # load example data spe <- STexampleData::Visium_humanDLPFC() #> see ?STexampleData and browseVignettes('STexampleData') for documentation #> loading from cache # change from gene id to gene names rownames(spe) <- rowData(spe)$gene_name # drop out-of-tissue spots spe <- spe[, spe$in_tissue == 1] spe <- spe[, !is.na(spe$ground_truth)] # Identifying the mitochondrial transcripts in our SpatialExperiment. is.mito <- rownames(spe)[grepl(\"^MT-\", rownames(spe))] # Calculating QC metrics for each spot using scuttle spe <- scuttle::addPerCellQCMetrics(spe, subsets = list(Mito = is.mito)) colnames(colData(spe)) #> [1] \"barcode_id\" \"sample_id\" \"in_tissue\" #> [4] \"array_row\" \"array_col\" \"ground_truth\" #> [7] \"reference\" \"cell_count\" \"sum\" #> [10] \"detected\" \"subsets_Mito_sum\" \"subsets_Mito_detected\" #> [13] \"subsets_Mito_percent\" \"total\" # Identifying local outliers using SpotSweeper spe <- localOutliers(spe, metric = \"sum\", direction = \"lower\", log = TRUE )"},{"path":"https://mictott.github.io/SpotSweeper/reference/localVariance.html","id":null,"dir":"Reference","previous_headings":"","what":"localVariance Function — localVariance","title":"localVariance Function — localVariance","text":"function calculates local variance based kNN.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localVariance.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"localVariance Function — localVariance","text":"","code":"localVariance( spe, n_neighbors = 36, metric = c(\"expr_chrM_ratio\"), samples = \"sample_id\", log = FALSE, name = NULL, workers = 1 )"},{"path":"https://mictott.github.io/SpotSweeper/reference/localVariance.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"localVariance Function — localVariance","text":"spe SpatialExperiment object following columns colData: sample_id, sum_umi, sum_gene n_neighbors Number nearest neighbors use variance calculation metric Metric use variance calculation samples Column colData use sample ID log Whether log1p transform metric name Name new column add colData workers Number workers use parallel computation","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localVariance.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"localVariance Function — localVariance","text":"SpatialExperiment object metric variance added colData","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localVariance.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"localVariance Function — localVariance","text":"","code":"# for more details see extended example in vignettes library(SpotSweeper) library(SpatialExperiment) library(escheR) # load example data spe <- STexampleData::Visium_humanDLPFC() #> see ?STexampleData and browseVignettes('STexampleData') for documentation #> loading from cache # change from gene id to gene names rownames(spe) <- rowData(spe)$gene_name # show column data before SpotSweepR colnames(colData(spe)) #> [1] \"barcode_id\" \"sample_id\" \"in_tissue\" \"array_row\" \"array_col\" #> [6] \"ground_truth\" \"reference\" \"cell_count\" # drop out-of-tissue spots spe <- spe[, spe$in_tissue == 1] spe <- spe[, !is.na(spe$ground_truth)] # Identifying the mitochondrial transcripts in our SpatialExperiment. is.mito <- rownames(spe)[grepl(\"^MT-\", rownames(spe))] # Calculating QC metric for each spot using scuttle spe <- scuttle::addPerCellQCMetrics(spe, subsets = list(Mito = is.mito)) colnames(colData(spe)) #> [1] \"barcode_id\" \"sample_id\" \"in_tissue\" #> [4] \"array_row\" \"array_col\" \"ground_truth\" #> [7] \"reference\" \"cell_count\" \"sum\" #> [10] \"detected\" \"subsets_Mito_sum\" \"subsets_Mito_detected\" #> [13] \"subsets_Mito_percent\" \"total\" spe <- localVariance(spe, metric = \"subsets_Mito_percent\", n_neighbors = 36, name = \"local_mito_variance_k36\", workers = 1 )"},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCmetrics.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","title":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","text":"function generates plot specified sample within SpatialExperiment object, highlighting outliers based specified metric. plot visualizes metric interest indicates outliers distinct color.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCmetrics.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","text":"","code":"plotQCmetrics( spe, sample_id = \"sample_id\", sample = unique(spe$sample_id)[1], metric = \"detected\", outliers = NULL, point_size = 2, colors = c(\"white\", \"black\"), stroke = 1 )"},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCmetrics.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","text":"spe SpatialExperiment object containing data plotted. sample_id character string specifying column name colData(spe) contains unique sample identifiers. Default \"sample_id\". sample character string numeric value specifying sample plotted. default, plots first unique sample found spe$sample_id. metric character string specifying metric visualized plot. metric column name colData(spe). outliers character string specifying column name colData(spe) indicates whether data point considered outlier. Default NULL. point_size numeric value specifying size points plot. Default 2. colors character vector specifying colors used gradient scale. length 2, gradient single color gradient. stroke numeric value specifying border thickness outlier points. Default 1.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCmetrics.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","text":"function returns plot object created make_escheR modified additional layers visualizing specified metric outliers. plot explicitly printed function printed caller.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCmetrics.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","text":"","code":"library(SpotSweeper) library(SpatialExperiment) library(escheR) # load example data spe <- STexampleData::Visium_humanDLPFC() #> see ?STexampleData and browseVignettes('STexampleData') for documentation #> loading from cache # change from gene id to gene names rownames(spe) <- rowData(spe)$gene_name # drop out-of-tissue spots spe <- spe[, spe$in_tissue == 1] spe <- spe[, !is.na(spe$ground_truth)] # Identifying the mitochondrial transcripts in our SpatialExperiment. is.mito <- rownames(spe)[grepl(\"^MT-\", rownames(spe))] # Calculating QC metrics for each spot using scuttle spe <- scuttle::addPerCellQCMetrics(spe, subsets = list(Mito = is.mito)) colnames(colData(spe)) #> [1] \"barcode_id\" \"sample_id\" \"in_tissue\" #> [4] \"array_row\" \"array_col\" \"ground_truth\" #> [7] \"reference\" \"cell_count\" \"sum\" #> [10] \"detected\" \"subsets_Mito_sum\" \"subsets_Mito_detected\" #> [13] \"subsets_Mito_percent\" \"total\" # Identifying local outliers using SpotSweeper spe <- localOutliers(spe, metric = \"sum\", direction = \"lower\", log = TRUE ) plotQCmetrics(spe, metric=\"sum\", outliers=\"sum_outliers\")"},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCpdf.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot Outlier Metrics to PDF — plotQCpdf","title":"Plot Outlier Metrics to PDF — plotQCpdf","text":"function generates PDF file containing plots sample SpatialExperiment object, highlighting outliers based specified metrics. plot visualizes outlier metrics single sample, allowing easy comparison analysis across samples.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCpdf.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot Outlier Metrics to PDF — plotQCpdf","text":"","code":"plotQCpdf( spe, sample_id = \"sample_id\", metric = \"detected\", outliers = \"local_outliers\", colors = c(\"white\", \"black\"), stroke = 1, point_size = 2, width = 5, height = 5, fname )"},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCpdf.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot Outlier Metrics to PDF — plotQCpdf","text":"spe SpatialExperiment object containing data plotted. sample_id character string specifying column name colData(spe) contains unique sample identifiers. Default 'sample_id'. metric character string specifying metric visualized plot. metric column name colData(spe). outliers character string specifying column name colData(spe) indicates whether data point considered outlier. Default local_outliers'. colors character vector specifying colors used gradient scale. length 2, gradient single color gradient stroke numeric value specifying border thickness outlier points. Default 1. point_size numeric value specifying size points plot. Default 2. width numeric value indicating width plot. Default 5. height numeric value indicating height plot. Default 5. fname character string specifying path name output PDF file.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCpdf.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot Outlier Metrics to PDF — plotQCpdf","text":"ggplot object specified. Generates plot otherwise.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCpdf.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot Outlier Metrics to PDF — plotQCpdf","text":"","code":"library(SpotSweeper) library(SpatialExperiment) library(escheR) # load example data spe <- STexampleData::Visium_humanDLPFC() #> see ?STexampleData and browseVignettes('STexampleData') for documentation #> loading from cache tempFilePath <- file.path(tempdir(), \"examplePlot.pdf\") # change from gene id to gene names rownames(spe) <- rowData(spe)$gene_name # drop out-of-tissue spots spe <- spe[, spe$in_tissue == 1] spe <- spe[, !is.na(spe$ground_truth)] # Identifying the mitochondrial transcripts in our SpatialExperiment. is.mito <- rownames(spe)[grepl(\"^MT-\", rownames(spe))] # Calculating QC metrics for each spot using scuttle spe <- scuttle::addPerCellQCMetrics(spe, subsets = list(Mito = is.mito)) colnames(colData(spe)) #> [1] \"barcode_id\" \"sample_id\" \"in_tissue\" #> [4] \"array_row\" \"array_col\" \"ground_truth\" #> [7] \"reference\" \"cell_count\" \"sum\" #> [10] \"detected\" \"subsets_Mito_sum\" \"subsets_Mito_detected\" #> [13] \"subsets_Mito_percent\" \"total\" # Identifying local outliers using SpotSweeper spe <- localOutliers(spe, metric = \"sum\", direction = \"lower\", log = TRUE ) plotQCpdf(spe, metric=\"sum\", outliers=\"sum_outliers\", fname=tempFilePath) #> Warning: 'plotQC' is deprecated. #> Use 'plotQCmetrics' instead. #> See help(\"Deprecated\") #> pdf #> 2"},{"path":[]},{"path":"https://mictott.github.io/SpotSweeper/news/index.html","id":"major-changes-1-3-1","dir":"Changelog","previous_headings":"","what":"Major Changes","title":"Version 1.3.1","text":"Function Renaming: function plotQC renamed plotQCmetrics better reflect purpose. new function plotQCmetrics used moving forward. change improves clarity package’s API specifying function designed plotting QC metrics.","code":""},{"path":"https://mictott.github.io/SpotSweeper/news/index.html","id":"new-features-and-enhancements-1-3-1","dir":"Changelog","previous_headings":"","what":"New Features and Enhancements","title":"Version 1.3.1","text":"shape argument: Added shape argument findArtifacts, allowing users specify neighborhood shape either \"hexagonal\" \"square\" local variance calculations. enhancement provides flexibility different spatial arrangements spatial transcriptomics data. Updated n_order parameter: Renamed n_rings parameter n_order findArtifacts function better describe purpose specifying N-order neighbors local mitochondrial variance calculations. Parallelization: Added workers argument parallel processing using BiocParallel localOutlier localVariance functions. allows faster computation, particularly larger datasets.","code":""},{"path":"https://mictott.github.io/SpotSweeper/news/index.html","id":"deprecations-1-3-1","dir":"Changelog","previous_headings":"","what":"Deprecations","title":"Version 1.3.1","text":"plotQC Function Deprecated: plotQC function now deprecated. remains available backward compatibility, users encouraged transition plotQCmetrics. Calling plotQC display warning, reminding users deprecation. change backward compatible; existing code using plotQC still work show warning. recommend updating code use plotQCmetrics avoid issues future versions plotQC may removed.","code":""}] +[{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to SpotSweeper","title":"Contributing to SpotSweeper","text":"outlines propose change SpotSweeper. detailed discussion contributing tidyverse packages, please see development contributing guide code review principles.","code":""},{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":"fixing-typos","dir":"","previous_headings":"","what":"Fixing typos","title":"Contributing to SpotSweeper","text":"can fix typos, spelling mistakes, grammatical errors documentation directly using GitHub web interface, long changes made source file. generally means ’ll need edit roxygen2 comments .R, .Rd file. can find .R file generates .Rd reading comment first line.","code":""},{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":"bigger-changes","dir":"","previous_headings":"","what":"Bigger changes","title":"Contributing to SpotSweeper","text":"want make bigger change, ’s good idea first file issue make sure someone team agrees ’s needed. ’ve found bug, please file issue illustrates bug minimal reprex (also help write unit test, needed). See guide create great issue advice.","code":""},{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"Bigger changes","what":"Pull request process","title":"Contributing to SpotSweeper","text":"Fork package clone onto computer. haven’t done , recommend using usethis::create_from_github(\"MicTott/SpotSweeper\", fork = TRUE). Install development dependencies devtools::install_dev_deps(), make sure package passes R CMD check running devtools::check(). R CMD check doesn’t pass cleanly, ’s good idea ask help continuing. Create Git branch pull request (PR). recommend using usethis::pr_init(\"brief-description--change\"). Make changes, commit git, create PR running usethis::pr_push(), following prompts browser. title PR briefly describe change. body PR contain Fixes #issue-number. user-facing changes, add bullet top NEWS.md (.e. just first header). Follow style described https://style.tidyverse.org/news.html.","code":""},{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":"code-style","dir":"","previous_headings":"Bigger changes","what":"Code style","title":"Contributing to SpotSweeper","text":"New code follow tidyverse style guide. can use styler package apply styles, please don’t restyle code nothing PR. use roxygen2, Markdown syntax, documentation. use testthat unit tests. Contributions test cases included easier accept.","code":""},{"path":"https://mictott.github.io/SpotSweeper/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to SpotSweeper","text":"Please note SpotSweeper project released Contributor Code Conduct. contributing project agree abide terms.","code":""},{"path":"https://mictott.github.io/SpotSweeper/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 SpotSweeper authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://mictott.github.io/SpotSweeper/SUPPORT.html","id":null,"dir":"","previous_headings":"","what":"Getting help with SpotSweeper","title":"Getting help with SpotSweeper","text":"Thank using SpotSweeper! filing issue, things know make process smooth possible parties.","code":""},{"path":"https://mictott.github.io/SpotSweeper/SUPPORT.html","id":"make-a-reprex","dir":"","previous_headings":"","what":"Make a reprex","title":"Getting help with SpotSweeper","text":"Start making minimally reproducible example, also known ‘reprex’. may use reprex R package create one, though necessary help. make R-question-asking endeavors easier. Learning use takes 5 10 minutes. tips make minimally reproducible example, see StackOverflow link.","code":""},{"path":"https://mictott.github.io/SpotSweeper/SUPPORT.html","id":"where-to-post-it","dir":"","previous_headings":"","what":"Where to post it?","title":"Getting help with SpotSweeper","text":"Bioconductor help web page gives overview places may help answer question. Bioconductor software related questions, bug reports feature requests, addressed appropriate Bioconductor/SpotSweeper GitHub repository. Follow bug report feature request templates GitHub. package GitHub repository, see next bullet point. Bioconductor software usage questions addressed Bioconductor Support Website. Make sure use appropriate package tag, otherwise package authors get notification. General R questions can posed StackOverflow RStudio Community website especially pertain tidyverse RStudio GUI related products.","code":""},{"path":"https://mictott.github.io/SpotSweeper/SUPPORT.html","id":"issues-or-feature-requests","dir":"","previous_headings":"","what":"Issues or Feature Requests","title":"Getting help with SpotSweeper","text":"opening new issue feature request, sure search issues pull requests ensure one already exist implemented development version. Note. can remove :open search term issues page search open closed issues. See link learn modifying search.","code":""},{"path":"https://mictott.github.io/SpotSweeper/SUPPORT.html","id":"what-happens-next","dir":"","previous_headings":"","what":"What happens next?","title":"Getting help with SpotSweeper","text":"Bioconductor maintainers limited resources strive responsive possible. Please forget tag appropriate maintainer issue GitHub username (e.g., @username). order make easy possible Bioconductor core developers remediate issue. Provide accurate, brief, reproducible report outlined issue templates. Thank trusting Bioconductor.","code":""},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Getting started with 'SpotSweeper'","text":"SpotSweeper R package spatial transcriptomics data quality control (QC). provides functions detecting visualizing spot-level local outliers artifacts using spatially-aware methods. package designed work SpatialExperiment objects, compatible data 10X Genomics Visium spatial transcriptomics platforms.","code":""},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"installation","dir":"Articles","previous_headings":"","what":"Installation","title":"Getting started with 'SpotSweeper'","text":"Currently, way install SpotSweeper downloading development version can installed GitHub using following: accepted Bioconductor, SpotSweeper installable using:","code":"if (!require(\"devtools\")) install.packages(\"devtools\") remotes::install_github(\"MicTott/SpotSweeper\") if (!requireNamespace(\"BiocManager\", quietly = TRUE)) { install.packages(\"BiocManager\") } BiocManager::install(\"SpotSweeper\")"},{"path":[]},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"loading-example-data","dir":"Articles","previous_headings":"Spot-level local outlier detection","what":"Loading example data","title":"Getting started with 'SpotSweeper'","text":"’ll walk standard workflow using ‘SpotSweeper’ detect visualize local outliers spatial transcriptomics data. ’ll use Visium_humanDLPFC dataset STexampleData package, SpatialExperiment object. local outliers saved colData SpatialExperiment object, ’ll first view colData drop --tissue spots calculating quality control (QC) metrics running SpotSweeper.","code":"library(SpotSweeper) ## Error in get(paste0(generic, \".\", class), envir = get_method_env()) : ## object 'type_sum.accel' not found # load Maynard et al DLPFC daatset spe <- STexampleData::Visium_humanDLPFC() ## see ?STexampleData and browseVignettes('STexampleData') for documentation ## loading from cache # show column data before SpotSweeper colnames(colData(spe)) ## [1] \"barcode_id\" \"sample_id\" \"in_tissue\" \"array_row\" \"array_col\" ## [6] \"ground_truth\" \"reference\" \"cell_count\" # drop out-of-tissue spots spe <- spe[, spe$in_tissue == 1]"},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"calculating-qc-metrics-using-scuttle","dir":"Articles","previous_headings":"Spot-level local outlier detection","what":"Calculating QC metrics using scuttle","title":"Getting started with 'SpotSweeper'","text":"’ll use scuttle package calculate QC metrics. , ’ll need first change rownames gene id gene names. ’ll get mitochondrial transcripts calculate QC metrics spot using scuttle::addPerCellQCMetrics.","code":"# change from gene id to gene names rownames(spe) <- rowData(spe)$gene_name # identifying the mitochondrial transcripts is.mito <- rownames(spe)[grepl(\"^MT-\", rownames(spe))] # calculating QC metrics for each spot using scuttle spe <- scuttle::addPerCellQCMetrics(spe, subsets = list(Mito = is.mito)) colnames(colData(spe)) ## [1] \"barcode_id\" \"sample_id\" \"in_tissue\" ## [4] \"array_row\" \"array_col\" \"ground_truth\" ## [7] \"reference\" \"cell_count\" \"sum\" ## [10] \"detected\" \"subsets_Mito_sum\" \"subsets_Mito_detected\" ## [13] \"subsets_Mito_percent\" \"total\""},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"identifying-local-outliers-using-spotsweeper","dir":"Articles","previous_headings":"Spot-level local outlier detection","what":"Identifying local outliers using SpotSweeper","title":"Getting started with 'SpotSweeper'","text":"can now use SpotSweeper identify local outliers spatial transcriptomics data. ’ll use localOutliers function detect local outliers based unique detected genes, total library size, percent total reads mitochondrial. methods assume normal distribution, ’ll use log-transformed sum counts log-transformed number detected genes. mitochondrial percent, ’ll use raw mitochondrial percentage. localOutlier function automatically outputs results colData naming convention X_outliers, X name input colData. can combine outliers single column called local_outliers colData SpatialExperiment object.","code":"# library size spe <- localOutliers(spe, metric = \"sum\", direction = \"lower\", log = TRUE ) # unique genes spe <- localOutliers(spe, metric = \"detected\", direction = \"lower\", log = TRUE ) # mitochondrial percent spe <- localOutliers(spe, metric = \"subsets_Mito_percent\", direction = \"higher\", log = FALSE ) # combine all outliers into \"local_outliers\" column spe$local_outliers <- as.logical(spe$sum_outliers) | as.logical(spe$detected_outliers) | as.logical(spe$subsets_Mito_percent_outliers)"},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"visualizing-local-outliers","dir":"Articles","previous_headings":"Spot-level local outlier detection","what":"Visualizing local outliers","title":"Getting started with 'SpotSweeper'","text":"can visualize local outliers using plotQCmetrics function. function creates scatter plot specified metric highlights local outliers red using escheR package. , ’ll visualize local outliers library size, unique genes, mitochondrial percent, finally, local outliers. ’ll arrange plots grid using ggpubr::arrange.","code":"library(escheR) ## Loading required package: ggplot2 # all local outliers plotQCmetrics(spe, metric = \"sum_log\", outliers = \"local_outliers\", point_size = 1.1, stroke = 0.75) + ggtitle(\"All Local Outliers\")"},{"path":[]},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"loading-example-data-1","dir":"Articles","previous_headings":"Removing technical artifacts using SpotSweeper","what":"Loading example data","title":"Getting started with 'SpotSweeper'","text":"","code":"# load in DLPFC sample with hangnail artifact data(DLPFC_artifact) spe <- DLPFC_artifact # inspect colData before artifact detection colnames(colData(spe)) ## [1] \"sample_id\" \"in_tissue\" \"array_row\" ## [4] \"array_col\" \"key\" \"sum_umi\" ## [7] \"sum_gene\" \"expr_chrM\" \"expr_chrM_ratio\" ## [10] \"ManualAnnotation\" \"subject\" \"region\" ## [13] \"sex\" \"age\" \"diagnosis\" ## [16] \"sample_id_complete\" \"count\" \"sizeFactor\""},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"visualizing-technical-artifacts","dir":"Articles","previous_headings":"Removing technical artifacts using SpotSweeper","what":"Visualizing technical artifacts","title":"Getting started with 'SpotSweeper'","text":"Technical artifacts can commonly visualized standard QC metrics, including library size, unique genes, mitochondrial percentage. can first visualize technical artifacts using plotQCmetrics function. sample, can clearly see hangnail artifact right side tissue section mitochondrial ratio plot.","code":"plotQCmetrics(spe, metric = \"expr_chrM_ratio\", outliers = NULL, point_size = 1.1 ) + ggtitle(\"Mitochondrial Percent\")"},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"identifying-artifacts-using-spotsweeper","dir":"Articles","previous_headings":"Removing technical artifacts using SpotSweeper","what":"Identifying artifacts using SpotSweeper","title":"Getting started with 'SpotSweeper'","text":"can use findArtifacts function identify artifacts spatial transcriptomics (data. function identifies technical artifacts based first principle component local variance specified QC metric (mito_percent) numerous neighorhood sizes (n_order=5). Currently, kmeans clustering used cluster technical artifact vs high-quality Visium spots. Similar localOutliers, findArtifacts function outputs results colData.","code":"# find artifacts using SpotSweeper spe <- findArtifacts(spe, mito_percent = \"expr_chrM_ratio\", mito_sum = \"expr_chrM\", n_order = 5, name = \"artifact\" ) # check that \"artifact\" is now in colData colnames(colData(spe)) ## [1] \"sample_id\" \"in_tissue\" \"array_row\" ## [4] \"array_col\" \"key\" \"sum_umi\" ## [7] \"sum_gene\" \"expr_chrM\" \"expr_chrM_ratio\" ## [10] \"ManualAnnotation\" \"subject\" \"region\" ## [13] \"sex\" \"age\" \"diagnosis\" ## [16] \"sample_id_complete\" \"count\" \"sizeFactor\" ## [19] \"expr_chrM_ratio_log\" \"coords\" \"k6\" ## [22] \"k18\" \"k36\" \"k60\" ## [25] \"k90\" \"artifact\""},{"path":"https://mictott.github.io/SpotSweeper/articles/getting_started.html","id":"visualizing-artifacts","dir":"Articles","previous_headings":"Removing technical artifacts using SpotSweeper","what":"Visualizing artifacts","title":"Getting started with 'SpotSweeper'","text":"can visualize artifacts using escheR package. , ’ll visualize artifacts using plotQCmetrics function arrange plots using ggpubr::arrange. # Session information","code":"plotQCmetrics(spe, metric = \"expr_chrM_ratio\", outliers = \"artifact\", point_size = 1.1 ) + ggtitle(\"Hangnail artifact\") utils::sessionInfo() ## R version 4.4.2 (2024-10-31) ## Platform: x86_64-pc-linux-gnu ## Running under: Ubuntu 24.04.1 LTS ## ## Matrix products: default ## BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 ## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so; LAPACK version 3.12.0 ## ## locale: ## [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 ## [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 ## [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C ## [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C ## ## time zone: UTC ## tzcode source: system (glibc) ## ## attached base packages: ## [1] stats4 stats graphics grDevices utils datasets methods ## [8] base ## ## other attached packages: ## [1] escheR_1.6.0 ggplot2_3.5.1 ## [3] STexampleData_1.14.0 SpatialExperiment_1.16.0 ## [5] SingleCellExperiment_1.28.1 SummarizedExperiment_1.36.0 ## [7] Biobase_2.66.0 GenomicRanges_1.58.0 ## [9] GenomeInfoDb_1.42.1 IRanges_2.40.1 ## [11] S4Vectors_0.44.0 MatrixGenerics_1.18.0 ## [13] matrixStats_1.4.1 ExperimentHub_2.14.0 ## [15] AnnotationHub_3.14.0 BiocFileCache_2.14.0 ## [17] dbplyr_2.5.0 BiocGenerics_0.52.0 ## [19] SpotSweeper_1.3.3 BiocStyle_2.34.0 ## ## loaded via a namespace (and not attached): ## [1] DBI_1.2.3 rlang_1.1.4 magrittr_2.0.3 ## [4] spatialEco_2.0-2 compiler_4.4.2 RSQLite_2.3.9 ## [7] png_0.1-8 systemfonts_1.1.0 vctrs_0.6.5 ## [10] pkgconfig_2.0.3 crayon_1.5.3 fastmap_1.2.0 ## [13] magick_2.8.5 XVector_0.46.0 labeling_0.4.3 ## [16] scuttle_1.16.0 rmarkdown_2.29 UCSC.utils_1.2.0 ## [19] ragg_1.3.3 purrr_1.0.2 bit_4.5.0.1 ## [22] xfun_0.49 zlibbioc_1.52.0 cachem_1.1.0 ## [25] beachmat_2.22.0 jsonlite_1.8.9 blob_1.2.4 ## [28] DelayedArray_0.32.0 BiocParallel_1.40.0 terra_1.8-5 ## [31] parallel_4.4.2 R6_2.5.1 bslib_0.8.0 ## [34] jquerylib_0.1.4 Rcpp_1.0.13-1 bookdown_0.41 ## [37] knitr_1.49 Matrix_1.7-1 tidyselect_1.2.1 ## [40] abind_1.4-8 yaml_2.3.10 codetools_0.2-20 ## [43] curl_6.0.1 lattice_0.22-6 tibble_3.2.1 ## [46] withr_3.0.2 KEGGREST_1.46.0 evaluate_1.0.1 ## [49] desc_1.4.3 Biostrings_2.74.1 pillar_1.10.0 ## [52] BiocManager_1.30.25 filelock_1.0.3 generics_0.1.3 ## [55] BiocVersion_3.20.0 munsell_0.5.1 scales_1.3.0 ## [58] glue_1.8.0 tools_4.4.2 BiocNeighbors_2.0.1 ## [61] fs_1.6.5 grid_4.4.2 AnnotationDbi_1.68.0 ## [64] colorspace_2.1-1 GenomeInfoDbData_1.2.13 cli_3.6.3 ## [67] rappdirs_0.3.3 textshaping_0.4.1 viridisLite_0.4.2 ## [70] S4Arrays_1.6.0 dplyr_1.1.4 gtable_0.3.6 ## [73] sass_0.4.9 digest_0.6.37 SparseArray_1.6.0 ## [76] farver_2.1.2 rjson_0.2.23 memoise_2.0.1 ## [79] htmltools_0.5.8.1 pkgdown_2.1.1 lifecycle_1.0.4 ## [82] httr_1.4.7 mime_0.12 bit64_4.5.2 ## [85] MASS_7.3-61"},{"path":"https://mictott.github.io/SpotSweeper/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Michael Totty. Author, maintainer. Stephanie Hicks. Author. Boyi Guo. Author.","code":""},{"path":"https://mictott.github.io/SpotSweeper/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Totty M (2024). SpotSweeper: spatially-aware quality control spatial transcriptomics. doi:10.18129/B9.bioc.SpotSweeper, https://github.com/MicTott/SpotSweeper/SpotSweeper - R package version 1.3.3, http://www.bioconductor.org/packages/SpotSweeper. Totty M, Hicks S, Guo B (2024). “SpotSweeper: spatially-aware quality control spatial transcriptomics.” bioRxiv. doi:10.1101/2024.06.06.597765, https://doi.org/10.1101/2024.06.06.597765.","code":"@Manual{, title = {SpotSweeper: spatially-aware quality control for spatial transcriptomics}, author = {Michael Totty}, year = {2024}, url = {http://www.bioconductor.org/packages/SpotSweeper}, note = {https://github.com/MicTott/SpotSweeper/SpotSweeper - R package version 1.3.3}, doi = {10.18129/B9.bioc.SpotSweeper}, } @Article{, title = {SpotSweeper: spatially-aware quality control for spatial transcriptomics}, author = {Michael Totty and Stephanie Hicks and Boyi Guo}, journal = {bioRxiv}, year = {2024}, doi = {10.1101/2024.06.06.597765}, url = {https://doi.org/10.1101/2024.06.06.597765}, }"},{"path":"https://mictott.github.io/SpotSweeper/index.html","id":"spotsweeper-","dir":"","previous_headings":"","what":"Spatially-aware quality control for spatial transcriptomics","title":"Spatially-aware quality control for spatial transcriptomics","text":"SpotSweeper package developed spatially-aware quality control (QC) methods detection, visualization, removal local outliers regional artifacts spot-based spatial transcriptomics data, 10x Genomics Visium, using standard QC metrics. experience issues using package like make suggestion, please open issue GitHub repository. find information, please visit documentation website.","code":""},{"path":"https://mictott.github.io/SpotSweeper/index.html","id":"installation-instructions","dir":"","previous_headings":"","what":"Installation instructions","title":"Spatially-aware quality control for spatial transcriptomics","text":"can install latest version SpotSweeper Bioconductor following code: latest development version can installed GitHub using following:","code":"if (!requireNamespace(\"BiocManager\", quietly = TRUE)) { install.packages(\"BiocManager\") } BiocManager::install(\"SpotSweeper\") if (!require(\"devtools\")) install.packages(\"devtools\") remotes::install_github(\"MicTott/SpotSweeper\")"},{"path":"https://mictott.github.io/SpotSweeper/index.html","id":"tutorials","dir":"","previous_headings":"","what":"Tutorials","title":"Spatially-aware quality control for spatial transcriptomics","text":"detailed tutorial available package vignette Bioconductor. direct link tutorial / package vignette available .","code":""},{"path":"https://mictott.github.io/SpotSweeper/index.html","id":"development-tools","dir":"","previous_headings":"","what":"Development tools","title":"Spatially-aware quality control for spatial transcriptomics","text":"Continuous code testing possible thanks GitHub actions BiocStyle::Biocpkg('biocthis'). documentation website automatically updated thanks BiocStyle::CRANpkg('pkgdown'). code styled automatically thanks BiocStyle::CRANpkg('styler'). documentation formatted thanks BiocStyle::CRANpkg('devtools') BiocStyle::CRANpkg('roxygen2'). package developed using BiocStyle::Biocpkg('biocthis').","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":null,"dir":"Reference","previous_headings":"","what":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"DLPFC_artifact dataset SpatialExperiment object containing single-sample subset human dorsolateral prefrontal cortex (DLPFC) dataset Hukki-Myers et al. 2023. particular sample ('Br2743_ant') included demonstrate identification removal technical artifacts within spatial transcriptomics data. dataset serves example artifact detection using 'SpotSweeper' workflow.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"","code":"data(DLPFC_artifact)"},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"SpatialExperiment object.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"spatialLIBD","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"Hukki-Myers et al. (2023) bioRxiv (bioRxiv)","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/DLPFC_artifact.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"human DLPFC dataset with a technical artifact (hangnail). — DLPFC_artifact","text":"","code":"data(DLPFC_artifact)"},{"path":"https://mictott.github.io/SpotSweeper/reference/biased_spots.html","id":null,"dir":"Reference","previous_headings":"","what":"Biased Spots Data — biased_spots","title":"Biased Spots Data — biased_spots","text":"biased_spots dataset data.frame containing information specific spatial spots identified technical outliers spatial transcriptomics experiments. entry represents biased spot characterized spatial coordinates (row column) unique barcode. dataset utilized flagVisiumOutliers function flag exclude outlier spots downstream analyses, thereby enhancing data quality reliability.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/biased_spots.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Biased Spots Data — biased_spots","text":"","code":"data(biased_spots)"},{"path":"https://mictott.github.io/SpotSweeper/reference/biased_spots.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Biased Spots Data — biased_spots","text":"data.frame following columns: row Integer. row position biased spot within spatial grid. col Integer. column position biased spot within spatial grid. barcode Character. unique identifier corresponding spatial transcriptomics barcode biased spot.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/biased_spots.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Biased Spots Data — biased_spots","text":"biased_spots.rds file generated analysis local outliers. See https://github.com/boyiguo1/Manuscript-SpotSweeper/blob/main/code/03_Visium/figure_3.R details.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/biased_spots.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Biased Spots Data — biased_spots","text":"","code":"data(biased_spots)"},{"path":"https://mictott.github.io/SpotSweeper/reference/findArtifacts.html","id":null,"dir":"Reference","previous_headings":"","what":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","title":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","text":"function identifies annotates potential artifacts spatial transcriptomics data. Artifacts detected based local mito variance, results added original SpatialExperiment (sce) object.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/findArtifacts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","text":"","code":"findArtifacts( spe, mito_percent = \"expr_chrM_ratio\", mito_sum = \"expr_chrM\", samples = \"sample_id\", n_order = 5, shape = \"hexagonal\", log = TRUE, name = \"artifact\", var_output = TRUE )"},{"path":"https://mictott.github.io/SpotSweeper/reference/findArtifacts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","text":"spe SingleCellExperiment object. mito_percent column name representing mitochondrial percent. Default 'expr_chrM_ratio'. mito_sum column name representing sum mitochondrial expression. Default 'expr_chrM'. samples column name representing sample IDs. Default 'sample_id'. n_order number orders local mito variance calculation. Default 5. shape shape neighborhood local variance calculation. Can either 'hexagonal' 'square'. Default 'hexagonal'. log Logical, indicating whether log1p transform mito_percent. Default TRUE. name Prefix local variance column names. Default 'artifact'. var_output Logical, indicating whether include local variances output. Default TRUE.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/findArtifacts.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","text":"Returns modified SingleCellExperiment object artifact annotations.","code":""},{"path":[]},{"path":"https://mictott.github.io/SpotSweeper/reference/findArtifacts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Identify and annotate artifacts in spatial transcriptomics data — findArtifacts","text":"","code":"library(SpotSweeper) library(SpatialExperiment) #> Loading required package: SingleCellExperiment #> Loading required package: SummarizedExperiment #> Loading required package: MatrixGenerics #> Loading required package: matrixStats #> #> Attaching package: ‘MatrixGenerics’ #> The following objects are masked from ‘package:matrixStats’: #> #> colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse, #> colCounts, colCummaxs, colCummins, colCumprods, colCumsums, #> colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs, #> colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats, #> colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds, #> colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads, #> colWeightedMeans, colWeightedMedians, colWeightedSds, #> colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet, #> rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods, #> rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps, #> rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins, #> rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks, #> rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars, #> rowWeightedMads, rowWeightedMeans, rowWeightedMedians, #> rowWeightedSds, rowWeightedVars #> Loading required package: GenomicRanges #> Loading required package: stats4 #> Loading required package: BiocGenerics #> #> Attaching package: ‘BiocGenerics’ #> The following objects are masked from ‘package:stats’: #> #> IQR, mad, sd, var, xtabs #> The following objects are masked from ‘package:base’: #> #> Filter, Find, Map, Position, Reduce, anyDuplicated, aperm, append, #> as.data.frame, basename, cbind, colnames, dirname, do.call, #> duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted, #> lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin, #> pmin.int, rank, rbind, rownames, sapply, saveRDS, setdiff, table, #> tapply, union, unique, unsplit, which.max, which.min #> Loading required package: S4Vectors #> #> Attaching package: ‘S4Vectors’ #> The following object is masked from ‘package:utils’: #> #> findMatches #> The following objects are masked from ‘package:base’: #> #> I, expand.grid, unname #> Loading required package: IRanges #> Loading required package: GenomeInfoDb #> Loading required package: Biobase #> Welcome to Bioconductor #> #> Vignettes contain introductory material; view with #> 'browseVignettes()'. To cite Bioconductor, see #> 'citation(\"Biobase\")', and for packages 'citation(\"pkgname\")'. #> #> Attaching package: ‘Biobase’ #> The following object is masked from ‘package:MatrixGenerics’: #> #> rowMedians #> The following objects are masked from ‘package:matrixStats’: #> #> anyMissing, rowMedians library(escheR) #> Loading required package: ggplot2 data(DLPFC_artifact) spe <- DLPFC_artifact # find artifacts spe <- findArtifacts(spe, mito_percent = \"expr_chrM_ratio\", mito_sum = \"expr_chrM\", n_order = 2, # 5 recommended, using 2 for time shape = \"hexagonal\", name = \"artifact\" )"},{"path":"https://mictott.github.io/SpotSweeper/reference/flagVisiumOutliers.html","id":null,"dir":"Reference","previous_headings":"","what":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","title":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","text":"flagVisiumoutliers function identifies flags Visium systematic outlier spots SpatialExperiment object based barcodes. outliers marked colData SpatialExperiment object, allowing users exclude downstream analyses enhance data quality reliability.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/flagVisiumOutliers.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","text":"","code":"flagVisiumOutliers(spe)"},{"path":"https://mictott.github.io/SpotSweeper/reference/flagVisiumOutliers.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","text":"spe SpatialExperiment object containing spatial transcriptomics data. object must include array_row array_col columns colData specify spatial coordinates spot.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/flagVisiumOutliers.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","text":"SpatialExperiment object identical input spe additional logical column systematic_outliers colData. column indicates whether spot flagged technical outlier (TRUE) (FALSE).","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/flagVisiumOutliers.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Flag Visium Outliers in SpatialExperiment Objects — flagVisiumOutliers","text":"","code":"library(SpotSweeper) library(SpatialExperiment) # load example data spe <- STexampleData::Visium_humanDLPFC() #> see ?STexampleData and browseVignettes('STexampleData') for documentation #> downloading 1 resources #> retrieving 1 resource #> loading from cache # Flag outlier spots spe <- flagVisiumOutliers(spe) # drop outlier spots spe <- spe[, !colData(spe)$systematic_outliers]"},{"path":"https://mictott.github.io/SpotSweeper/reference/localOutliers.html","id":null,"dir":"Reference","previous_headings":"","what":"localOutliers Function — localOutliers","title":"localOutliers Function — localOutliers","text":"function detects local outliers spatial transcriptomics data based standard quality control metrics, library size, unique genes, mitochondrial ratio. Local outliers defined spots low/high quality metrics compared surrounding neighbors, based modified z-score statistic.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localOutliers.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"localOutliers Function — localOutliers","text":"","code":"localOutliers( spe, metric = \"detected\", direction = \"lower\", n_neighbors = 36, samples = \"sample_id\", log = TRUE, cutoff = 3, workers = 1 )"},{"path":"https://mictott.github.io/SpotSweeper/reference/localOutliers.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"localOutliers Function — localOutliers","text":"spe SpatialExperiment SingleCellExperiment object metric colData QC metric use outlier detection direction Direction outlier detection (higher, lower, ) n_neighbors Number nearest neighbors use outlier detection samples Column name colData use sample IDs log Logical indicating whether log1p transform features (default TRUE) cutoff Cutoff outlier detection (default 3) workers Number workers parallel processing (default 1)","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localOutliers.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"localOutliers Function — localOutliers","text":"SpatialExperiment SingleCellExperiment object updated colData containing outputs","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localOutliers.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"localOutliers Function — localOutliers","text":"","code":"library(SpotSweeper) library(SpatialExperiment) # load example data spe <- STexampleData::Visium_humanDLPFC() #> see ?STexampleData and browseVignettes('STexampleData') for documentation #> loading from cache # change from gene id to gene names rownames(spe) <- rowData(spe)$gene_name # drop out-of-tissue spots spe <- spe[, spe$in_tissue == 1] spe <- spe[, !is.na(spe$ground_truth)] # Identifying the mitochondrial transcripts in our SpatialExperiment. is.mito <- rownames(spe)[grepl(\"^MT-\", rownames(spe))] # Calculating QC metrics for each spot using scuttle spe <- scuttle::addPerCellQCMetrics(spe, subsets = list(Mito = is.mito)) colnames(colData(spe)) #> [1] \"barcode_id\" \"sample_id\" \"in_tissue\" #> [4] \"array_row\" \"array_col\" \"ground_truth\" #> [7] \"reference\" \"cell_count\" \"sum\" #> [10] \"detected\" \"subsets_Mito_sum\" \"subsets_Mito_detected\" #> [13] \"subsets_Mito_percent\" \"total\" # Identifying local outliers using SpotSweeper spe <- localOutliers(spe, metric = \"sum\", direction = \"lower\", log = TRUE )"},{"path":"https://mictott.github.io/SpotSweeper/reference/localVariance.html","id":null,"dir":"Reference","previous_headings":"","what":"localVariance Function — localVariance","title":"localVariance Function — localVariance","text":"function calculates local variance based kNN.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localVariance.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"localVariance Function — localVariance","text":"","code":"localVariance( spe, n_neighbors = 36, metric = c(\"expr_chrM_ratio\"), samples = \"sample_id\", log = FALSE, name = NULL, workers = 1 )"},{"path":"https://mictott.github.io/SpotSweeper/reference/localVariance.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"localVariance Function — localVariance","text":"spe SpatialExperiment object following columns colData: sample_id, sum_umi, sum_gene n_neighbors Number nearest neighbors use variance calculation metric Metric use variance calculation samples Column colData use sample ID log Whether log1p transform metric name Name new column add colData workers Number workers use parallel computation","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localVariance.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"localVariance Function — localVariance","text":"SpatialExperiment object metric variance added colData","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/localVariance.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"localVariance Function — localVariance","text":"","code":"# for more details see extended example in vignettes library(SpotSweeper) library(SpatialExperiment) library(escheR) # load example data spe <- STexampleData::Visium_humanDLPFC() #> see ?STexampleData and browseVignettes('STexampleData') for documentation #> loading from cache # change from gene id to gene names rownames(spe) <- rowData(spe)$gene_name # show column data before SpotSweepR colnames(colData(spe)) #> [1] \"barcode_id\" \"sample_id\" \"in_tissue\" \"array_row\" \"array_col\" #> [6] \"ground_truth\" \"reference\" \"cell_count\" # drop out-of-tissue spots spe <- spe[, spe$in_tissue == 1] spe <- spe[, !is.na(spe$ground_truth)] # Identifying the mitochondrial transcripts in our SpatialExperiment. is.mito <- rownames(spe)[grepl(\"^MT-\", rownames(spe))] # Calculating QC metric for each spot using scuttle spe <- scuttle::addPerCellQCMetrics(spe, subsets = list(Mito = is.mito)) colnames(colData(spe)) #> [1] \"barcode_id\" \"sample_id\" \"in_tissue\" #> [4] \"array_row\" \"array_col\" \"ground_truth\" #> [7] \"reference\" \"cell_count\" \"sum\" #> [10] \"detected\" \"subsets_Mito_sum\" \"subsets_Mito_detected\" #> [13] \"subsets_Mito_percent\" \"total\" spe <- localVariance(spe, metric = \"subsets_Mito_percent\", n_neighbors = 36, name = \"local_mito_variance_k36\", workers = 1 )"},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCmetrics.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","title":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","text":"function generates plot specified sample within SpatialExperiment object, highlighting outliers based specified metric. plot visualizes metric interest indicates outliers distinct color.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCmetrics.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","text":"","code":"plotQCmetrics( spe, sample_id = \"sample_id\", sample = unique(spe$sample_id)[1], metric = \"detected\", outliers = NULL, point_size = 2, colors = c(\"white\", \"black\"), stroke = 1 )"},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCmetrics.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","text":"spe SpatialExperiment object containing data plotted. sample_id character string specifying column name colData(spe) contains unique sample identifiers. Default \"sample_id\". sample character string numeric value specifying sample plotted. default, plots first unique sample found spe$sample_id. metric character string specifying metric visualized plot. metric column name colData(spe). outliers character string specifying column name colData(spe) indicates whether data point considered outlier. Default NULL. point_size numeric value specifying size points plot. Default 2. colors character vector specifying colors used gradient scale. length 2, gradient single color gradient. stroke numeric value specifying border thickness outlier points. Default 1.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCmetrics.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","text":"function returns plot object created make_escheR modified additional layers visualizing specified metric outliers. plot explicitly printed function printed caller.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCmetrics.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot QC metrics for a Single Sample in a SpatialExperiment object — plotQCmetrics","text":"","code":"library(SpotSweeper) library(SpatialExperiment) library(escheR) # load example data spe <- STexampleData::Visium_humanDLPFC() #> see ?STexampleData and browseVignettes('STexampleData') for documentation #> loading from cache # change from gene id to gene names rownames(spe) <- rowData(spe)$gene_name # drop out-of-tissue spots spe <- spe[, spe$in_tissue == 1] spe <- spe[, !is.na(spe$ground_truth)] # Identifying the mitochondrial transcripts in our SpatialExperiment. is.mito <- rownames(spe)[grepl(\"^MT-\", rownames(spe))] # Calculating QC metrics for each spot using scuttle spe <- scuttle::addPerCellQCMetrics(spe, subsets = list(Mito = is.mito)) colnames(colData(spe)) #> [1] \"barcode_id\" \"sample_id\" \"in_tissue\" #> [4] \"array_row\" \"array_col\" \"ground_truth\" #> [7] \"reference\" \"cell_count\" \"sum\" #> [10] \"detected\" \"subsets_Mito_sum\" \"subsets_Mito_detected\" #> [13] \"subsets_Mito_percent\" \"total\" # Identifying local outliers using SpotSweeper spe <- localOutliers(spe, metric = \"sum\", direction = \"lower\", log = TRUE ) plotQCmetrics(spe, metric=\"sum\", outliers=\"sum_outliers\")"},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCpdf.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot Outlier Metrics to PDF — plotQCpdf","title":"Plot Outlier Metrics to PDF — plotQCpdf","text":"function generates PDF file containing plots sample SpatialExperiment object, highlighting outliers based specified metrics. plot visualizes outlier metrics single sample, allowing easy comparison analysis across samples.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCpdf.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot Outlier Metrics to PDF — plotQCpdf","text":"","code":"plotQCpdf( spe, sample_id = \"sample_id\", metric = \"detected\", outliers = \"local_outliers\", colors = c(\"white\", \"black\"), stroke = 1, point_size = 2, width = 5, height = 5, fname )"},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCpdf.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot Outlier Metrics to PDF — plotQCpdf","text":"spe SpatialExperiment object containing data plotted. sample_id character string specifying column name colData(spe) contains unique sample identifiers. Default 'sample_id'. metric character string specifying metric visualized plot. metric column name colData(spe). outliers character string specifying column name colData(spe) indicates whether data point considered outlier. Default local_outliers'. colors character vector specifying colors used gradient scale. length 2, gradient single color gradient stroke numeric value specifying border thickness outlier points. Default 1. point_size numeric value specifying size points plot. Default 2. width numeric value indicating width plot. Default 5. height numeric value indicating height plot. Default 5. fname character string specifying path name output PDF file.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCpdf.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot Outlier Metrics to PDF — plotQCpdf","text":"ggplot object specified. Generates plot otherwise.","code":""},{"path":"https://mictott.github.io/SpotSweeper/reference/plotQCpdf.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot Outlier Metrics to PDF — plotQCpdf","text":"","code":"library(SpotSweeper) library(SpatialExperiment) library(escheR) # load example data spe <- STexampleData::Visium_humanDLPFC() #> see ?STexampleData and browseVignettes('STexampleData') for documentation #> loading from cache tempFilePath <- file.path(tempdir(), \"examplePlot.pdf\") # change from gene id to gene names rownames(spe) <- rowData(spe)$gene_name # drop out-of-tissue spots spe <- spe[, spe$in_tissue == 1] spe <- spe[, !is.na(spe$ground_truth)] # Identifying the mitochondrial transcripts in our SpatialExperiment. is.mito <- rownames(spe)[grepl(\"^MT-\", rownames(spe))] # Calculating QC metrics for each spot using scuttle spe <- scuttle::addPerCellQCMetrics(spe, subsets = list(Mito = is.mito)) colnames(colData(spe)) #> [1] \"barcode_id\" \"sample_id\" \"in_tissue\" #> [4] \"array_row\" \"array_col\" \"ground_truth\" #> [7] \"reference\" \"cell_count\" \"sum\" #> [10] \"detected\" \"subsets_Mito_sum\" \"subsets_Mito_detected\" #> [13] \"subsets_Mito_percent\" \"total\" # Identifying local outliers using SpotSweeper spe <- localOutliers(spe, metric = \"sum\", direction = \"lower\", log = TRUE ) plotQCpdf(spe, metric=\"sum\", outliers=\"sum_outliers\", fname=tempFilePath) #> Warning: 'plotQC' is deprecated. #> Use 'plotQCmetrics' instead. #> See help(\"Deprecated\") #> pdf #> 2"},{"path":[]},{"path":"https://mictott.github.io/SpotSweeper/news/index.html","id":"major-changes-1-3-1","dir":"Changelog","previous_headings":"","what":"Major Changes","title":"Version 1.3.1","text":"Function Renaming: function plotQC renamed plotQCmetrics better reflect purpose. new function plotQCmetrics used moving forward. change improves clarity package’s API specifying function designed plotting QC metrics.","code":""},{"path":"https://mictott.github.io/SpotSweeper/news/index.html","id":"new-features-and-enhancements-1-3-1","dir":"Changelog","previous_headings":"","what":"New Features and Enhancements","title":"Version 1.3.1","text":"shape argument: Added shape argument findArtifacts, allowing users specify neighborhood shape either \"hexagonal\" \"square\" local variance calculations. enhancement provides flexibility different spatial arrangements spatial transcriptomics data. Updated n_order parameter: Renamed n_rings parameter n_order findArtifacts function better describe purpose specifying N-order neighbors local mitochondrial variance calculations. Parallelization: Added workers argument parallel processing using BiocParallel localOutlier localVariance functions. allows faster computation, particularly larger datasets.","code":""},{"path":"https://mictott.github.io/SpotSweeper/news/index.html","id":"deprecations-1-3-1","dir":"Changelog","previous_headings":"","what":"Deprecations","title":"Version 1.3.1","text":"plotQC Function Deprecated: plotQC function now deprecated. remains available backward compatibility, users encouraged transition plotQCmetrics. Calling plotQC display warning, reminding users deprecation. change backward compatible; existing code using plotQC still work show warning. recommend updating code use plotQCmetrics avoid issues future versions plotQC may removed.","code":""}]