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

Accept functions #624

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

* Fix error while creating the filter choices when the data has a factor with a level containing an empty string ("").

### Miscellaneous

* `DefaultFilteredDataset` has been removed and filter panel no longer displays entries for non-filterable datasets.

### Breaking changes

* `ui_add` and `srv_add` no longer exist as adding new filters is a part of `ui_active` and `srv_active`.
Expand Down
5 changes: 4 additions & 1 deletion R/FilteredData-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ init_filtered_data <- function(x, join_keys = teal.data::join_keys(), code, chec
"init_filtered_data(check = 'No longer supported')"
)
}
FilteredData$new(x, join_keys = join_keys)
FilteredData$new(
Filter(function(obj) inherits(obj, c("data.frame", "MultiAssayExperiment")), x),
join_keys = join_keys
)
Comment on lines +32 to +35
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I echo @chlebowa comment here. I think this should be delegated lower into the dataset constructor. Conceptually - a function (or anything like that) cannot become a filtered dataset.

}

#' Evaluate expression with meaningful message
Expand Down
6 changes: 2 additions & 4 deletions R/FilteredData.R
Original file line number Diff line number Diff line change
Expand Up @@ -377,15 +377,13 @@ FilteredData <- R6::R6Class( # nolint
#'
format = function(show_all = FALSE, trim_lines = TRUE) {
datasets <- lapply(self$datanames(), private$get_filtered_dataset)
ind <- vapply(datasets, inherits, logical(1L), what = "DefaultFilteredDataset")
states <- do.call(c, lapply(datasets[!ind], function(ds) ds$get_filter_state()))
states <- do.call(c, lapply(datasets, function(ds) ds$get_filter_state()))
states_fmt <- format(states, show_all = show_all, trim_lines = trim_lines)
holders_fmt <- vapply(datasets[ind], format, character(1L), show_all = show_all, trim_lines = trim_lines)

sprintf(
"%s:\n%s",
class(self)[1],
paste(c(states_fmt, holders_fmt), collapse = "\n")
paste(states_fmt, collapse = "\n")
)
},

Expand Down
6 changes: 1 addition & 5 deletions R/FilteredDataset-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,5 @@ init_filtered_dataset.default <- function(dataset,
parent, # ignored
join_keys, # ignored
label = attr(dataset, "label", exact = TRUE)) {
DefaultFilteredDataset$new(
dataset = dataset,
dataname = dataname,
label = label
)
NULL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about an error message?

}
124 changes: 0 additions & 124 deletions R/FilteredDatasetDefault.R

This file was deleted.

Loading
Loading