Skip to content

Commit

Permalink
See if importing SummarizedExperiment fixes the issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick-Eagles committed Oct 24, 2023
1 parent a92e592 commit 5618f5d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ Imports:
viridisLite,
spatialLIBD,
ggplot2,
SpatialExperiment
SpatialExperiment,
SummarizedExperiment
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

export(spot_plot)
import(SpatialExperiment)
import(SummarizedExperiment)
import(ggplot2)
import(spatialLIBD)
import(viridisLite)
20 changes: 10 additions & 10 deletions R/spot_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#'
#' @export
#' @author Nicholas J. Eagles
#' @import viridisLite spatialLIBD ggplot2 SpatialExperiment
#' @import viridisLite spatialLIBD ggplot2 SpatialExperiment SummarizedExperiment
#'
#' @examples
#'
Expand Down Expand Up @@ -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) &
Expand Down

0 comments on commit 5618f5d

Please sign in to comment.