Skip to content

Commit

Permalink
refactor print function
Browse files Browse the repository at this point in the history
  • Loading branch information
rcannood committed Sep 20, 2023
1 parent 4edfa90 commit e56b2dc
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions R/AbstractAnnData.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,25 +82,28 @@ AbstractAnnData <- R6::R6Class("AbstractAnnData", # nolint
for (attribute in c(
"obs",
"var",
"uns",
# "uns", # TODO: remove this when uns is implemented
"obsm",
"varm",
"layers",
"obsp",
"varp"
)) {
attr_key <- paste0(attribute, "_keys")
if (!is.null(self[[attr_key]])) {
slot_keys <- self[[attr_key]]()
if (length(slot_keys) > 0) {
key_fun <- self[[paste0(attribute, "_keys")]]
keys <-
if (!is.null(key_fun)) {
key_fun()
} else {
NULL
}
if (length(keys) > 0) {
cat(
" ", attribute, ":",
paste("'", slot_keys, "'", collapse = ", "),
paste("'", keys, "'", collapse = ", "),
"\n", sep = ""
)
}
}
}
},

#' @description Dimensions (observations x variables) of the AnnData object.
Expand Down

0 comments on commit e56b2dc

Please sign in to comment.