Skip to content

Commit

Permalink
cleanup syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
shackett committed Sep 19, 2024
1 parent fbdd47a commit 0df1502
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 20 deletions.
30 changes: 16 additions & 14 deletions R/data_classes.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@
#' )
#' @export
create_tidy_omic <- function(
df,
feature_pk,
feature_vars = NULL,
sample_pk,
sample_vars = NULL,
omic_type_tag = "general",
verbose = TRUE
) {
df,
feature_pk,
feature_vars = NULL,
sample_pk,
sample_vars = NULL,
omic_type_tag = "general",
verbose = TRUE
) {

checkmate::assertDataFrame(df)
checkmate::assertString(omic_type_tag)
Expand Down Expand Up @@ -367,12 +367,14 @@ check_tidy_omic <- function(tidy_omic, fast_check = TRUE) {
#' "feature_id", "sample_id"
#' )
#' @export
create_triple_omic <- function(measurement_df,
feature_df = NULL,
sample_df = NULL,
feature_pk,
sample_pk,
omic_type_tag = "general") {
create_triple_omic <- function(
measurement_df,
feature_df = NULL,
sample_df = NULL,
feature_pk,
sample_pk,
omic_type_tag = "general"
) {
# testing

checkmate::assertClass(measurement_df, "data.frame")
Expand Down
19 changes: 13 additions & 6 deletions R/filters.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
#' filter_value}
#' \item{range}{filter filter_variable to using the range (i.e., lower and
#' upper limit) provided in filter_value}
#' \item{apply}{a quosure as a \code{filter_value} to a table of interest}
#' \item{quo}{a quosure as a \code{filter_value} to a table of interest}
#' }
#' @param filter_table table where the filter should be applied
#' @param filter_variable variable to apply the filter to
#' @param filter_value values to filter based on
#' @param invert If FALSE (default) entities will be retained; if TRUE, they
#' will be removed.
#'
#' @returns A \code{tomic} object where a subset of features, samples or
#' measurmenets have been filtered.
Expand Down Expand Up @@ -51,17 +53,22 @@
#' filter_value = rlang::quo(BP == "biological process unknown")
#' )
#' @export
filter_tomic <- function(tomic,
filter_type,
filter_table,
filter_value,
filter_variable = NULL) {
filter_tomic <- function(
tomic,
filter_type,
filter_table,
filter_value,
filter_variable = NULL,
invert = FALSE
) {

checkmate::assertClass(tomic, "tomic")
checkmate::assertChoice(filter_type, c("category", "range", "quo"))
checkmate::assertChoice(
filter_table,
c("features", "samples", "measurements")
)
checkmate::assertLogical(invert, len = 1)

# convert to triple_omic
triple_omic <- tomic_to(tomic, "triple_omic")
Expand Down

0 comments on commit 0df1502

Please sign in to comment.