@sjcrh/proteinpaint-server 2.78.0 → 2.79.1-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -109,7 +109,7 @@ benchmark[["prepareDataTable"]] <- unbox(paste(round(as.numeric(dtime), 4), attr
109
109
  ##################
110
110
 
111
111
  stime <- Sys.time()
112
- formulas <- buildFormulas(input$outcome, input$independent, input$neuroOnc)
112
+ formulas <- buildFormulas(input$outcome, input$independent, input$includeUnivariate)
113
113
  etime <- Sys.time()
114
114
  dtime <- etime - stime
115
115
  benchmark[["buildFormulas"]] <- unbox(paste(round(as.numeric(dtime), 4), attr(dtime, "units")))
@@ -137,9 +137,9 @@ benchmark[["runRegression"]] <- unbox(paste(round(as.numeric(dtime), 4), attr(dt
137
137
  # PARSE RESULTS #
138
138
  ##################
139
139
 
140
- if (isTRUE(input$neuroOnc) && nrow(input$independent) > 1) {
141
- # neuro-oncology dataset using multiple covariates
142
- # parse the results from univariate and multivariate analyses
140
+ if (isTRUE(input$includeUnivariate)) {
141
+ # univariate analysis included along with multivariate analysis
142
+ # parse the results
143
143
  # TODO: this function will not work with snplocus regression because it
144
144
  # will combine results from multiple analyses into a single set of results
145
145
  reg_results <- parseUniMultiResults(reg_results, input$regressionType)
@@ -54,7 +54,7 @@ cubic_spline <- function(values, knots) {
54
54
  }
55
55
 
56
56
  # build formulas
57
- buildFormulas <- function(outcome, independent, neuroOnc) {
57
+ buildFormulas <- function(outcome, independent, includeUnivariate) {
58
58
  # first, format variables for building formulas
59
59
 
60
60
  # declare new objects
@@ -117,8 +117,6 @@ buildFormulas <- function(outcome, independent, neuroOnc) {
117
117
  }
118
118
  }
119
119
 
120
- if (isTRUE(neuroOnc) && length(formula_interaction) > 0) stop ("interactions not supported in neuro-onc datasets")
121
-
122
120
  # combine variables into formula(s)
123
121
  # if snplocus snps are present, then prepare a
124
122
  # separate formula for each snplocus snp
@@ -152,9 +150,10 @@ buildFormulas <- function(outcome, independent, neuroOnc) {
152
150
  }
153
151
  } else {
154
152
  # no snplocus snps
155
- if (isTRUE(neuroOnc) && length(formula_independent) > 1) {
156
- # neuro-onc dataset using multiple covariates
157
- # build multivariate and univariate formulas
153
+ if (isTRUE(includeUnivariate)) {
154
+ # include univariate formulas along with the multivariate formula
155
+ if (length(formula_independent) < 2) stop("must have multiple covariates to build multivariate and univariate formulas")
156
+ if (length(formula_interaction) > 0) stop("interactions not supported in univariate models")
158
157
  formula <- as.formula(paste(formula_outcome, paste(formula_independent, collapse = "+"), sep = "~"))
159
158
  formulas[[1]] <- list("id" = "", "type" = "multivariate", "formula" = formula)
160
159
  for (var in formula_independent) {