diff --git a/pkgdown.yml b/pkgdown.yml index d719b64..e2043fc 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-11-14T16:49Z +last_built: 2024-11-14T17:09Z urls: reference: https://mictott.github.io/SpotSweeper/reference article: https://mictott.github.io/SpotSweeper/articles diff --git a/reference/localOutliers.html b/reference/localOutliers.html index 3122774..abb2ac7 100644 --- a/reference/localOutliers.html +++ b/reference/localOutliers.html @@ -63,7 +63,6 @@

Usage samples = "sample_id", log = TRUE, cutoff = 3, - neighborhood = spatialCoords(spe_subset), workers = 1 ) @@ -101,10 +100,6 @@

Argumentsneighborhood -

Matrix of spatial coordinates for neighborhood calculation

- -
workers

Number of workers for parallel processing (default is 1)

@@ -149,10 +144,8 @@

Examplesspe <- localOutliers(spe, metric = "sum", direction = "lower", - log = TRUE, - neighborhood = spatialCoords(spe) + log = TRUE ) -#> Error in localOutliers(spe, metric = "sum", direction = "lower", log = TRUE, neighborhood = spatialCoords(spe)): unused argument (neighborhood = spatialCoords(spe)) diff --git a/search.json b/search.json index c78b706..0041ea9 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) # 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 22.04.5 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.20.so; LAPACK version 3.10.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.0 IRanges_2.40.0 ## [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.1 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.7 ## [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 utf8_1.2.4 rmarkdown_2.29 ## [19] UCSC.utils_1.2.0 ragg_1.3.3 purrr_1.0.2 ## [22] bit_4.5.0 xfun_0.49 beachmat_2.22.0 ## [25] zlibbioc_1.52.0 cachem_1.1.0 jsonlite_1.8.9 ## [28] blob_1.2.4 DelayedArray_0.32.0 BiocParallel_1.40.0 ## [31] terra_1.7-83 parallel_4.4.2 R6_2.5.1 ## [34] bslib_0.8.0 jquerylib_0.1.4 Rcpp_1.0.13-1 ## [37] bookdown_0.41 knitr_1.49 Matrix_1.7-1 ## [40] tidyselect_1.2.1 abind_1.4-8 yaml_2.3.10 ## [43] codetools_0.2-20 curl_6.0.0 lattice_0.22-6 ## [46] tibble_3.2.1 withr_3.0.2 KEGGREST_1.46.0 ## [49] evaluate_1.0.1 desc_1.4.3 Biostrings_2.74.0 ## [52] pillar_1.9.0 BiocManager_1.30.25 filelock_1.0.3 ## [55] generics_0.1.3 BiocVersion_3.20.0 munsell_0.5.1 ## [58] scales_1.3.0 glue_1.8.0 tools_4.4.2 ## [61] BiocNeighbors_2.0.0 fs_1.6.5 grid_4.4.2 ## [64] AnnotationDbi_1.68.0 colorspace_2.1-1 GenomeInfoDbData_1.2.13 ## [67] cli_3.6.3 rappdirs_0.3.3 textshaping_0.4.0 ## [70] fansi_1.0.6 viridisLite_0.4.2 S4Arrays_1.6.0 ## [73] dplyr_1.1.4 gtable_0.3.6 sass_0.4.9 ## [76] digest_0.6.37 SparseArray_1.6.0 farver_2.1.2 ## [79] rjson_0.2.23 memoise_2.0.1 htmltools_0.5.8.1 ## [82] pkgdown_2.1.1 lifecycle_1.0.4 httr_1.4.7 ## [85] mime_0.12 bit64_4.5.2 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 et al. (2024), SpotSweeper: spatially-aware quality control spatial transcriptomics, bioRxiv.","code":"@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.597765v1}, }"},{"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 user package, 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/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/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, neighborhood = spatialCoords(spe_subset), 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) neighborhood Matrix spatial coordinates neighborhood calculation 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 #> downloading 1 resources #> retrieving 1 resource #> 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, neighborhood = spatialCoords(spe) ) #> Error in localOutliers(spe, metric = \"sum\", direction = \"lower\", log = TRUE, neighborhood = spatialCoords(spe)): unused argument (neighborhood = spatialCoords(spe))"},{"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":"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) # 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 22.04.5 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.20.so; LAPACK version 3.10.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.0 IRanges_2.40.0 ## [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.1 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.7 ## [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 utf8_1.2.4 rmarkdown_2.29 ## [19] UCSC.utils_1.2.0 ragg_1.3.3 purrr_1.0.2 ## [22] bit_4.5.0 xfun_0.49 beachmat_2.22.0 ## [25] zlibbioc_1.52.0 cachem_1.1.0 jsonlite_1.8.9 ## [28] blob_1.2.4 DelayedArray_0.32.0 BiocParallel_1.40.0 ## [31] terra_1.7-83 parallel_4.4.2 R6_2.5.1 ## [34] bslib_0.8.0 jquerylib_0.1.4 Rcpp_1.0.13-1 ## [37] bookdown_0.41 knitr_1.49 Matrix_1.7-1 ## [40] tidyselect_1.2.1 abind_1.4-8 yaml_2.3.10 ## [43] codetools_0.2-20 curl_6.0.0 lattice_0.22-6 ## [46] tibble_3.2.1 withr_3.0.2 KEGGREST_1.46.0 ## [49] evaluate_1.0.1 desc_1.4.3 Biostrings_2.74.0 ## [52] pillar_1.9.0 BiocManager_1.30.25 filelock_1.0.3 ## [55] generics_0.1.3 BiocVersion_3.20.0 munsell_0.5.1 ## [58] scales_1.3.0 glue_1.8.0 tools_4.4.2 ## [61] BiocNeighbors_2.0.0 fs_1.6.5 grid_4.4.2 ## [64] AnnotationDbi_1.68.0 colorspace_2.1-1 GenomeInfoDbData_1.2.13 ## [67] cli_3.6.3 rappdirs_0.3.3 textshaping_0.4.0 ## [70] fansi_1.0.6 viridisLite_0.4.2 S4Arrays_1.6.0 ## [73] dplyr_1.1.4 gtable_0.3.6 sass_0.4.9 ## [76] digest_0.6.37 SparseArray_1.6.0 farver_2.1.2 ## [79] rjson_0.2.23 memoise_2.0.1 htmltools_0.5.8.1 ## [82] pkgdown_2.1.1 lifecycle_1.0.4 httr_1.4.7 ## [85] mime_0.12 bit64_4.5.2 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 et al. (2024), SpotSweeper: spatially-aware quality control spatial transcriptomics, bioRxiv.","code":"@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.597765v1}, }"},{"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 user package, 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/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/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 #> downloading 1 resources #> retrieving 1 resource #> 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"}]