Skip to content

Commit ec13d52

Browse files
committed
Enable 5 additional linters and fix all violations
Re-enable assignment_linter, commented_code_linter, semicolon_linter, pipe_continuation_linter, and quotes_linter. Fix 56 assignment (= to <-), 110 commented-out code, and 14 quotes violations across 26 R files.
1 parent eddd3c5 commit ec13d52

27 files changed

Lines changed: 87 additions & 268 deletions

.lintr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
linters: linters_with_defaults(line_length_linter(120), assignment_linter = NULL, brace_linter = NULL, commas_linter = NULL, commented_code_linter = NULL, indentation_linter = NULL, infix_spaces_linter = NULL, object_length_linter(40), object_name_linter = NULL, paren_body_linter = NULL, pipe_continuation_linter = NULL, quotes_linter = NULL, return_linter = NULL, semicolon_linter = NULL, spaces_inside_linter = NULL, spaces_left_parentheses_linter = NULL, trailing_blank_lines_linter = NULL, trailing_whitespace_linter = NULL)
1+
linters: linters_with_defaults(line_length_linter(120), brace_linter = NULL, commas_linter = NULL, indentation_linter = NULL, infix_spaces_linter = NULL, object_length_linter(40), object_name_linter = NULL, paren_body_linter = NULL, return_linter = NULL, spaces_inside_linter = NULL, spaces_left_parentheses_linter = NULL, trailing_blank_lines_linter = NULL, trailing_whitespace_linter = NULL)
22
exclusions: list("data-raw", "inst/deprecated", "inst/doc", "inst/issue71", "tests/testthat", "vignettes", "R/generatedContrastsDF.r")
33

44

R/A_dataset_docu.R

Lines changed: 5 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -100,161 +100,78 @@ NULL
100100
"x5463yzwer453bbb"
101101

102102

103-
# data_benchmarkExample <- prolfqua::benchmarkDataExample
104-
# usethis::use_data(data_benchmarkExample, compress = TRUE, overwrite = TRUE)
105-
# file.remove("data/benchmarkDataExample.rda")
106-
107103
#' Benchmark data Example
108104
#' @format A data frame
109105
#' @family data
110106
#' @docType data
111107
#' @keywords internal
112108
"data_benchmarkExample"
113109

114-
# #@usage data_benchmarkExample <- prolfqua_data("data_benchmarkExample")
115-
116-
# data_checksummarizationrobust87 <- prolfqua::checksummarizationrobust87
117-
# usethis::use_data(data_checksummarizationrobust87, compress = TRUE, overwrite = TRUE)
118-
# file.remove("data/checksummarizationrobust87.rda")
119-
120110
#' example data for check
121111
#' @family data
122112
#' @docType data
123113
#' @keywords internal
124114
"data_checksummarizationrobust87"
125115

126-
# #@usage data_checksummarizationrobust87 <- prolfqua_data("data_checksummarizationrobust87")
127-
128-
# data_checksummarizerobust <- prolfqua::checksummarizerobust
129-
# usethis::use_data(data_checksummarizerobust, compress = TRUE, overwrite = TRUE)
130-
# file.remove("data/checksummarizerobust.rda")
131-
132116
#' example data for check
133117
#' @family data
134118
#' @docType data
135119
#' @keywords internal
136120
"data_checksummarizerobust"
137121

138-
# #@usage data_checksummarizerobust <- prolfqua_data("data_checksummarizerobust")
139-
140-
# data_checksummarizerobust69 <- prolfqua::checksummarizerobust69
141-
# usethis::use_data(data_checksummarizerobust69, compress = TRUE, overwrite = TRUE)
142-
# file.remove("data/checksummarizerobust69.rda")
143-
144122
#' example data for check
145123
#' @family data
146124
#' @docType data
147125
#' @keywords internal
148126
#'
149127
"data_checksummarizerobust69"
150128

151-
# #@usage data_checksummarizerobust69 <- prolfqua_data("data_checksummarizerobust69")
152-
153-
# data_correlatedPeptideList <- prolfqua::correlatedPeptideList
154-
# usethis::use_data(data_correlatedPeptideList, compress = TRUE, overwrite = TRUE)
155-
# file.remove("data/correlatedPeptideList.rda")
156-
157129
#' example data for check
158130
#' @family data
159131
#' @docType data
160132
#' @keywords internal
161133
#'
162134
"data_correlatedPeptideList"
163135

164-
# #@usage data_correlatedPeptideList <- prolfqua_data("data_correlatedPeptideList")
165-
166-
# data_IonstarProtein_subsetNorm <- prolfqua::dataIonstarProtein_subsetNorm
167-
# usethis::use_data(data_IonstarProtein_subsetNorm, compress = TRUE, overwrite = TRUE)
168-
# file.remove("data/dataIonstarProtein_subsetNorm.rda")
169-
170136
#' example data for check
171137
#' @family data
172138
#' @docType data
173139
#' @keywords internal
174140
#'
175141
"data_IonstarProtein_subsetNorm"
176142

177-
# #@usage data_IonstarProtein_subsetNorm <- prolfqua_data("data_IonstarProtein_subsetNorm")
178-
179-
# #@usage data_interactionModel_p1807 <- prolfqua_data("data_interactionModel_p1807")
180-
181-
# data_ionstar <- ionstar
182-
# usethis::use_data(data_ionstar, compress = TRUE, overwrite = TRUE)
183-
# file.remove("data/ionstar.rda")
184-
185143
#' example data for check
186144
#' @family data
187145
#' @docType data
188146
#' @keywords internal
189147
"data_ionstar"
190148

191-
# #@usage data_ionstar <- prolfqua_data("data_ionstar")
192-
193-
# #@usage data_multigroupFC <- prolfqua_data("data_multigroupFC")
194-
195149
#' example data for check of scores produced based on confusion matrix
196150
#' @family data
197151
#' @docType data
198152
#' @keywords internal
199153
"data_test_confusion_matrix_scores"
200154

201-
# data_skylinePRMSample_A <- skylinePRMSampleData_A
202-
# usethis::use_data(data_skylinePRMSample_A,compress = TRUE, overwrite = TRUE)
203-
# file.remove("data/skylinePRMSampleData_A.rda")
204-
205155
#' example data for check
206156
#' @family data
207157
#' @docType data
208158
#' @keywords internal
209159
"data_skylinePRMSample_A"
210160

211-
# #@usage data_skylinePRMSample_A <- prolfqua_data("data_skylinePRMSample_A")
212-
213-
# data_skylineSRM_HL_A <- skylineSRM_HL_A
214-
# usethis::use_data(data_skylineSRM_HL_A,compress = TRUE, overwrite = TRUE)
215-
# file.remove("data/skylineSRM_HL_A.rda")
216-
217161
#' example data for check
218162
#' @family data
219163
#' @docType data
220164
#' @keywords internal
221165
"data_skylineSRM_HL_A"
222166

223-
# data_skylineSRM_HL_A <- prolfqua_data("data_skylineSRM_HL_A")
224-
# data_skylineSRM_HL_A_new <- list()
225-
# data_skylineSRM_HL_A_new$data <- data_skylineSRM_HL_A$data
226-
# data_skylineSRM_HL_A_new$config_f <- function(){
227-
# skylineconfig_HL <- create_config_Skyline(isotopeLabel = "Isotope.Label",
228-
# ident_qValue = "annotation_QValue")
229-
# skylineconfig_HL$table$factors[["treatment_c"]] <- "Condition2"
230-
# skylineconfig_HL$table$factors[["time_c"]] <- "time"
231-
# skylineconfig_HL$table$is_response_transformed = FALSE
232-
# return(skylineconfig_HL)
233-
# }
234-
# data_skylineSRM_HL_A_new$analysis <- function(data,config ){
235-
# data$Area[data$Area == 0] <- NA
236-
# analysis <- setup_analysis(data, config)
237-
# return(analysis)
238-
# }
239-
# data_skylineSRM_HL_A <- data_skylineSRM_HL_A_new
240-
# usethis::use_data(data_skylineSRM_HL_A,compress = TRUE, overwrite = TRUE)
241-
242-
# data_spectronautDIA250_A <- spectronautDIAData250_A
243-
# usethis::use_data(data_spectronautDIA250_A,compress = TRUE, overwrite = TRUE)
244-
# file.remove("data/spectronautDIAData250_A.rda")
245-
246167
#' example data for check
247168
#' @family data
248169
#' @docType data
249170
#' @keywords internal
250171
"data_spectronautDIA250_A"
251172

252-
# #@usage data_spectronautDIA250_A <- prolfqua_data("data_spectronautDIA250_A")
253-
254-
# example of 2 Factor data
255-
# @family data
256-
# @docType data
257-
# @keywords internal
258-
#' data_Yeast2Factor'
259-
260-
# #@usage data_spectronautDIA250_A <- prolfqua_data("data_spectronautDIA250_A")
173+
#' example of 2 Factor data
174+
#' @family data
175+
#' @docType data
176+
#' @keywords internal
177+
"data_Yeast2Factor"

R/AnalysisConfiguration.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,8 @@ list_to_AnalysisConfiguration <- function(dd) {
306306
#' stopifnot(length(red$hierarchy) == 1)
307307
make_reduced_hierarchy_config <- function(config, workIntensity, hierarchy) {
308308
newConfig <- config$clone(deep = TRUE)
309-
newConfig$hierarchy = hierarchy
310-
newConfig$workIntensity = workIntensity
309+
newConfig$hierarchy <- hierarchy
310+
newConfig$workIntensity <- workIntensity
311311
return(newConfig)
312312
}
313313

@@ -437,9 +437,9 @@ setup_analysis <- function(data, configuration, cc = TRUE, from_factors = FALSE)
437437
if (length(configuration$factors) == 0) {
438438
stop(
439439
"No factors (explanatory variables) specified in the AnalysisConfiguration.\n",
440-
'Please use config$factors["Condition"] = "columnName".\n',
441-
'where Condition is the new name of the variable and\n',
442-
'columnName is the name of the column containing the variable.'
440+
"Please use config$factors[\"Condition\"] = \"columnName\".\n",
441+
"where Condition is the new name of the variable and\n",
442+
"columnName is the name of the column containing the variable."
443443
)
444444
}
445445
for (i in seq_along(configuration$factors)) {

R/Benchmark.R

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ ionstar_bench_preprocess <- function(data, idcol = "protein_Id") {
5050
#' plot(1- xd$PREC, xd$FDP)
5151
#'
5252
ms_bench_add_scores <- function(data, TP_col = "TP", arrangeby = "diff", desc = TRUE, subject_Id = "protein_Id") {
53-
#data <- est
54-
5553
data <- if (!desc) {
5654
data |> arrange(!!sym(arrangeby))
5755
} else {
@@ -116,7 +114,7 @@ ms_bench_auc <- function(FPR, TPR, fpr_threshold = 1) {
116114
.scale_probabilities <-
117115
function(est, toscale, fcestimate = "diff") {
118116
addScaledP <- function(data, fcestimate, scale) {
119-
scaled.p = paste0("scaled.", scale)
117+
scaled.p <- paste0("scaled.", scale)
120118
data <-
121119
data |> dplyr::mutate(!!scaled.p := ifelse(!!sym(fcestimate) > 0, 1 - !!sym(scale), !!sym(scale) - 1))
122120
return(data)
@@ -170,15 +168,11 @@ do_confusion_c <- function(
170168
)
171169
}
172170
txx$out <- out
173-
#txx <- txx |> mutate(out = map(data,
174-
# do_confusion,
175-
# arrangeby = arrangeby, subject_Id = subject_Id))
176171
xx <- txx |> select(all_of(c(contrast, "out"))) |> unnest("out") |> ungroup()
177172

178173
# computes FDR FDP for all contrasts
179174
xy <- do_confusion(data, arrangeby = arrangeby, subject_Id = subject_Id)
180175
xy <- xy |> dplyr::mutate(!!contrast := "all")
181-
#xy <- tibble::add_column(data, contrast = "all", .before = 1)
182176
xx <- dplyr::bind_rows(xy, xx)
183177
return(xx)
184178
}
@@ -270,8 +264,8 @@ do_confusion_c <- function(
270264
) {
271265
plots <- list()
272266
for (i in score) {
273-
xlim = i$xlim
274-
score = i$score
267+
xlim <- i$xlim
268+
score <- i$score
275269
plots[[score]] <- ggplot(data, aes(x = !!sym(score), y = !!sym(contrast), color = !!sym(species))) +
276270
ggridges::geom_density_ridges(alpha = 0.1) +
277271
if (!is.null(xlim)) {
@@ -563,7 +557,6 @@ Benchmark <-
563557
#' @return ggplot
564558
plot_FDRvsFDP = function() {
565559
xx <- self$get_confusion_FDRvsFDP()
566-
#xx$FDP <- xx$FDP/seq(1,max(xx$FDP), length = length(xx$FDP))
567560
p <- ggplot(xx, aes(x = scorecol, y = FDP_, color = !!sym(self$contrast))) +
568561
geom_line() +
569562
geom_abline(slope = max(xx$FDP_), col = 2) +

R/ContrastFirth.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ ContrastsFirth <- R6::R6Class(
199199
contrast_minimal,
200200
subject_Id = self$subject_Id,
201201
columns = c("diff", columns),
202-
contrast = 'contrast'
202+
contrast = "contrast"
203203
)
204204
return(contrasts_wide)
205205
}

R/Contrasts.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ Contrasts <- R6::R6Class(
164164
if (is.null(self$contrast_result)) {
165165
message("determine linear functions:")
166166
linfct <- self$get_linfct(global = self$global)
167-
# contrast_sides <- self$get_contrast_sides()
168167
message("get_contrasts -> contrasts_linfct")
169168
# TODO (goes into calling code)
170169
contrast_result <- contrasts_linfct(

R/ContrastsModerated.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ ContrastsModerated <- R6::R6Class(
182182
contrast_minimal,
183183
subject_Id = self$subject_Id,
184184
columns = c("diff", columns),
185-
contrast = 'contrast'
185+
contrast = "contrast"
186186
)
187187
return(contrasts_wide)
188188
}

R/ContrastsProDA.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ ContrastsProDA <- R6::R6Class(
108108
contrast_minimal,
109109
subject_Id = self$subject_Id,
110110
columns = c("diff", columns),
111-
contrast = 'contrast'
111+
contrast = "contrast"
112112
)
113113
return(contrasts_wide)
114114
}

R/ContrastsROPECA.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ ContrastsROPECA <- R6::R6Class(
169169
contrast_minimal,
170170
subject_Id = self$subject_Id[length(self$subject_Id) - 1],
171171
columns = c("diff", columns),
172-
contrast = 'contrast'
172+
contrast = "contrast"
173173
)
174174
return(contrasts_wide)
175175
}

R/ContrastsSimpleImpute.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ ContrastsMissing <- R6::R6Class(
158158
contrast_minimal,
159159
subject_Id = self$subject_Id,
160160
columns = c("diff", columns),
161-
contrast = 'contrast'
161+
contrast = "contrast"
162162
)
163163
return(contrasts_wide)
164164
}

0 commit comments

Comments
 (0)