Skip to content

Commit

Permalink
code-review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkerl committed Sep 11, 2024
1 parent 1100d96 commit 5bb7d5f
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 31 deletions.
14 changes: 0 additions & 14 deletions apis/r/R/Init.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,6 @@
}
}

# This is temporary only. Please see:
# * https://github.com/single-cell-data/TileDB-SOMA/issues/2407
# * https://github.com/single-cell-data/TileDB-SOMA/pull/2950
.new_shape_feature_flag_enable <- function() {
.pkgenv[["use_current_domain_transitional_internal_only"]] <- TRUE
}

# This is temporary only. Please see:
# * https://github.com/single-cell-data/TileDB-SOMA/issues/2407
# * https://github.com/single-cell-data/TileDB-SOMA/pull/2950
.new_shape_feature_flag_disable <- function() {
.pkgenv[["use_current_domain_transitional_internal_only"]] <- FALSE
}

# This is temporary only. Please see:
# * https://github.com/single-cell-data/TileDB-SOMA/issues/2407
# * https://github.com/single-cell-data/TileDB-SOMA/pull/2950
Expand Down
12 changes: 7 additions & 5 deletions apis/r/R/SOMASparseNDArray.R
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ SOMASparseNDArray <- R6::R6Class(
#' an error if the new shape exceeds maxshape in any dimension. Raises an
#' error if the array doesn't already have a shape: in that case please call
#' tiledbsoma_upgrade_shape.
#' @param new_shape A vector of integerish, of the same length as the array's `ndim`.
#' @return No return value
resize = function(new_shape) {
# TODO: move this to SOMANDArrayBase.R once core offers current-domain support for dense arrays.
Expand All @@ -210,19 +211,20 @@ SOMASparseNDArray <- R6::R6Class(
},

#' @description Allows the array to have a resizeable shape as described in the
#' TileDB-SOMA 1.15 release notes. Raises an error if the new shape exceeds maxshape in any
#' TileDB-SOMA 1.15 release notes. Raises an error if the shape exceeds maxshape in any
#' dimension. Raises an error if the array already has a shape.
#' @param shape A vector of integerish, of the same length as the array's `ndim`.
#' @return No return value
tiledbsoma_upgrade_shape = function(new_shape) {
tiledbsoma_upgrade_shape = function(shape) {
# TODO: move this to SOMANDArrayBase.R once core offers current-domain support for dense arrays.
# https://github.com/single-cell-data/TileDB-SOMA/issues/2955

stopifnot("'new_shape' must be a vector of integerish values, of the same length as maxshape" = rlang::is_integerish(new_shape, n = self$ndim()) ||
(bit64::is.integer64(new_shape) && length(new_shape) == self$ndim())
stopifnot("'shape' must be a vector of integerish values, of the same length as maxshape" = rlang::is_integerish(shape, n = self$ndim()) ||
(bit64::is.integer64(shape) && length(shape) == self$ndim())
)
# Checking slotwise new shape >= old shape, and <= max_shape, is already done in libtiledbsoma

tiledbsoma_upgrade_shape(self$uri, new_shape, config=as.character(tiledb::config(self$tiledbsoma_ctx$context())))
tiledbsoma_upgrade_shape(self$uri, shape, config=as.character(tiledb::config(self$tiledbsoma_ctx$context())))
}

),
Expand Down
10 changes: 5 additions & 5 deletions apis/r/man/SOMADataFrame.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apis/r/man/SOMADenseNDArray.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions apis/r/man/SOMANDArrayBase.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 49 additions & 1 deletion apis/r/man/SOMASparseNDArray.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5bb7d5f

Please sign in to comment.