Skip to content

Commit

Permalink
fix: default setting in createNetwork()
Browse files Browse the repository at this point in the history
  • Loading branch information
jiajic committed Oct 29, 2024
1 parent 2571f66 commit 4fb1b6a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
- `buffer()` for `giottoPolygon`, `giottoPoints`, `spatLocsObj`. Default is to crop by voronoi borders with `settleGeom()`
- `settleGeom()` for `giottoPolygon` and `SpatVector` for finding non overlapping borders determined by voronoi

## bug fixes
- fix default method setting in `createNetwork()` for "delaunay" networks


# GiottoClass 0.4.0 (2024/10/27)

Expand Down
27 changes: 20 additions & 7 deletions R/NN_network.R
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,28 @@ createNetwork <- function(

# check params
type <- match.arg(type, choices = c("sNN", "kNN", "delaunay"))

mdef <- c("dbscan", "geometry", "RTriangle", "deldir")
if (type %in% c("sNN", "kNN")) {
mchoices <- c("dbscan")
if (identical(method, mdef)) method <- mchoices
}
if (type %in% c("delaunay")) {
mchoices <- c("geometry", "RTriangle", "deldir")
if (identical(method, mdef)) method <- mchoices
}

method <- switch(type,
"sNN" = match.arg(method, choices = c("dbscan"), several.ok = TRUE),
"kNN" = match.arg(method, choices = c("dbscan"), several.ok = TRUE),
"delaunay" = match.arg(
method,
choices = c("geometry", "RTriangle", "deldir"),
several.ok = TRUE
)
"sNN" = match.arg(method, choices = mchoices, several.ok = TRUE),
"kNN" = match.arg(method, choices = mchoices, several.ok = TRUE),
"delaunay" = {
method <- method[[1L]]
match.arg(method, choices = mchoices, several.ok = TRUE)
}
)

vmsg(.is_debug = TRUE, sprintf("network\n type: %s\n method: %s",
type, method))

# get common params
alist <- list(
Expand Down

0 comments on commit 4fb1b6a

Please sign in to comment.