Skip to content

Commit

Permalink
explicit call to setdiff -> base::setdiff
Browse files Browse the repository at this point in the history
  • Loading branch information
wolski committed Apr 2, 2024
1 parent 57ec208 commit 4678e14
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 26 deletions.
6 changes: 3 additions & 3 deletions R/AnalysisConfiguration.R
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ setup_analysis <- function(data, configuration, cc = TRUE, from_factors = FALSE
#' bb <- prolfqua_data('data_ionstar')$filtered()
#' bb$config <- old2new(bb$config)
#' dt <- separate_hierarchy(bb$data, bb$config)
#' setdiff(colnames(dt) ,colnames(bb$data))
#' base::setdiff(colnames(dt) ,colnames(bb$data))
#' stopifnot(ncol(dt) >= ncol(bb$data))
#'
separate_hierarchy <- function(data, config){
Expand All @@ -255,7 +255,7 @@ separate_hierarchy <- function(data, config){
#' bb <- prolfqua_data('data_ionstar')$filtered()
#' bb$config <- old2new(bb$config)
#' dt <- separate_factors(bb$data, bb$config)
#' setdiff(colnames(dt), colnames(bb$data))
#' base::setdiff(colnames(dt), colnames(bb$data))
#' stopifnot(ncol(bb$data) < ncol(dt))
#'
separate_factors <- function(data, config) {
Expand Down Expand Up @@ -486,7 +486,7 @@ summarize_hierarchy <- function(pdata,

precursor <- pdata |> dplyr::select(factors, all_hierarchy) |> dplyr::distinct()
x3 <- precursor |> dplyr::group_by_at(c(factors, hierarchy)) |>
dplyr::summarize_at( setdiff(all_hierarchy, hierarchy),
dplyr::summarize_at( base::setdiff(all_hierarchy, hierarchy),
list( n = dplyr::n_distinct))
return(x3)
}
Expand Down
4 changes: 2 additions & 2 deletions R/tidyMS_R6_Modelling.R
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ plot_lmer_peptide_predictions <- function(m){
plot_lmer_peptide_noRandom <- function(m,legend.position = "none"){
data <- m@frame
ran <- lme4::ranef(m)[[1]]
randeffect <- setdiff(all.vars( terms(formula(m)) ) , all.vars(terms(m)))
randeffect <- base::setdiff(all.vars( terms(formula(m)) ) , all.vars(terms(m)))
ran <- tibble::as_tibble(ran,rownames = randeffect)
colnames(ran) <- gsub("[()]","",colnames(ran))
ran <- dplyr::inner_join(data, ran, by = randeffect)
Expand Down Expand Up @@ -579,7 +579,7 @@ linfct_matrix_contrasts <- function(linfct , contrasts, p.message = FALSE){
make_contrasts <- function(data,
contrasts)
{
cnams <- setdiff(colnames(data),"interaction")
cnams <- base::setdiff(colnames(data),"interaction")
for (i in seq_along(contrasts)) {
if (p.message) {message(names(contrasts)[i], "=", contrasts[i],"\n")}
data <- dplyr::mutate(data, !!names(contrasts)[i] := !!rlang::parse_expr(contrasts[i]))
Expand Down
21 changes: 12 additions & 9 deletions R/tidyMS_aggregation.R
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ medpolish_estimate <- function(x, name = FALSE, sampleName = "sampleName" ){
#' dplyr::group_by_at( configur$table$hierarchy_keys_depth() ) |>
#' tidyr::nest()
#' x <- xnested$data[[1]]
#' nn <- x |> dplyr::select( setdiff(configur$table$hierarchy_keys() , configur$table$hierarchy_keys_depth()) ) |>
#' nn <- x |> dplyr::select( base::setdiff(configur$table$hierarchy_keys() ,
#' configur$table$hierarchy_keys_depth()) ) |>
#' dplyr::distinct() |> nrow()
#'
#' xx <- response_as_matrix(x,configur)
Expand All @@ -282,7 +283,8 @@ medpolish_estimate <- function(x, name = FALSE, sampleName = "sampleName" ){
#' tidyr::nest()
#'
#' x <- xnested$data[[1]]
#' nn <- x |> dplyr::select( setdiff(configur$table$hierarchy_keys(), configur$table$hierarchy_keys_depth()) ) |>
#' nn <- x |> dplyr::select( base::setdiff(configur$table$hierarchy_keys(),
#' configur$table$hierarchy_keys_depth()) ) |>
#' dplyr::distinct() |> nrow()
#'
#' xx <- response_as_matrix(x,conf)
Expand All @@ -292,7 +294,7 @@ response_as_matrix <- function(pdata, config ){
table <- config$table
.extractInt(pdata,
table$get_response(),
setdiff(table$hierarchy_keys(), table$hierarchy_keys_depth()),
base::setdiff(table$hierarchy_keys(), table$hierarchy_keys_depth()),
table$sampleName)
}

Expand Down Expand Up @@ -320,7 +322,8 @@ response_as_matrix <- function(pdata, config ){
#' xnested <- data |>
#' dplyr::group_by_at(conf$table$hierarchy_keys_depth()) |> tidyr::nest()
#'
#' feature <- setdiff(conf$table$hierarchy_keys(), conf$table$hierarchy_keys_depth())
#' feature <- base::setdiff(conf$table$hierarchy_keys(),
#' conf$table$hierarchy_keys_depth())
#' x <- xnested$data[[1]]
#' bb <- medpolish_estimate_df(x,
#' response = conf$table$get_response(),
Expand Down Expand Up @@ -356,7 +359,7 @@ medpolish_estimate_df <- function(pdata, response, feature, sampleName ){
#' xnested <- data |>
#' dplyr::group_by_at(conf$table$hierarchy_keys_depth()) |> tidyr::nest()
#'
#' feature <- setdiff(conf$table$hierarchy_keys(), conf$table$hierarchy_keys_depth())
#' feature <- base::setdiff(conf$table$hierarchy_keys(), conf$table$hierarchy_keys_depth())
#' x <- xnested$data[[1]]
#' bb <- medpolish_estimate_dfconfig(x,conf)
#' prolfqua:::.reestablish_condition(x,bb, conf)
Expand All @@ -366,7 +369,7 @@ medpolish_estimate_dfconfig <- function(pdata, config, name=FALSE){
return("medpolish")
}

feature <- setdiff(config$table$hierarchy_keys(), config$table$hierarchy_keys_depth())
feature <- base::setdiff(config$table$hierarchy_keys(), config$table$hierarchy_keys_depth())
res <- medpolish_estimate_df(pdata,
response = config$table$get_response(),
feature = feature,
Expand Down Expand Up @@ -490,7 +493,7 @@ medpolish_estimate_dfconfig <- function(pdata, config, name=FALSE){
#' xnested <- data |>
#' dplyr::group_by_at(conf$table$hierarchy_keys_depth()) |> tidyr::nest()
#'
#' feature <- setdiff(conf$table$hierarchy_keys(), conf$table$hierarchy_keys_depth())
#' feature <- base::setdiff(conf$table$hierarchy_keys(), conf$table$hierarchy_keys_depth())
#' x <- xnested$data[[1]]
#' bb <- rlm_estimate(x,
#' response = conf$table$get_response(),
Expand Down Expand Up @@ -524,7 +527,7 @@ rlm_estimate <- function(pdata, response, feature , samples, maxIt = 20) {
#' xnested <- data |>
#' dplyr::group_by_at(conf$table$hierarchy_keys_depth()) |> tidyr::nest()
#'
#' feature <- setdiff(conf$table$hierarchy_keys(), conf$table$hierarchy_keys_depth())
#' feature <- base::setdiff(conf$table$hierarchy_keys(), conf$table$hierarchy_keys_depth())
#' x <- xnested$data[[1]]
#' bb <- rlm_estimate_dfconfig(x, conf)
#'
Expand All @@ -533,7 +536,7 @@ rlm_estimate <- function(pdata, response, feature , samples, maxIt = 20) {
rlm_estimate_dfconfig <- function(pdata, config, name= FALSE){
if (name) {return("lmrob")}

feature <- setdiff(config$table$hierarchy_keys(), config$table$hierarchy_keys_depth())
feature <- base::setdiff(config$table$hierarchy_keys(), config$table$hierarchy_keys_depth())
rlm_estimate(pdata, response = config$table$get_response(),
feature = feature,
samples = config$table$sampleName
Expand Down
8 changes: 4 additions & 4 deletions R/tidyMS_missigness.R
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,19 @@ interaction_missing_stats <- function(pdata,

pid <- config$table$hierarchy_keys_depth()
nrReplicates <- mstats |>
dplyr::select( -one_of(c(setdiff(x_summaries,"nrReplicates"),"imputed") )) |>
dplyr::select( -one_of(c(base::setdiff(x_summaries,"nrReplicates"),"imputed") )) |>
tidyr::spread(interaction, nrReplicates, sep = ".nrReplicates.") |>
arrange(!!!syms(pid)) |>
dplyr::ungroup()
nrMeasured <- mstats |> dplyr::select(-one_of(c(setdiff(x_summaries,"nrMeasured"),"imputed" ) )) |>
nrMeasured <- mstats |> dplyr::select(-one_of(c(base::setdiff(x_summaries,"nrMeasured"),"imputed" ) )) |>
tidyr::spread(interaction, nrMeasured, sep = ".nrMeasured.") |>
arrange(!!!syms(pid)) |> dplyr::ungroup()

meanAbundance <- mstats |> dplyr::select(-one_of(c(setdiff(x_summaries,"meanAbundance"),"imputed" ) )) |>
meanAbundance <- mstats |> dplyr::select(-one_of(c(base::setdiff(x_summaries,"meanAbundance"),"imputed" ) )) |>
tidyr::spread(interaction, meanAbundance, sep = ".meanAbundance.") |>
arrange(!!!syms(pid)) |> dplyr::ungroup()

meanAbundanceImputed <- mstats |> dplyr::select(-one_of(setdiff(x_summaries,"imputed" ) )) |>
meanAbundanceImputed <- mstats |> dplyr::select(-one_of(base::setdiff(x_summaries,"imputed" ) )) |>
tidyr::spread(interaction, .data$imputed, sep = ".imputed.") |>
arrange(!!!syms(pid)) |> dplyr::ungroup()

Expand Down
3 changes: 2 additions & 1 deletion man/medpolish_estimate_df.Rd

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

2 changes: 1 addition & 1 deletion man/medpolish_estimate_dfconfig.Rd

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

6 changes: 4 additions & 2 deletions man/response_as_matrix.Rd

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

2 changes: 1 addition & 1 deletion man/rlm_estimate.Rd

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

2 changes: 1 addition & 1 deletion man/rlm_estimate_dfconfig.Rd

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

2 changes: 1 addition & 1 deletion man/separate_factors.Rd

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

2 changes: 1 addition & 1 deletion man/separate_hierarchy.Rd

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

0 comments on commit 4678e14

Please sign in to comment.