From 557cad744dee1bb86568da8fbd77e6cba4b6e06f Mon Sep 17 00:00:00 2001 From: Evan Glasscock <121138977+evanglass@users.noreply.github.com> Date: Fri, 6 Jan 2023 15:18:58 -0800 Subject: [PATCH 1/8] Replace T with TRUE for R-CMD-check --- pmartR-Ex.R | 54 ++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/pmartR-Ex.R b/pmartR-Ex.R index 9dbd7c3a..4cda8be2 100644 --- a/pmartR-Ex.R +++ b/pmartR-Ex.R @@ -256,11 +256,11 @@ flush(stderr()); flush(stdout()) ##D ##D # Combine lipid and protein object into multidata, both must be log2 + normalized. ##D mylipid_object <- edata_transform(lipid_object, "log2") -##D mylipid_object <- normalize_global(mylipid_object, "all", "median", apply_norm = T) +##D mylipid_object <- normalize_global(mylipid_object, "all", "median", apply_norm = TRUE) ##D ##D # Combine without specifically supplying f_meta, either directly, or as one ##D # of the f_datas in any object. -##D mymultidata <- as.multiData(pro_object, mylipid_object, auto_fmeta = T) +##D mymultidata <- as.multiData(pro_object, mylipid_object, auto_fmeta = TRUE) ##D ##D # Manually supply an f_meta ##D f_meta <- data.frame( @@ -271,11 +271,11 @@ flush(stderr()); flush(stdout()) ##D ) ##D ##D mymetab_object <- edata_transform(metab_object, "log2") -##D mymetab_object <- normalize_global(mymetab_object, "all", "median", apply_norm = T) +##D mymetab_object <- normalize_global(mymetab_object, "all", "median", apply_norm = TRUE) ##D ##D as.multiData(mylipid_object, pro_object, mymetab_object, f_meta = f_meta) ##D # remove samples that are not common across all data. -##D as.multiData(mylipid_object, pro_object, mymetab_object, f_meta = f_meta, sample_intersect = T) +##D as.multiData(mylipid_object, pro_object, mymetab_object, f_meta = f_meta, sample_intersect = TRUE) ## End(Not run) @@ -409,7 +409,7 @@ flush(stderr()); flush(stdout()) ##D # Generate an example e_meta file for lipid data ##D lipid_emeta <- data.frame("LipidCommonName" = lipid_edata_pos$LipidCommonName, ##D "LipidFamily" = lipid_edata_pos$LipidCommonName %>% as.character() %>% -##D strsplit("(", fixed = T) %>% lapply(function(el) {el[1]}) %>% unlist()) +##D strsplit("(", fixed = TRUE) %>% lapply(function(el) {el[1]}) %>% unlist()) ##D ##D # Extend fdata to have two infection groups ##D lipid_fdata_pos2 <- data.frame("Sample_Name" = lipid_fdata_pos$Sample_Name, @@ -536,9 +536,9 @@ combine_object <- combine_lipidData(obj_1, obj_2) # preprocess and group the data and keep filters/grouping structure obj_1 <- edata_transform(obj_1, "log2") -obj_1 <- normalize_global(obj_1, "all", "median", apply_norm = T) +obj_1 <- normalize_global(obj_1, "all", "median", apply_norm = TRUE) obj_2 <- edata_transform(obj_2, "log2") -obj_2 <- normalize_global(obj_2, "all", "median", apply_norm = T) +obj_2 <- normalize_global(obj_2, "all", "median", apply_norm = TRUE) obj_1 <- group_designation(obj_1, "Condition") obj_2 <- group_designation(obj_2, "Condition") @@ -546,7 +546,7 @@ obj_2 <- group_designation(obj_2, "Condition") obj_1 <- applyFilt(molecule_filter(obj_1), obj_1, min_num = 2) obj_2 <- applyFilt(cv_filter(obj_2),obj_2, cv_thresh = 60) -combine_lipidData(obj_1, obj_2, retain_groups = T, retain_filters = T) +combine_lipidData(obj_1, obj_2, retain_groups = TRUE, retain_filters = TRUE) @@ -2188,26 +2188,26 @@ flush(stderr()); flush(stdout()) ##D ##D ## Build the abundance boxplot with an edata file. Generate trelliData in as.trelliData.edata ##D trelli_panel_by(trelliData = trelliData, panel = "LipidCommonName") %>% -##D trelli_abundance_boxplot(test_mode = T, test_example = 1:10) +##D trelli_abundance_boxplot(test_mode = TRUE, test_example = 1:10) ##D trelli_panel_by(trelliData = trelliData, panel = "Sample") %>% trelli_abundance_boxplot() ##D ##D ## Build the abundance boxplot with an omicsData object. Generate trelliData in as.trelliData ##D trelli_panel_by(trelliData = trelliData2, panel = "LipidCommonName") %>% -##D trelli_abundance_boxplot(test_mode = T, test_example = 1:10) +##D trelli_abundance_boxplot(test_mode = TRUE, test_example = 1:10) ##D trelli_panel_by(trelliData = trelliData2, panel = "LipidFamily") %>% trelli_abundance_boxplot() ##D ##D ## Build the abundance boxplot with an omicsData and statRes object. Generate trelliData in as.trelliData. ##D trelli_panel_by(trelliData = trelliData4, panel = "LipidCommonName") %>% -##D trelli_abundance_boxplot(test_mode = T, test_example = 1:10) +##D trelli_abundance_boxplot(test_mode = TRUE, test_example = 1:10) ##D trelli_panel_by(trelliData = trelliData4, panel = "LipidFamily") %>% trelli_abundance_boxplot() ##D ##D ## Other options include modifying the ggplot ##D trelli_panel_by(trelliData = trelliData, panel = "LipidCommonName") %>% -##D trelli_abundance_boxplot(test_mode = T, test_example = 1:10, +##D trelli_abundance_boxplot(test_mode = TRUE, test_example = 1:10, ##D ggplot_params = c("ylab('')", "ylim(c(2,20))")) ##D ##D ## Or making the plot interactive -##D trelli_panel_by(trelliData = trelliData4, panel = "LipidFamily") %>% trelli_abundance_boxplot(interactive = T) +##D trelli_panel_by(trelliData = trelliData4, panel = "LipidFamily") %>% trelli_abundance_boxplot(interactive = TRUE) ##D ## End(Not run) @@ -2230,12 +2230,12 @@ flush(stderr()); flush(stdout()) ##D ##D ## Build the abundance heatmap with an omicsData object with emeta variables. Generate trelliData in as.trelliData. ##D trelli_panel_by(trelliData = trelliData2, panel = "LipidFamily") %>% -##D trelli_abundance_heatmap(test_mode = T, test_example = 1:3) +##D trelli_abundance_heatmap(test_mode = TRUE, test_example = 1:3) ##D ##D ## Users can modify the plotting function with ggplot parameters and interactivity, ##D ## and can also select certain cognostics. ##D trelli_panel_by(trelliData = trelliData4, panel = "LipidFamily") %>% -##D trelli_abundance_heatmap(test_mode = T, test_example = 1:5, +##D trelli_abundance_heatmap(test_mode = TRUE, test_example = 1:5, ##D ggplot_params = c("ylab('')", "xlab('')"), interactive = TRUE, cognostics = c("mean", "median")) ##D ## End(Not run) @@ -2260,20 +2260,20 @@ flush(stderr()); flush(stdout()) ##D ##D ## Build the abundance histogram with an edata file. Generate trelliData in as.trelliData.edata ##D trelli_panel_by(trelliData = trelliData, panel = "LipidCommonName") %>% -##D trelli_abundance_histogram(test_mode = T, test_example = 1:10) +##D trelli_abundance_histogram(test_mode = TRUE, test_example = 1:10) ##D ##D ## Build the abundance histogram with an omicsData object. Generate trelliData in as.trelliData ##D trelli_panel_by(trelliData = trelliData2, panel = "LipidCommonName") %>% -##D trelli_abundance_histogram(test_mode = T, test_example = 1:10) +##D trelli_abundance_histogram(test_mode = TRUE, test_example = 1:10) ##D ##D ## Build the abundance histogram with an omicsData and statRes object. Generate trelliData in as.trelliData. ##D trelli_panel_by(trelliData = trelliData4, panel = "LipidCommonName") %>% -##D trelli_abundance_histogram(test_mode = T, test_example = 1:10) +##D trelli_abundance_histogram(test_mode = TRUE, test_example = 1:10) ##D ##D ## Users can modify the plotting function with ggplot parameters and interactivity, ##D ## and can also select certain cognostics. ##D trelli_panel_by(trelliData = trelliData, panel = "LipidCommonName") %>% -##D trelli_abundance_histogram(test_mode = T, test_example = 1:10, +##D trelli_abundance_histogram(test_mode = TRUE, test_example = 1:10, ##D ggplot_params = c("ylab('')", "xlab('Abundance')"), interactive = TRUE, ##D cognostics = c("mean", "median")) ##D @@ -2299,11 +2299,11 @@ flush(stderr()); flush(stdout()) ##D ##D ## Build fold_change bar plot with statRes data grouped by edata_colname. ##D trelli_panel_by(trelliData = trelliData3, panel = "LipidCommonName") %>% -##D trelli_foldchange_bar(test_mode = T, test_example = 1:10, p_value_test = TRUE) +##D trelli_foldchange_bar(test_mode = TRUE, test_example = 1:10, p_value_test = TRUE) ##D ##D ## Or make the plot interactive ##D trelli_panel_by(trelliData = trelliData4, panel = "LipidCommonName") %>% -##D trelli_foldchange_bar(test_mode = T, test_example = 1:10, p_value_test = TRUE, interactive = T) +##D trelli_foldchange_bar(test_mode = TRUE, test_example = 1:10, p_value_test = TRUE, interactive = TRUE) ##D ## End(Not run) @@ -2398,28 +2398,28 @@ flush(stderr()); flush(stdout()) ##D ##D ## Build the missingness bar plot with an edata file. Generate trelliData in as.trelliData.edata ##D trelli_panel_by(trelliData = trelliData, panel = "LipidCommonName") %>% -##D trelli_missingness_bar(test_mode = T, test_example = 1:10) +##D trelli_missingness_bar(test_mode = TRUE, test_example = 1:10) ##D trelli_panel_by(trelliData = trelliData, panel = "Sample") %>% trelli_missingness_bar() ##D ##D ## Build the missingness bar plot with an omicsData object. Generate trelliData in as.trelliData ##D trelli_panel_by(trelliData = trelliData2, panel = "LipidCommonName") %>% -##D trelli_missingness_bar(test_mode = T, test_example = 1:10) +##D trelli_missingness_bar(test_mode = TRUE, test_example = 1:10) ##D ##D ## Build the missingness bar plot with a statRes object. Generate trelliData in as.trelliData ##D trelli_panel_by(trelliData = trelliData3, panel = "LipidCommonName") %>% -##D trelli_missingness_bar(test_mode = T, test_example = 1:10) +##D trelli_missingness_bar(test_mode = TRUE, test_example = 1:10) ##D ##D ## Build the missingness bar plot with an omicsData and statRes object. Generate trelliData in as.trelliData. ##D trelli_panel_by(trelliData = trelliData4, panel = "LipidCommonName") %>% -##D trelli_missingness_bar(test_mode = T, test_example = 1:10) +##D trelli_missingness_bar(test_mode = TRUE, test_example = 1:10) ##D ##D ## Or making the plot interactive ##D trelli_panel_by(trelliData = trelliData2, panel = "LipidCommonName") %>% -##D trelli_missingness_bar(test_mode = T, test_example = 1:5) +##D trelli_missingness_bar(test_mode = TRUE, test_example = 1:5) ##D ##D ## Or visualize only count data ##D trelli_panel_by(trelliData = trelliData2, panel = "LipidCommonName") %>% -##D trelli_missingness_bar(test_mode = T, test_example = 1:5, cognostics = "n", proportion = FALSE) +##D trelli_missingness_bar(test_mode = TRUE, test_example = 1:5, cognostics = "n", proportion = FALSE) ##D ## End(Not run) From e29839a6e2505501923f362232ba383ec2900d62 Mon Sep 17 00:00:00 2001 From: Evan Glasscock Date: Mon, 9 Jan 2023 08:27:48 -0800 Subject: [PATCH 2/8] Replace all instances of T with TRUE --- R/as.multiData.R | 6 +- R/as.omicsData.R | 2 +- R/as.trelliData.R | 4 +- R/bpquant.R | 6 +- R/dim_reduction.R | 2 +- R/edata_summary.R | 50 +++++++------- R/filter_objects.R | 12 ++-- R/plot_fns.R | 10 +-- R/protein_quant.R | 16 ++--- R/seqData_wrappers.R | 30 ++++----- R/trelliPlots.R | 88 ++++++++++++------------- man/as.multiData.Rd | 6 +- man/as.trelliData.Rd | 4 +- man/combine_lipidData.Rd | 2 +- man/trelli_abundance_boxplot.Rd | 10 +-- man/trelli_abundance_heatmap.Rd | 4 +- man/trelli_abundance_histogram.Rd | 8 +-- man/trelli_foldchange_bar.Rd | 4 +- man/trelli_missingness_bar.Rd | 12 ++-- tests/testthat/test_as_multiData.R | 20 +++--- tests/testthat/test_combine_omicsData.R | 28 ++++---- tests/testthat/test_dim_reduction.R | 4 +- tests/testthat/test_dispersion_est.R | 8 +-- tests/testthat/test_edata_summary.R | 20 +++--- tests/testthat/test_trelliPlots.R | 16 ++--- vignettes/Trelliscope_Vignette.R | 22 +++---- 26 files changed, 197 insertions(+), 197 deletions(-) diff --git a/R/as.multiData.R b/R/as.multiData.R index 5a9f7c52..fbd473ee 100644 --- a/R/as.multiData.R +++ b/R/as.multiData.R @@ -12,7 +12,7 @@ #' a series of left joins. Defaults to FALSE. #' @param auto_fmeta logical indicator for whether to attempt to automatically #' construct f_meta from the objects' sample information. Defaults to FALSE. -#' @param match_samples logical indicator. If auto_fmeta = T, whether to attempt +#' @param match_samples logical indicator. If auto_fmeta = TRUE, whether to attempt #' to match the names in the sample columns in f_data across all objects in an #' attempt to align them in f_meta. Defaults to TRUE. #' @@ -38,7 +38,7 @@ #' # Combine metabolomics and protein object into multidata, both must be log2 #' # and normalized. #' mymetab <- edata_transform(omicsData = metab_object, data_scale = "log2") -#' mymetab <- normalize_global(omicsData = mymetab, subset_fn = "all", norm_fn = "median", apply_norm = T) +#' mymetab <- normalize_global(omicsData = mymetab, subset_fn = "all", norm_fn = "median", apply_norm = TRUE) #' #' mypro <- pro_object #' @@ -62,7 +62,7 @@ as.multiData <- function(..., f_meta = NULL, sample_intersect = F, - match_samples = T, + match_samples = TRUE, keep_sample_info = F, auto_fmeta = F) { omicsData_objects <- list(...) diff --git a/R/as.omicsData.R b/R/as.omicsData.R index a0a57a96..17dd76b7 100755 --- a/R/as.omicsData.R +++ b/R/as.omicsData.R @@ -1189,7 +1189,7 @@ as.seqData <- function (e_data, f_data, e_meta = NULL, # Analyses must have raw counts nums <- e_data[which(colnames(e_data) != edata_cname)] - notint <- any(apply(nums, 2, function(col) (sum(col%%1, na.rm = T) != 0))) + notint <- any(apply(nums, 2, function(col) (sum(col%%1, na.rm = TRUE) != 0))) if(notint){ warning("Non-integers detected. Analyses supported by pmartR for RNA-seq data require raw counts.") } diff --git a/R/as.trelliData.R b/R/as.trelliData.R index 20e501f1..8f4b5860 100644 --- a/R/as.trelliData.R +++ b/R/as.trelliData.R @@ -239,12 +239,12 @@ as.trelliData.edata <- function(e_data, #' # Generate an example e_meta file for lipid data #' lipid_emeta <- data.frame("Lipid" = lipid_pos_edata$Lipid, #' "LipidFamily" = lipid_pos_edata$Lipid %>% as.character() %>% -#' strsplit("(", fixed = T) %>% lapply(function(el) {el[1]}) %>% unlist()) +#' strsplit("(", fixed = TRUE) %>% lapply(function(el) {el[1]}) %>% unlist()) #' #' # Transform the data #' omicsData <- edata_transform(omicsData = lipid_pos_object, data_scale = "log2") #' omicsData$e_meta$LipidFamily <- omicsData$e_meta$Lipid %>% as.character() %>% -#' strsplit("(", fixed = T) %>% lapply(function(el) {el[1]}) %>% unlist() +#' strsplit("(", fixed = TRUE) %>% lapply(function(el) {el[1]}) %>% unlist() #' #' # Group the data by condition #' omicsData <- group_designation(omicsData = omicsData, main_effects = c("Virus")) diff --git a/R/bpquant.R b/R/bpquant.R index 489bac44..9e9c2297 100644 --- a/R/bpquant.R +++ b/R/bpquant.R @@ -222,9 +222,9 @@ bpquant_mod <- function (protein_sig, pi_not, max_proteoforms) { } ## order signatures by count## - cnt.ord = counts[order(counts, decreasing=T)] + cnt.ord = counts[order(counts, decreasing=TRUE)] if(nrow(sigs) > 1){ - sig.ord = as.data.frame(sigs[order(counts, decreasing=T),]) + sig.ord = as.data.frame(sigs[order(counts, decreasing=TRUE),]) }else{ sig.ord = sigs } @@ -289,7 +289,7 @@ bpquant_mod <- function (protein_sig, pi_not, max_proteoforms) { for(j in 1:(nu-1)){ tmp.rws = mat[apply(mat,1,sum)==j,] ord.var = apply(tmp.rws,1,function(x) as.numeric(paste(x,collapse=""))) - mat.list[[j+1]] = tmp.rws[order(ord.var, decreasing=T),] + mat.list[[j+1]] = tmp.rws[order(ord.var, decreasing=TRUE),] } p_configs = do.call(rbind,mat.list) } diff --git a/R/dim_reduction.R b/R/dim_reduction.R index 03334963..2ce40712 100644 --- a/R/dim_reduction.R +++ b/R/dim_reduction.R @@ -89,7 +89,7 @@ dim_reduction <- function (omicsData, k = 2){ } ## check for near zero variance features and remove ## - minvars = which(apply(temp_data, 1, var, na.rm = T) < 0.000001) + minvars = which(apply(temp_data, 1, var, na.rm = TRUE) < 0.000001) if(length(minvars) > 0){ temp_data = temp_data[-minvars, ] } diff --git a/R/edata_summary.R b/R/edata_summary.R index 60766e0e..b4c55722 100644 --- a/R/edata_summary.R +++ b/R/edata_summary.R @@ -79,18 +79,18 @@ edata_summary <- function (omicsData, by = 'sample', groupvar = NULL) { function(x){if(all(is.na(x))){ mean(x) }else{ - mean(x, na.rm = T) + mean(x, na.rm = TRUE) }})) avg = cbind(names(edata[, -edata_cname_id]), avg) names(avg)<- c("sample", "mean") rownames(avg)<- NULL - sd = as.data.frame(apply(edata[,-edata_cname_id], 2, sd, na.rm = T)) + sd = as.data.frame(apply(edata[,-edata_cname_id], 2, sd, na.rm = TRUE)) sd = cbind(names(edata[,-edata_cname_id]), sd) names(sd)<- c("sample", "sd") rownames(sd)<- NULL - mds = as.data.frame(apply(edata[,-edata_cname_id], 2, median, na.rm = T)) + mds = as.data.frame(apply(edata[,-edata_cname_id], 2, median, na.rm = TRUE)) mds = cbind(names(edata[,-edata_cname_id]), mds) names(mds)<- c("sample", "median") rownames(mds)<- NULL @@ -111,12 +111,12 @@ edata_summary <- function (omicsData, by = 'sample', groupvar = NULL) { rownames(pct_obs)<- NULL } - min = as.data.frame(apply(edata[,-edata_cname_id], 2, min, na.rm = T)) + min = as.data.frame(apply(edata[,-edata_cname_id], 2, min, na.rm = TRUE)) min = cbind(names(edata[,-edata_cname_id]), min) names(min)<- c("sample", "min") rownames(min)<- NULL - max = as.data.frame(apply(edata[,-edata_cname_id], 2, max, na.rm = T)) + max = as.data.frame(apply(edata[,-edata_cname_id], 2, max, na.rm = TRUE)) max = cbind(names(edata[,-edata_cname_id]), max) names(max)<- c("sample", "max") rownames(max)<- NULL @@ -144,18 +144,18 @@ edata_summary <- function (omicsData, by = 'sample', groupvar = NULL) { function(x){if(all(is.na(x))){ mean(x) }else{ - mean(x, na.rm = T) + mean(x, na.rm = TRUE) }}) avg = data.frame(molecule = edata[, edata_cname_id], mean = avg, stringsAsFactors = F) names(avg)[1]<- edata_cname - sd = apply(edata[, -edata_cname_id], 1, sd, na.rm = T) + sd = apply(edata[, -edata_cname_id], 1, sd, na.rm = TRUE) sd = data.frame(molecule = edata[, edata_cname_id], sd = sd, stringsAsFactors = F) names(sd)[1]<- edata_cname - mds = apply(edata[, -edata_cname_id], 1, median, na.rm = T) + mds = apply(edata[, -edata_cname_id], 1, median, na.rm = TRUE) mds = data.frame(molecule = edata[, edata_cname_id], median = mds, stringsAsFactors = F) @@ -166,12 +166,12 @@ edata_summary <- function (omicsData, by = 'sample', groupvar = NULL) { pct_obs = pct_obs, stringsAsFactors = F) names(pct_obs)[1]<- edata_cname - min = apply(edata[, -edata_cname_id], 1, min, na.rm = T) + min = apply(edata[, -edata_cname_id], 1, min, na.rm = TRUE) min = data.frame(molecule = edata[, edata_cname_id], min = min, stringsAsFactors = F) names(min)[1]<- edata_cname - max = apply(edata[, -edata_cname_id], 1, max, na.rm = T) + max = apply(edata[, -edata_cname_id], 1, max, na.rm = TRUE) max = data.frame(molecule = edata[, edata_cname_id], max = max, stringsAsFactors = F) @@ -226,14 +226,14 @@ edata_summary <- function (omicsData, by = 'sample', groupvar = NULL) { function(x){if(all(is.na(x))){ mean(x) }else{ - mean(x, na.rm = T) + mean(x, na.rm = TRUE) }}) names(avg)[which(colnames(avg)== ".")]<- "value" avg = reshape2::dcast(avg, formula = formula2) - std_dev = reshape2::dcast(edata_melt, formula = formula1, sd, na.rm = T) + std_dev = reshape2::dcast(edata_melt, formula = formula1, sd, na.rm = TRUE) names(std_dev)[which(colnames(std_dev)== ".")]<- "value" std_dev = reshape2::dcast(std_dev, formula = formula2) - mds = reshape2::dcast(edata_melt, formula = formula1, median, na.rm = T) + mds = reshape2::dcast(edata_melt, formula = formula1, median, na.rm = TRUE) names(mds)[which(colnames(mds)== ".")]<- "value" mds = reshape2::dcast(mds, formula = formula2) pct_obs = reshape2::dcast(edata_melt, formula = formula1, @@ -244,7 +244,7 @@ edata_summary <- function (omicsData, by = 'sample', groupvar = NULL) { function(x){if(all(is.na(x))){ min(x) }else{ - min(x, na.rm = T) + min(x, na.rm = TRUE) }}) names(mins)[which(colnames(mins)== ".")]<- "value" mins = reshape2::dcast(mins, formula = formula2) @@ -252,7 +252,7 @@ edata_summary <- function (omicsData, by = 'sample', groupvar = NULL) { function(x){if(all(is.na(x))){ max(x) }else{ - max(x, na.rm = T) + max(x, na.rm = TRUE) }}) names(maxs)[which(colnames(maxs)== ".")]<- "value" maxs = reshape2::dcast(maxs, formula = formula2) @@ -309,14 +309,14 @@ edata_summary <- function (omicsData, by = 'sample', groupvar = NULL) { function(x){if(all(is.na(x))){ mean(x) }else{ - mean(x, na.rm = T) + mean(x, na.rm = TRUE) }}) names(avg)[which(colnames(avg)== ".")]<- "value" avg = reshape2::dcast(avg, formula = formula2) - std_dev = reshape2::dcast(edata_melt, formula = formula1, sd, na.rm = T) + std_dev = reshape2::dcast(edata_melt, formula = formula1, sd, na.rm = TRUE) names(std_dev)[which(colnames(std_dev)== ".")]<- "value" std_dev = reshape2::dcast(std_dev, formula = formula2) - mds = reshape2::dcast(edata_melt, formula = formula1, median, na.rm = T) + mds = reshape2::dcast(edata_melt, formula = formula1, median, na.rm = TRUE) names(mds)[which(colnames(mds)== ".")]<- "value" mds = reshape2::dcast(mds, formula = formula2) pct_obs = reshape2::dcast(edata_melt, formula = formula1, @@ -327,7 +327,7 @@ edata_summary <- function (omicsData, by = 'sample', groupvar = NULL) { function(x){if(all(is.na(x))){ min(x) }else{ - min(x, na.rm = T) + min(x, na.rm = TRUE) }}) names(mins)[which(colnames(mins)== ".")]<- "value" mins = reshape2::dcast(mins, formula = formula2) @@ -335,7 +335,7 @@ edata_summary <- function (omicsData, by = 'sample', groupvar = NULL) { function(x){if(all(is.na(x))){ max(x) }else{ - max(x, na.rm = T) + max(x, na.rm = TRUE) }}) names(maxs)[which(colnames(maxs)== ".")]<- "value" maxs = reshape2::dcast(maxs, formula = formula2) @@ -407,14 +407,14 @@ edata_summary <- function (omicsData, by = 'sample', groupvar = NULL) { function(x){if(all(is.na(x))){ mean(x) }else{ - mean(x, na.rm = T) + mean(x, na.rm = TRUE) }}) names(avg)[which(colnames(avg)== ".")]<- "value" avg = reshape2::dcast(avg, formula = formula2) - std_dev = reshape2::dcast(edata_melt, formula = formula1, sd, na.rm = T) + std_dev = reshape2::dcast(edata_melt, formula = formula1, sd, na.rm = TRUE) names(std_dev)[which(colnames(std_dev)== ".")]<- "value" std_dev = reshape2::dcast(std_dev, formula = formula2) - mds = reshape2::dcast(edata_melt, formula = formula1, median, na.rm = T) + mds = reshape2::dcast(edata_melt, formula = formula1, median, na.rm = TRUE) names(mds)[which(colnames(mds)== ".")]<- "value" mds = reshape2::dcast(mds, formula = formula2) pct_obs = reshape2::dcast(edata_melt, formula = formula1, @@ -425,7 +425,7 @@ edata_summary <- function (omicsData, by = 'sample', groupvar = NULL) { function(x){if(all(is.na(x))){ min(x) }else{ - min(x, na.rm = T) + min(x, na.rm = TRUE) }}) names(mins)[which(colnames(mins)== ".")]<- "value" mins = reshape2::dcast(mins, formula = formula2) @@ -433,7 +433,7 @@ edata_summary <- function (omicsData, by = 'sample', groupvar = NULL) { function(x){if(all(is.na(x))){ max(x) }else{ - max(x, na.rm = T) + max(x, na.rm = TRUE) }}) names(maxs)[which(colnames(maxs)== ".")]<- "value" maxs = reshape2::dcast(maxs, formula = formula2) diff --git a/R/filter_objects.R b/R/filter_objects.R index 916fe160..ce915fc6 100755 --- a/R/filter_objects.R +++ b/R/filter_objects.R @@ -548,7 +548,7 @@ cv_filter <- function(omicsData, use_groups = TRUE) { ## determine plotting window cutoff ## # calculate percentage of observations with CV <= 200 # - prct.less200 <- (sum(pool_cv$CV <= 200, na.rm = T) / + prct.less200 <- (sum(pool_cv$CV <= 200, na.rm = TRUE) / length(pool_cv$CV[!is.na(pool_cv$CV)])) if (prct.less200 > 0.95) { @@ -1121,14 +1121,14 @@ run_prop_missing <- function(data_only){ run_mad <- function(data_only){ # calculate MAD # - mad_val = apply(data_only, 2, function(x) median(abs(x - median(x, na.rm = T)), na.rm = T)) + mad_val = apply(data_only, 2, function(x) median(abs(x - median(x, na.rm = TRUE)), na.rm = TRUE)) # calculate the number of samples with MAD equal to NA # num.miss <- sum(is.na(mad_val)) # if at least one sample has a MAD of NA, replace it with mean MAD value # if(num.miss > 0){ - mad_val[is.na(mad_val)] <- mean(mad_val, na.rm = T) + mad_val[is.na(mad_val)] <- mean(mad_val, na.rm = TRUE) } # store data # @@ -1165,7 +1165,7 @@ run_kurtosis <- function(data_only){ # if at least one sample has a kurtosis of NA, replace it with mean kurtosis # if(num.miss > 0){ - kurt_res[is.na(kurt_res)] <- mean(kurt_res, na.rm = T) + kurt_res[is.na(kurt_res)] <- mean(kurt_res, na.rm = TRUE) } # store data # @@ -1202,7 +1202,7 @@ run_skewness <- function(data_only){ # if at least one sample has a skewness of NA, replace it with mean skewness # if(num.miss > 0){ - skew_res[is.na(skew_res)] <- mean(skew_res, na.rm = T) + skew_res[is.na(skew_res)] <- mean(skew_res, na.rm = TRUE) } # store data # @@ -1333,7 +1333,7 @@ run_group_meancor <- function(omicsData, mintR_groupDF, ignore_singleton_groups grp.cors = lapply(prwse.grp.cors, function(x) x*(matrix(1, nrow = nrow(x), ncol = ncol(x)) + diag(NA, nrow(x)))) # compute mean correlation for each sample # - mean.cor = lapply(grp.cors, function(x) apply(x, 1, mean, na.rm = T)) + mean.cor = lapply(grp.cors, function(x) apply(x, 1, mean, na.rm = TRUE)) ## need to adjust the list elements of mean.cor for any singleton groups, ## to just contain the value for the sample in that group diff --git a/R/plot_fns.R b/R/plot_fns.R index 0b151248..c98149d7 100755 --- a/R/plot_fns.R +++ b/R/plot_fns.R @@ -288,7 +288,7 @@ plot.dataRes <- function (dataRes_obj, metric = NULL, density = FALSE, paste("Density plots for ", metric, sep = "") else title_lab - # if density == T, will plot geom_density + # if density == TRUE, will plot geom_density data = dataRes_obj[[metric]] data_melt = reshape2::melt(data, id.vars = edata_cname) @@ -5876,7 +5876,7 @@ plot.statRes <- function (x, plotter <- purrr::map_dfr(1:length(comps), function(n_comp){ label <- attr(x, "comparisons")[n_comp] comp <- paste("Mean", comps[[n_comp]], sep = "_") - pval <- grep(paste0("^P_value_.+", label), colnames(x), value = T) + pval <- grep(paste0("^P_value_.+", label), colnames(x), value = TRUE) v1 <- x[[comp[1]]] v2 <- x[[comp[2]]] @@ -5902,8 +5902,8 @@ plot.statRes <- function (x, ggplot2::facet_wrap(~comp) + ggplot2::geom_segment( y = 0, yend = 0, linetype = "dashed", color = "red", - x = min(log2((plotter$var1 + plotter$var2)/2), na.rm = T), - xend = max(log2((plotter$var1 + plotter$var2)/2), na.rm = T) + x = min(log2((plotter$var1 + plotter$var2)/2), na.rm = TRUE), + xend = max(log2((plotter$var1 + plotter$var2)/2), na.rm = TRUE) ) + ggplot2::labs( x = "A (Log2 Average Expression)", y = "M (Log2 Fold change)", @@ -6471,7 +6471,7 @@ gtest_heatmap <- subplot_list[[length(subplot_list) + 1]] <- p } - p <- plotly::subplot(subplot_list, shareY = T) %>% + p <- plotly::subplot(subplot_list, shareY = TRUE) %>% plotly::layout( xaxis = list(title = the_x_label), yaxis = list(title = the_y_label) diff --git a/R/protein_quant.R b/R/protein_quant.R index cb0f3abf..3838d9bb 100644 --- a/R/protein_quant.R +++ b/R/protein_quant.R @@ -653,7 +653,7 @@ rrollup <- function (pepData, combine_fn, parallel = TRUE) { ## If tied, select one with highest median abundance## if(length(least.na)>1){ - mds = apply(current_subset,1,median,na.rm=T)[least.na] + mds = apply(current_subset,1,median,na.rm=TRUE)[least.na] least.na = least.na[which(mds==max(mds))] } prot_val = unlist(current_subset[least.na,]) @@ -664,7 +664,7 @@ rrollup <- function (pepData, combine_fn, parallel = TRUE) { each = nrow(current_subset)) - current_subset, 1, median, - na.rm=T) + na.rm=TRUE) ## Step 3: Use the median of the ratio as a scaling factor for each ## peptide ## @@ -815,8 +815,8 @@ qrollup <- function (pepData, qrollup_thresh, peps_used <- 1 }else{ ## Step 1: Subset peptides whose abundance is >= to qrollup_thresh ## - means = apply(current_subset,1,mean,na.rm=T) - quantil = quantile(means, probs = qrollup_thresh, na.rm = T) + means = apply(current_subset,1,mean,na.rm=TRUE) + quantil = quantile(means, probs = qrollup_thresh, na.rm = TRUE) new_subset = current_subset[which(means >= quantil), ] peps_used <- nrow(new_subset) @@ -981,8 +981,8 @@ zrollup <- function (pepData, combine_fn, parallel = TRUE) { res = matrix(NA, nrow = 1, ncol = ncol(current_subset)) ## Step 1: Compute mean and sd of peptides ## - mds = apply(current_subset, 1, median, na.rm = T) - sds = apply(current_subset, 1, sd, na.rm = T) + mds = apply(current_subset, 1, median, na.rm = TRUE) + sds = apply(current_subset, 1, sd, na.rm = TRUE) ## Step 2: Scale peptide data as pep_scaled = (pep - median)/sd medians_mat = matrix(mds, nrow = num_peps, ncol = ncol(current_subset), byrow = F) @@ -1044,8 +1044,8 @@ combine_fn_mean <- function (x) { if (all(is.na(x))) mean(x) else - mean(x, na.rm = T) + mean(x, na.rm = TRUE) } -combine_fn_median <- function (x) median(x, na.rm = T) +combine_fn_median <- function (x) median(x, na.rm = TRUE) diff --git a/R/seqData_wrappers.R b/R/seqData_wrappers.R index 00558533..ca7ebddb 100644 --- a/R/seqData_wrappers.R +++ b/R/seqData_wrappers.R @@ -245,10 +245,10 @@ DESeq2_wrapper <- function( object = edata_deseq, test = test, ## reasonable to allow change in pmartR fitType = "parametric", #fitting of dispersions to the mean intensity - quiet = T, + quiet = TRUE, minReplicatesForReplace = Inf, ## cook's distance used to flag outliers, require at least n replicates to replace flagged outliers-- defined as .99 quantile of the F(p, m - p) distribution, where p is the number of parameters and m is the number of samples. Replacement is values predicted by the trimmed mean over all samples (and adjusted by size factor or normalization factor). Inf disables replacement modelMatrixType = "standard", ## If we need anything fancier than what is defined by "Group" we should consider this argument for the glm use case -- betapriors req for expanded - parallel = T, + parallel = TRUE, ## Waldy betaPrior = F, @@ -279,7 +279,7 @@ DESeq2_wrapper <- function( ## and m is the number of samples. Excludes groups w/ only 2 samples independentFiltering = FALSE, pAdjustMethod = p_adjust, - tidy = T, + tidy = TRUE, parallel = T ) @@ -334,7 +334,7 @@ DESeq2_wrapper <- function( group_means <- purrr::map_dfc(groups_used, function(grp){ rows_use <- apply(group_res[[1]] == grp, 1, any) samples <- group_res[[1]][rows_use,][[get_fdata_cname(omicsData)]] - df <- data.frame(apply(omicsData$e_data[samples], 1, mean, na.rm = T)) + df <- data.frame(apply(omicsData$e_data[samples], 1, mean, na.rm = TRUE)) colnames(df) <- paste0("Mean_", grp) df }) @@ -369,8 +369,8 @@ DESeq2_wrapper <- function( attr(results, "number_significant") <- flag_df %>% dplyr::group_by(Comparison) %>% dplyr::summarise( - Up_total = sum(Flags > 0, na.rm = T), - Down_total = sum(Flags < 0, na.rm = T), + Up_total = sum(Flags > 0, na.rm = TRUE), + Down_total = sum(Flags < 0, na.rm = TRUE), row.names = NULL ) @@ -601,13 +601,13 @@ edgeR_wrapper <- function( if(length(cmb1) == 0) cmb1 <- e_data_counts[grouping_info[[attr(grouping_info, "pair_group")]] == combo[1]] res[[paste0("NonZero_Count_", combo[1])]] <- rowSums(cmb1 != 0) - res[[paste0("Mean_", combo[1])]] <- apply(cmb1, 1, mean, na.rm = T) + res[[paste0("Mean_", combo[1])]] <- apply(cmb1, 1, mean, na.rm = TRUE) cmb2 <- e_data_counts[grouping_info$Group == combo[2]] if(length(cmb2) == 0) cmb2 <- e_data_counts[grouping_info[[attr(grouping_info, "pair_group")]] == combo[2]] res[[paste0("NonZero_Count_", combo[2])]] <- rowSums(cmb2 != 0) - res[[paste0("Mean_", combo[2])]] <- apply(cmb2, 1, mean, na.rm = T) + res[[paste0("Mean_", combo[2])]] <- apply(cmb2, 1, mean, na.rm = TRUE) res[[get_edata_cname(omicsData)]] <- as.character(omicsData$e_data[[get_edata_cname(omicsData)]]) row.names(res) <- NULL @@ -643,8 +643,8 @@ edgeR_wrapper <- function( attr(results, "number_significant") <- flag_df %>% dplyr::group_by(Comparison) %>% dplyr::summarise( - Up_total = sum(Flags > 0, na.rm = T), - Down_total = sum(Flags < 0, na.rm = T), + Up_total = sum(Flags > 0, na.rm = TRUE), + Down_total = sum(Flags < 0, na.rm = TRUE), row.names = NULL ) @@ -848,12 +848,12 @@ voom_wrapper <- function( cmb1 <- e_data_counts[grouping_info$Group == combo[1]] if(length(cmb1) == 0) cmb1 <- e_data_counts[grouping_info[[attr(grouping_info, "pair_group")]] == combo[1]] res[[paste0("NonZero_Count_", combo[1])]] <- rowSums(cmb1 != 0) - res[[paste0("Mean_", combo[1])]] <- apply(cmb1, 1, mean, na.rm = T) + res[[paste0("Mean_", combo[1])]] <- apply(cmb1, 1, mean, na.rm = TRUE) cmb2 <- e_data_counts[grouping_info$Group == combo[2]] if(length(cmb2) == 0) cmb2 <- e_data_counts[grouping_info[[attr(grouping_info, "pair_group")]] == combo[2]] res[[paste0("NonZero_Count_", combo[2])]] <- rowSums(cmb2 != 0) - res[[paste0("Mean_", combo[2])]] <- apply(cmb2, 1, mean, na.rm = T) + res[[paste0("Mean_", combo[2])]] <- apply(cmb2, 1, mean, na.rm = TRUE) res[[get_edata_cname(omicsData)]] <- as.character(omicsData$e_data[[get_edata_cname(omicsData)]]) row.names(res) <- NULL @@ -889,8 +889,8 @@ voom_wrapper <- function( attr(results, "number_significant") <- flag_df %>% dplyr::group_by(Comparison) %>% dplyr::summarise( - Up_total = sum(Flags > 0, na.rm = T), - Down_total = sum(Flags < 0, na.rm = T), + Up_total = sum(Flags > 0, na.rm = TRUE), + Down_total = sum(Flags < 0, na.rm = TRUE), row.names = NULL ) @@ -1296,7 +1296,7 @@ dispersion_est <- function(omicsData, method, edata_limma <- edgeR::DGEList(e_data_counts) norm_factors_limma <- edgeR::calcNormFactors(edata_limma) - limma_voom <- limma::voom(norm_factors_limma, design_matrix, save.plot = T) + limma_voom <- limma::voom(norm_factors_limma, design_matrix, save.plot = TRUE) limma_vfit <- limma::lmFit(limma_voom, design_matrix) efit <- limma::eBayes(limma_vfit) diff --git a/R/trelliPlots.R b/R/trelliPlots.R index a388bf45..696aa1b9 100644 --- a/R/trelliPlots.R +++ b/R/trelliPlots.R @@ -216,7 +216,7 @@ trelli_builder <- function(toBuild, cognostics, plotFUN, cogFUN, path, name, ... dplyr::mutate( panel = trelliscopejs::map2_plot(Nested_DF, as.character(unlist(toBuild[,1])), plotFUN) ) %>% - trelliscopejs::trelliscope(path = path, name = name, nrow = 1, ncol = 1, thumb = T, ...) + trelliscopejs::trelliscope(path = path, name = name, nrow = 1, ncol = 1, thumb = TRUE, ...) } else { @@ -226,7 +226,7 @@ trelli_builder <- function(toBuild, cognostics, plotFUN, cogFUN, path, name, ... panel = trelliscopejs::map2_plot(Nested_DF, as.character(unlist(toBuild[,1])), plotFUN), cog = trelliscopejs::map2_cog(Nested_DF, as.character(unlist(toBuild[,1])), cogFUN) ) %>% - trelliscopejs::trelliscope(path = path, name = name, nrow = 1, ncol = 1, thumb = T, ...) + trelliscopejs::trelliscope(path = path, name = name, nrow = 1, ncol = 1, thumb = TRUE, ...) } } @@ -280,26 +280,26 @@ trelli_builder <- function(toBuild, cognostics, plotFUN, cogFUN, path, name, ... #' #' ## Build the abundance boxplot with an edata file. Generate trelliData in as.trelliData.edata #' trelli_panel_by(trelliData = trelliData, panel = "Lipid") %>% -#' trelli_abundance_boxplot(test_mode = T, test_example = 1:10) +#' trelli_abundance_boxplot(test_mode = TRUE, test_example = 1:10) #' trelli_panel_by(trelliData = trelliData, panel = "Sample") %>% trelli_abundance_boxplot() #' #' ## Build the abundance boxplot with an omicsData object. Generate trelliData in as.trelliData #' trelli_panel_by(trelliData = trelliData2, panel = "Lipid") %>% -#' trelli_abundance_boxplot(test_mode = T, test_example = 1:10) +#' trelli_abundance_boxplot(test_mode = TRUE, test_example = 1:10) #' trelli_panel_by(trelliData = trelliData2, panel = "LipidFamily") %>% trelli_abundance_boxplot() #' #' ## Build the abundance boxplot with an omicsData and statRes object. Generate trelliData in as.trelliData. #' trelli_panel_by(trelliData = trelliData4, panel = "Lipid") %>% -#' trelli_abundance_boxplot(test_mode = T, test_example = 1:10) +#' trelli_abundance_boxplot(test_mode = TRUE, test_example = 1:10) #' trelli_panel_by(trelliData = trelliData4, panel = "LipidFamily") %>% trelli_abundance_boxplot() #' #' ## Other options include modifying the ggplot #' trelli_panel_by(trelliData = trelliData, panel = "Lipid") %>% -#' trelli_abundance_boxplot(test_mode = T, test_example = 1:10, +#' trelli_abundance_boxplot(test_mode = TRUE, test_example = 1:10, #' ggplot_params = c("ylab('')", "ylim(c(2,20))")) #' #' ## Or making the plot interactive -#' trelli_panel_by(trelliData = trelliData4, panel = "LipidFamily") %>% trelli_abundance_boxplot(interactive = T) +#' trelli_panel_by(trelliData = trelliData4, panel = "LipidFamily") %>% trelli_abundance_boxplot(interactive = TRUE) #' #' } #' @@ -399,10 +399,10 @@ trelli_abundance_boxplot <- function(trelliData, # Set basic cognostics for ungrouped data or in case when data is not split by fdata_cname cog <- list( "n" = dplyr::tibble(`Count` = trelliscopejs::cog(sum(!is.na(DF$Abundance)), desc = "Biomolecule Count")), - "mean" = dplyr::tibble(`Mean Abundance` = trelliscopejs::cog(round(mean(DF$Abundance, na.rm = T), 4), desc = "Mean Abundance")), - "median" = dplyr::tibble(`Median Abundance` = trelliscopejs::cog(round(median(DF$Abundance, na.rm = T), 4), desc = "Median Abundance")), - "sd" = dplyr::tibble(`Standard Deviation Abundance` = trelliscopejs::cog(round(sd(DF$Abundance, na.rm = T), 4), desc = "Abundance Standard Deviation")), - "skew" = dplyr::tibble(`Skew Abundance` = trelliscopejs::cog(round(e1071::skewness(DF$Abundance, na.rm = T), 4), desc= "Abundance Skewness")) + "mean" = dplyr::tibble(`Mean Abundance` = trelliscopejs::cog(round(mean(DF$Abundance, na.rm = TRUE), 4), desc = "Mean Abundance")), + "median" = dplyr::tibble(`Median Abundance` = trelliscopejs::cog(round(median(DF$Abundance, na.rm = TRUE), 4), desc = "Median Abundance")), + "sd" = dplyr::tibble(`Standard Deviation Abundance` = trelliscopejs::cog(round(sd(DF$Abundance, na.rm = TRUE), 4), desc = "Abundance Standard Deviation")), + "skew" = dplyr::tibble(`Skew Abundance` = trelliscopejs::cog(round(e1071::skewness(DF$Abundance, na.rm = TRUE), 4), desc= "Abundance Skewness")) ) # If cognostics are any of the cog, then add them @@ -426,10 +426,10 @@ trelli_abundance_boxplot <- function(trelliData, dplyr::group_by(Group) %>% dplyr::summarise( "n" = sum(!is.na(Abundance)), - "mean" = round(mean(Abundance, na.rm = T), 4), - "median" = round(median(Abundance, na.rm = T), 4), - "sd" = round(sd(Abundance, na.rm = T), 4), - "skew" = round(e1071::skewness(Abundance, na.rm = T), 4) + "mean" = round(mean(Abundance, na.rm = TRUE), 4), + "median" = round(median(Abundance, na.rm = TRUE), 4), + "sd" = round(sd(Abundance, na.rm = TRUE), 4), + "skew" = round(e1071::skewness(Abundance, na.rm = TRUE), 4) ) %>% tidyr::pivot_longer(c(n, mean, median, sd, skew)) %>% dplyr::filter(name %in% cognostics) %>% @@ -563,20 +563,20 @@ trelli_abundance_boxplot <- function(trelliData, #' #' ## Build the abundance histogram with an edata file. Generate trelliData in as.trelliData.edata #' trelli_panel_by(trelliData = trelliData, panel = "Lipid") %>% -#' trelli_abundance_histogram(test_mode = T, test_example = 1:10) +#' trelli_abundance_histogram(test_mode = TRUE, test_example = 1:10) #' #' ## Build the abundance histogram with an omicsData object. Generate trelliData in as.trelliData #' trelli_panel_by(trelliData = trelliData2, panel = "Lipid") %>% -#' trelli_abundance_histogram(test_mode = T, test_example = 1:10) +#' trelli_abundance_histogram(test_mode = TRUE, test_example = 1:10) #' #' ## Build the abundance histogram with an omicsData and statRes object. Generate trelliData in as.trelliData. #' trelli_panel_by(trelliData = trelliData4, panel = "Lipid") %>% -#' trelli_abundance_histogram(test_mode = T, test_example = 1:10) +#' trelli_abundance_histogram(test_mode = TRUE, test_example = 1:10) #' #' ## Users can modify the plotting function with ggplot parameters and interactivity, #' ## and can also select certain cognostics. #' trelli_panel_by(trelliData = trelliData, panel = "Lipid") %>% -#' trelli_abundance_histogram(test_mode = T, test_example = 1:10, +#' trelli_abundance_histogram(test_mode = TRUE, test_example = 1:10, #' ggplot_params = c("ylab('')", "xlab('Abundance')"), interactive = TRUE, #' cognostics = c("mean", "median")) #' @@ -667,10 +667,10 @@ trelli_abundance_histogram <- function(trelliData, # Set basic cognostics for ungrouped data or in case when data is not split by fdata_cname cog <- list( "n" = dplyr::tibble(`Count` = trelliscopejs::cog(sum(!is.na(DF$Abundance)), desc = "Biomolecule Count")), - "mean" = dplyr::tibble(`Mean Abundance` = trelliscopejs::cog(round(mean(DF$Abundance, na.rm = T), 4), desc = "Mean Abundance")), - "median" = dplyr::tibble(`Median Abundance` = trelliscopejs::cog(round(median(DF$Abundance, na.rm = T), 4), desc = "Median Abundance")), - "sd" = dplyr::tibble(`Standard Deviation Abundance` = trelliscopejs::cog(round(sd(DF$Abundance, na.rm = T), 4), desc = "Abundance Standard Deviation")), - "skew" = dplyr::tibble(`Skew Abundance` = trelliscopejs::cog(round(e1071::skewness(DF$Abundance, na.rm = T), 4), desc= "Abundance Skewness")) + "mean" = dplyr::tibble(`Mean Abundance` = trelliscopejs::cog(round(mean(DF$Abundance, na.rm = TRUE), 4), desc = "Mean Abundance")), + "median" = dplyr::tibble(`Median Abundance` = trelliscopejs::cog(round(median(DF$Abundance, na.rm = TRUE), 4), desc = "Median Abundance")), + "sd" = dplyr::tibble(`Standard Deviation Abundance` = trelliscopejs::cog(round(sd(DF$Abundance, na.rm = TRUE), 4), desc = "Abundance Standard Deviation")), + "skew" = dplyr::tibble(`Skew Abundance` = trelliscopejs::cog(round(e1071::skewness(DF$Abundance, na.rm = TRUE), 4), desc= "Abundance Skewness")) ) # If cognostics are any of the cog, then add them @@ -789,12 +789,12 @@ trelli_abundance_histogram <- function(trelliData, #' #' ## Build the abundance heatmap with an omicsData object with emeta variables. Generate trelliData in as.trelliData. #' trelli_panel_by(trelliData = trelliData2, panel = "LipidFamily") %>% -#' trelli_abundance_heatmap(test_mode = T, test_example = 1:3) +#' trelli_abundance_heatmap(test_mode = TRUE, test_example = 1:3) #' #' ## Users can modify the plotting function with ggplot parameters and interactivity, #' ## and can also select certain cognostics. #' trelli_panel_by(trelliData = trelliData4, panel = "LipidFamily") %>% -#' trelli_abundance_heatmap(test_mode = T, test_example = 1:5, +#' trelli_abundance_heatmap(test_mode = TRUE, test_example = 1:5, #' ggplot_params = c("ylab('')", "xlab('')"), interactive = TRUE, cognostics = c("mean", "median")) #' #' } @@ -896,10 +896,10 @@ trelli_abundance_heatmap <- function(trelliData, dplyr::group_by(Group) %>% dplyr::summarise( "n" = sum(!is.na(Abundance)), - "mean" = round(mean(Abundance, na.rm = T), 4), - "median" = round(median(Abundance, na.rm = T), 4), - "sd" = round(sd(Abundance, na.rm = T), 4), - "skew" = round(e1071::skewness(Abundance, na.rm = T), 4) + "mean" = round(mean(Abundance, na.rm = TRUE), 4), + "median" = round(median(Abundance, na.rm = TRUE), 4), + "sd" = round(sd(Abundance, na.rm = TRUE), 4), + "skew" = round(e1071::skewness(Abundance, na.rm = TRUE), 4) ) %>% tidyr::pivot_longer(c(n, mean, median, sd, skew)) %>% dplyr::filter(name %in% cognostics) %>% @@ -983,28 +983,28 @@ trelli_abundance_heatmap <- function(trelliData, #' #' ## Build the missingness bar plot with an edata file. Generate trelliData in as.trelliData.edata #' trelli_panel_by(trelliData = trelliData, panel = "Lipid") %>% -#' trelli_missingness_bar(test_mode = T, test_example = 1:10) +#' trelli_missingness_bar(test_mode = TRUE, test_example = 1:10) #' trelli_panel_by(trelliData = trelliData, panel = "Sample") %>% trelli_missingness_bar() #' #' ## Build the missingness bar plot with an omicsData object. Generate trelliData in as.trelliData #' trelli_panel_by(trelliData = trelliData2, panel = "Lipid") %>% -#' trelli_missingness_bar(test_mode = T, test_example = 1:10) +#' trelli_missingness_bar(test_mode = TRUE, test_example = 1:10) #' #' ## Build the missingness bar plot with a statRes object. Generate trelliData in as.trelliData #' trelli_panel_by(trelliData = trelliData3, panel = "Lipid") %>% -#' trelli_missingness_bar(test_mode = T, test_example = 1:10) +#' trelli_missingness_bar(test_mode = TRUE, test_example = 1:10) #' #' ## Build the missingness bar plot with an omicsData and statRes object. Generate trelliData in as.trelliData. #' trelli_panel_by(trelliData = trelliData4, panel = "Lipid") %>% -#' trelli_missingness_bar(test_mode = T, test_example = 1:10) +#' trelli_missingness_bar(test_mode = TRUE, test_example = 1:10) #' #' ## Or making the plot interactive #' trelli_panel_by(trelliData = trelliData2, panel = "Lipid") %>% -#' trelli_missingness_bar(test_mode = T, test_example = 1:5, interactive = T) +#' trelli_missingness_bar(test_mode = TRUE, test_example = 1:5, interactive = TRUE) #' #' ## Or visualize only count data #' trelli_panel_by(trelliData = trelliData2, panel = "Lipid") %>% -#' trelli_missingness_bar(test_mode = T, test_example = 1:5, cognostics = "n", proportion = FALSE) +#' trelli_missingness_bar(test_mode = TRUE, test_example = 1:5, cognostics = "n", proportion = FALSE) #' #' } #' @@ -1296,11 +1296,11 @@ determine_significance <- function(DF, p_value_thresh) { #' #' ## Build fold_change bar plot with statRes data grouped by edata_colname. #' trelli_panel_by(trelliData = trelliData3, panel = "Lipid") %>% -#' trelli_foldchange_bar(test_mode = T, test_example = 1:10, p_value_test = TRUE) +#' trelli_foldchange_bar(test_mode = TRUE, test_example = 1:10, p_value_test = TRUE) #' #' ## Or make the plot interactive #' trelli_panel_by(trelliData = trelliData4, panel = "Lipid") %>% -#' trelli_foldchange_bar(test_mode = T, test_example = 1:10, p_value_test = TRUE, interactive = T) +#' trelli_foldchange_bar(test_mode = TRUE, test_example = 1:10, p_value_test = TRUE, interactive = TRUE) #' #' } #' @@ -1584,9 +1584,9 @@ trelli_foldchange_boxplot <- function(trelliData, dplyr::group_by(Comparison) %>% dplyr::summarise( "n" = sum(!is.nan(fold_change)), - "mean" = round(mean(fold_change, na.rm = T), 4), - "median" = round(median(fold_change, na.rm = T), 4), - "sd" = round(sd(fold_change, na.rm = T), 4) + "mean" = round(mean(fold_change, na.rm = TRUE), 4), + "median" = round(median(fold_change, na.rm = TRUE), 4), + "sd" = round(sd(fold_change, na.rm = TRUE), 4) ) %>% tidyr::pivot_longer(c(n, mean, median, sd)) %>% dplyr::filter(name %in% cognostics) %>% @@ -2004,9 +2004,9 @@ trelli_foldchange_heatmap <- function(trelliData, dplyr::group_by(Comparison) %>% dplyr::summarise( "n" = sum(!is.nan(fold_change)), - "mean" = round(mean(fold_change, na.rm = T), 4), - "median" = round(median(fold_change, na.rm = T), 4), - "sd" = round(sd(fold_change, na.rm = T), 4) + "mean" = round(mean(fold_change, na.rm = TRUE), 4), + "median" = round(median(fold_change, na.rm = TRUE), 4), + "sd" = round(sd(fold_change, na.rm = TRUE), 4) ) %>% tidyr::pivot_longer(c(n, mean, median, sd)) %>% dplyr::filter(name %in% cognostics) %>% @@ -2053,4 +2053,4 @@ trelli_foldchange_heatmap <- function(trelliData, } -} \ No newline at end of file +} diff --git a/man/as.multiData.Rd b/man/as.multiData.Rd index 7407b477..e7ffa133 100644 --- a/man/as.multiData.Rd +++ b/man/as.multiData.Rd @@ -8,7 +8,7 @@ as.multiData( ..., f_meta = NULL, sample_intersect = F, - match_samples = T, + match_samples = TRUE, keep_sample_info = F, auto_fmeta = F ) @@ -24,7 +24,7 @@ omicsData objects supplied to the function.} are common across all datasets be kept in f_meta. See details for how samples will be dropped.} -\item{match_samples}{logical indicator. If auto_fmeta = T, whether to attempt +\item{match_samples}{logical indicator. If auto_fmeta = TRUE, whether to attempt to match the names in the sample columns in f_data across all objects in an attempt to align them in f_meta. Defaults to TRUE.} @@ -59,7 +59,7 @@ library(pmartRdata) # Combine metabolomics and protein object into multidata, both must be log2 # and normalized. mymetab <- edata_transform(omicsData = metab_object, data_scale = "log2") -mymetab <- normalize_global(omicsData = mymetab, subset_fn = "all", norm_fn = "median", apply_norm = T) +mymetab <- normalize_global(omicsData = mymetab, subset_fn = "all", norm_fn = "median", apply_norm = TRUE) mypro <- pro_object diff --git a/man/as.trelliData.Rd b/man/as.trelliData.Rd index faea0c90..02b366ec 100644 --- a/man/as.trelliData.Rd +++ b/man/as.trelliData.Rd @@ -33,12 +33,12 @@ library(pmartRdata) # Generate an example e_meta file for lipid data lipid_emeta <- data.frame("Lipid" = lipid_pos_edata$Lipid, "LipidFamily" = lipid_pos_edata$Lipid \%>\% as.character() \%>\% - strsplit("(", fixed = T) \%>\% lapply(function(el) {el[1]}) \%>\% unlist()) + strsplit("(", fixed = TRUE) \%>\% lapply(function(el) {el[1]}) \%>\% unlist()) # Transform the data omicsData <- edata_transform(omicsData = lipid_pos_object, data_scale = "log2") omicsData$e_meta$LipidFamily <- omicsData$e_meta$Lipid \%>\% as.character() \%>\% - strsplit("(", fixed = T) \%>\% lapply(function(el) {el[1]}) \%>\% unlist() + strsplit("(", fixed = TRUE) \%>\% lapply(function(el) {el[1]}) \%>\% unlist() # Group the data by condition omicsData <- group_designation(omicsData = omicsData, main_effects = c("Virus")) diff --git a/man/combine_lipidData.Rd b/man/combine_lipidData.Rd index afcffb40..da4d9f20 100644 --- a/man/combine_lipidData.Rd +++ b/man/combine_lipidData.Rd @@ -72,6 +72,6 @@ obj_2 <- group_designation(omicsData = obj_2, main_effects = "Virus") obj_1 <- applyFilt(filter_object = molecule_filter(omicsData = obj_1), omicsData = obj_1, min_num = 2) obj_2 <- applyFilt(filter_object = cv_filter(omicsData = obj_2),obj_2, cv_thresh = 60) -combine_object_later <- combine_lipidData(obj_1 = obj_1, obj_2 = obj_2, retain_groups = T, retain_filters = TRUE) +combine_object_later <- combine_lipidData(obj_1 = obj_1, obj_2 = obj_2, retain_groups = TRUE, retain_filters = TRUE) } diff --git a/man/trelli_abundance_boxplot.Rd b/man/trelli_abundance_boxplot.Rd index b5bcdadd..0b976357 100644 --- a/man/trelli_abundance_boxplot.Rd +++ b/man/trelli_abundance_boxplot.Rd @@ -61,26 +61,26 @@ Specify a boxplot design and cognostics for the abundance ## Build the abundance boxplot with an edata file. Generate trelliData in as.trelliData.edata trelli_panel_by(trelliData = trelliData, panel = "Lipid") \%>\% - trelli_abundance_boxplot(test_mode = T, test_example = 1:10) + trelli_abundance_boxplot(test_mode = TRUE, test_example = 1:10) trelli_panel_by(trelliData = trelliData, panel = "Sample") \%>\% trelli_abundance_boxplot() ## Build the abundance boxplot with an omicsData object. Generate trelliData in as.trelliData trelli_panel_by(trelliData = trelliData2, panel = "Lipid") \%>\% - trelli_abundance_boxplot(test_mode = T, test_example = 1:10) + trelli_abundance_boxplot(test_mode = TRUE, test_example = 1:10) trelli_panel_by(trelliData = trelliData2, panel = "LipidFamily") \%>\% trelli_abundance_boxplot() ## Build the abundance boxplot with an omicsData and statRes object. Generate trelliData in as.trelliData. trelli_panel_by(trelliData = trelliData4, panel = "Lipid") \%>\% - trelli_abundance_boxplot(test_mode = T, test_example = 1:10) + trelli_abundance_boxplot(test_mode = TRUE, test_example = 1:10) trelli_panel_by(trelliData = trelliData4, panel = "LipidFamily") \%>\% trelli_abundance_boxplot() ## Other options include modifying the ggplot trelli_panel_by(trelliData = trelliData, panel = "Lipid") \%>\% - trelli_abundance_boxplot(test_mode = T, test_example = 1:10, + trelli_abundance_boxplot(test_mode = TRUE, test_example = 1:10, ggplot_params = c("ylab('')", "ylim(c(2,20))")) ## Or making the plot interactive -trelli_panel_by(trelliData = trelliData4, panel = "LipidFamily") \%>\% trelli_abundance_boxplot(interactive = T) +trelli_panel_by(trelliData = trelliData4, panel = "LipidFamily") \%>\% trelli_abundance_boxplot(interactive = TRUE) } diff --git a/man/trelli_abundance_heatmap.Rd b/man/trelli_abundance_heatmap.Rd index 4dbf913c..f7b0bf18 100644 --- a/man/trelli_abundance_heatmap.Rd +++ b/man/trelli_abundance_heatmap.Rd @@ -57,12 +57,12 @@ Specify a plot design and cognostics for the abundance heatmap ## Build the abundance heatmap with an omicsData object with emeta variables. Generate trelliData in as.trelliData. trelli_panel_by(trelliData = trelliData2, panel = "LipidFamily") \%>\% - trelli_abundance_heatmap(test_mode = T, test_example = 1:3) + trelli_abundance_heatmap(test_mode = TRUE, test_example = 1:3) ## Users can modify the plotting function with ggplot parameters and interactivity, ## and can also select certain cognostics. trelli_panel_by(trelliData = trelliData4, panel = "LipidFamily") \%>\% - trelli_abundance_heatmap(test_mode = T, test_example = 1:5, + trelli_abundance_heatmap(test_mode = TRUE, test_example = 1:5, ggplot_params = c("ylab('')", "xlab('')"), interactive = TRUE, cognostics = c("mean", "median")) } diff --git a/man/trelli_abundance_histogram.Rd b/man/trelli_abundance_histogram.Rd index 0e070407..82db2a70 100644 --- a/man/trelli_abundance_histogram.Rd +++ b/man/trelli_abundance_histogram.Rd @@ -58,20 +58,20 @@ Specify a plot design and cognostics for the abundance histogram ## Build the abundance histogram with an edata file. Generate trelliData in as.trelliData.edata trelli_panel_by(trelliData = trelliData, panel = "Lipid") \%>\% - trelli_abundance_histogram(test_mode = T, test_example = 1:10) + trelli_abundance_histogram(test_mode = TRUE, test_example = 1:10) ## Build the abundance histogram with an omicsData object. Generate trelliData in as.trelliData trelli_panel_by(trelliData = trelliData2, panel = "Lipid") \%>\% - trelli_abundance_histogram(test_mode = T, test_example = 1:10) + trelli_abundance_histogram(test_mode = TRUE, test_example = 1:10) ## Build the abundance histogram with an omicsData and statRes object. Generate trelliData in as.trelliData. trelli_panel_by(trelliData = trelliData4, panel = "Lipid") \%>\% - trelli_abundance_histogram(test_mode = T, test_example = 1:10) + trelli_abundance_histogram(test_mode = TRUE, test_example = 1:10) ## Users can modify the plotting function with ggplot parameters and interactivity, ## and can also select certain cognostics. trelli_panel_by(trelliData = trelliData, panel = "Lipid") \%>\% - trelli_abundance_histogram(test_mode = T, test_example = 1:10, + trelli_abundance_histogram(test_mode = TRUE, test_example = 1:10, ggplot_params = c("ylab('')", "xlab('Abundance')"), interactive = TRUE, cognostics = c("mean", "median")) diff --git a/man/trelli_foldchange_bar.Rd b/man/trelli_foldchange_bar.Rd index e6003e6f..ce4a3cfd 100644 --- a/man/trelli_foldchange_bar.Rd +++ b/man/trelli_foldchange_bar.Rd @@ -63,11 +63,11 @@ Specify a plot design and cognostics for the fold_change ## Build fold_change bar plot with statRes data grouped by edata_colname. trelli_panel_by(trelliData = trelliData3, panel = "Lipid") \%>\% - trelli_foldchange_bar(test_mode = T, test_example = 1:10, p_value_test = TRUE) + trelli_foldchange_bar(test_mode = TRUE, test_example = 1:10, p_value_test = TRUE) ## Or make the plot interactive trelli_panel_by(trelliData = trelliData4, panel = "Lipid") \%>\% - trelli_foldchange_bar(test_mode = T, test_example = 1:10, p_value_test = TRUE, interactive = T) + trelli_foldchange_bar(test_mode = TRUE, test_example = 1:10, p_value_test = TRUE, interactive = TRUE) } diff --git a/man/trelli_missingness_bar.Rd b/man/trelli_missingness_bar.Rd index b02b1665..6e67a410 100644 --- a/man/trelli_missingness_bar.Rd +++ b/man/trelli_missingness_bar.Rd @@ -60,28 +60,28 @@ Specify a plot design and cognostics for the missing barchart ## Build the missingness bar plot with an edata file. Generate trelliData in as.trelliData.edata trelli_panel_by(trelliData = trelliData, panel = "Lipid") \%>\% - trelli_missingness_bar(test_mode = T, test_example = 1:10) + trelli_missingness_bar(test_mode = TRUE, test_example = 1:10) trelli_panel_by(trelliData = trelliData, panel = "Sample") \%>\% trelli_missingness_bar() ## Build the missingness bar plot with an omicsData object. Generate trelliData in as.trelliData trelli_panel_by(trelliData = trelliData2, panel = "Lipid") \%>\% - trelli_missingness_bar(test_mode = T, test_example = 1:10) + trelli_missingness_bar(test_mode = TRUE, test_example = 1:10) ## Build the missingness bar plot with a statRes object. Generate trelliData in as.trelliData trelli_panel_by(trelliData = trelliData3, panel = "Lipid") \%>\% - trelli_missingness_bar(test_mode = T, test_example = 1:10) + trelli_missingness_bar(test_mode = TRUE, test_example = 1:10) ## Build the missingness bar plot with an omicsData and statRes object. Generate trelliData in as.trelliData. trelli_panel_by(trelliData = trelliData4, panel = "Lipid") \%>\% - trelli_missingness_bar(test_mode = T, test_example = 1:10) + trelli_missingness_bar(test_mode = TRUE, test_example = 1:10) ## Or making the plot interactive trelli_panel_by(trelliData = trelliData2, panel = "Lipid") \%>\% - trelli_missingness_bar(test_mode = T, test_example = 1:5, interactive = T) + trelli_missingness_bar(test_mode = TRUE, test_example = 1:5, interactive = TRUE) ## Or visualize only count data trelli_panel_by(trelliData = trelliData2, panel = "Lipid") \%>\% - trelli_missingness_bar(test_mode = T, test_example = 1:5, cognostics = "n", proportion = FALSE) + trelli_missingness_bar(test_mode = TRUE, test_example = 1:5, cognostics = "n", proportion = FALSE) } diff --git a/tests/testthat/test_as_multiData.R b/tests/testthat/test_as_multiData.R index 4bcbae3b..ed3fe634 100644 --- a/tests/testthat/test_as_multiData.R +++ b/tests/testthat/test_as_multiData.R @@ -1,4 +1,4 @@ -source(system.file('testdata', 'load_data.R', package = 'pmartR'), local = T) +source(system.file('testdata', 'load_data.R', package = 'pmartR'), local = TRUE) f_meta <- data.frame( "Proteins" = c(paste0("Mock", 1:3), paste0("Infection", c(1:7)), NA, "Infection9"), @@ -16,13 +16,13 @@ bad_fmeta1 <- data.frame( ) lipid_object_proc <- edata_transform(ldata, "log2") -lipid_object_proc <- normalize_global(lipid_object_proc, "all", "median", apply_norm = T) +lipid_object_proc <- normalize_global(lipid_object_proc, "all", "median", apply_norm = TRUE) metab_object_proc <- edata_transform(mdata, "log2") -metab_object_proc <- normalize_global(lipid_object_proc, "all", "median", apply_norm = T) +metab_object_proc <- normalize_global(lipid_object_proc, "all", "median", apply_norm = TRUE) pro_object_proc <- edata_transform(prdata, "log2") -pro_object_proc <- normalize_global(pro_object_proc, "all", "median", apply_norm = T) +pro_object_proc <- normalize_global(pro_object_proc, "all", "median", apply_norm = TRUE) pro_grouped = group_designation(pro_object_proc, main_effects = "Condition") metab_grouped = group_designation(metab_object_proc, main_effects = "Condition") @@ -30,11 +30,11 @@ lipid_grouped = group_designation(lipid_object_proc, main_effects = "Condition") mdata_man_fmeta1 = as.multiData(lipid_object_proc, metab_object_proc, pro_object_proc, f_meta = f_meta) mdata_man_fmeta2 = as.multiData(metab_object_proc, pro_object_proc, lipid_object_proc, f_meta = f_meta) -mdata_auto_fmeta = as.multiData(metab_object_proc, pro_object_proc, lipid_object_proc, auto_fmeta = T) -mdata_auto_fmeta_sinter = as.multiData(metab_object_proc, lipid_object_proc, pro_object_proc, auto_fmeta = T, sample_intersect = T) -mdata_auto_fmeta_noarr = as.multiData(metab_object_proc, lipid_object_proc, pro_object_proc, auto_fmeta = T, match_samples = F) -mdata_noarr_sint = as.multiData(metab_object_proc, lipid_object_proc, pro_object_proc, auto_fmeta = T, match_samples = F, sample_intersect = T) -mdata_grouped = as.multiData(metab_grouped, lipid_grouped, pro_grouped, auto_fmeta = T, sample_intersect = T, keep_sample_info = T) +mdata_auto_fmeta = as.multiData(metab_object_proc, pro_object_proc, lipid_object_proc, auto_fmeta = TRUE) +mdata_auto_fmeta_sinter = as.multiData(metab_object_proc, lipid_object_proc, pro_object_proc, auto_fmeta = TRUE, sample_intersect = TRUE) +mdata_auto_fmeta_noarr = as.multiData(metab_object_proc, lipid_object_proc, pro_object_proc, auto_fmeta = TRUE, match_samples = F) +mdata_noarr_sint = as.multiData(metab_object_proc, lipid_object_proc, pro_object_proc, auto_fmeta = TRUE, match_samples = F, sample_intersect = TRUE) +mdata_grouped = as.multiData(metab_grouped, lipid_grouped, pro_grouped, auto_fmeta = TRUE, sample_intersect = TRUE, keep_sample_info = TRUE) obj_list = list(mdata_man_fmeta1 , mdata_man_fmeta2, mdata_auto_fmeta, mdata_auto_fmeta_sinter, mdata_grouped) @@ -42,7 +42,7 @@ test_that("Bad input throws error", { # objects with different log2/normalization expect_error(as.multiData(ldata, prdata)) expect_error(as.multiData(edata_transform(ldata, "log2"), prdata)) - expect_error(as.multiData(normalize_global(mdata, "all", "median", apply_norm = T), pro_object_proc)) + expect_error(as.multiData(normalize_global(mdata, "all", "median", apply_norm = TRUE), pro_object_proc)) # not both grouped expect_error(as.multiData(group_designation(lipid_object_proc, main_effects = "Condition"), pro_object_proc)) diff --git a/tests/testthat/test_combine_omicsData.R b/tests/testthat/test_combine_omicsData.R index cbf14b86..3372132f 100644 --- a/tests/testthat/test_combine_omicsData.R +++ b/tests/testthat/test_combine_omicsData.R @@ -1,8 +1,8 @@ -source(system.file('testdata', 'load_data.R', package = 'pmartR'), local = T) +source(system.file('testdata', 'load_data.R', package = 'pmartR'), local = TRUE) obj1 <- edata_transform(ldata, "log2") obj12 <- obj1 -obj1 <- normalize_global(obj1, "all", "median", apply_norm = T) +obj1 <- normalize_global(obj1, "all", "median", apply_norm = TRUE) fake_cov <- c(rep("A", 5), rep("B", 6)) fake_cov2 <- c(rep(LETTERS[1:4],2), rep(LETTERS[5], 3)) @@ -35,19 +35,19 @@ obj2 <- applyFilt(cv_filter(obj2),obj2, cv_thresh = 60) suppressWarnings({ combn1 <- combine_lipidData(obj1, obj2) - combn2 <- combine_lipidData(obj1, obj2, retain_groups = T) - combn3 <- combine_lipidData(obj1, obj2, retain_groups = F, retain_filters = T) - combn4 <- combine_lipidData(obj1, obj2, retain_groups = T, retain_filters = T) + combn2 <- combine_lipidData(obj1, obj2, retain_groups = TRUE) + combn3 <- combine_lipidData(obj1, obj2, retain_groups = F, retain_filters = TRUE) + combn4 <- combine_lipidData(obj1, obj2, retain_groups = TRUE, retain_filters = TRUE) combn5 <- combine_lipidData(obj1, obj3) - combn6 <- combine_lipidData(obj1, obj3, retain_filters = T) + combn6 <- combine_lipidData(obj1, obj3, retain_filters = TRUE) combn7 <- combine_lipidData(obj1, obj5) - combn8 <- combine_lipidData(obj2, obj3, retain_filters = T) + combn8 <- combine_lipidData(obj2, obj3, retain_filters = TRUE) }) test_that("bad class errors", { suppressWarnings({ - expect_error(combine_lipidData(5, obj2, retain_groups = T), regexp = "Objects must be of the same class") - expect_error(combine_lipidData(5, 5, retain_groups = T), regexp = "Currently only support lipidData") + expect_error(combine_lipidData(5, obj2, retain_groups = TRUE), regexp = "Objects must be of the same class") + expect_error(combine_lipidData(5, 5, retain_groups = TRUE), regexp = "Currently only support lipidData") }) }) @@ -57,7 +57,7 @@ test_that("pipeline errors", { obj2), regexp = "Objects must be on the same scale") expect_error(combine_lipidData(obj1, obj12), regexp = "Both objects must have the same normalization status") - expect_error(combine_lipidData(obj1, normalize_global(obj12, "all", "median", apply_norm = T), retain_groups = T), + expect_error(combine_lipidData(obj1, normalize_global(obj12, "all", "median", apply_norm = TRUE), retain_groups = TRUE), regexp = "Both objects must be grouped.") }) }) @@ -71,10 +71,10 @@ test_that("sample errors", { test_that("bad group/covariate structures throw an error", { suppressWarnings({ - expect_error(combine_lipidData(obj3, obj2, retain_groups = T), regexp = "covariate structure") - expect_error(combine_lipidData(obj2, obj4, retain_groups = T), regexp = "covariate structure") - expect_error(combine_lipidData(obj1, obj5, retain_groups = T), regexp = "main effect") - expect_error(combine_lipidData(obj3, obj5, retain_groups = T), regexp = "main effect") + expect_error(combine_lipidData(obj3, obj2, retain_groups = TRUE), regexp = "covariate structure") + expect_error(combine_lipidData(obj2, obj4, retain_groups = TRUE), regexp = "covariate structure") + expect_error(combine_lipidData(obj1, obj5, retain_groups = TRUE), regexp = "main effect") + expect_error(combine_lipidData(obj3, obj5, retain_groups = TRUE), regexp = "main effect") }) }) diff --git a/tests/testthat/test_dim_reduction.R b/tests/testthat/test_dim_reduction.R index f7232bfc..fc58c50f 100644 --- a/tests/testthat/test_dim_reduction.R +++ b/tests/testthat/test_dim_reduction.R @@ -103,7 +103,7 @@ test_that('PCA produces the correct output',{ } ## check for near zero variance features and remove ## - minvars = which(apply(temp_data, 1, var, na.rm = T) < 0.000001) + minvars = which(apply(temp_data, 1, var, na.rm = TRUE) < 0.000001) if(length(minvars) > 0){ temp_data = temp_data[-minvars, ] } @@ -132,7 +132,7 @@ test_that('PCA produces the correct output',{ } ## check for near zero variance features and remove ## - minvars = which(apply(temp_data, 1, var, na.rm = T) < 0.000001) + minvars = which(apply(temp_data, 1, var, na.rm = TRUE) < 0.000001) if(length(minvars) > 0){ temp_data = temp_data[-minvars, ] } diff --git a/tests/testthat/test_dispersion_est.R b/tests/testthat/test_dispersion_est.R index d455de0f..7d8a2070 100644 --- a/tests/testthat/test_dispersion_est.R +++ b/tests/testthat/test_dispersion_est.R @@ -38,14 +38,14 @@ test_that('dispersion_est returns the correct data frame and attributes',{ ## Custom theme warning/error edgeR_res <- expect_error(expect_warning( - dispersion_est(seqdata_grp, method = "edgeR", bw_theme = T, custom_theme = 2), + dispersion_est(seqdata_grp, method = "edgeR", bw_theme = TRUE, custom_theme = 2), "Setting both bw_theme to TRUE and specifying a custom"), "custom_theme must be a valid 'theme' object as used in ggplot") ## plotly result - edgeR_res_py <- dispersion_est(seqdata_grp, method = "edgeR", interactive = T) - deseq2_res_py <- suppressWarnings(dispersion_est(seqdata_grp, method = "DESeq2", interactive = T)) - voom_res_py <- dispersion_est(seqdata_grp, method = "voom", interactive = T) + edgeR_res_py <- dispersion_est(seqdata_grp, method = "edgeR", interactive = TRUE) + deseq2_res_py <- suppressWarnings(dispersion_est(seqdata_grp, method = "DESeq2", interactive = TRUE)) + voom_res_py <- dispersion_est(seqdata_grp, method = "voom", interactive = TRUE) res <- purrr::map(list(edgeR_res_py, deseq2_res_py, voom_res_py), function(gg){ expect_true(inherits(gg, "plotly")) diff --git a/tests/testthat/test_edata_summary.R b/tests/testthat/test_edata_summary.R index 01b0a224..8b4ae04c 100644 --- a/tests/testthat/test_edata_summary.R +++ b/tests/testthat/test_edata_summary.R @@ -141,13 +141,13 @@ test_that('edata_summary correctly summarizes the data',{ function(x){if(all(is.na(x))){ min(x) }else{ - min(x, na.rm = T) + min(x, na.rm = TRUE) }}), Mock = apply(pdata$e_data[, 11:13], 1, function(x){if(all(is.na(x))){ min(x) }else{ - min(x, na.rm = T) + min(x, na.rm = TRUE) }}), row.names = 1:150), max = data.frame(Mass_Tag_ID = pdata$e_data$Mass_Tag_ID, @@ -155,13 +155,13 @@ test_that('edata_summary correctly summarizes the data',{ function(x){if(all(is.na(x))){ max(x) }else{ - max(x, na.rm = T) + max(x, na.rm = TRUE) }}), Mock = apply(pdata$e_data[, 11:13], 1, function(x){if(all(is.na(x))){ max(x) }else{ - max(x, na.rm = T) + max(x, na.rm = TRUE) }}), row.names = 1:150) ) @@ -233,19 +233,19 @@ test_that('edata_summary correctly summarizes the data',{ function(x){if(all(is.na(x))){ min(x) }else{ - min(x, na.rm = T) + min(x, na.rm = TRUE) }}), Infection_low = apply(pdata$e_data[, c(2, 3, 5, 10)], 1, function(x){if(all(is.na(x))){ min(x) }else{ - min(x, na.rm = T) + min(x, na.rm = TRUE) }}), Mock_none = apply(pdata$e_data[, 11:13], 1, function(x){if(all(is.na(x))){ min(x) }else{ - min(x, na.rm = T) + min(x, na.rm = TRUE) }}), row.names = 1:150), max = data.frame(Mass_Tag_ID = pdata$e_data$Mass_Tag_ID, @@ -253,19 +253,19 @@ test_that('edata_summary correctly summarizes the data',{ function(x){if(all(is.na(x))){ max(x) }else{ - max(x, na.rm = T) + max(x, na.rm = TRUE) }}), Infection_low = apply(pdata$e_data[, c(2, 3, 5, 10)], 1, function(x){if(all(is.na(x))){ max(x) }else{ - max(x, na.rm = T) + max(x, na.rm = TRUE) }}), Mock_none = apply(pdata$e_data[, 11:13], 1, function(x){if(all(is.na(x))){ max(x) }else{ - max(x, na.rm = T) + max(x, na.rm = TRUE) }}), row.names = 1:150) ) diff --git a/tests/testthat/test_trelliPlots.R b/tests/testthat/test_trelliPlots.R index 1ca09101..eddfb8a9 100644 --- a/tests/testthat/test_trelliPlots.R +++ b/tests/testthat/test_trelliPlots.R @@ -50,9 +50,9 @@ test_that("trelliPlots check the correct inputs", { cognostics = NULL, ggplot_params = NULL, interactive = F, - test_mode = T, + test_mode = TRUE, test_example = 10.2345, - single_plot = T, + single_plot = TRUE, p_value_thresh = 0.05, p_value_test = NA)) @@ -62,11 +62,11 @@ test_that("trelliPlots check the correct inputs", { cognostics = NULL, ggplot_params = NULL, interactive = F, - test_mode = T, + test_mode = TRUE, test_example = 10.2345, - single_plot = T, + single_plot = TRUE, p_value_thresh = 0.05, - p_value_test = T), + p_value_test = TRUE), "No imd-anova stats were detected in the statRes object which is" ) @@ -427,7 +427,7 @@ test_that("trelliPlots check the correct inputs", { expect_true(file.exists(file.path(testFolder, "boxFoldChangeTest2"))) # Generate a single plot - fc_boxplot <- singleEmetaPlot %>% trelli_foldchange_boxplot(single_plot = T) + fc_boxplot <- singleEmetaPlot %>% trelli_foldchange_boxplot(single_plot = TRUE) expect_true(inherits(fc_boxplot, "ggplot")) ## trelli_foldchange_volcano @@ -499,7 +499,7 @@ test_that("trelliPlots check the correct inputs", { expect_true(file.exists(file.path(testFolder, "hmFoldChangeTest2"))) # Generate a single plot - fc_heatmap <- singleEmetaPlot %>% trelli_foldchange_heatmap(single_plot = T) + fc_heatmap <- singleEmetaPlot %>% trelli_foldchange_heatmap(single_plot = TRUE) expect_true(inherits(fc_heatmap, "ggplot")) ## NaN significance results ######################## might need a second look @@ -567,4 +567,4 @@ test_that("trelliPlots check the correct inputs", { # interactive = TRUE) -}) \ No newline at end of file +}) diff --git a/vignettes/Trelliscope_Vignette.R b/vignettes/Trelliscope_Vignette.R index 74675987..14c6338a 100644 --- a/vignettes/Trelliscope_Vignette.R +++ b/vignettes/Trelliscope_Vignette.R @@ -22,7 +22,7 @@ data.table( knitr::include_graphics("TrelliData_Plotting_Options.png") ## ---- echo = F---------------------------------------------------------------- -knitr::kable(head(pmartRdata::lipid_pos_edata), options = list(`scrollX` = T)) +knitr::kable(head(pmartRdata::lipid_pos_edata), options = list(`scrollX` = TRUE)) ## ----------------------------------------------------------------------------- trelliData1 <- as.trelliData.edata( @@ -56,7 +56,7 @@ data.table( "Output a single plot instead of a trelliscope display") ) %>% knitr::kable() -## ---- echo = T, eval = F------------------------------------------------------ +## ---- echo = TRUE, eval = F------------------------------------------------------ # trelli_abundance_boxplot( # trelli_panel_by(trelliData1, "Lipid"), # cognostics = c("n", "mean", "median", "sd"), @@ -75,7 +75,7 @@ SampleGroups <- trelliData1 %>% trelli_panel_by("Sample") # Create an example boxplot Abun_Box_Edata <- trelli_abundance_boxplot(MassGroups, single_plot = TRUE, test_example = 3) # Make an abundance boxplot without the points -Abun_Box_Sample <- trelli_abundance_boxplot(SampleGroups, include_points = F, single_plot = T, +Abun_Box_Sample <- trelli_abundance_boxplot(SampleGroups, include_points = F, single_plot = TRUE, ggplot_params = "scale_fill_manual(values = 'forestgreen')") # Use patchwork to put plots together Abun_Box_Edata + Abun_Box_Sample @@ -97,7 +97,7 @@ Miss_Bar_Edata <- trelli_missingness_bar(trelli_panel_by(pep_trelliData, "Peptid # Make a missingness barplot Miss_Bar_Sample <- trelli_missingness_bar(trelli_panel_by(pep_trelliData, "Sample"), include_points = F, - proportion = FALSE, single_plot = T, + proportion = FALSE, single_plot = TRUE, ggplot_params = "ggtitle('Sample')") # Put plots together with patchwork Miss_Bar_Edata + Miss_Bar_Sample @@ -107,7 +107,7 @@ Miss_Bar_Edata + Miss_Bar_Sample lipids <- pmartRdata::lipid_pos_object # Extract and add lipid family information lipids$e_meta$Family <- lipids$e_meta$Lipid %>% - strsplit("(", fixed = T) %>% + strsplit("(", fixed = TRUE) %>% lapply(function(x) {head(x, 1)}) %>% unlist() # Log transform the edata file @@ -130,22 +130,22 @@ summary(trelliData2) ## ----------------------------------------------------------------------------- trelliData2 %>% trelli_panel_by("Lipid") %>% - trelli_abundance_boxplot(test_example = 3, single_plot = T, ggplot_params = "xlab('Viral Strain')") + trelli_abundance_boxplot(test_example = 3, single_plot = TRUE, ggplot_params = "xlab('Viral Strain')") ## ----------------------------------------------------------------------------- trelliData2 %>% trelli_panel_by("Family") %>% - trelli_abundance_boxplot(test_example = 6, single_plot = T) + trelli_abundance_boxplot(test_example = 6, single_plot = TRUE) ## ----------------------------------------------------------------------------- trelliData2 %>% trelli_panel_by("Family") %>% - trelli_missingness_bar(test_example = 3, single_plot = T) + trelli_missingness_bar(test_example = 3, single_plot = TRUE) ## ----------------------------------------------------------------------------- trelliData2 %>% trelli_panel_by("Family") %>% - trelli_abundance_heatmap(test_example = 2, single_plot = T, ggplot_params = "coord_flip()") + trelli_abundance_heatmap(test_example = 2, single_plot = TRUE, ggplot_params = "coord_flip()") ## ----------------------------------------------------------------------------- # Since nothing is missing from this dataset, there is no need to run the G-test. @@ -195,7 +195,7 @@ trelliData4 %>% ## ----------------------------------------------------------------------------- trelliData2 %>% trelli_panel_by("Lipid") %>% - trelli_abundance_boxplot(test_example = 3, single_plot = T, + trelli_abundance_boxplot(test_example = 3, single_plot = TRUE, ggplot_params = c("ggtitle('CYC Human')", "ylab('Log Adjusted Abundance')", "xlab('')", "theme_classic()", @@ -230,7 +230,7 @@ data.table( ## ----------------------------------------------------------------------------- trelliData2 %>% trelli_panel_by("Lipid") %>% - trelli_abundance_boxplot(test_example = 3, single_plot = T, interactive = T) + trelli_abundance_boxplot(test_example = 3, single_plot = TRUE, interactive = TRUE) ## ---- echo = FALSE------------------------------------------------------------ data.table( From d63ebfcbe0445fdb8e0fd307c5b019e75db4324f Mon Sep 17 00:00:00 2001 From: Evan Glasscock Date: Mon, 9 Jan 2023 11:23:33 -0800 Subject: [PATCH 3/8] Fix errors from rcmdcheck --- .github/workflows/R-CMD-check.yaml | 1 + R/plot_fns.R | 2 +- man/plot-isobaricnormRes.Rd | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index df1e3cf8..d98d7c82 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -27,6 +27,7 @@ jobs: any::rcmdcheck any::XML github::pmartR/pmartRdata@master + github::hafen/trelliscopejs needs: check - uses: r-lib/actions/setup-pandoc@v2 diff --git a/R/plot_fns.R b/R/plot_fns.R index c98149d7..80128a5d 100755 --- a/R/plot_fns.R +++ b/R/plot_fns.R @@ -371,7 +371,7 @@ plot.dataRes <- function (dataRes_obj, metric = NULL, density = FALSE, #' @examples #' library(pmartRdata) #' myiso <- edata_transform(omicsData = isobaric_object, data_scale = "log2") -#' myiso_norm <- normalize_isobaric(myiso, exp_cname = "Plex", +#' result <- normalize_isobaric(myiso, exp_cname = "Plex", #' apply_norm = FALSE, #' refpool_cname = "Virus", #' refpool_notation = "Pool") diff --git a/man/plot-isobaricnormRes.Rd b/man/plot-isobaricnormRes.Rd index 34656a40..9d6662c8 100644 --- a/man/plot-isobaricnormRes.Rd +++ b/man/plot-isobaricnormRes.Rd @@ -70,7 +70,7 @@ Creates box plots for an S3 object of type 'isobaricnormRes' \examples{ library(pmartRdata) myiso <- edata_transform(omicsData = isobaric_object, data_scale = "log2") -myiso_norm <- normalize_isobaric(myiso, exp_cname = "Plex", +result <- normalize_isobaric(myiso, exp_cname = "Plex", apply_norm = FALSE, refpool_cname = "Virus", refpool_notation = "Pool") From d5931e6110d51c16d4033a1b049f1b21ec5499ba Mon Sep 17 00:00:00 2001 From: Evan Glasscock Date: Tue, 10 Jan 2023 09:32:12 -0800 Subject: [PATCH 4/8] Fix a few examples --- R/plot_fns.R | 6 ++++++ man/plot-SPANSRes.Rd | 1 + man/plot-cvFilt.Rd | 1 + man/plot-imdanovaFilt.Rd | 1 + man/plot-moleculeFilt.Rd | 1 + man/plot-pepData.Rd | 1 + man/plot-proteomicsFilt.Rd | 1 + pmartR-Ex.R | 5 +++++ 8 files changed, 17 insertions(+) diff --git a/R/plot_fns.R b/R/plot_fns.R index 80128a5d..7bd95871 100755 --- a/R/plot_fns.R +++ b/R/plot_fns.R @@ -818,6 +818,7 @@ plot.nmrnormRes <- function (nmrnormRes_obj, nmrData = NULL, order_by = NULL, #' #' @examples #' library(pmartRdata) +#' data(pep_object) #' mypep <- edata_transform(omicsData = pep_object, data_scale = "log2") #' mypep <- group_designation(omicsData = mypep, main_effects = "Phenotype") #' myspans <- spans_procedure(omicsData = mypep) @@ -2073,6 +2074,7 @@ plot.dimRes <- function (dimRes_obj, interactive = FALSE, x_lab = NULL, #' interactive is TRUE #' #' @examples +#' library(pmartRdata) #' data(pep_object) #' molfilt <- molecule_filter(omicsData = pep_object) #' plot(molfilt, min_num = 5) @@ -2768,6 +2770,7 @@ plot.RNAFilt <- function (filter_object, plot_type = "library", #' #' @examples #' library(pmartRdata) +#' data(pep_object) #' mypep <- group_designation(omicsData = pep_object, main_effects = "Phenotype") #' to_filter <- imdanova_filter(omicsData = mypep) #' plot(to_filter, min_nonmiss_anova = 2, min_nonmiss_gtest = 3) @@ -3171,6 +3174,7 @@ plot.imdanovaFilt <- function (filter_object, min_nonmiss_anova = NULL, #' #' @examples #' library(pmartRdata) +#' data(pep_object) #' my_filter <- proteomics_filter(omicsData = pep_object) #' plot(my_filter, min_num_peps = 3) #' plot(my_filter, plot_type = "redundancy") @@ -4100,6 +4104,7 @@ plot.rmdFilt <- function (filter_object, pvalue_threshold = NULL, sampleID = NUL #' #' @examples #' library(pmartRdata) +#' data(pep_object) #' mypep <- group_designation(omicsData = pep_object, #' main_effects = "Phenotype") #' @@ -4939,6 +4944,7 @@ plot.seqData <- function (omicsData, order_by = NULL, color_by = NULL, #' #' @examples #' library(pmartRdata) +#' data(pep_object) #' mypep <- edata_transform(omicsData = pep_object, data_scale = "log2") #' plot(omicsData = mypep, order_by = "Phenotype", color_by = "Phenotype") #' diff --git a/man/plot-SPANSRes.Rd b/man/plot-SPANSRes.Rd index 0e3a012b..0307cb9e 100644 --- a/man/plot-SPANSRes.Rd +++ b/man/plot-SPANSRes.Rd @@ -68,6 +68,7 @@ For plotting an S3 object of type 'SPANSRes' } \examples{ library(pmartRdata) +data(pep_object) mypep <- edata_transform(omicsData = pep_object, data_scale = "log2") mypep <- group_designation(omicsData = mypep, main_effects = "Phenotype") myspans <- spans_procedure(omicsData = mypep) diff --git a/man/plot-cvFilt.Rd b/man/plot-cvFilt.Rd index 150773f5..407b11a4 100644 --- a/man/plot-cvFilt.Rd +++ b/man/plot-cvFilt.Rd @@ -84,6 +84,7 @@ For plotting an S3 object of type 'cvFilt' } \examples{ library(pmartRdata) +data(pep_object) mypep <- group_designation(omicsData = pep_object, main_effects = "Phenotype") diff --git a/man/plot-imdanovaFilt.Rd b/man/plot-imdanovaFilt.Rd index 54fbbe3d..f4ea1f5f 100644 --- a/man/plot-imdanovaFilt.Rd +++ b/man/plot-imdanovaFilt.Rd @@ -92,6 +92,7 @@ For plotting an S3 object of type 'imdanovaFilt' } \examples{ library(pmartRdata) +data(pep_object) mypep <- group_designation(omicsData = pep_object, main_effects = "Phenotype") to_filter <- imdanova_filter(omicsData = mypep) plot(to_filter, min_nonmiss_anova = 2, min_nonmiss_gtest = 3) diff --git a/man/plot-moleculeFilt.Rd b/man/plot-moleculeFilt.Rd index 94d19007..806db48b 100644 --- a/man/plot-moleculeFilt.Rd +++ b/man/plot-moleculeFilt.Rd @@ -90,6 +90,7 @@ ggplot2 plot object if interactive is FALSE, or plotly plot object if For plotting an S3 object of type 'moleculeFilt': } \examples{ +library(pmartRdata) data(pep_object) molfilt <- molecule_filter(omicsData = pep_object) plot(molfilt, min_num = 5) diff --git a/man/plot-pepData.Rd b/man/plot-pepData.Rd index 8e8fc199..58634e5d 100644 --- a/man/plot-pepData.Rd +++ b/man/plot-pepData.Rd @@ -95,6 +95,7 @@ For plotting pepData S3 objects } \examples{ library(pmartRdata) +data(pep_object) mypep <- edata_transform(omicsData = pep_object, data_scale = "log2") plot(omicsData = mypep, order_by = "Phenotype", color_by = "Phenotype") diff --git a/man/plot-proteomicsFilt.Rd b/man/plot-proteomicsFilt.Rd index 21b06ddf..27ac3420 100644 --- a/man/plot-proteomicsFilt.Rd +++ b/man/plot-proteomicsFilt.Rd @@ -114,6 +114,7 @@ For plotting an S3 object of type 'proteomicsFilt': } \examples{ library(pmartRdata) +data(pep_object) my_filter <- proteomics_filter(omicsData = pep_object) plot(my_filter, min_num_peps = 3) plot(my_filter, plot_type = "redundancy") diff --git a/pmartR-Ex.R b/pmartR-Ex.R index 4cda8be2..bf6341c3 100644 --- a/pmartR-Ex.R +++ b/pmartR-Ex.R @@ -1382,6 +1382,8 @@ flush(stderr()); flush(stdout()) ### ** Examples ## Not run: +##D library(pmartRdata) +##D ##D data(pep_object) ##D ##D pep_object <- group_designation(omicsData = pep_object, @@ -1468,6 +1470,7 @@ flush(stderr()); flush(stdout()) ### ** Examples ## Not run: +##D library(pmartRdata) ##D data(pep_object) ##D molfilt <- molecule_filter(pep_object) ##D plot(molfilt, min_num = 5) @@ -1550,6 +1553,7 @@ flush(stderr()); flush(stdout()) ### ** Examples ## Not run: +##D library(pmartRdata) ##D data(pep_object) ##D profilt <- proteomics_filter(pep_object) ##D plot(profilt, min_num_peps = 5) @@ -1571,6 +1575,7 @@ flush(stderr()); flush(stdout()) ### ** Examples ## Not run: +##D library(pmartRdata) ##D data(seq_object) ##D seqfilt <- total_count_filter(pep_object) ##D plot(seqfilt, min_count = 5) From 5241935f870368a5f1f4bf088a43e6c77f281477 Mon Sep 17 00:00:00 2001 From: Daniel Claborne Date: Wed, 11 Jan 2023 14:38:30 -0800 Subject: [PATCH 5/8] use devel version of pak, edit trelliscopejs dependency in DESCRIPTION --- .github/workflows/R-CMD-check.yaml | 7 +++---- .github/workflows/pkgdown.yaml | 1 + DESCRIPTION | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index d98d7c82..ca734588 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -2,9 +2,9 @@ # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: [master, develop, github-actions-test] + branches: [master, develop] pull_request: - branches: [master, develop, github-actions-test] + branches: [master, develop] name: R-CMD-check @@ -25,10 +25,9 @@ jobs: with: extra-packages: | any::rcmdcheck - any::XML github::pmartR/pmartRdata@master - github::hafen/trelliscopejs needs: check + pak-version: devel # See https://github.com/r-lib/actions/issues/559 - uses: r-lib/actions/setup-pandoc@v2 diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index a16ac242..1d1a6f8f 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -38,6 +38,7 @@ jobs: local::. github::pmartR/pmartRdata@master needs: website + pak-version: devel # See https://github.com/r-lib/actions/issues/559 - name: Build site run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) diff --git a/DESCRIPTION b/DESCRIPTION index ba8a961e..17767c1a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -42,8 +42,8 @@ Suggests: knitr, rmarkdown, testthat, - survival + trelliscopejs Remotes: - hafen/trelliscopejs + github::hafen/trelliscopejs RoxygenNote: 7.2.3 Encoding: UTF-8 From e34b280c9db6b5c28814f3aa3dd8e961c19529a2 Mon Sep 17 00:00:00 2001 From: Daniel Claborne Date: Fri, 13 Jan 2023 11:15:15 -0800 Subject: [PATCH 6/8] re-add survival to suggests [skip ci] --- DESCRIPTION | 1 + 1 file changed, 1 insertion(+) diff --git a/DESCRIPTION b/DESCRIPTION index 17767c1a..209a6333 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -41,6 +41,7 @@ Imports: Suggests: knitr, rmarkdown, + survival, testthat, trelliscopejs Remotes: From 8e37d4142358344180f3c85aa0c244f052fbe67d Mon Sep 17 00:00:00 2001 From: Evan Glasscock Date: Thu, 19 Jan 2023 10:58:17 -0800 Subject: [PATCH 7/8] Create lint test --- .github/workflows/lint.yaml | 48 +++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/lint.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 00000000..5adccc87 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,48 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [master, develop] + pull_request: + branches: [master, develop] + +name: lint + +jobs: + lint: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + steps: + - uses: actions/checkout@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: | + r-lib/lintr + github::pmartR/pmartRdata@master + local::. + needs: lint + pak-version: devel # See https://github.com/r-lib/actions/issues/559 + + - name: Lint + run: | + library(lintr) + lint_dir("R", linters = linters_with_defaults( + commented_code_linter = NULL, + cyclocomp_linter = cyclocomp_linter(20), + implicit_integer_linter = NULL, + line_length_linter(120), + object_name_linter = NULL, + object_length_linter(50), + object_usage_linter = NULL, + todo_comment_linter = NULL, + extraction_operator_linter = NULL, + defaults = linters_with_tags(tags = NULL) + )) + shell: Rscript {0} \ No newline at end of file From ab9e44637156f574df4b69a91cc95d284c45035b Mon Sep 17 00:00:00 2001 From: Evan Glasscock Date: Wed, 25 Jan 2023 11:03:20 -0800 Subject: [PATCH 8/8] Remove options so we can change them one at a time --- .github/workflows/lint.yaml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 5adccc87..2ea13435 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -33,16 +33,7 @@ jobs: - name: Lint run: | library(lintr) - lint_dir("R", linters = linters_with_defaults( - commented_code_linter = NULL, - cyclocomp_linter = cyclocomp_linter(20), - implicit_integer_linter = NULL, - line_length_linter(120), - object_name_linter = NULL, - object_length_linter(50), - object_usage_linter = NULL, - todo_comment_linter = NULL, - extraction_operator_linter = NULL, - defaults = linters_with_tags(tags = NULL) + lint_package(linter = linters_with_defaults( + # options go here )) shell: Rscript {0} \ No newline at end of file