Skip to content

Commit 369b02e

Browse files
committed
Allow this check, even though I assay names might not be present
1 parent 275b3f3 commit 369b02e

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

R/utilities.R

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,8 @@ is_filer_columns_in_column_selection <- function(.data, ...) {
13001300
check_if_assays_are_NOT_consistently_ordered <- function(se) {
13011301

13021302
# If I have any assay at all
1303-
assays(se) |> length() |> gt(0) &&
1303+
do_I_have_assays =
1304+
assays(se) |> length() |> gt(0) &&
13041305

13051306
# If I have more than one assay with colnames
13061307
Filter(
@@ -1310,9 +1311,24 @@ check_if_assays_are_NOT_consistently_ordered <- function(se) {
13101311
map(colnames)
13111312
) |>
13121313
length() |>
1313-
gt(0) &&
1314-
1315-
# If I have lack of consistency
1314+
1315+
gt(0)
1316+
1317+
# If I have lack of consistency
1318+
# Forcing assay names otherwise fails if assay is unnamed
1319+
if(
1320+
se |>
1321+
assays(withDimnames = FALSE) |>
1322+
as.list() |>
1323+
names()
1324+
)
1325+
assays(se) =
1326+
se |>
1327+
assays(withDimnames = FALSE) |>
1328+
as.list() |>
1329+
set_names(se |> assays() |> as.list() |> length() |> seq_len())
1330+
1331+
lack_of_consistency =
13161332
se |>
13171333
assays(withDimnames = FALSE) |>
13181334
as.list() |>
@@ -1321,6 +1337,8 @@ check_if_assays_are_NOT_consistently_ordered <- function(se) {
13211337
equals(1) |>
13221338
all() |>
13231339
not()
1340+
1341+
do_I_have_assays && lack_of_consistency
13241342
}
13251343

13261344
check_if_any_dimnames_duplicated <- function(se, dim = "cols") {

0 commit comments

Comments
 (0)