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
0 commit comments