From 9f4fbe4619867061e85c22a5d709df4972f30ec7 Mon Sep 17 00:00:00 2001 From: Tony Wu Date: Thu, 29 Jan 2026 15:15:56 -0500 Subject: [PATCH] feat(doseResponseFit): Add progress bar --- DESCRIPTION | 3 ++- NAMESPACE | 2 ++ R/Fit_Isotonic_Regression.R | 4 ++++ ...vertGroupToNumericDose.Rd => convertGroupToNumericDose.Rd} | 0 man/{DoseResponseFit.Rd => doseResponseFit.Rd} | 2 +- ...eExperimentSimulation.Rd => futureExperimentSimulation.Rd} | 0 man/{PredictIC50Parallel.Rd => predictIC50Parallel.Rd} | 0 ...isualizeResponseProtein.Rd => visualizeResponseProtein.Rd} | 0 8 files changed, 9 insertions(+), 2 deletions(-) rename man/{ConvertGroupToNumericDose.Rd => convertGroupToNumericDose.Rd} (100%) rename man/{DoseResponseFit.Rd => doseResponseFit.Rd} (96%) rename man/{FutureExperimentSimulation.Rd => futureExperimentSimulation.Rd} (100%) rename man/{PredictIC50Parallel.Rd => predictIC50Parallel.Rd} (100%) rename man/{VisualizeResponseProtein.Rd => visualizeResponseProtein.Rd} (100%) diff --git a/DESCRIPTION b/DESCRIPTION index 0e40607..2f27d1b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -31,7 +31,8 @@ Imports: dplyr, stats, parallel, - data.table + data.table, + utils Suggests: MSstats, MSstatsTMT, diff --git a/NAMESPACE b/NAMESPACE index d7a1451..d40cab3 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -48,3 +48,5 @@ importFrom(stats,pf) importFrom(stats,quantile) importFrom(stats,rlnorm) importFrom(stats,rnorm) +importFrom(utils,setTxtProgressBar) +importFrom(utils,txtProgressBar) diff --git a/R/Fit_Isotonic_Regression.R b/R/Fit_Isotonic_Regression.R index 48724f5..0c5cb6e 100644 --- a/R/Fit_Isotonic_Regression.R +++ b/R/Fit_Isotonic_Regression.R @@ -64,6 +64,7 @@ #' @importFrom stats pf p.adjust #' @importFrom dplyr filter select mutate group_by summarise arrange distinct #' @importFrom data.table rbindlist +#' @importFrom utils setTxtProgressBar txtProgressBar doseResponseFit = function(data, weights = NULL, increasing = FALSE, transform_dose = TRUE, @@ -92,6 +93,7 @@ doseResponseFit = function(data, weights = NULL, protein_list = unique(drug_subset$protein) results_list = list() + progress_bar = txtProgressBar(min = 0, max = length(protein_list), style = 3) for (i in seq_along(protein_list)) { tryCatch({ suppressWarnings({ @@ -130,11 +132,13 @@ doseResponseFit = function(data, weights = NULL, results_temp$drug = drug_type results_temp = results_temp[, c("protein", "drug", setdiff(names(results_temp), c("protein", "drug")))] results_list[[i]] = results_temp + setTxtProgressBar(progress_bar, i) }) }, error = function(e) { warning(paste("Error for drug:", drug_type, "protein:", protein_list[i], ":", conditionMessage(e))) }) } + close(progress_bar) # Combine and adjust p-values for this drug if (length(results_list) > 0) { diff --git a/man/ConvertGroupToNumericDose.Rd b/man/convertGroupToNumericDose.Rd similarity index 100% rename from man/ConvertGroupToNumericDose.Rd rename to man/convertGroupToNumericDose.Rd diff --git a/man/DoseResponseFit.Rd b/man/doseResponseFit.Rd similarity index 96% rename from man/DoseResponseFit.Rd rename to man/doseResponseFit.Rd index 07dd21f..3033264 100644 --- a/man/DoseResponseFit.Rd +++ b/man/doseResponseFit.Rd @@ -66,7 +66,7 @@ interaction_results <- doseResponseFit( print(interaction_results) # Check significant interactions -significant <- interaction_results[interaction_results$adjust_pval < 0.05, ] +significant <- interaction_results[interaction_results$adj.pvalue < 0.05, ] print(paste("Found", nrow(significant), "significant interactions")) \dontrun{ diff --git a/man/FutureExperimentSimulation.Rd b/man/futureExperimentSimulation.Rd similarity index 100% rename from man/FutureExperimentSimulation.Rd rename to man/futureExperimentSimulation.Rd diff --git a/man/PredictIC50Parallel.Rd b/man/predictIC50Parallel.Rd similarity index 100% rename from man/PredictIC50Parallel.Rd rename to man/predictIC50Parallel.Rd diff --git a/man/VisualizeResponseProtein.Rd b/man/visualizeResponseProtein.Rd similarity index 100% rename from man/VisualizeResponseProtein.Rd rename to man/visualizeResponseProtein.Rd