diff --git a/DESCRIPTION b/DESCRIPTION index e919ec7..4fc891b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -24,4 +24,5 @@ Imports: viridisLite, spatialLIBD, ggplot2, - SpatialExperiment + SpatialExperiment, + SummarizedExperiment diff --git a/NAMESPACE b/NAMESPACE index 96e0016..7e6e724 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -2,6 +2,7 @@ export(spot_plot) import(SpatialExperiment) +import(SummarizedExperiment) import(ggplot2) import(spatialLIBD) import(viridisLite) diff --git a/R/spot_plot.R b/R/spot_plot.R index 7731057..3199d88 100644 --- a/R/spot_plot.R +++ b/R/spot_plot.R @@ -37,7 +37,7 @@ #' #' @export #' @author Nicholas J. Eagles -#' @import viridisLite spatialLIBD ggplot2 SpatialExperiment +#' @import viridisLite spatialLIBD ggplot2 SpatialExperiment SummarizedExperiment #' #' @examples #' @@ -79,15 +79,15 @@ spot_plot <- function( } # State assumptions about columns expected to be in the colData - # expected_cols <- c("array_row", "array_col", "sample_id", "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 = '", "') - # ) - # ) - # } + expected_cols <- c("array_row", "array_col", "sample_id", "exclude_overlapping") + if (!all(expected_cols %in% colnames(colnames(colData(spe))))) { + stop( + sprintf( + 'Missing at least one of the following colData columns: "%s"', + paste(expected_cols, collapse = '", "') + ) + ) + } # Subset to specific sample ID, and ensure overlapping spots are dropped subset_cols <- (spe$sample_id == sample_id) &