Skip to content

Commit

Permalink
more codereview feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mojaveazure committed Jan 17, 2025
1 parent 8d3811e commit 8859e93
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions apis/r/tests/testthat/helper-test-soma-objects.R
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,9 @@ create_and_populate_ragged_experiment <- function(
)
ms_rna$X <- SOMACollectionCreate(file.path(ms_rna$uri, "X"))

obsv <- seq.int(to = n_obs)
varv <- seq.int(to = n_var)
nd <- seq(from = 0L, to = 1L, by = 0.1)
nd <- rev(nd[nd > 0L])
nd <- rep_len(nd, length.out = length(X_layer_names))
ragged_density <- seq(from = 0L, to = 1L, by = 0.1)
ragged_density <- rev(ragged_density[ragged_density > 0L])
ragged_density <- rep_len(ragged_density, length.out = length(X_layer_names))

if (!is.na(seed)) {
set.seed(seed)
Expand All @@ -372,8 +370,8 @@ create_and_populate_ragged_experiment <- function(
layer_name <- X_layer_names[i]

mat <- Matrix::rsparsematrix(
nrow = ceiling(n_obs * nd[i]),
ncol = ceiling(n_var * nd[i]),
nrow = ceiling(n_obs * ragged_density[i]),
ncol = ceiling(n_var * ragged_density[i]),
density = 0.6,
rand.x = function(n) as.integer(runif(n, min = 1, max = 100)),
repr = 'T'
Expand All @@ -385,7 +383,7 @@ create_and_populate_ragged_experiment <- function(
shape = dim(mat)
)
ndarray$write(mat)
if (nd[i] != 1L) {
if (ragged_density[i] != 1L) {
ndarray$set_metadata(.ragged_array_hint())
}
ndarray$set_metadata(.type_hint(class(mat)))
Expand Down

0 comments on commit 8859e93

Please sign in to comment.