Skip to content

Commit

Permalink
fix: gpoly ID cacheing after rbind()
Browse files Browse the repository at this point in the history
  • Loading branch information
jiajic committed Feb 29, 2024
1 parent 09fc532 commit 55a9d4b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
## bug fixes
- fix `createGiottoPolygonsFromMask()` IDs being applied out of sync to mask values
- remove unused `fix_multipart` param in `createGiottoPolygonsFromMask()`
- fix `giottoPolygon` ID cacheing after `rbind()`

## enhancements
- `createGiottoPolygonsFromMask()` now has `ID_fmt` param for finer control of automatic poly_ID generation
Expand Down
5 changes: 4 additions & 1 deletion R/methods-rbind.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ rbind2_giotto_polygon_homo <- function(x, y) {
} else {
slot(x, "overlaps") <- rbind(slot(x, "overlaps"), slot(y, "overlaps"))
}

slot(x, "unique_ID_cache") <- unique(c(spatIDs(x), spatIDs(y)))
x
}

Expand Down Expand Up @@ -159,7 +161,8 @@ rbind2_giotto_polygon_hetero <- function(x, y, new_name, add_list_ID = TRUE) {
name = new_name,
spatVector = new_sv,
spatVectorCentroids = new_svc,
overlaps = new_ovlp
overlaps = new_ovlp,
unique_IDs = unique(c(spatIDs(x), spatIDs(y)))
)
new_poly
}

0 comments on commit 55a9d4b

Please sign in to comment.