Skip to content

Commit ab1d78e

Browse files
committed
fixes for BiocCheck
line length and indents
1 parent 9e96201 commit ab1d78e

File tree

118 files changed

+2808
-2018
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+2808
-2018
lines changed

DESCRIPTION

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ Description: A package to merge, filter sort, organise and otherwise mash
2121
imported from multiple sources (software) and combined using workflow
2222
steps based on S4
2323
class templates derived from the `struct` package. Other modular workflow
24-
such as filtering, merging, splitting, normalisation and rest-api queries
25-
are also included.
24+
steps such as filtering, merging, splitting, normalisation and rest-api
25+
queries are included.
2626
License: GPL-3
2727
Encoding: UTF-8
2828
LazyData: false
@@ -38,10 +38,10 @@ Imports:
3838
httr,
3939
scales,
4040
ggthemes,
41-
cowplot,
4241
ggplot2,
4342
utils,
44-
rlang
43+
rlang,
44+
cowplot
4545
Collate:
4646
'generics.R'
4747
'zzz.R'
@@ -114,6 +114,7 @@ Collate:
114114
'rdata_database_class.R'
115115
'rds_database_class.R'
116116
'rds_cache_class.R'
117+
'remove_columns_class.R'
117118
'rename_columns_class.R'
118119
'rt_match_class.R'
119120
'select_columns_class.R'

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export(pubchem_widget)
8080
export(rdata_database)
8181
export(rds_cache)
8282
export(rds_database)
83+
export(remove_columns)
8384
export(rename_columns)
8485
export(rest_api)
8586
export(rt_match)
@@ -106,7 +107,6 @@ import(ggplot2)
106107
import(ggthemes)
107108
import(httr)
108109
import(methods)
109-
import(patchwork)
110110
import(rlang)
111111
import(struct)
112112
importFrom(scales,manual_pal)

R/AnnotationDb_select_class.R

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,45 +123,45 @@ setMethod(
123123
definition = function(M, D) {
124124
# get db
125125
db <- do.call(`::`, list(M$database, M$database))
126-
126+
127127
# prepare from:to for left join
128128
by <- M$key_type
129129
names(by) <- M$key_column
130-
130+
131131
# columns
132132
if (any(M$database_columns == ".all")) {
133133
M$database_columns <- AnnotationDbi::columns(db)
134134
}
135-
135+
136136
# select
137-
db = AnnotationDbi::select(
137+
db <- AnnotationDbi::select(
138138
x = db,
139139
keys = as.character(D$data[[M$key_column]]),
140140
columns = M$database_columns,
141141
keytype = M$key_type
142142
)
143-
143+
144144
# remove NA
145145
if (M$drop_na) {
146146
na <- apply(db, 1, function(x) {
147147
any(is.na(x))
148148
})
149149
db <- db[!na, ]
150150
}
151-
151+
152152
# unique rows
153153
db <- unique(db)
154-
154+
155155
# add the columns
156156
M2 <- add_columns(
157157
new_columns = db,
158158
by = by
159159
)
160160
M2 <- model_apply(M2, D)
161-
161+
162162
# assign to object
163163
M$updated <- predicted(M2)
164-
164+
165165
return(M)
166166
}
167167
)

R/BiocFileCache_database_class.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,15 @@ setMethod(
159159
field = "rtype", query = "web"
160160
)$rid) {
161161
# TRUE if newly added or stale
162-
update = BiocFileCache::bfcneedsupdate(bfc, rid)
162+
update <- BiocFileCache::bfcneedsupdate(bfc, rid)
163163
if (is.na(update)) { # FALSE if NA
164-
update=FALSE
164+
update <- FALSE
165165
}
166166
} else {
167-
update = FALSE # cant update if not web resource
167+
update <- FALSE # cant update if not web resource
168168
}
169-
170-
169+
170+
171171
# download & unzip
172172
if (update & !obj$offline) {
173173
BiocFileCache::bfcdownload(

R/MTox700plus_database_class.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ MTox700plus_database <- function(version = "latest",
5757
description = paste0(
5858
"The version number of the MTox700+ database to import. ",
5959
"Available versions are listed here: ",
60-
"[https://github.com/michabohealthscience/MTox700plus/releases].",
60+
'[https://github.com/michabohealthscience/MTox700plus/',
61+
'releases].',
6162
' `version` should match the tag of the release e.g. `"v1.0"`.',
6263
' For convenience `version = "latest"` will always retrieve ',
6364
"the most recent release. To prevent unecessary downloads ",

R/MetMashR-package.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#' @import struct
2-
#' @import patchwork
32
#' @importFrom utils URLencode modifyList read.csv stack unzip
43
#' @keywords internal
54
"_PACKAGE"

R/annotation_bar_chart.R

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
#' @eval get_description('annotation_pie_chart')
22
#' @include annotation_source_class.R
33
#' @export
4-
annotation_bar_chart <- function(
5-
factor_name,
6-
label_rotation = FALSE,
7-
label_location = "inside",
8-
label_type = "percent",
9-
legend = FALSE,
10-
...) {
4+
annotation_bar_chart <- function(factor_name,
5+
label_rotation = FALSE,
6+
label_location = "inside",
7+
label_type = "percent",
8+
legend = FALSE,
9+
...) {
1110
out <- struct::new_struct(
1211
"annotation_bar_chart",
1312
factor_name = factor_name,
@@ -17,7 +16,7 @@ annotation_bar_chart <- function(
1716
legend = legend,
1817
...
1918
)
20-
19+
2120
return(out)
2221
}
2322

@@ -111,8 +110,8 @@ setMethod(
111110
df <- dobj$data %>%
112111
group_by(.data[[obj$factor_name]]) %>%
113112
summarise(count = n()) %>%
114-
tidyr::complete(.data[[obj$factor_name]],fill=list(count=0))
115-
113+
tidyr::complete(.data[[obj$factor_name]], fill = list(count = 0))
114+
116115
# labels
117116
df$label <- ""
118117
if (obj$label_type == "percent") {
@@ -122,7 +121,7 @@ setMethod(
122121
} else if (obj$label_type == "count") {
123122
df$label <- as.character(df$count)
124123
}
125-
124+
126125
if (obj$label_rotation) {
127126
df$label <- paste0(" ", df$label, " ")
128127
} else {
@@ -132,7 +131,7 @@ setMethod(
132131
df$label <- paste0(df$label)
133132
}
134133
}
135-
134+
136135
# add newlines of spaces to offset depending on rotation
137136
if (!obj$legend) {
138137
if (obj$label_type != "none") {
@@ -144,13 +143,13 @@ setMethod(
144143
df$label <- df[[obj$factor_name]]
145144
}
146145
}
147-
146+
148147
if (!obj$label_rotation) {
149148
df$rotate <- 0
150149
} else {
151150
df$rotate <- -90
152151
}
153-
152+
154153
df$hjust <- 0.5
155154
if (obj$label_rotation) {
156155
if (obj$label_location == "inside") {
@@ -159,7 +158,7 @@ setMethod(
159158
df$hjust <- 1
160159
}
161160
}
162-
161+
163162
# plot
164163
g <- ggplot(
165164
data = df,
@@ -183,15 +182,15 @@ setMethod(
183182
structToolbox:::theme_Publication(12) +
184183
scale_fill_Publication() +
185184
theme_Publication()
186-
185+
187186
# legend
188187
if (!obj$legend) {
189188
g <- g + theme(legend.position = "none")
190189
} else {
191190
g <- g + theme(axis.text.x = element_blank())
192191
}
193-
194-
192+
193+
195194
return(g)
196195
}
197196
)

R/annotation_pie_chart.R

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
#' @eval get_description('annotation_pie_chart')
22
#' @export
3-
annotation_pie_chart <- function(
4-
factor_name,
5-
label_rotation = FALSE,
6-
label_location = "inside",
7-
label_type = "percent",
8-
legend = FALSE,
9-
pie_rotation = 0,
10-
centre_radius = 0,
11-
centre_label = NULL,
12-
count_na = FALSE,
13-
...) {
3+
annotation_pie_chart <- function(factor_name,
4+
label_rotation = FALSE,
5+
label_location = "inside",
6+
label_type = "percent",
7+
legend = FALSE,
8+
pie_rotation = 0,
9+
centre_radius = 0,
10+
centre_label = NULL,
11+
count_na = FALSE,
12+
...) {
1413
check <- centre_radius >= 0 & centre_radius <= 1
1514
if (!check) {
1615
stop("Pie chart centre_radius must be between 0 and 1.")
1716
}
18-
17+
1918
out <- struct::new_struct(
2019
"annotation_pie_chart",
2120
factor_name = factor_name,
@@ -29,7 +28,7 @@ annotation_pie_chart <- function(
2928
count_na = count_na,
3029
...
3130
)
32-
31+
3332
return(out)
3433
}
3534

@@ -47,7 +46,7 @@ annotation_pie_chart <- function(
4746
centre_radius = "entity",
4847
centre_label = "entity",
4948
count_na = "entity",
50-
.pie_data = 'data.frame'
49+
.pie_data = "data.frame"
5150
),
5251
prototype = list(
5352
name = "Annotation pie chart",
@@ -165,13 +164,13 @@ setMethod(
165164
definition = function(obj, dobj) {
166165
r1 <- obj$centre_radius
167166
radians <- obj$pie_rotation * pi / 180
168-
167+
169168
if (obj$label_location == "inside") {
170169
offset <- 1
171170
} else {
172171
offset <- 1.6
173172
}
174-
173+
175174
if (obj$count_na) {
176175
dobj$data[[obj$factor_name]] <-
177176
factor(dobj$data[[obj$factor_name]])
@@ -180,8 +179,8 @@ setMethod(
180179
df <- dobj$data %>%
181180
group_by(.data[[obj$factor_name]]) %>%
182181
summarise(count = n()) %>%
183-
tidyr::complete(.data[[obj$factor_name]],fill=list(count=0))
184-
182+
tidyr::complete(.data[[obj$factor_name]], fill = list(count = 0))
183+
185184
# labels
186185
df$label <- ""
187186
if (obj$label_type == "percent") {
@@ -191,7 +190,7 @@ setMethod(
191190
} else if (obj$label_type == "count") {
192191
df$label <- as.character(df$count)
193192
}
194-
193+
195194
if (!obj$legend) {
196195
if (obj$label_type != "none") {
197196
df$label <- paste0(
@@ -202,7 +201,7 @@ setMethod(
202201
df$label <- df[[obj$factor_name]]
203202
}
204203
}
205-
204+
206205
# position of label in degrees
207206
df$angle <- ((cumsum(df$count) - (df$count / 2)) / sum(df$count)) *
208207
360 - obj$pie_rotation
@@ -211,13 +210,13 @@ setMethod(
211210
# centre if at top or bottom
212211
df$hjust[df$angle > 175 & df$angle < 185] <- 0.5
213212
df$hjust[df$angle > 355 | df$angle < 5] <- 0.5
214-
213+
215214
if (!obj$label_rotation) {
216215
df$rotate <- 0
217216
} else {
218217
df$rotate <- df$angle - 270 - (180 * df$hjust)
219218
}
220-
219+
221220
# plot
222221
g <- ggplot(
223222
data = df,
@@ -233,18 +232,18 @@ setMethod(
233232
coord_polar("y", start = radians, clip = "off") +
234233
theme_void() +
235234
geom_text(aes(x = offset, label = .data[["label"]], angle = rotate),
236-
position = position_stack(vjust = 0.5),
237-
hjust = df$hjust,
235+
position = position_stack(vjust = 0.5),
236+
hjust = df$hjust,
238237
) +
239238
theme(plot.margin = unit(c(1, 1, 1, 1), "lines")) +
240239
xlim(c(0.5, 1.6)) +
241240
scale_fill_Publication()
242-
241+
243242
# legend
244243
if (!obj$legend) {
245244
g <- g + theme(legend.position = "none")
246245
}
247-
246+
248247
# add centre label
249248
if (!is.null(obj$centre_label)) {
250249
if (obj$centre_label == ".total") {
@@ -255,8 +254,8 @@ setMethod(
255254
g <- g +
256255
geom_text(aes(x = 0.5, y = 0), label = obj$centre_label)
257256
}
258-
259-
obj@.pie_data = df
257+
258+
obj@.pie_data <- df
260259
return(g)
261260
}
262261
)

0 commit comments

Comments
 (0)