Skip to content

Commit

Permalink
merge from devel
Browse files Browse the repository at this point in the history
Merge branch 'devel' of https://github.com/pachterlab/SpatialFeatureExperiment into devel

# Conflicts:
#	R/read.R
  • Loading branch information
lambdamoses committed Jun 7, 2024
2 parents c222d3f + 99eedb2 commit aa523b3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion R/read.R
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ read10xVisiumSFE <- function(samples = "",

# sanity on geometries to remove any self-intersection
#' @importFrom sf st_buffer st_is_valid
# TODO: this needs to be optimized, takes too long for real data ----
.check_st_valid <- function(sf_df = NULL) {
# sf_df is a single sf data frame, not a list of sf data frames
invalid_inds <- which(!st_is_valid(sf_df))
Expand Down Expand Up @@ -808,6 +809,7 @@ readVizgen <- function(data_dir,

if (!is.null(polys)) {
# sanity on geometries
message(">>> Checking polygon validity")
polys <- .check_st_valid(polys)
rownames(polys) <- polys$ID
polys$ID <- NULL
Expand Down Expand Up @@ -896,6 +898,7 @@ readCosMX <- function(data_dir,
spatialCoordsNames = c("CenterX_global_px", "CenterY_global_px"),
unit = "full_res_image_pixel")
# sanity on geometries
message(">>> Checking polygon validity")
polys <- .check_st_valid(polys)
cellSeg(sfe) <- polys

Expand Down Expand Up @@ -1170,8 +1173,8 @@ readXenium <- function(data_dir,
df2sf(x, c("vertex_x", "vertex_y"), id_col = "cell_id",
geometryType = "POLYGON") })
}
message(">>> Checking polygon validity")
# sanity on geometries
message(">>> Checking polygon validity")
polys <- lapply(polys, .check_st_valid)

fn_out <- c(cell = "cell_boundaries_sf.parquet",
Expand Down

0 comments on commit aa523b3

Please sign in to comment.