diff --git a/.github/workflows/check-bioc.yml b/.github/workflows/check-bioc.yml index 2b37d332..9f88c52b 100644 --- a/.github/workflows/check-bioc.yml +++ b/.github/workflows/check-bioc.yml @@ -52,9 +52,9 @@ jobs: fail-fast: false matrix: config: - - { os: ubuntu-latest, r: '4.3', bioc: '3.18', cont: "bioconductor/bioconductor_docker:RELEASE_3_18", rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest" } - - { os: macOS-latest, r: '4.3', bioc: '3.18'} - - { os: windows-latest, r: '4.3', bioc: '3.18'} + - { os: ubuntu-latest, r: '4.4', bioc: '3.19', cont: "bioconductor/bioconductor_docker:RELEASE_3_19", rspm: "https://packagemanager.rstudio.com/cran/__linux__/jammy/latest" } + # - { os: macOS-latest, r: '4.4', bioc: '3.19'} + - { os: windows-latest, r: '4.4', bioc: '3.19'} ## Check https://github.com/r-lib/actions/tree/master/examples ## for examples using the http-user-agent env: @@ -105,16 +105,16 @@ jobs: uses: actions/cache@v3 with: path: ${{ env.R_LIBS_USER }} - key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_18-r-4.3-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_18-r-4.3- + key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_19-r-4.4-${{ hashFiles('.github/depends.Rds') }} + restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_19-r-4.4- - name: Cache R packages on Linux if: "!contains(github.event.head_commit.message, '/nocache') && runner.os == 'Linux' " uses: actions/cache@v3 with: path: /home/runner/work/_temp/Library - key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_18-r-4.3-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_18-r-4.3- + key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_19-r-4.4-${{ hashFiles('.github/depends.Rds') }} + restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_19-r-4.4- # - name: Install Linux system dependencies # if: runner.os == 'Linux' @@ -221,7 +221,7 @@ jobs: rcmdcheck::rcmdcheck( args = c("--no-manual", "--no-vignettes", "--timings"), build_args = c("--no-manual", "--keep-empty-dirs", "--no-resave-data"), - error_on = "error", + error_on = "warning", check_dir = "check" ) shell: Rscript {0} @@ -253,7 +253,7 @@ jobs: - name: Test coverage if: github.ref == 'refs/heads/devel' && env.run_covr == 'true' && runner.os == 'Linux' run: | - covr::codecov() + covr::codecov(coverage = covr::package_coverage(type = "all")) shell: Rscript {0} - name: Install package @@ -286,7 +286,7 @@ jobs: if: failure() uses: actions/upload-artifact@master with: - name: ${{ runner.os }}-biocversion-RELEASE_3_18-r-4.3-results + name: ${{ runner.os }}-biocversion-RELEASE_3_19-r-4.4-results path: check diff --git a/DESCRIPTION b/DESCRIPTION index 69dbfc42..d67643f5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: spatialLIBD Title: spatialLIBD: an R/Bioconductor package to visualize spatially-resolved transcriptomics data -Version: 1.17.0 -Date: 2024-04-19 +Version: 1.17.4 +Date: 2024-07-03 Authors@R: c( person("Leonardo", "Collado-Torres", role = c("aut", "cre"), @@ -80,7 +80,7 @@ Imports: MatrixGenerics, rlang, dplyr -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 Roxygen: list(markdown = TRUE) URL: https://github.com/LieberInstitute/spatialLIBD BugReports: https://support.bioconductor.org/tag/spatialLIBD diff --git a/NEWS.md b/NEWS.md index 2da9df7f..eac9b512 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,12 @@ +# spatialLIBD 1.17.3 + +NEW FEATURES + +* Added support for `SpatialExperiment` objects created with +`visiumStitched::build_spe()` + that +stitch together multiple Visium capture areas. Developed by @Nick-Eagles. + # spatialLIBD 1.15.2 SIGNIFICANT USER-VISIBLE CHANGES diff --git a/R/add10xVisiumAnalysis.R b/R/add10xVisiumAnalysis.R index dbe49f86..de4f5fee 100644 --- a/R/add10xVisiumAnalysis.R +++ b/R/add10xVisiumAnalysis.R @@ -29,9 +29,8 @@ #' #' ## Note that ?SpatialExperiment::read10xVisium doesn't include all the files #' ## we need to illustrate read10xVisiumWrapper(). -add10xVisiumAnalysis <- function( - spe, - visium_analysis) { +add10xVisiumAnalysis <- function(spe, + visium_analysis) { col_info <- colData(spe) barcode_present <- "barcode" %in% colnames(col_info) if (!barcode_present) { diff --git a/R/add_images.R b/R/add_images.R index e7b09e5c..bfdddbe5 100644 --- a/R/add_images.R +++ b/R/add_images.R @@ -43,13 +43,12 @@ #' )) #' } add_images <- - function( - spe, - image_dir, - image_pattern, - image_id_current = "lowres", - image_id = image_pattern, - image_paths = locate_images(spe, image_dir, image_pattern)) { + function(spe, + image_dir, + image_pattern, + image_id_current = "lowres", + image_id = image_pattern, + image_paths = locate_images(spe, image_dir, image_pattern)) { stopifnot(length(names(image_paths)) > 0) stopifnot(all(names(image_paths) %in% unique(spe$sample_id))) stopifnot(!any(duplicated(names(image_paths)))) diff --git a/R/annotate_registered_clusters.R b/R/annotate_registered_clusters.R index 13e1d5ab..c2a9ec43 100644 --- a/R/annotate_registered_clusters.R +++ b/R/annotate_registered_clusters.R @@ -48,10 +48,9 @@ #' ## More relaxed merging threshold #' annotate_registered_clusters(cor_stats_layer, cutoff_merge_ratio = 1) annotate_registered_clusters <- - function( - cor_stats_layer, - confidence_threshold = 0.25, - cutoff_merge_ratio = 0.25) { + function(cor_stats_layer, + confidence_threshold = 0.25, + cutoff_merge_ratio = 0.25) { annotated <- apply(cor_stats_layer, 1, @@ -87,11 +86,10 @@ annotate_registered_clusters <- } annotate_registered_cluster <- - function( - remaining, - label = "", - current = NULL, - cutoff_merge_ratio = 0.25) { + function(remaining, + label = "", + current = NULL, + cutoff_merge_ratio = 0.25) { ## Filter negative correlations remaining <- remaining[remaining > 0] diff --git a/R/app_server.R b/R/app_server.R index af18dbb7..ca416d98 100644 --- a/R/app_server.R +++ b/R/app_server.R @@ -25,6 +25,7 @@ app_server <- function(input, output, session) { modeling_results <- golem::get_golem_options("modeling_results") sig_genes <- golem::get_golem_options("sig_genes") default_cluster <- golem::get_golem_options("default_cluster") + is_stitched <- golem::get_golem_options("is_stitched") # List the first level callModules here @@ -171,6 +172,7 @@ app_server <- function(input, output, session) { alpha = input$alphalevel, point_size = input$pointsize, auto_crop = input$auto_crop, + is_stitched = is_stitched, ... = paste(" with", input$cluster) ) if (!input$side_by_side_histology) { @@ -211,6 +213,7 @@ app_server <- function(input, output, session) { sample_order = isolate(input$grid_samples), point_size = isolate(input$pointsize), auto_crop = isolate(input$auto_crop), + is_stitched = is_stitched, ... = paste(" with", isolate(input$cluster)) ) cowplot::plot_grid( @@ -232,7 +235,8 @@ app_server <- function(input, output, session) { image_id = input$imageid, alpha = input$alphalevel, point_size = input$pointsize, - auto_crop = input$auto_crop + auto_crop = input$auto_crop, + is_stitched = is_stitched ) if (!input$side_by_side_gene) { return(p) @@ -270,7 +274,8 @@ app_server <- function(input, output, session) { alpha = isolate(input$alphalevel), point_size = isolate(input$pointsize), sample_order = isolate(input$gene_grid_samples), - auto_crop = isolate(input$auto_crop) + auto_crop = isolate(input$auto_crop), + is_stitched = is_stitched ) cowplot::plot_grid( plotlist = plots, @@ -608,8 +613,17 @@ app_server <- function(input, output, session) { ## From vis_gene() in global.R spe_sub <- spe[, spe$sample_id == sampleid] + + point_size <- input$pointsize + if (is_stitched) { + # Drop excluded spots and calculate an appropriate point size + temp <- prep_stitched_data(spe_sub, point_size, input$imageid) + spe_sub <- temp$spe + point_size <- temp$point_size + } + d <- - as.data.frame(cbind(colData(spe), SpatialExperiment::spatialCoords(spe))[spe$sample_id == sampleid, ], + as.data.frame(cbind(colData(spe_sub), SpatialExperiment::spatialCoords(spe_sub)), optional = TRUE ) # Grab any continuous colData columns @@ -692,7 +706,7 @@ app_server <- function(input, output, session) { title = plot_title, image_id = input$imageid, alpha = input$alphalevel, - point_size = input$pointsize, + point_size = point_size, auto_crop = input$auto_crop ) @@ -706,11 +720,11 @@ app_server <- function(input, output, session) { cont_colors = cont_colors(), image_id = input$imageid, alpha = input$alphalevel, - point_size = input$pointsize, + point_size = point_size, auto_crop = input$auto_crop ) + geom_point( shape = 21, - size = input$pointsize, + size = point_size, stroke = 0, alpha = input$alphalevel ) @@ -728,7 +742,7 @@ app_server <- function(input, output, session) { ) + geom_point( shape = 21, - size = input$pointsize, + size = point_size, stroke = 0 ) + scale_fill_manual(values = get_colors(colors, colData(spe)[[clustervar]][spe$sample_id == sampleid])) + @@ -756,7 +770,7 @@ app_server <- function(input, output, session) { ) + geom_point( shape = 21, - size = input$pointsize, + size = point_size, stroke = 0 ) } else { @@ -951,7 +965,8 @@ app_server <- function(input, output, session) { image_id = input$imageid, alpha = input$alphalevel, point_size = input$pointsize, - auto_crop = input$auto_crop + auto_crop = input$auto_crop, + is_stitched = is_stitched ) + geom_point( shape = 21, diff --git a/R/check_sce.R b/R/check_sce.R index 1d625342..0d17423b 100644 --- a/R/check_sce.R +++ b/R/check_sce.R @@ -24,41 +24,40 @@ #' ## Check the object #' check_sce(sce_example) #' } -check_sce <- function( - sce, - variables = c( - "GraphBased", - "ManualAnnotation", - "Maynard", - "Martinowich", - paste0("SNN_k50_k", 4:28), - "spatialLIBD", - "cell_count", - "sum_umi", - "sum_gene", - "expr_chrM", - "expr_chrM_ratio", - "SpatialDE_PCA", - "SpatialDE_pool_PCA", - "HVG_PCA", - "pseudobulk_PCA", - "markers_PCA", - "SpatialDE_UMAP", - "SpatialDE_pool_UMAP", - "HVG_UMAP", - "pseudobulk_UMAP", - "markers_UMAP", - "SpatialDE_PCA_spatial", - "SpatialDE_pool_PCA_spatial", - "HVG_PCA_spatial", - "pseudobulk_PCA_spatial", - "markers_PCA_spatial", - "SpatialDE_UMAP_spatial", - "SpatialDE_pool_UMAP_spatial", - "HVG_UMAP_spatial", - "pseudobulk_UMAP_spatial", - "markers_UMAP_spatial" - )) { +check_sce <- function(sce, + variables = c( + "GraphBased", + "ManualAnnotation", + "Maynard", + "Martinowich", + paste0("SNN_k50_k", 4:28), + "spatialLIBD", + "cell_count", + "sum_umi", + "sum_gene", + "expr_chrM", + "expr_chrM_ratio", + "SpatialDE_PCA", + "SpatialDE_pool_PCA", + "HVG_PCA", + "pseudobulk_PCA", + "markers_PCA", + "SpatialDE_UMAP", + "SpatialDE_pool_UMAP", + "HVG_UMAP", + "pseudobulk_UMAP", + "markers_UMAP", + "SpatialDE_PCA_spatial", + "SpatialDE_pool_PCA_spatial", + "HVG_PCA_spatial", + "pseudobulk_PCA_spatial", + "markers_PCA_spatial", + "SpatialDE_UMAP_spatial", + "SpatialDE_pool_UMAP_spatial", + "HVG_UMAP_spatial", + "pseudobulk_UMAP_spatial", + "markers_UMAP_spatial" + )) { ## Should be a SingleCellExperiment object stopifnot(is(sce, "SingleCellExperiment")) diff --git a/R/check_spe.R b/R/check_spe.R index d0344daa..47de3c0a 100644 --- a/R/check_spe.R +++ b/R/check_spe.R @@ -25,14 +25,13 @@ #' ## Check the object #' check_spe(spe) #' } -check_spe <- function( - spe, - variables = c( - "sum_umi", - "sum_gene", - "expr_chrM", - "expr_chrM_ratio" - )) { +check_spe <- function(spe, + variables = c( + "sum_umi", + "sum_gene", + "expr_chrM", + "expr_chrM_ratio" + )) { ## Should be a SpatialExperiment object stopifnot(is(spe, "SpatialExperiment")) diff --git a/R/fetch_data.R b/R/fetch_data.R index 3426ae6d..94b4bea8 100644 --- a/R/fetch_data.R +++ b/R/fetch_data.R @@ -84,26 +84,30 @@ #' #> 172.28 MB #' } fetch_data <- - function(type = c( - "sce", - "sce_layer", - "modeling_results", - "sce_example", - "spe", - "spatialDLPFC_Visium", - "spatialDLPFC_Visium_example_subset", - "spatialDLPFC_Visium_pseudobulk", - "spatialDLPFC_Visium_modeling_results", - "spatialDLPFC_Visium_SPG", - "spatialDLPFC_snRNAseq", - "Visium_SPG_AD_Visium_wholegenome_spe", - "Visium_SPG_AD_Visium_targeted_spe", - "Visium_SPG_AD_Visium_wholegenome_pseudobulk_spe", - "Visium_SPG_AD_Visium_wholegenome_modeling_results" - ), - destdir = tempdir(), - eh = ExperimentHub::ExperimentHub(), - bfc = BiocFileCache::BiocFileCache()) { + function( + type = c( + "sce", + "sce_layer", + "modeling_results", + "sce_example", + "spe", + "spatialDLPFC_Visium", + "spatialDLPFC_Visium_example_subset", + "spatialDLPFC_Visium_pseudobulk", + "spatialDLPFC_Visium_modeling_results", + "spatialDLPFC_Visium_SPG", + "spatialDLPFC_snRNAseq", + "Visium_SPG_AD_Visium_wholegenome_spe", + "Visium_SPG_AD_Visium_targeted_spe", + "Visium_SPG_AD_Visium_wholegenome_pseudobulk_spe", + "Visium_SPG_AD_Visium_wholegenome_modeling_results", + "Visium_LS_spe", + "Visium_LS_spaceranger", + "Visium_LS_ImageJ_out" + ), + destdir = tempdir(), + eh = ExperimentHub::ExperimentHub(), + bfc = BiocFileCache::BiocFileCache()) { ## Some variables sce <- sce_layer <- modeling_results <- sce_sub <- spe <- NULL @@ -258,6 +262,30 @@ fetch_data <- file_name <- "Visium_IF_AD_modeling_results.Rdata" url <- "https://www.dropbox.com/s/5plupu8bj5m0kfh/Visium_IF_AD_modeling_results.Rdata?dl=1" + } else if (type == "Visium_LS_spe") { + tag <- "VisiumLS_Visium_stitched_spatialLIBD" + hub_title <- type + + ## While EH is not set-up + file_name <- "Visium_LS_spe.rds" + url <- + "https://www.dropbox.com/scl/fi/9re464y6qaojx3r94nq5u/Visium_LS_spe.rds?rlkey=nq6a82u23xuu9hohr86oodwdi&dl=1" + } else if (type == "Visium_LS_spaceranger") { + tag <- "VisiumLS_Visium_stitched_spatialLIBD" + hub_title <- type + + ## While EH is not set-up + file_name <- "Visium_LS_spaceranger.zip" + url <- + "https://www.dropbox.com/scl/fi/5jdoaukvhq3v7lk19228y/Visium_LS_spaceranger.zip?rlkey=bdgjc6mgy1ierdad6h6v5g29c&dl=1" + } else if (type == "Visium_LS_ImageJ_out") { + tag <- "VisiumLS_Visium_stitched_spatialLIBD" + hub_title <- type + + ## While EH is not set-up + file_name <- "Visium_LS_imagej_out.zip" + url <- + "https://www.dropbox.com/scl/fi/bevo52e96f2kdwllf8dkk/Visium_LS_imagej_out.zip?rlkey=ptwal8f5zxakzejwd0oqw0lhj&dl=1" } file_path <- file.path(destdir, file_name) diff --git a/R/frame_limits.R b/R/frame_limits.R index 320cc643..b22b5c8a 100644 --- a/R/frame_limits.R +++ b/R/frame_limits.R @@ -37,17 +37,16 @@ #' } #' frame_limits <- - function( - spe, - sampleid, - image_id = "lowres", - visium_grid = list( - row_min = 0, - row_max = 77, - col_min = 0, - col_max = 127, - fiducial_vs_capture_edge = (8 - 6.5) * 1000 / 2 / 100 - )) { + function(spe, + sampleid, + image_id = "lowres", + visium_grid = list( + row_min = 0, + row_max = 77, + col_min = 0, + col_max = 127, + fiducial_vs_capture_edge = (8 - 6.5) * 1000 / 2 / 100 + )) { ## Subset the info we need for the particular sample d <- as.data.frame(cbind(colData(spe), SpatialExperiment::spatialCoords(spe))[spe$sample_id == sampleid, ], diff --git a/R/gene_set_enrichment.R b/R/gene_set_enrichment.R index e6b6a63d..1accea28 100644 --- a/R/gene_set_enrichment.R +++ b/R/gene_set_enrichment.R @@ -58,12 +58,11 @@ #' ## Explore the results #' asd_sfari_enrichment gene_set_enrichment <- - function( - gene_list, - fdr_cut = 0.1, - modeling_results = fetch_data(type = "modeling_results"), - model_type = names(modeling_results)[1], - reverse = FALSE) { + function(gene_list, + fdr_cut = 0.1, + modeling_results = fetch_data(type = "modeling_results"), + model_type = names(modeling_results)[1], + reverse = FALSE) { model_results <- modeling_results[[model_type]] ## Keep only the genes present diff --git a/R/gene_set_enrichment_plot.R b/R/gene_set_enrichment_plot.R index c155e672..4ccbfcbc 100644 --- a/R/gene_set_enrichment_plot.R +++ b/R/gene_set_enrichment_plot.R @@ -84,18 +84,17 @@ #' layerHeights = c(0, 40, 55, 75, 85, 110, 120, 135), #' ) gene_set_enrichment_plot <- - function( - enrichment, - xlabs = unique(enrichment$ID), - PThresh = 12, - ORcut = 3, - enrichOnly = FALSE, - layerHeights = c(0, seq_len(length(unique(enrichment$test)))) * 15, - mypal = c( - "white", - grDevices::colorRampPalette(RColorBrewer::brewer.pal(9, "YlOrRd"))(50) - ), - cex = 1.2) { + function(enrichment, + xlabs = unique(enrichment$ID), + PThresh = 12, + ORcut = 3, + enrichOnly = FALSE, + layerHeights = c(0, seq_len(length(unique(enrichment$test)))) * 15, + mypal = c( + "white", + grDevices::colorRampPalette(RColorBrewer::brewer.pal(9, "YlOrRd"))(50) + ), + cex = 1.2) { ## Re-order and shorten names if they match our data if (all(unique(enrichment$test) %in% c("WM", paste0("Layer", seq_len(6))))) { enrichment$test <- diff --git a/R/geom_spatial.R b/R/geom_spatial.R index 965db758..64f00cc3 100644 --- a/R/geom_spatial.R +++ b/R/geom_spatial.R @@ -58,15 +58,14 @@ #' ## Clean up #' rm(spe_sub) #' } -geom_spatial <- function( - mapping = NULL, - data = NULL, - stat = "identity", - position = "identity", - na.rm = FALSE, - show.legend = NA, - inherit.aes = FALSE, - ...) { +geom_spatial <- function(mapping = NULL, + data = NULL, + stat = "identity", + position = "identity", + na.rm = FALSE, + show.legend = NA, + inherit.aes = FALSE, + ...) { ## To avoid a NOTE on R CMD check ggname <- function(prefix, grob) { grob$name <- grid::grobName(grob, prefix) diff --git a/R/img_edit.R b/R/img_edit.R index 93aceee3..ec6fae90 100644 --- a/R/img_edit.R +++ b/R/img_edit.R @@ -58,25 +58,24 @@ #' plot(x) #' } img_edit <- - function( - spe, - sampleid, - image_id = "lowres", - channel = NA, - brightness = 100, - saturation = 100, - hue = 100, - enhance = FALSE, - contrast_sharpen = NA, - quantize_max = NA, - quantize_dither = TRUE, - equalize = FALSE, - normalize = FALSE, - transparent_color = NA, - transparent_fuzz = 0, - background_color = NA, - median_radius = NA, - negate = FALSE) { + function(spe, + sampleid, + image_id = "lowres", + channel = NA, + brightness = 100, + saturation = 100, + hue = 100, + enhance = FALSE, + contrast_sharpen = NA, + quantize_max = NA, + quantize_dither = TRUE, + equalize = FALSE, + normalize = FALSE, + transparent_color = NA, + transparent_fuzz = 0, + background_color = NA, + median_radius = NA, + negate = FALSE) { img <- magick::image_read(SpatialExperiment::imgRaster(spe, sample_id = sampleid, image_id = image_id)) diff --git a/R/img_update.R b/R/img_update.R index fdfe5b83..db6dfcb1 100644 --- a/R/img_update.R +++ b/R/img_update.R @@ -41,13 +41,12 @@ #' imgData(img_update(spe, sampleid = "151507", brightness = 25)) #' } img_update <- - function( - spe, - sampleid, - image_id = "lowres", - new_image_id = paste0("edited_", image_id), - overwrite = FALSE, - ...) { + function(spe, + sampleid, + image_id = "lowres", + new_image_id = paste0("edited_", image_id), + overwrite = FALSE, + ...) { img_data <- SpatialExperiment::imgData(spe) ## Skip this sample if there's no existing image to update diff --git a/R/img_update_all.R b/R/img_update_all.R index 314b9b0d..31c368c9 100644 --- a/R/img_update_all.R +++ b/R/img_update_all.R @@ -22,12 +22,11 @@ #' imgData(img_update_all(spe, brightness = 25)) #' } img_update_all <- - function( - spe, - image_id = "lowres", - new_image_id = paste0("edited_", image_id), - overwrite = FALSE, - ...) { + function(spe, + image_id = "lowres", + new_image_id = paste0("edited_", image_id), + overwrite = FALSE, + ...) { for (sampleid in unique(spe$sample_id)) { spe <- img_update( diff --git a/R/layer_boxplot.R b/R/layer_boxplot.R index 6a671a5e..345d5499 100644 --- a/R/layer_boxplot.R +++ b/R/layer_boxplot.R @@ -114,20 +114,19 @@ #' col_high_point = "firebrick4", #' cex = 3 #' ) -layer_boxplot <- function( - i = 1, - sig_genes = sig_genes_extract(), - short_title = TRUE, - sce_layer = fetch_data(type = "sce_layer"), - col_bkg_box = "grey80", - col_bkg_point = "grey40", - col_low_box = "violet", - col_low_point = "darkviolet", - col_high_box = "skyblue", - col_high_point = "dodgerblue4", - cex = 2, - group_var = "layer_guess_reordered_short", - assayname = "logcounts") { +layer_boxplot <- function(i = 1, + sig_genes = sig_genes_extract(), + short_title = TRUE, + sce_layer = fetch_data(type = "sce_layer"), + col_bkg_box = "grey80", + col_bkg_point = "grey40", + col_low_box = "violet", + col_low_point = "darkviolet", + col_high_box = "skyblue", + col_high_point = "dodgerblue4", + cex = 2, + group_var = "layer_guess_reordered_short", + assayname = "logcounts") { ## Extract the logcounts (default) mat <- assay(sce_layer, assayname) diff --git a/R/layer_matrix_plot.R b/R/layer_matrix_plot.R index 4a44fd18..f1530fb1 100644 --- a/R/layer_matrix_plot.R +++ b/R/layer_matrix_plot.R @@ -55,20 +55,19 @@ #' cex = 2 #' ) layer_matrix_plot <- - function( - matrix_values, - matrix_labels = NULL, - xlabs = NULL, - layerHeights = NULL, - mypal = c( - "white", - grDevices::colorRampPalette(RColorBrewer::brewer.pal(9, "YlOrRd"))(50) - ), - breaks = NULL, - axis.args = NULL, - srt = 45, - mar = c(8, 4 + (max(nchar(rownames(matrix_values))) %/% 3) * 0.5, 4, 2) + 0.1, - cex = 1.2) { + function(matrix_values, + matrix_labels = NULL, + xlabs = NULL, + layerHeights = NULL, + mypal = c( + "white", + grDevices::colorRampPalette(RColorBrewer::brewer.pal(9, "YlOrRd"))(50) + ), + breaks = NULL, + axis.args = NULL, + srt = 45, + mar = c(8, 4 + (max(nchar(rownames(matrix_values))) %/% 3) * 0.5, 4, 2) + 0.1, + cex = 1.2) { ## Create some default values in case the user didn't specify them if (is.null(xlabs)) { if (is.null(colnames(matrix_values))) { diff --git a/R/layer_stat_cor.R b/R/layer_stat_cor.R index f484c912..0ccf0bf2 100644 --- a/R/layer_stat_cor.R +++ b/R/layer_stat_cor.R @@ -49,12 +49,11 @@ #' top_n = 10 #' )) layer_stat_cor <- - function( - stats, - modeling_results = fetch_data(type = "modeling_results"), - model_type = names(modeling_results)[1], - reverse = FALSE, - top_n = NULL) { + function(stats, + modeling_results = fetch_data(type = "modeling_results"), + model_type = names(modeling_results)[1], + reverse = FALSE, + top_n = NULL) { model_results <- modeling_results[[model_type]] tstats <- diff --git a/R/layer_stat_cor_plot.R b/R/layer_stat_cor_plot.R index 0d2653b8..c0f4e924 100644 --- a/R/layer_stat_cor_plot.R +++ b/R/layer_stat_cor_plot.R @@ -72,12 +72,11 @@ #' top_n = 10 #' ), max = 0.25) layer_stat_cor_plot <- - function( - cor_stats_layer, - max = 0.81, - min = -max, - layerHeights = NULL, - cex = 1.2) { + function(cor_stats_layer, + max = 0.81, + min = -max, + layerHeights = NULL, + cex = 1.2) { ## From https://github.com/LieberInstitute/HumanPilot/blob/master/Analysis/Layer_Guesses/dlpfc_snRNAseq_annotation.R theSeq <- seq(min, max, by = 0.01) my.col <- grDevices::colorRampPalette(RColorBrewer::brewer.pal(7, "PRGn"))(length(theSeq)) diff --git a/R/prep_stitched_data.R b/R/prep_stitched_data.R new file mode 100644 index 00000000..1485d924 --- /dev/null +++ b/R/prep_stitched_data.R @@ -0,0 +1,74 @@ +#' Prepare stitched data for plotting +#' +#' Given a \code{SpatialExperiment} built with \code{visiumStitched::build_spe()} +#' , drop +#' excluded spots (specified by \code{spe$exclude_overlapping}) and compute an +#' appropriate spot size for plotting with \code{vis_gene()} or +#' \code{vis_clus()}, assuming the plot will be written to a PDF of default +#' dimensions (i.e. \code{width = 7} and \code{height = 7}). +#' +#' @param spe A \code{SpatialExperiment} built with +#' \code{visiumStitched::build_spe()}, containing a logical +#' \code{spe$exclude_overlapping} column specifying which spots to display in +#' plots +#' @inheritParams vis_clus +#' +#' @return A list with names \code{spe} and \code{point_size} containing a +#' filtered, ready-to-plot \code{SpatialExperiment} and an appropriate spot size +#' (passed to \code{vis_gene()} or \code{vis_clus()}), respectively +#' +#' @author Nicholas J. Eagles +#' @keywords internal +prep_stitched_data <- function(spe, point_size, image_id) { + # State assumptions about columns expected to be in the colData + expected_cols <- c("array_row", "array_col", "exclude_overlapping") + if (!all(expected_cols %in% colnames(colData(spe)))) { + stop( + sprintf( + 'Missing at least one of the following colData columns: "%s"', + paste(expected_cols, collapse = '", "') + ), + call. = FALSE + ) + } + + if (any(is.na(spe$exclude_overlapping))) { + stop("spe$exclude_overlapping must not have NAs", call. = FALSE) + } + + # Drop excluded spots; verify some spots are not excluded + subset_cols <- !spe$exclude_overlapping + if (length(which(subset_cols)) == 0) { + stop( + "spe$exclude_overlapping must include some FALSE values to plot", + call. = FALSE + ) + } + spe <- spe[, subset_cols] + + # Compute an appropriate spot size for this sample + + # Determine some pixel values for the horizontal bounds of the spots + MIN_COL <- min(spatialCoords(spe)[, "pxl_row_in_fullres"]) + MAX_COL <- max(spatialCoords(spe)[, "pxl_row_in_fullres"]) + + # The distance between spots (in pixels) is double the average distance + # between array columns + INTER_SPOT_DIST_PX <- 2 * (MAX_COL - MIN_COL) / + (max(spe$array_col) - min(spe$array_col)) + + # Find the appropriate spot size for this donor. This can vary because + # ggplot downscales a plot to fit desired output dimensions (in this + # case presumably a square region on a PDF), and stitched images can vary + # in aspect ratio. Also, lowres images always have a larger image + # dimension of 1200, no matter how many spots fit in either dimension. + small_image_data <- imgData(spe)[ + imgData(spe)$image_id == image_id, + ] + + # The coefficient of 100 was determined empirically + point_size <- point_size * 100 * INTER_SPOT_DIST_PX * + small_image_data$scaleFactor / max(dim(small_image_data$data[[1]])) + + return(list(spe = spe, point_size = point_size)) +} diff --git a/R/read10xVisiumAnalysis.R b/R/read10xVisiumAnalysis.R index 70bc49ac..ef76f1d0 100644 --- a/R/read10xVisiumAnalysis.R +++ b/R/read10xVisiumAnalysis.R @@ -24,8 +24,9 @@ #' #' ## Note that ?SpatialExperiment::read10xVisium doesn't include all the files #' ## we need to illustrate read10xVisiumWrapper(). -read10xVisiumAnalysis <- function(samples = "", - sample_id = paste0("sample", sprintf("%02d", seq_along(samples)))) { +read10xVisiumAnalysis <- function( + samples = "", + sample_id = paste0("sample", sprintf("%02d", seq_along(samples)))) { # check sample identifiers if (is.null(sids <- names(samples))) { if (is.null(sids <- sample_id)) { diff --git a/R/read10xVisiumWrapper.R b/R/read10xVisiumWrapper.R index d9f31fc2..501a744d 100644 --- a/R/read10xVisiumWrapper.R +++ b/R/read10xVisiumWrapper.R @@ -44,17 +44,16 @@ #' #' ## Note that ?SpatialExperiment::read10xVisium doesn't include all the files #' ## we need to illustrate read10xVisiumWrapper(). -read10xVisiumWrapper <- function( - samples = "", - sample_id = paste0("sample", sprintf("%02d", seq_along(samples))), - type = c("HDF5", "sparse"), - data = c("filtered", "raw"), - images = c("lowres", "hires", "detected", "aligned"), - load = TRUE, - reference_gtf = NULL, - chrM = "chrM", - gtf_cols = c("source", "type", "gene_id", "gene_version", "gene_name", "gene_type"), - verbose = TRUE) { +read10xVisiumWrapper <- function(samples = "", + sample_id = paste0("sample", sprintf("%02d", seq_along(samples))), + type = c("HDF5", "sparse"), + data = c("filtered", "raw"), + images = c("lowres", "hires", "detected", "aligned"), + load = TRUE, + reference_gtf = NULL, + chrM = "chrM", + gtf_cols = c("source", "type", "gene_id", "gene_version", "gene_name", "gene_type"), + verbose = TRUE) { stopifnot(all(c("gene_name", "gene_id") %in% gtf_cols)) if (missing(reference_gtf)) { diff --git a/R/registration_model.R b/R/registration_model.R index 6921dbb9..3f36260c 100644 --- a/R/registration_model.R +++ b/R/registration_model.R @@ -24,10 +24,9 @@ #' head(registration_mod) #' registration_model <- - function( - sce_pseudo, - covars = NULL, - var_registration = "registration_variable") { + function(sce_pseudo, + covars = NULL, + var_registration = "registration_variable") { ## Specify a formula without an intercept if (is.null(covars)) { mat_formula <- diff --git a/R/registration_pseudobulk.R b/R/registration_pseudobulk.R index 2d859e4e..5f3c5dd2 100644 --- a/R/registration_pseudobulk.R +++ b/R/registration_pseudobulk.R @@ -51,12 +51,13 @@ #' sce_pseudo <- registration_pseudobulk(sce, "Cell_Cycle", "sample_id", c("age"), min_ncells = NULL) #' colData(sce_pseudo) registration_pseudobulk <- - function(sce, - var_registration, - var_sample_id, - covars = NULL, - min_ncells = 10, - pseudobulk_rds_file = NULL) { + function( + sce, + var_registration, + var_sample_id, + covars = NULL, + min_ncells = 10, + pseudobulk_rds_file = NULL) { ## Check that inputs are correct stopifnot(is(sce, "SingleCellExperiment")) stopifnot(var_registration %in% colnames(colData(sce))) diff --git a/R/registration_stats_anova.R b/R/registration_stats_anova.R index d1d0b135..c899459d 100644 --- a/R/registration_stats_anova.R +++ b/R/registration_stats_anova.R @@ -50,15 +50,14 @@ #' results_anova_merged <- merge(results_anova, results_anova_nocovar) #' head(results_anova_merged) registration_stats_anova <- - function( - sce_pseudo, - block_cor, - covars = NULL, - var_registration = "registration_variable", - var_sample_id = "registration_sample_id", - gene_ensembl = NULL, - gene_name = NULL, - suffix = "") { + function(sce_pseudo, + block_cor, + covars = NULL, + var_registration = "registration_variable", + var_sample_id = "registration_sample_id", + gene_ensembl = NULL, + gene_name = NULL, + suffix = "") { if (is.null(covars)) { mat_formula <- eval(str2expression(paste("~", var_registration))) } else { diff --git a/R/registration_stats_enrichment.R b/R/registration_stats_enrichment.R index cd3ee182..d186547e 100644 --- a/R/registration_stats_enrichment.R +++ b/R/registration_stats_enrichment.R @@ -34,13 +34,14 @@ #' ) #' head(results_enrichment_nan) registration_stats_enrichment <- - function(sce_pseudo, - block_cor, - covars = NULL, - var_registration = "registration_variable", - var_sample_id = "registration_sample_id", - gene_ensembl = NULL, - gene_name = NULL) { + function( + sce_pseudo, + block_cor, + covars = NULL, + var_registration = "registration_variable", + var_sample_id = "registration_sample_id", + gene_ensembl = NULL, + gene_name = NULL) { ## For each cluster, test it against the rest cluster_idx <- split(seq(along = sce_pseudo[[var_registration]]), sce_pseudo[[var_registration]]) diff --git a/R/registration_stats_pairwise.R b/R/registration_stats_pairwise.R index 09bb3ff9..afb9771a 100644 --- a/R/registration_stats_pairwise.R +++ b/R/registration_stats_pairwise.R @@ -32,13 +32,14 @@ #' ) #' head(results_pairwise_nan) registration_stats_pairwise <- - function(sce_pseudo, - registration_model, - block_cor, - var_registration = "registration_variable", - var_sample_id = "registration_sample_id", - gene_ensembl = NULL, - gene_name = NULL) { + function( + sce_pseudo, + registration_model, + block_cor, + var_registration = "registration_variable", + var_sample_id = "registration_sample_id", + gene_ensembl = NULL, + gene_name = NULL) { ## Identify which are the pairwise columns of interest (aka, don't use ## the sample-level covariates we are adjusting for) and then ## shorten the names diff --git a/R/registration_wrapper.R b/R/registration_wrapper.R index 38a1c297..49896d78 100644 --- a/R/registration_wrapper.R +++ b/R/registration_wrapper.R @@ -50,15 +50,16 @@ #' "Cell_Cycle", "sample_id", c("age"), "ensembl", "gene_name", "wrapper" #' ) registration_wrapper <- - function(sce, - var_registration, - var_sample_id, - covars = NULL, - gene_ensembl = NULL, - gene_name = NULL, - suffix = "", - min_ncells = 10, - pseudobulk_rds_file = NULL) { + function( + sce, + var_registration, + var_sample_id, + covars = NULL, + gene_ensembl = NULL, + gene_name = NULL, + suffix = "", + min_ncells = 10, + pseudobulk_rds_file = NULL) { ## Change the rownames to ENSEMBL IDs rownames(sce) <- rowData(sce)[, gene_ensembl] diff --git a/R/run_app.R b/R/run_app.R index 93701444..851045a3 100644 --- a/R/run_app.R +++ b/R/run_app.R @@ -40,6 +40,7 @@ #' automatically cropping the images. Set this to `FALSE` if your images do not #' follow the Visium grid size expectations, which are key for enabling #' auto-cropping. +#' @inheritParams vis_clus #' @param ... Other arguments passed to the list of golem options for running #' the application. #' @@ -185,6 +186,28 @@ #' ## * https://github.com/LieberInstitute/spatialDLPFC/tree/main/code/deploy_app_k09_position_noWM #' ## * https://github.com/LieberInstitute/spatialDLPFC/tree/main/code/deploy_app_k16 #' ## * https://github.com/LieberInstitute/spatialDLPFC/tree/main/code/analysis_IF/03_spatialLIBD_app +#' +#' +#' ## Example for an object with multiple capture areas stitched together with +#' ## . +#' spe_stitched <- fetch_data("Visium_LS_spe") +#' +#' ## Inspect this object +#' spe_stitched +#' +#' ## Notice the use of "exclude_overlapping" +#' table(spe_stitched$exclude_overlapping, useNA = "ifany") +#' +#' ## Run the app with this stitched data +#' run_app( +#' spe = spe_stitched, +#' sce_layer = NULL, modeling_results = NULL, sig_genes = NULL, +#' title = "visiumStitched example data", +#' spe_discrete_vars = c("capture_area", "scran_quick_cluster", "ManualAnnotation"), +#' spe_continuous_vars = c("sum_umi", "sum_gene", "expr_chrM", "expr_chrM_ratio"), +#' default_cluster = "scran_quick_cluster", +#' is_stitched = TRUE +#' ) #' } run_app <- function( spe = fetch_data(type = "spe"), @@ -234,10 +257,12 @@ run_app <- function( ), default_cluster = "spatialLIBD", auto_crop_default = TRUE, + is_stitched = FALSE, ...) { ## Run the checks in the relevant order stopifnot(length(default_cluster) == 1) stopifnot(default_cluster %in% spe_discrete_vars) + if (is_stitched) auto_crop_default <- FALSE spe <- check_spe(spe, @@ -282,6 +307,7 @@ run_app <- function( spe_continuous_vars = spe_continuous_vars, default_cluster = default_cluster, auto_crop_default = auto_crop_default, + is_stitched = is_stitched, ... ) ) diff --git a/R/sig_genes_extract.R b/R/sig_genes_extract.R index fac5f65b..b21902c1 100644 --- a/R/sig_genes_extract.R +++ b/R/sig_genes_extract.R @@ -59,11 +59,12 @@ #' sce_layer = sce_layer, #' n = nrow(sce_layer) #' ) -sig_genes_extract <- function(n = 10, - modeling_results = fetch_data(type = "modeling_results"), - model_type = names(modeling_results)[1], - reverse = FALSE, - sce_layer = fetch_data(type = "sce_layer")) { +sig_genes_extract <- function( + n = 10, + modeling_results = fetch_data(type = "modeling_results"), + model_type = names(modeling_results)[1], + reverse = FALSE, + sce_layer = fetch_data(type = "sce_layer")) { model_results <- modeling_results[[model_type]] tstats <- diff --git a/R/sig_genes_extract_all.R b/R/sig_genes_extract_all.R index 0d68b880..d2c3c01f 100644 --- a/R/sig_genes_extract_all.R +++ b/R/sig_genes_extract_all.R @@ -27,9 +27,10 @@ #' modeling_results = modeling_results, #' sce_layer = sce_layer #' ) -sig_genes_extract_all <- function(n = 10, - modeling_results = fetch_data(type = "modeling_results"), - sce_layer = fetch_data(type = "sce_layer")) { +sig_genes_extract_all <- function( + n = 10, + modeling_results = fetch_data(type = "modeling_results"), + sce_layer = fetch_data(type = "sce_layer")) { ## Run checks since this function is run by default by run_app() ## before the checks have been run elsewhere sce_layer <- check_sce_layer(sce_layer) diff --git a/R/vis_clus.R b/R/vis_clus.R index 5e1cfc1a..2dae1971 100644 --- a/R/vis_clus.R +++ b/R/vis_clus.R @@ -29,6 +29,12 @@ #' alpha blending already, which will make non-NA values pop up more and the NA #' values will show with a lighter color. This behavior is lost when `alpha` is #' set to a non-`NA` value. +#' @param is_stitched A \code{logical(1)} vector: If `TRUE`, expects a +#' [SpatialExperiment-class][SpatialExperiment::SpatialExperiment-class] built +#' with `visiumStitched::build_spe()`. +#' ; in +#' particular, expects a logical colData column `exclude_overlapping` +#' specifying which spots to exclude from the plot. Sets `auto_crop = FALSE`. #' @param ... Passed to [paste0()][base::paste] for making the title of the #' plot following the `sampleid`. #' @@ -93,30 +99,32 @@ #' ) #' print(p4) #' } -vis_clus <- function(spe, - sampleid = unique(spe$sample_id)[1], - clustervar, - colors = c( - "#b2df8a", - "#e41a1c", - "#377eb8", - "#4daf4a", - "#ff7f00", - "gold", - "#a65628", - "#999999", - "black", - "grey", - "white", - "purple" - ), - spatial = TRUE, - image_id = "lowres", - alpha = NA, - point_size = 2, - auto_crop = TRUE, - na_color = "#CCCCCC40", - ...) { +vis_clus <- function( + spe, + sampleid = unique(spe$sample_id)[1], + clustervar, + colors = c( + "#b2df8a", + "#e41a1c", + "#377eb8", + "#4daf4a", + "#ff7f00", + "gold", + "#a65628", + "#999999", + "black", + "grey", + "white", + "purple" + ), + spatial = TRUE, + image_id = "lowres", + alpha = NA, + point_size = 2, + auto_crop = TRUE, + na_color = "#CCCCCC40", + is_stitched = FALSE, + ...) { # Verify existence and legitimacy of 'sampleid' if ( !("sample_id" %in% colnames(colData(spe))) || @@ -130,7 +138,26 @@ vis_clus <- function(spe, ) } + # Check validity of spatial coordinates + if (!setequal(c("pxl_col_in_fullres", "pxl_row_in_fullres"), colnames(spatialCoords(spe)))) { + stop( + "Abnormal spatial coordinates: should have 'pxl_row_in_fullres' and 'pxl_col_in_fullres' columns.", + call. = FALSE + ) + } + spe_sub <- spe[, spe$sample_id == sampleid] + + if (is_stitched) { + # Drop excluded spots and calculate an appropriate point size + temp <- prep_stitched_data(spe_sub, point_size, image_id) + spe_sub <- temp$spe + point_size <- temp$point_size + + # Frame limits are poorly defined for stitched data + auto_crop <- FALSE + } + d <- as.data.frame(cbind(colData(spe_sub), SpatialExperiment::spatialCoords(spe_sub)), optional = TRUE) vis_clus_p( diff --git a/R/vis_clus_p.R b/R/vis_clus_p.R index d2b37cec..a91ce369 100644 --- a/R/vis_clus_p.R +++ b/R/vis_clus_p.R @@ -42,19 +42,18 @@ #' rm(spe_sub) #' } vis_clus_p <- - function( - spe, - d, - clustervar, - sampleid = unique(spe$sample_id)[1], - colors, - spatial, - title, - image_id = "lowres", - alpha = NA, - point_size = 2, - auto_crop = TRUE, - na_color = "#CCCCCC40") { + function(spe, + d, + clustervar, + sampleid = unique(spe$sample_id)[1], + colors, + spatial, + title, + image_id = "lowres", + alpha = NA, + point_size = 2, + auto_crop = TRUE, + na_color = "#CCCCCC40") { ## Some variables pxl_row_in_fullres <- pxl_col_in_fullres <- key <- NULL # stopifnot(all(c("pxl_col_in_fullres", "pxl_row_in_fullres", "key") %in% colnames(d))) diff --git a/R/vis_gene.R b/R/vis_gene.R index 594940af..6a28af3f 100644 --- a/R/vis_gene.R +++ b/R/vis_gene.R @@ -158,21 +158,23 @@ #' print(p8) #' } vis_gene <- - function(spe, - sampleid = unique(spe$sample_id)[1], - geneid = rowData(spe)$gene_search[1], - spatial = TRUE, - assayname = "logcounts", - minCount = 0, - viridis = TRUE, - image_id = "lowres", - alpha = NA, - cont_colors = if (viridis) viridisLite::viridis(21) else c("aquamarine4", "springgreen", "goldenrod", "red"), - point_size = 2, - auto_crop = TRUE, - na_color = "#CCCCCC40", - multi_gene_method = c("z_score", "pca", "sparsity"), - ...) { + function( + spe, + sampleid = unique(spe$sample_id)[1], + geneid = rowData(spe)$gene_search[1], + spatial = TRUE, + assayname = "logcounts", + minCount = 0, + viridis = TRUE, + image_id = "lowres", + alpha = NA, + cont_colors = if (viridis) viridisLite::viridis(21) else c("aquamarine4", "springgreen", "goldenrod", "red"), + point_size = 2, + auto_crop = TRUE, + na_color = "#CCCCCC40", + multi_gene_method = c("z_score", "pca", "sparsity"), + is_stitched = FALSE, + ...) { multi_gene_method <- rlang::arg_match(multi_gene_method) # Verify existence and legitimacy of 'sampleid' if ( @@ -192,7 +194,26 @@ vis_gene <- stop(sprintf("'%s' is not an assay in 'spe'", assayname), call. = FALSE) } + # Check validity of spatial coordinates + if (!setequal(c("pxl_col_in_fullres", "pxl_row_in_fullres"), colnames(spatialCoords(spe)))) { + stop( + "Abnormal spatial coordinates: should have 'pxl_row_in_fullres' and 'pxl_col_in_fullres' columns.", + call. = FALSE + ) + } + spe_sub <- spe[, spe$sample_id == sampleid] + + if (is_stitched) { + # Drop excluded spots and calculate an appropriate point size + temp <- prep_stitched_data(spe_sub, point_size, image_id) + spe_sub <- temp$spe + point_size <- temp$point_size + + # Frame limits are poorly defined for stitched data + auto_crop <- FALSE + } + d <- as.data.frame(cbind(colData(spe_sub), SpatialExperiment::spatialCoords(spe_sub)), optional = TRUE) # Verify legitimacy of names in geneid diff --git a/R/vis_gene_p.R b/R/vis_gene_p.R index 9bc3dc0a..e659d477 100644 --- a/R/vis_gene_p.R +++ b/R/vis_gene_p.R @@ -48,24 +48,23 @@ #' rm(spe_sub) #' } vis_gene_p <- - function( - spe, - d, - sampleid = unique(spe$sample_id)[1], - spatial, - title, - viridis = TRUE, - image_id = "lowres", - alpha = NA, - cont_colors = if (viridis) { - viridisLite::viridis(21) - } else { - c("aquamarine4", "springgreen", "goldenrod", "red") - }, - point_size = 2, - auto_crop = TRUE, - na_color = "#CCCCCC40", - legend_title = "") { + function(spe, + d, + sampleid = unique(spe$sample_id)[1], + spatial, + title, + viridis = TRUE, + image_id = "lowres", + alpha = NA, + cont_colors = if (viridis) { + viridisLite::viridis(21) + } else { + c("aquamarine4", "springgreen", "goldenrod", "red") + }, + point_size = 2, + auto_crop = TRUE, + na_color = "#CCCCCC40", + legend_title = "") { ## Some variables pxl_row_in_fullres <- pxl_col_in_fullres <- key <- COUNT <- NULL diff --git a/R/vis_grid_clus.R b/R/vis_grid_clus.R index 74b4d3ce..c84dbac4 100644 --- a/R/vis_grid_clus.R +++ b/R/vis_grid_clus.R @@ -63,6 +63,7 @@ vis_grid_clus <- point_size = 2, auto_crop = TRUE, na_color = "#CCCCCC40", + is_stitched = FALSE, ...) { stopifnot(all(sample_order %in% unique(spe$sample_id))) @@ -82,6 +83,7 @@ vis_grid_clus <- point_size = point_size, auto_crop = auto_crop, na_color = na_color, + is_stitched = is_stitched, ... ) }) diff --git a/R/vis_grid_gene.R b/R/vis_grid_gene.R index 2504cce5..bf32dd7a 100644 --- a/R/vis_grid_gene.R +++ b/R/vis_grid_gene.R @@ -53,6 +53,7 @@ vis_grid_gene <- point_size = 2, auto_crop = TRUE, na_color = "#CCCCCC40", + is_stitched = FALSE, ...) { stopifnot(all(sample_order %in% unique(spe$sample_id))) @@ -71,6 +72,7 @@ vis_grid_gene <- point_size = point_size, auto_crop = auto_crop, na_color = na_color, + is_stitched = is_stitched, ... ) }) diff --git a/README.Rmd b/README.Rmd index 27248ae7..573bd17d 100644 --- a/README.Rmd +++ b/README.Rmd @@ -70,6 +70,16 @@ spatialLIBD::run_app() * [Main shiny application website](http://spatial.libd.org/spatialLIBD/) (note that the link must have a trailing slash `/` for it to work) * [Shinyapps](https://libd.shinyapps.io/spatialLIBD/) This version has less RAM memory but is typically deployed using the latest version of `spatialLIBD`. +## Introductory material + +If you prefer to watch a video overview of the `HumanPilot` project, check the following journal club presentation of the main results. + + + +You might also be interested in the explainer video and [companion blog post](https://lcolladotor.github.io/2024/05/23/humanpilot-first-spatially-resolved-transcriptomics-study-using-visium/) as well as [the original Feb 29, 2020 blog post](https://lcolladotor.github.io/2020/02/29/diving-together-into-the-unknown-world-of-spatial-transcriptomics/) from when we first made this project public. + + + ## R/Bioconductor package The `spatialLIBD` package contains functions for: diff --git a/README.md b/README.md index b15cfbdc..c4c49cd2 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,23 @@ spatialLIBD::run_app() less RAM memory but is typically deployed using the latest version of `spatialLIBD`. +## Introductory material + +If you prefer to watch a video overview of the `HumanPilot` project, +check the following journal club presentation of the main results. + + + +You might also be interested in the explainer video and [companion blog +post](https://lcolladotor.github.io/2024/05/23/humanpilot-first-spatially-resolved-transcriptomics-study-using-visium/) +as well as [the original Feb 29, 2020 blog +post](https://lcolladotor.github.io/2020/02/29/diving-together-into-the-unknown-world-of-spatial-transcriptomics/) +from when we first made this project public. + + + ## R/Bioconductor package The `spatialLIBD` package contains functions for: @@ -198,10 +215,16 @@ spe #> altExpNames(0): #> spatialCoords names(2) : pxl_col_in_fullres pxl_row_in_fullres #> imgData names(4): sample_id image_id data scaleFactor +``` + +``` r ## Note the memory size lobstr::obj_size(spe) #> 2.04 GB +``` + +``` r ## Remake the logo image with histology information vis_clus( @@ -222,20 +245,20 @@ You can access all the raw data through Furthermore, below you can find the links to the raw data we received from 10x Genomics. -| SampleID | h5_filtered | h5_raw | image_full | image_hi | image_lo | loupe | HTML_report | -|---------:|:------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------| -| 151507 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151507_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151507_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151507_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151507_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151507_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151507.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151507/151507_web_summary.html) | -| 151508 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151508_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151508_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151508_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151508_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151508_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151508.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151508/151508_web_summary.html) | -| 151509 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151509_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151509_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151509_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151509_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151509_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151509.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151509/151509_web_summary.html) | -| 151510 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151510_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151510_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151510_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151510_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151510_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151510.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151510/151510_web_summary.html) | -| 151669 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151669_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151669_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151669_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151669_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151669_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151669.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151669/151669_web_summary.html) | -| 151670 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151670_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151670_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151670_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151670_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151670_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151670.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151670/151670_web_summary.html) | -| 151671 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151671_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151671_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151671_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151671_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151671_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151671.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151671/151671_web_summary.html) | -| 151672 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151672_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151672_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151672_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151672_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151672_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151672.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151672/151672_web_summary.html) | -| 151673 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151673_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151673_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151673_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151673_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151673_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151673.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151673/151673_web_summary.html) | -| 151674 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151674_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151674_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151674_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151674_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151674_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151674.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151674/151674_web_summary.html) | -| 151675 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151675_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151675_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151675_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151675_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151675_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151675.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151675/151675_web_summary.html) | -| 151676 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151676_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151676_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151676_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151676_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151676_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151676.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151676/151676_web_summary.html) | +| SampleID | h5_filtered | h5_raw | image_full | image_hi | image_lo | loupe | HTML_report | +|---:|:---|:---|:---|:---|:---|:---|:---| +| 151507 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151507_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151507_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151507_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151507_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151507_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151507.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151507/151507_web_summary.html) | +| 151508 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151508_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151508_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151508_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151508_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151508_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151508.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151508/151508_web_summary.html) | +| 151509 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151509_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151509_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151509_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151509_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151509_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151509.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151509/151509_web_summary.html) | +| 151510 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151510_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151510_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151510_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151510_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151510_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151510.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151510/151510_web_summary.html) | +| 151669 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151669_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151669_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151669_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151669_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151669_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151669.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151669/151669_web_summary.html) | +| 151670 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151670_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151670_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151670_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151670_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151670_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151670.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151670/151670_web_summary.html) | +| 151671 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151671_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151671_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151671_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151671_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151671_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151671.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151671/151671_web_summary.html) | +| 151672 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151672_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151672_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151672_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151672_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151672_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151672.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151672/151672_web_summary.html) | +| 151673 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151673_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151673_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151673_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151673_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151673_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151673.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151673/151673_web_summary.html) | +| 151674 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151674_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151674_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151674_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151674_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151674_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151674.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151674/151674_web_summary.html) | +| 151675 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151675_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151675_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151675_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151675_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151675_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151675.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151675/151675_web_summary.html) | +| 151676 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151676_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151676_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151676_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151676_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151676_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151676.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151676/151676_web_summary.html) | ## Citation @@ -289,22 +312,21 @@ print(citation("spatialLIBD"), bibtex = TRUE) #> B, Grant-Peters M, Divecha HR, Tippani M, Sriworarat C, Nguyen AB, #> Ravichandran P, Tran MN, Seyedian A, Consortium P, Hyde TM, Kleinman #> JE, Battle A, Page SC, Ryten M, Hicks SC, Martinowich K, -#> Collado-Torres L, Maynard KR (2023). "Integrated single cell and -#> unsupervised spatial transcriptomic analysis defines molecular -#> anatomy of the human dorsolateral prefrontal cortex." _bioRxiv_. -#> doi:10.1101/2023.02.15.528722 -#> , -#> . +#> Collado-Torres L, Maynard KR (2024). "A data-driven single-cell and +#> spatial transcriptomic map of the human prefrontal cortex." +#> _Science_. doi:10.1126/science.adh1938 +#> , +#> . #> #> A BibTeX entry for LaTeX users is #> #> @Article{, -#> title = {Integrated single cell and unsupervised spatial transcriptomic analysis defines molecular anatomy of the human dorsolateral prefrontal cortex}, +#> title = {A data-driven single-cell and spatial transcriptomic map of the human prefrontal cortex}, #> author = {Louise A. Huuki-Myers and Abby Spangler and Nicholas J. Eagles and Kelsey D. Montgomergy and Sang Ho Kwon and Boyi Guo and Melissa Grant-Peters and Heena R. Divecha and Madhavi Tippani and Chaichontat Sriworarat and Annie B. Nguyen and Prashanthi Ravichandran and Matthew N. Tran and Arta Seyedian and PsychENCODE Consortium and Thomas M. Hyde and Joel E. Kleinman and Alexis Battle and Stephanie C. Page and Mina Ryten and Stephanie C. Hicks and Keri Martinowich and Leonardo Collado-Torres and Kristen R. Maynard}, -#> year = {2023}, -#> journal = {bioRxiv}, -#> doi = {10.1101/2023.02.15.528722}, -#> url = {https://www.biorxiv.org/content/10.1101/2023.02.15.528722v1}, +#> year = {2024}, +#> journal = {Science}, +#> doi = {10.1126/science.adh1938}, +#> url = {https://doi.org/10.1126/science.adh1938}, #> } #> #> Kwon SH, Parthiban S, Tippani M, Divecha HR, Eagles NJ, Lobana JS, @@ -312,9 +334,9 @@ print(citation("spatialLIBD"), bibtex = TRUE) #> Hicks SC, Martinowich K, Maynard KR, Collado-Torres L (2023). #> "Influence of Alzheimer’s disease related neuropathology on local #> microenvironment gene expression in the human inferior temporal -#> cortex." _bioRxiv_. doi:10.1101/2023.04.20.537710 -#> , -#> . +#> cortex." _GEN Biotechnology_. doi:10.1089/genbio.2023.0019 +#> , +#> . #> #> A BibTeX entry for LaTeX users is #> @@ -322,9 +344,9 @@ print(citation("spatialLIBD"), bibtex = TRUE) #> title = {Influence of Alzheimer’s disease related neuropathology on local microenvironment gene expression in the human inferior temporal cortex}, #> author = {Sang Ho Kwon and Sowmya Parthiban and Madhavi Tippani and Heena R. Divecha and Nicholas J. Eagles and Jashandeep S. Lobana and Stephen R. Williams and Michelle Mark and Rahul A. Bharadwaj and Joel E. Kleinman and Thomas M. Hyde and Stephanie C. Page and Stephanie C. Hicks and Keri Martinowich and Kristen R. Maynard and Leonardo Collado-Torres}, #> year = {2023}, -#> journal = {bioRxiv}, -#> doi = {10.1101/2023.04.20.537710}, -#> url = {https://www.biorxiv.org/content/10.1101/2023.04.20.537710v1}, +#> journal = {GEN Biotechnology}, +#> doi = {10.1089/genbio.2023.0019}, +#> url = {https://doi.org/10.1089/genbio.2023.0019}, #> } ``` @@ -349,7 +371,7 @@ By contributing to this project, you agree to abide by its terms. *[rcmdcheck](https://CRAN.R-project.org/package=rcmdcheck)* customized to use [Bioconductor’s docker containers](https://www.bioconductor.org/help/docker/) and - *[BiocCheck](https://bioconductor.org/packages/3.17/BiocCheck)*. + *[BiocCheck](https://bioconductor.org/packages/3.19/BiocCheck)*. - Code coverage assessment is possible thanks to [codecov](https://codecov.io/gh) and *[covr](https://CRAN.R-project.org/package=covr)*. @@ -366,7 +388,7 @@ By contributing to this project, you agree to abide by its terms. For more details, check the `dev` directory. This package was developed using -*[biocthis](https://bioconductor.org/packages/3.17/biocthis)*. +*[biocthis](https://bioconductor.org/packages/3.19/biocthis)*. @@ -379,6 +401,5 @@ This package was developed using window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); - gtag('config', 'G-QKT3SV9EFL'); diff --git a/inst/CITATION b/inst/CITATION index 36731c8c..e10fdcf2 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -45,7 +45,7 @@ c( url = "https://www.nature.com/articles/s41593-020-00787-0" ), bibentry(bibtype="article", - title = "Integrated single cell and unsupervised spatial transcriptomic analysis defines molecular anatomy of the human dorsolateral prefrontal cortex", + title = "A data-driven single-cell and spatial transcriptomic map of the human prefrontal cortex", author = personList( as.person("Louise A. Huuki-Myers"), as.person("Abby Spangler"), @@ -72,10 +72,10 @@ c( as.person("Leonardo Collado-Torres"), as.person("Kristen R. Maynard") ), - year = 2023, - journal = "bioRxiv", - doi = "10.1101/2023.02.15.528722", - url = "https://www.biorxiv.org/content/10.1101/2023.02.15.528722v1" + year = 2024, + journal = "Science", + doi = "10.1126/science.adh1938", + url = "https://doi.org/10.1126/science.adh1938" ), bibentry(bibtype="article", title = "Influence of Alzheimer’s disease related neuropathology on local microenvironment gene expression in the human inferior temporal cortex", @@ -98,8 +98,8 @@ c( as.person("Leonardo Collado-Torres") ), year = 2023, - journal = "bioRxiv", - doi = "10.1101/2023.04.20.537710", - url = "https://www.biorxiv.org/content/10.1101/2023.04.20.537710v1" + journal = "GEN Biotechnology", + doi = "10.1089/genbio.2023.0019", + url = "https://doi.org/10.1089/genbio.2023.0019" ) ) diff --git a/inst/app/www/README.md b/inst/app/www/README.md index 5a4d943a..8c3e846b 100644 --- a/inst/app/www/README.md +++ b/inst/app/www/README.md @@ -25,29 +25,31 @@ coverage](https://codecov.io/gh/LieberInstitute/spatialLIBD/branch/devel/graph/b status](https://github.com/LieberInstitute/spatialLIBD/workflows/R-CMD-check-bioc/badge.svg)](https://github.com/LieberInstitute/spatialLIBD/actions) [![GitHub issues](https://img.shields.io/github/issues/LieberInstitute/spatialLIBD)](https://github.com/LieberInstitute/spatialLIBD/issues) +[![GitHub +pulls](https://img.shields.io/github/issues-pr/LieberInstitute/spatialLIBD)](https://github.com/LieberInstitute/spatialLIBD/pulls) [![DOI](https://zenodo.org/badge/225913568.svg)](https://zenodo.org/badge/latestdoi/225913568) Welcome to the `spatialLIBD` project! It is composed of: -- a [shiny](https://shiny.rstudio.com/) web application that we are - hosting at - [spatial.libd.org/spatialLIBD/](http://spatial.libd.org/spatialLIBD/) - that can handle a - [limited](https://github.com/LieberInstitute/spatialLIBD/issues/2) - set of concurrent users, -- a Bioconductor package at - [bioconductor.org/packages/spatialLIBD](http://bioconductor.org/packages/spatialLIBD) - (or from [here](http://research.libd.org/spatialLIBD/)) that lets - you analyze the data and run a local version of our web application - (with our data or yours), -- and a [research article](https://doi.org/10.1038/s41593-020-00787-0) - with the scientific knowledge we drew from this dataset. The - analysis code for our project is available - [here](https://github.com/LieberInstitute/HumanPilot/) and the high - quality figures for the manuscript are available through - [Figshare](https://doi.org/10.6084/m9.figshare.13623902.v1). +- a [shiny](https://shiny.rstudio.com/) web application that we are + hosting at + [spatial.libd.org/spatialLIBD/](http://spatial.libd.org/spatialLIBD/) + that can handle a + [limited](https://github.com/LieberInstitute/spatialLIBD/issues/2) set + of concurrent users, +- a Bioconductor package at + [bioconductor.org/packages/spatialLIBD](http://bioconductor.org/packages/spatialLIBD) + (or from [here](http://research.libd.org/spatialLIBD/)) that lets you + analyze the data and run a local version of our web application (with + our data or yours), +- and a [research article](https://doi.org/10.1038/s41593-020-00787-0) + with the scientific knowledge we drew from this dataset. The analysis + code for our project is available + [here](https://github.com/LieberInstitute/HumanPilot/) and the high + quality figures for the manuscript are available through + [Figshare](https://doi.org/10.6084/m9.figshare.13623902.v1). The web application allows you to browse the LIBD human dorsolateral pre-frontal cortex (DLPFC) spatial transcriptomics data generated with @@ -115,19 +117,35 @@ spatialLIBD::run_app() less RAM memory but is typically deployed using the latest version of `spatialLIBD`. +## Introductory material + +If you prefer to watch a video overview of the `HumanPilot` project, +check the following journal club presentation of the main results. + + + +You might also be interested in the explainer video and [companion blog +post](https://lcolladotor.github.io/2024/05/23/humanpilot-first-spatially-resolved-transcriptomics-study-using-visium/) +as well as [the original Feb 29, 2020 blog +post](https://lcolladotor.github.io/2020/02/29/diving-together-into-the-unknown-world-of-spatial-transcriptomics/) +from when we first made this project public. + + + ## R/Bioconductor package The `spatialLIBD` package contains functions for: -- Accessing the spatial transcriptomics data from the LIBD Human Pilot - project ([code on - GitHub](https://github.com/LieberInstitute/HumanPilot)) generated - with the Visium platform from 10x Genomics. The data is retrieved - from [Bioconductor](http://bioconductor.org/)’s `ExperimentHub`. -- Visualizing the spot-level spatial gene expression data and - clusters. -- Inspecting the data interactively either on your computer or through - [spatial.libd.org/spatialLIBD/](http://spatial.libd.org/spatialLIBD/). +- Accessing the spatial transcriptomics data from the LIBD Human Pilot + project ([code on + GitHub](https://github.com/LieberInstitute/HumanPilot)) generated with + the Visium platform from 10x Genomics. The data is retrieved from + [Bioconductor](http://bioconductor.org/)’s `ExperimentHub`. +- Visualizing the spot-level spatial gene expression data and clusters. +- Inspecting the data interactively either on your computer or through + [spatial.libd.org/spatialLIBD/](http://spatial.libd.org/spatialLIBD/). For more details, please check the [documentation website](http://lieberinstitute.github.io/spatialLIBD) or the @@ -190,18 +208,23 @@ spe #> rowData names(9): source type ... gene_search is_top_hvg #> colnames(47681): AAACAACGAATAGTTC-1 AAACAAGTATCTCCCA-1 ... #> TTGTTTCCATACAACT-1 TTGTTTGTGTAAATTC-1 -#> colData names(66): sample_id Cluster ... spatialLIBD ManualAnnotation +#> colData names(69): sample_id Cluster ... array_row array_col #> reducedDimNames(6): PCA TSNE_perplexity50 ... TSNE_perplexity80 #> UMAP_neighbors15 #> mainExpName: NULL #> altExpNames(0): -#> spatialData names(3) : in_tissue array_row array_col #> spatialCoords names(2) : pxl_col_in_fullres pxl_row_in_fullres #> imgData names(4): sample_id image_id data scaleFactor +``` + +``` r ## Note the memory size -lobstr::obj_size(spe) +lobstr::obj_size(spe) #> 2.04 GB +``` + +``` r ## Remake the logo image with histology information vis_clus( @@ -222,20 +245,20 @@ You can access all the raw data through Furthermore, below you can find the links to the raw data we received from 10x Genomics. -| SampleID | h5\_filtered | h5\_raw | image\_full | image\_hi | image\_lo | loupe | HTML\_report | -|---------:|:------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------------| -| 151507 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151507_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151507_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151507_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151507_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151507_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151507.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151507/151507_web_summary.html) | -| 151508 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151508_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151508_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151508_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151508_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151508_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151508.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151508/151508_web_summary.html) | -| 151509 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151509_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151509_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151509_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151509_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151509_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151509.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151509/151509_web_summary.html) | -| 151510 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151510_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151510_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151510_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151510_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151510_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151510.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151510/151510_web_summary.html) | -| 151669 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151669_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151669_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151669_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151669_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151669_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151669.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151669/151669_web_summary.html) | -| 151670 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151670_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151670_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151670_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151670_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151670_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151670.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151670/151670_web_summary.html) | -| 151671 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151671_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151671_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151671_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151671_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151671_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151671.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151671/151671_web_summary.html) | -| 151672 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151672_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151672_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151672_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151672_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151672_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151672.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151672/151672_web_summary.html) | -| 151673 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151673_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151673_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151673_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151673_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151673_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151673.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151673/151673_web_summary.html) | -| 151674 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151674_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151674_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151674_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151674_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151674_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151674.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151674/151674_web_summary.html) | -| 151675 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151675_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151675_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151675_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151675_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151675_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151675.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151675/151675_web_summary.html) | -| 151676 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151676_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151676_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151676_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151676_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151676_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151676.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151676/151676_web_summary.html) | +| SampleID | h5_filtered | h5_raw | image_full | image_hi | image_lo | loupe | HTML_report | +|---:|:---|:---|:---|:---|:---|:---|:---| +| 151507 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151507_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151507_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151507_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151507_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151507_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151507.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151507/151507_web_summary.html) | +| 151508 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151508_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151508_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151508_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151508_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151508_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151508.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151508/151508_web_summary.html) | +| 151509 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151509_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151509_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151509_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151509_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151509_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151509.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151509/151509_web_summary.html) | +| 151510 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151510_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151510_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151510_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151510_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151510_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151510.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151510/151510_web_summary.html) | +| 151669 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151669_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151669_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151669_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151669_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151669_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151669.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151669/151669_web_summary.html) | +| 151670 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151670_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151670_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151670_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151670_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151670_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151670.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151670/151670_web_summary.html) | +| 151671 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151671_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151671_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151671_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151671_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151671_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151671.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151671/151671_web_summary.html) | +| 151672 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151672_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151672_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151672_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151672_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151672_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151672.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151672/151672_web_summary.html) | +| 151673 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151673_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151673_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151673_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151673_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151673_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151673.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151673/151673_web_summary.html) | +| 151674 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151674_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151674_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151674_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151674_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151674_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151674.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151674/151674_web_summary.html) | +| 151675 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151675_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151675_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151675_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151675_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151675_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151675.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151675/151675_web_summary.html) | +| 151676 | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151676_filtered_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/h5/151676_raw_feature_bc_matrix.h5) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151676_full_image.tif) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151676_tissue_hires_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/images/151676_tissue_lowres_image.png) | [AWS](https://spatial-dlpfc.s3.us-east-2.amazonaws.com/loupe/151676.cloupe) | [GitHub](https://github.com/LieberInstitute/HumanPilot/blob/master/10X/151676/151676_web_summary.html) | ## Citation @@ -245,13 +268,14 @@ Please run this yourself to check for any updates on how to cite ``` r print(citation("spatialLIBD"), bibtex = TRUE) +#> To cite package 'spatialLIBD' in publications use: #> -#> Pardo B, Spangler A, Weber LM, Hicks SC, Jaffe AE, Martinowich K, -#> Maynard KR, Collado-Torres L (2022). "spatialLIBD: an R/Bioconductor -#> package to visualize spatially-resolved transcriptomics data." -#> _BMC Genomics_. doi: 10.1186/s12864-022-08601-w (URL: -#> https://doi.org/10.1186/s12864-022-08601-w), https://doi.org/10.1186/s12864-022-08601-w>. +#> Pardo B, Spangler A, Weber LM, Hicks SC, Jaffe AE, Martinowich K, +#> Maynard KR, Collado-Torres L (2022). "spatialLIBD: an R/Bioconductor +#> package to visualize spatially-resolved transcriptomics data." _BMC +#> Genomics_. doi:10.1186/s12864-022-08601-w +#> , +#> . #> #> A BibTeX entry for LaTeX users is #> @@ -264,14 +288,14 @@ print(citation("spatialLIBD"), bibtex = TRUE) #> url = {https://doi.org/10.1186/s12864-022-08601-w}, #> } #> -#> Maynard KR, Collado-Torres L, Weber LM, Uytingco C, Barry BK, Williams -#> SR, II JLC, Tran MN, Besich Z, Tippani M, Chew J, Yin Y, Kleinman JE, -#> Hyde TM, Rao N, Hicks SC, Martinowich K, Jaffe AE (2021). -#> "Transcriptome-scale spatial gene expression in the human dorsolateral -#> prefrontal cortex." _Nature Neuroscience_. doi: -#> 10.1038/s41593-020-00787-0 (URL: -#> https://doi.org/10.1038/s41593-020-00787-0), https://www.nature.com/articles/s41593-020-00787-0>. +#> Maynard KR, Collado-Torres L, Weber LM, Uytingco C, Barry BK, +#> Williams SR, II JLC, Tran MN, Besich Z, Tippani M, Chew J, Yin Y, +#> Kleinman JE, Hyde TM, Rao N, Hicks SC, Martinowich K, Jaffe AE +#> (2021). "Transcriptome-scale spatial gene expression in the human +#> dorsolateral prefrontal cortex." _Nature Neuroscience_. +#> doi:10.1038/s41593-020-00787-0 +#> , +#> . #> #> A BibTeX entry for LaTeX users is #> @@ -283,8 +307,99 @@ print(citation("spatialLIBD"), bibtex = TRUE) #> doi = {10.1038/s41593-020-00787-0}, #> url = {https://www.nature.com/articles/s41593-020-00787-0}, #> } +#> +#> Huuki-Myers LA, Spangler A, Eagles NJ, Montgomergy KD, Kwon SH, Guo +#> B, Grant-Peters M, Divecha HR, Tippani M, Sriworarat C, Nguyen AB, +#> Ravichandran P, Tran MN, Seyedian A, Consortium P, Hyde TM, Kleinman +#> JE, Battle A, Page SC, Ryten M, Hicks SC, Martinowich K, +#> Collado-Torres L, Maynard KR (2024). "A data-driven single-cell and +#> spatial transcriptomic map of the human prefrontal cortex." +#> _Science_. doi:10.1126/science.adh1938 +#> , +#> . +#> +#> A BibTeX entry for LaTeX users is +#> +#> @Article{, +#> title = {A data-driven single-cell and spatial transcriptomic map of the human prefrontal cortex}, +#> author = {Louise A. Huuki-Myers and Abby Spangler and Nicholas J. Eagles and Kelsey D. Montgomergy and Sang Ho Kwon and Boyi Guo and Melissa Grant-Peters and Heena R. Divecha and Madhavi Tippani and Chaichontat Sriworarat and Annie B. Nguyen and Prashanthi Ravichandran and Matthew N. Tran and Arta Seyedian and PsychENCODE Consortium and Thomas M. Hyde and Joel E. Kleinman and Alexis Battle and Stephanie C. Page and Mina Ryten and Stephanie C. Hicks and Keri Martinowich and Leonardo Collado-Torres and Kristen R. Maynard}, +#> year = {2024}, +#> journal = {Science}, +#> doi = {10.1126/science.adh1938}, +#> url = {https://doi.org/10.1126/science.adh1938}, +#> } +#> +#> Kwon SH, Parthiban S, Tippani M, Divecha HR, Eagles NJ, Lobana JS, +#> Williams SR, Mark M, Bharadwaj RA, Kleinman JE, Hyde TM, Page SC, +#> Hicks SC, Martinowich K, Maynard KR, Collado-Torres L (2023). +#> "Influence of Alzheimer’s disease related neuropathology on local +#> microenvironment gene expression in the human inferior temporal +#> cortex." _bioRxiv_. doi:10.1101/2023.04.20.537710 +#> , +#> . +#> +#> A BibTeX entry for LaTeX users is +#> +#> @Article{, +#> title = {Influence of Alzheimer’s disease related neuropathology on local microenvironment gene expression in the human inferior temporal cortex}, +#> author = {Sang Ho Kwon and Sowmya Parthiban and Madhavi Tippani and Heena R. Divecha and Nicholas J. Eagles and Jashandeep S. Lobana and Stephen R. Williams and Michelle Mark and Rahul A. Bharadwaj and Joel E. Kleinman and Thomas M. Hyde and Stephanie C. Page and Stephanie C. Hicks and Keri Martinowich and Kristen R. Maynard and Leonardo Collado-Torres}, +#> year = {2023}, +#> journal = {GEN Biotechnology}, +#> doi = {10.1089/genbio.2023.0019}, +#> url = {https://doi.org/10.1089/genbio.2023.0019}, +#> } ``` Please note that the `spatialLIBD` was only made possible thanks to many other R and bioinformatics software authors, which are cited either in the vignettes and/or the paper(s) describing this package. + +## Code of Conduct + +Please note that the spatialLIBD project is released with a [Contributor +Code of +Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). +By contributing to this project, you agree to abide by its terms. + +## Development tools + +- Continuous code testing is possible thanks to [GitHub + actions](https://www.tidyverse.org/blog/2020/04/usethis-1-6-0/) + through *[usethis](https://CRAN.R-project.org/package=usethis)*, + *[remotes](https://CRAN.R-project.org/package=remotes)*, + *[sysreqs](https://github.com/r-hub/sysreqs)* and + *[rcmdcheck](https://CRAN.R-project.org/package=rcmdcheck)* customized + to use [Bioconductor’s docker + containers](https://www.bioconductor.org/help/docker/) and + *[BiocCheck](https://bioconductor.org/packages/3.19/BiocCheck)*. +- Code coverage assessment is possible thanks to + [codecov](https://codecov.io/gh) and + *[covr](https://CRAN.R-project.org/package=covr)*. +- The [documentation + website](http://lieberinstitute.github.io/spatialLIBD) is + automatically updated thanks to + *[pkgdown](https://CRAN.R-project.org/package=pkgdown)*. +- The code is styled automatically thanks to + *[styler](https://CRAN.R-project.org/package=styler)*. +- The documentation is formatted thanks to + *[devtools](https://CRAN.R-project.org/package=devtools)* and + *[roxygen2](https://CRAN.R-project.org/package=roxygen2)*. + +For more details, check the `dev` directory. + +This package was developed using +*[biocthis](https://bioconductor.org/packages/3.19/biocthis)*. + + + +
+ +
+ + + diff --git a/inst/extdata/metadata_Visium_LS.csv b/inst/extdata/metadata_Visium_LS.csv new file mode 100644 index 00000000..5b868cf7 --- /dev/null +++ b/inst/extdata/metadata_Visium_LS.csv @@ -0,0 +1,4 @@ +Title,Description,BiocVersion,Genome,SourceType,SourceUrl,SourceVersion,Species,TaxonomyId,Coordinate_1_based,DataProvider,Maintainer,RDataClass,DispatchClass,RDataPath,Tags +Visium_LS_spe,SpatialExperiment object at the spot-level for the spatially stitched lateral septum human brain (LS) spatial transcriptomics data (n = 3) from the Visium platform from 10x Genomics generated by the Lieber Institute for Brain Development (LIBD) and available through the spatialLIBD Bioconductor package.,3.19,GRCh38,GTF,https://bioconductor.org/packages/spatialLIBD,June 11 2024,Homo sapiens,9606,TRUE,LIBD,Leonardo Collado-Torres ,SpatialExperiment,Rds,spatialLIBD/spatialLIBD_files/Visium_LS_spe.rds,VisiumLS_Visium_stitched_spatialLIBD +Visium_LS_spaceranger,Spaceranger outputs for the spatially stitched lateral septum human brain (LS) spatial transcriptomics data (n = 3) from the Visium platform from 10x Genomics generated by the Lieber Institute for Brain Development (LIBD) and available through the spatialLIBD Bioconductor package. Can be used with visiumStitched::build_spe() to construct a SpatialExperiment.,3.19,GRCh38,Zip,https://bioconductor.org/packages/spatialLIBD,June 11 2024,Homo sapiens,9606,TRUE,LIBD,Leonardo Collado-Torres ,list,Zip,spatialLIBD/spatialLIBD_files/Visium_LS_spaceranger.zip,VisiumLS_Visium_stitched_spatialLIBD +Visium_LS_ImageJ_out,Stitched PNG image and XML file from aligning lateral septum human brain (LS) spatial transcriptomics data (n = 3) in ImageJ. Data to align was from the Visium platform from 10x Genomics generated by the Lieber Institute for Brain Development (LIBD) and is available through the spatialLIBD Bioconductor package.,3.19,GRCh38,Zip,https://bioconductor.org/packages/spatialLIBD,June 11 2024,Homo sapiens,9606,TRUE,LIBD,Leonardo Collado-Torres ,list,Zip,spatialLIBD/spatialLIBD_files/Visium_LS_imagej_out.zip,VisiumLS_Visium_stitched_spatialLIBD diff --git a/inst/scripts/make-metadata_Visium_LS.R b/inst/scripts/make-metadata_Visium_LS.R new file mode 100644 index 00000000..9fefe846 --- /dev/null +++ b/inst/scripts/make-metadata_Visium_LS.R @@ -0,0 +1,189 @@ +library(here) +library(sessioninfo) +library(tidyverse) + +outdir <- "spatialLIBD_files" +pkgname <- "spatialLIBD" + +meta <- tibble( + Title = c("Visium_LS_spe", "Visium_LS_spaceranger", "Visium_LS_ImageJ_out"), + Description = c( + "SpatialExperiment object at the spot-level for the spatially stitched lateral septum human brain (LS) spatial transcriptomics data (n = 3) from the Visium platform from 10x Genomics generated by the Lieber Institute for Brain Development (LIBD) and available through the spatialLIBD Bioconductor package.", + "Spaceranger outputs for the spatially stitched lateral septum human brain (LS) spatial transcriptomics data (n = 3) from the Visium platform from 10x Genomics generated by the Lieber Institute for Brain Development (LIBD) and available through the spatialLIBD Bioconductor package. Can be used with visiumStitched::build_spe() to construct a SpatialExperiment.", + "Stitched PNG image and XML file from aligning lateral septum human brain (LS) spatial transcriptomics data (n = 3) in ImageJ. Data to align was from the Visium platform from 10x Genomics generated by the Lieber Institute for Brain Development (LIBD) and is available through the spatialLIBD Bioconductor package." + ), + BiocVersion = "3.19", + Genome = "GRCh38", + SourceType = c("GTF", "Zip", "Zip"), + SourceUrl = "https://bioconductor.org/packages/spatialLIBD", + SourceVersion = "June 11 2024", + Species = "Homo sapiens", + TaxonomyId = 9606, + Coordinate_1_based = TRUE, + DataProvider = "LIBD", + Maintainer = "Leonardo Collado-Torres ", + RDataClass = c("SpatialExperiment", "list", "list"), + DispatchClass = c("Rds", "Zip", "Zip"), + RDataPath = file.path( + pkgname, + outdir, + c( + "Visium_LS_spe.rds", "Visium_LS_spaceranger.zip", + "Visium_LS_imagej_out.zip" + ) + ), + Tags = "VisiumLS_Visium_stitched_spatialLIBD" +) + +write_csv(meta, here("inst", "extdata", "metadata_Visium_LS.csv")) + +## Check interactively +if (FALSE) { + AnnotationHubData::makeAnnotationHubMetadata( + here(), + fileName = "metadata_Visium_LS.csv" + ) +} + +## Reproducibility information +print("Reproducibility information:") +Sys.time() +proc.time() +options(width = 120) +session_info() + +# ─ Session info ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────── +# setting value +# version R version 4.4.0 Patched (2024-05-22 r86590) +# os Rocky Linux 9.2 (Blue Onyx) +# system x86_64, linux-gnu +# ui X11 +# language (EN) +# collate en_US.UTF-8 +# ctype en_US.UTF-8 +# tz US/Eastern +# date 2024-06-11 +# pandoc 3.1.13 @ /jhpce/shared/community/core/conda_R/4.4/bin/pandoc + +# ─ Packages ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── +# package * version date (UTC) lib source +# abind 1.4-5 2016-07-21 [2] CRAN (R 4.4.0) +# AnnotationDbi 1.66.0 2024-05-01 [2] Bioconductor 3.19 (R 4.4.0) +# AnnotationForge 1.46.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# AnnotationHub 3.12.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# AnnotationHubData 1.34.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0) +# Biobase 2.64.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# BiocBaseUtils 1.6.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# BiocCheck 1.40.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# BiocFileCache 2.12.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# BiocGenerics 0.50.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# BiocIO 1.14.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# BiocManager 1.30.23 2024-05-04 [2] CRAN (R 4.4.0) +# BiocParallel 1.38.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# BiocVersion 3.19.1 2024-04-17 [2] Bioconductor 3.19 (R 4.4.0) +# biocViews 1.72.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# biomaRt 2.60.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# Biostrings 2.72.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# bit 4.0.5 2022-11-15 [2] CRAN (R 4.4.0) +# bit64 4.0.5 2020-08-30 [2] CRAN (R 4.4.0) +# bitops 1.0-7 2021-04-24 [2] CRAN (R 4.4.0) +# blob 1.2.4 2023-03-17 [2] CRAN (R 4.4.0) +# cachem 1.1.0 2024-05-16 [2] CRAN (R 4.4.0) +# cli 3.6.2 2023-12-11 [2] CRAN (R 4.4.0) +# codetools 0.2-20 2024-03-31 [3] CRAN (R 4.4.0) +# colorspace 2.1-0 2023-01-23 [2] CRAN (R 4.4.0) +# crayon 1.5.2 2022-09-29 [2] CRAN (R 4.4.0) +# curl 5.2.1 2024-03-01 [2] CRAN (R 4.4.0) +# DBI 1.2.2 2024-02-16 [2] CRAN (R 4.4.0) +# dbplyr 2.5.0 2024-03-19 [2] CRAN (R 4.4.0) +# DelayedArray 0.30.1 2024-05-07 [2] Bioconductor 3.19 (R 4.4.0) +# digest 0.6.35 2024-03-11 [2] CRAN (R 4.4.0) +# dplyr * 1.1.4 2023-11-17 [2] CRAN (R 4.4.0) +# fansi 1.0.6 2023-12-08 [2] CRAN (R 4.4.0) +# fastmap 1.2.0 2024-05-15 [2] CRAN (R 4.4.0) +# filelock 1.0.3 2023-12-11 [2] CRAN (R 4.4.0) +# forcats * 1.0.0 2023-01-29 [2] CRAN (R 4.4.0) +# formatR 1.14 2023-01-17 [2] CRAN (R 4.4.0) +# futile.logger * 1.4.3 2016-07-10 [2] CRAN (R 4.4.0) +# futile.options 1.0.1 2018-04-20 [2] CRAN (R 4.4.0) +# generics 0.1.3 2022-07-05 [2] CRAN (R 4.4.0) +# GenomeInfoDb 1.40.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# GenomeInfoDbData 1.2.12 2024-05-23 [2] Bioconductor +# GenomicAlignments 1.40.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# GenomicFeatures 1.56.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# GenomicRanges 1.56.0 2024-05-01 [2] Bioconductor 3.19 (R 4.4.0) +# ggplot2 * 3.5.1 2024-04-23 [2] CRAN (R 4.4.0) +# glue 1.7.0 2024-01-09 [2] CRAN (R 4.4.0) +# graph 1.82.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# gtable 0.3.5 2024-04-22 [2] CRAN (R 4.4.0) +# here * 1.0.1 2020-12-13 [2] CRAN (R 4.4.0) +# hms 1.1.3 2023-03-21 [2] CRAN (R 4.4.0) +# httr 1.4.7 2023-08-15 [2] CRAN (R 4.4.0) +# httr2 1.0.1 2024-04-01 [2] CRAN (R 4.4.0) +# IRanges 2.38.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# jsonlite 1.8.8 2023-12-04 [2] CRAN (R 4.4.0) +# KEGGREST 1.44.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# knitr 1.46 2024-04-06 [2] CRAN (R 4.4.0) +# lambda.r 1.2.4 2019-09-18 [2] CRAN (R 4.4.0) +# lattice 0.22-6 2024-03-20 [3] CRAN (R 4.4.0) +# lifecycle 1.0.4 2023-11-07 [2] CRAN (R 4.4.0) +# lubridate * 1.9.3 2023-09-27 [2] CRAN (R 4.4.0) +# magrittr 2.0.3 2022-03-30 [2] CRAN (R 4.4.0) +# Matrix 1.7-0 2024-04-26 [3] CRAN (R 4.4.0) +# MatrixGenerics 1.16.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# matrixStats 1.3.0 2024-04-11 [2] CRAN (R 4.4.0) +# memoise 2.0.1 2021-11-26 [2] CRAN (R 4.4.0) +# munsell 0.5.1 2024-04-01 [2] CRAN (R 4.4.0) +# OrganismDbi 1.46.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# pillar 1.9.0 2023-03-22 [2] CRAN (R 4.4.0) +# pkgconfig 2.0.3 2019-09-22 [2] CRAN (R 4.4.0) +# png 0.1-8 2022-11-29 [2] CRAN (R 4.4.0) +# prettyunits 1.2.0 2023-09-24 [2] CRAN (R 4.4.0) +# progress 1.2.3 2023-12-06 [2] CRAN (R 4.4.0) +# purrr * 1.0.2 2023-08-10 [2] CRAN (R 4.4.0) +# R6 2.5.1 2021-08-19 [2] CRAN (R 4.4.0) +# rappdirs 0.3.3 2021-01-31 [2] CRAN (R 4.4.0) +# RBGL 1.80.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# RCurl 1.98-1.14 2024-01-09 [2] CRAN (R 4.4.0) +# readr * 2.1.5 2024-01-10 [2] CRAN (R 4.4.0) +# restfulr 0.0.15 2022-06-16 [2] CRAN (R 4.4.0) +# rjson 0.2.21 2022-01-09 [2] CRAN (R 4.4.0) +# rlang 1.1.3 2024-01-10 [2] CRAN (R 4.4.0) +# rprojroot 2.0.4 2023-11-05 [2] CRAN (R 4.4.0) +# Rsamtools 2.20.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# RSQLite 2.3.6 2024-03-31 [2] CRAN (R 4.4.0) +# rtracklayer 1.64.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# RUnit 0.4.33 2024-02-22 [2] CRAN (R 4.4.0) +# S4Arrays 1.4.1 2024-05-20 [2] Bioconductor 3.19 (R 4.4.0) +# S4Vectors 0.42.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# scales 1.3.0 2023-11-28 [2] CRAN (R 4.4.0) +# sessioninfo * 1.2.2 2021-12-06 [2] CRAN (R 4.4.0) +# SparseArray 1.4.5 2024-05-20 [2] Bioconductor 3.19 (R 4.4.0) +# stringdist 0.9.12 2023-11-28 [2] CRAN (R 4.4.0) +# stringi 1.8.4 2024-05-06 [2] CRAN (R 4.4.0) +# stringr * 1.5.1 2023-11-14 [2] CRAN (R 4.4.0) +# SummarizedExperiment 1.34.0 2024-05-01 [2] Bioconductor 3.19 (R 4.4.0) +# tibble * 3.2.1 2023-03-20 [2] CRAN (R 4.4.0) +# tidyr * 1.3.1 2024-01-24 [2] CRAN (R 4.4.0) +# tidyselect 1.2.1 2024-03-11 [2] CRAN (R 4.4.0) +# tidyverse * 2.0.0 2023-02-22 [2] CRAN (R 4.4.0) +# timechange 0.3.0 2024-01-18 [2] CRAN (R 4.4.0) +# txdbmaker 1.0.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# tzdb 0.4.0 2023-05-12 [2] CRAN (R 4.4.0) +# UCSC.utils 1.0.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# utf8 1.2.4 2023-10-22 [2] CRAN (R 4.4.0) +# vctrs 0.6.5 2023-12-01 [2] CRAN (R 4.4.0) +# vroom 1.6.5 2023-12-05 [2] CRAN (R 4.4.0) +# withr 3.0.0 2024-01-16 [2] CRAN (R 4.4.0) +# xfun 0.44 2024-05-15 [2] CRAN (R 4.4.0) +# XML 3.99-0.16.1 2024-01-22 [2] CRAN (R 4.4.0) +# xml2 1.3.6 2023-12-04 [2] CRAN (R 4.4.0) +# XVector 0.44.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) +# yaml 2.3.8 2023-12-11 [2] CRAN (R 4.4.0) +# zlibbioc 1.50.0 2024-04-30 [2] Bioconductor 3.19 (R 4.4.0) + +# [1] /users/neagles/R/4.4 +# [2] /jhpce/shared/community/core/conda_R/4.4/R/lib64/R/site-library +# [3] /jhpce/shared/community/core/conda_R/4.4/R/lib64/R/library + +# ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── diff --git a/man/fetch_data.Rd b/man/fetch_data.Rd index b77f5aa9..ac411d47 100644 --- a/man/fetch_data.Rd +++ b/man/fetch_data.Rd @@ -11,7 +11,8 @@ fetch_data( "spatialDLPFC_Visium_SPG", "spatialDLPFC_snRNAseq", "Visium_SPG_AD_Visium_wholegenome_spe", "Visium_SPG_AD_Visium_targeted_spe", "Visium_SPG_AD_Visium_wholegenome_pseudobulk_spe", - "Visium_SPG_AD_Visium_wholegenome_modeling_results"), + "Visium_SPG_AD_Visium_wholegenome_modeling_results", "Visium_LS_spe", + "Visium_LS_spaceranger", "Visium_LS_ImageJ_out"), destdir = tempdir(), eh = ExperimentHub::ExperimentHub(), bfc = BiocFileCache::BiocFileCache() diff --git a/man/prep_stitched_data.Rd b/man/prep_stitched_data.Rd new file mode 100644 index 00000000..e87c0140 --- /dev/null +++ b/man/prep_stitched_data.Rd @@ -0,0 +1,37 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/prep_stitched_data.R +\name{prep_stitched_data} +\alias{prep_stitched_data} +\title{Prepare stitched data for plotting} +\usage{ +prep_stitched_data(spe, point_size, image_id) +} +\arguments{ +\item{spe}{A \code{SpatialExperiment} built with +\code{visiumStitched::build_spe()}, containing a logical +\code{spe$exclude_overlapping} column specifying which spots to display in +plots} + +\item{point_size}{A \code{numeric(1)} specifying the size of the points. Defaults +to \code{1.25}. Some colors look better if you use \code{2} for instance.} + +\item{image_id}{A \code{character(1)} with the name of the image ID you want to +use in the background.} +} +\value{ +A list with names \code{spe} and \code{point_size} containing a +filtered, ready-to-plot \code{SpatialExperiment} and an appropriate spot size +(passed to \code{vis_gene()} or \code{vis_clus()}), respectively +} +\description{ +Given a \code{SpatialExperiment} built with \code{visiumStitched::build_spe()} +\url{http://research.libd.org/visiumStitched/reference/build_spe.html}, drop +excluded spots (specified by \code{spe$exclude_overlapping}) and compute an +appropriate spot size for plotting with \code{vis_gene()} or +\code{vis_clus()}, assuming the plot will be written to a PDF of default +dimensions (i.e. \code{width = 7} and \code{height = 7}). +} +\author{ +Nicholas J. Eagles +} +\keyword{internal} diff --git a/man/run_app.Rd b/man/run_app.Rd index 5b1d6c6a..0eb0295d 100644 --- a/man/run_app.Rd +++ b/man/run_app.Rd @@ -24,6 +24,7 @@ run_app( "expr_chrM_ratio"), default_cluster = "spatialLIBD", auto_crop_default = TRUE, + is_stitched = FALSE, ... ) } @@ -75,6 +76,13 @@ automatically cropping the images. Set this to \code{FALSE} if your images do no follow the Visium grid size expectations, which are key for enabling auto-cropping.} +\item{is_stitched}{A \code{logical(1)} vector: If \code{TRUE}, expects a +\link[SpatialExperiment:SpatialExperiment]{SpatialExperiment-class} built +with \code{visiumStitched::build_spe()}. +\url{http://research.libd.org/visiumStitched/reference/build_spe.html}; in +particular, expects a logical colData column \code{exclude_overlapping} +specifying which spots to exclude from the plot. Sets \code{auto_crop = FALSE}.} + \item{...}{Other arguments passed to the list of golem options for running the application.} } @@ -233,5 +241,27 @@ if (enough_ram(9e9)) { ## * https://github.com/LieberInstitute/spatialDLPFC/tree/main/code/deploy_app_k09_position_noWM ## * https://github.com/LieberInstitute/spatialDLPFC/tree/main/code/deploy_app_k16 ## * https://github.com/LieberInstitute/spatialDLPFC/tree/main/code/analysis_IF/03_spatialLIBD_app + + +## Example for an object with multiple capture areas stitched together with +## . +spe_stitched <- fetch_data("Visium_LS_spe") + +## Inspect this object +spe_stitched + +## Notice the use of "exclude_overlapping" +table(spe_stitched$exclude_overlapping, useNA = "ifany") + +## Run the app with this stitched data +run_app( + spe = spe_stitched, + sce_layer = NULL, modeling_results = NULL, sig_genes = NULL, + title = "visiumStitched example data", + spe_discrete_vars = c("capture_area", "scran_quick_cluster", "ManualAnnotation"), + spe_continuous_vars = c("sum_umi", "sum_gene", "expr_chrM", "expr_chrM_ratio"), + default_cluster = "scran_quick_cluster", + is_stitched = TRUE +) } } diff --git a/man/vis_clus.Rd b/man/vis_clus.Rd index 3354bfb4..10729e46 100644 --- a/man/vis_clus.Rd +++ b/man/vis_clus.Rd @@ -16,6 +16,7 @@ vis_clus( point_size = 2, auto_crop = TRUE, na_color = "#CCCCCC40", + is_stitched = FALSE, ... ) } @@ -59,6 +60,13 @@ alpha blending already, which will make non-NA values pop up more and the NA values will show with a lighter color. This behavior is lost when \code{alpha} is set to a non-\code{NA} value.} +\item{is_stitched}{A \code{logical(1)} vector: If \code{TRUE}, expects a +\link[SpatialExperiment:SpatialExperiment]{SpatialExperiment-class} built +with \code{visiumStitched::build_spe()}. +\url{http://research.libd.org/visiumStitched/reference/build_spe.html}; in +particular, expects a logical colData column \code{exclude_overlapping} +specifying which spots to exclude from the plot. Sets \code{auto_crop = FALSE}.} + \item{...}{Passed to \link[base:paste]{paste0()} for making the title of the plot following the \code{sampleid}.} } diff --git a/man/vis_gene.Rd b/man/vis_gene.Rd index 644c8afe..2a6f94e6 100644 --- a/man/vis_gene.Rd +++ b/man/vis_gene.Rd @@ -20,6 +20,7 @@ vis_gene( auto_crop = TRUE, na_color = "#CCCCCC40", multi_gene_method = c("z_score", "pca", "sparsity"), + is_stitched = FALSE, ... ) } @@ -92,6 +93,13 @@ the proportion of continuous variables with positive values for each spot is computed. For more details, check the multi gene vignette at \url{https://research.libd.org/spatialLIBD/articles/multi_gene_plots.html}.} +\item{is_stitched}{A \code{logical(1)} vector: If \code{TRUE}, expects a +\link[SpatialExperiment:SpatialExperiment]{SpatialExperiment-class} built +with \code{visiumStitched::build_spe()}. +\url{http://research.libd.org/visiumStitched/reference/build_spe.html}; in +particular, expects a logical colData column \code{exclude_overlapping} +specifying which spots to exclude from the plot. Sets \code{auto_crop = FALSE}.} + \item{...}{Passed to \link[base:paste]{paste0()} for making the title of the plot following the \code{sampleid}.} } diff --git a/man/vis_grid_clus.Rd b/man/vis_grid_clus.Rd index c9410866..19dd2c3a 100644 --- a/man/vis_grid_clus.Rd +++ b/man/vis_grid_clus.Rd @@ -20,6 +20,7 @@ vis_grid_clus( point_size = 2, auto_crop = TRUE, na_color = "#CCCCCC40", + is_stitched = FALSE, ... ) } @@ -76,6 +77,13 @@ alpha blending already, which will make non-NA values pop up more and the NA values will show with a lighter color. This behavior is lost when \code{alpha} is set to a non-\code{NA} value.} +\item{is_stitched}{A \code{logical(1)} vector: If \code{TRUE}, expects a +\link[SpatialExperiment:SpatialExperiment]{SpatialExperiment-class} built +with \code{visiumStitched::build_spe()}. +\url{http://research.libd.org/visiumStitched/reference/build_spe.html}; in +particular, expects a logical colData column \code{exclude_overlapping} +specifying which spots to exclude from the plot. Sets \code{auto_crop = FALSE}.} + \item{...}{Passed to \link[base:paste]{paste0()} for making the title of the plot following the \code{sampleid}.} } diff --git a/man/vis_grid_gene.Rd b/man/vis_grid_gene.Rd index 0ed8c520..a102cbbe 100644 --- a/man/vis_grid_gene.Rd +++ b/man/vis_grid_gene.Rd @@ -23,6 +23,7 @@ vis_grid_gene( point_size = 2, auto_crop = TRUE, na_color = "#CCCCCC40", + is_stitched = FALSE, ... ) } @@ -93,6 +94,13 @@ alpha blending already, which will make non-NA values pop up more and the NA values will show with a lighter color. This behavior is lost when \code{alpha} is set to a non-\code{NA} value.} +\item{is_stitched}{A \code{logical(1)} vector: If \code{TRUE}, expects a +\link[SpatialExperiment:SpatialExperiment]{SpatialExperiment-class} built +with \code{visiumStitched::build_spe()}. +\url{http://research.libd.org/visiumStitched/reference/build_spe.html}; in +particular, expects a logical colData column \code{exclude_overlapping} +specifying which spots to exclude from the plot. Sets \code{auto_crop = FALSE}.} + \item{...}{Passed to \link[base:paste]{paste0()} for making the title of the plot following the \code{sampleid}.} } diff --git a/tests/testthat/test-prep_stitched_data.R b/tests/testthat/test-prep_stitched_data.R new file mode 100644 index 00000000..3866042d --- /dev/null +++ b/tests/testthat/test-prep_stitched_data.R @@ -0,0 +1,40 @@ +test_that( + "prep_stitched_data", + { + if (!exists("spe")) spe <- fetch_data("spe") + + # Missing exclude_overlapping + expect_error( + { + temp <- prep_stitched_data( + spe, + point_size = 2, image_id = "lowres" + ) + }, + "^Missing at least one of the following colData" + ) + + # Can't exclude all spots + spe$exclude_overlapping <- TRUE + expect_error( + { + temp <- prep_stitched_data( + spe, + point_size = 2, image_id = "lowres" + ) + }, + "^spe\\$exclude_overlapping must include some FALSE values to plot$" + ) + + # Output should be a list with the correct names, and the + # SpatialExperiment should have no excluded spots + spe$exclude_overlapping[1:100] <- FALSE + temp <- prep_stitched_data(spe, point_size = 2, image_id = "lowres") + expect_equal(class(temp), "list") + expect_equal(names(temp), c("spe", "point_size")) + expect_equal(all(temp$spe$exclude_overlapping), FALSE) + + # Note bad image_id is not tested, since this function is only used + # internally after checks for legitimate image_id are performed + } +) diff --git a/tests/testthat/test-vis_clus.R b/tests/testthat/test-vis_clus.R new file mode 100644 index 00000000..ab011efb --- /dev/null +++ b/tests/testthat/test-vis_clus.R @@ -0,0 +1,17 @@ +test_that( + "vis_clus", + { + if (!exists("spe")) spe <- fetch_data("spe") + + # Bad spatialCoords + spe_temp <- spe + colnames(spatialCoords(spe_temp)) <- c("a", "b") + expect_error( + { + p <- vis_clus(spe_temp, clustervar = "sample_id") + }, + "^Abnormal spatial coordinates" + ) + rm(spe_temp) + } +) diff --git a/tests/testthat/test-vis_gene.R b/tests/testthat/test-vis_gene.R index 27a8dfdd..b4a171c1 100644 --- a/tests/testthat/test-vis_gene.R +++ b/tests/testthat/test-vis_gene.R @@ -51,5 +51,17 @@ test_that( class(vis_gene(spe, geneid = c("sum_umi", rownames(spe)[1]))), c("gg", "ggplot") ) + + + # Bad spatialCoords + spe_temp <- spe + colnames(spatialCoords(spe_temp)) <- c("a", "b") + expect_error( + { + p <- vis_gene(spe_temp, geneid = "sum_umi") + }, + "^Abnormal spatial coordinates" + ) + rm(spe_temp) } )