Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce teal_data class #470

Merged
merged 22 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion R/FilteredData-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ init_filtered_data.TealData <- function(x, # nolint
join_keys = x$get_join_keys(),
code = x$get_code_class(),
check = x$get_check()) {
lifecycle::deprecate_warn(
when = "0.4.1",
"init_filtered_data(
x = 'constructor based on TealData is deprecated and will be removed soon.
Please use generic init_filtered_data and specify all arguments directly.'
)"
)
data_objects <- lapply(
x$get_datanames(),
function(dataname) {
Expand All @@ -55,7 +62,6 @@ init_filtered_data.TealData <- function(x, # nolint
#' @export
init_filtered_data.default <- function(x, join_keys = teal.data::join_keys(), code = NULL, check = FALSE) { # nolint
checkmate::assert_list(x, any.missing = FALSE, names = "unique")
mapply(validate_dataset_args, x, names(x))
checkmate::assert_class(code, "CodeClass", null.ok = TRUE)
checkmate::assert_class(join_keys, "JoinKeys")
checkmate::assert_flag(check)
Expand Down
4 changes: 2 additions & 2 deletions R/FilteredData.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ FilteredData <- R6::R6Class( # nolint

for (dataname in ordered_datanames) {
ds_object <- data_objects[[dataname]]
validate_dataset_args(ds_object, dataname)
if (inherits(ds_object, c("data.frame", "MultiAssayExperiment"))) {
self$set_dataset(
data = ds_object,
Expand All @@ -104,6 +103,7 @@ FilteredData <- R6::R6Class( # nolint
} else {
# custom support for TealData object which pass metadata and label also
# see init_filtered_data.TealData
validate_dataset_args(ds_object, dataname)
self$set_dataset(
data = ds_object$dataset,
dataname = dataname,
Expand Down Expand Up @@ -327,7 +327,7 @@ FilteredData <- R6::R6Class( # nolint
#' Label to describe the dataset
#' @return (`self`) invisibly this `FilteredData`
#'
set_dataset = function(data, dataname, metadata, label) {
set_dataset = function(data, dataname, metadata = attr(data, "metadata"), label = attr(data, "label")) {
logger::log_trace("FilteredData$set_dataset setting dataset, name: { dataname }")
# to include it nicely in the Show R Code;
# the UI also uses `datanames` in ids, so no whitespaces allowed
Expand Down
7 changes: 6 additions & 1 deletion man/FilteredData.Rd

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