Skip to content

Commit 39228fb

Browse files
committed
Make reading spatial_enrichment.csv file optional, #69
1 parent 057a369 commit 39228fb

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

R/read.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
#' Originally the Visium spots are in pixels in full res image. Either the
3030
#' image or the geometry needs to be flipped for them match in the Cartesian
3131
#' coordinate system.
32+
#' @param read_spatial_enrichment Logical, whether to read the
33+
#' `spatial_enrichment.csv` file from Visium output if the file is present and
34+
#' add its contents to `rowData`.
3235
#' @importFrom rjson fromJSON
3336
#' @importFrom SummarizedExperiment rowData<-
3437
#' @importFrom utils read.csv
@@ -69,7 +72,8 @@ read10xVisiumSFE <- function(samples = deprecated(),
6972
unit = c("full_res_image_pixel", "micron"),
7073
style = "W", zero.policy = NULL,
7174
row.names = c("id", "symbol"),
72-
flip = c("geometry", "image", "none")) {
75+
flip = c("geometry", "image", "none"),
76+
read_spatial_enrichment = TRUE) {
7377
if (is_present(samples)) {
7478
deprecate_warn("1.12.0", "read10xVisiumSFE(samples)",
7579
"read10xVisiuimSFE(dirs)")
@@ -95,7 +99,7 @@ read10xVisiumSFE <- function(samples = deprecated(),
9599
unit = unit, zero.policy = zero.policy, style = style)
96100
# Add spatial enrichment if present
97101
fn <- file.path(dirs[i], "spatial", "spatial_enrichment.csv")
98-
if (file.exists(fn)) {
102+
if (file.exists(fn) && read_spatial_enrichment) {
99103
enrichment <- read.csv(fn)
100104
row_inds <- match(rownames(o), enrichment[[enrichment_feature]])
101105
# Let me not worry about different samples having different genes for now

man/read10xVisiumSFE.Rd

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)