Skip to content

Commit 95a7f8c

Browse files
committed
rename non-internal functions
previously named with a preceding <dot> these helper functions were renamed to prevent giving the impression that they are internal functions
1 parent 5ce82bb commit 95a7f8c

23 files changed

+195
-187
lines changed

NAMESPACE

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,5 @@
11
# Generated by roxygen2: do not edit by hand
22

3-
export(.cache_as_is)
4-
export(.collapse)
5-
export(.count)
6-
export(.greek_dictionary)
7-
export(.mean)
8-
export(.median)
9-
export(.mode)
10-
export(.nothing)
11-
export(.prioritise)
12-
export(.racemic_dictionary)
13-
export(.select_exact)
14-
export(.select_grade)
15-
export(.select_match)
16-
export(.select_max)
17-
export(.select_min)
18-
export(.tripeptide_dictionary)
19-
export(.unique)
20-
export(.unzip)
213
export(AnnotationDb_database)
224
export(AnnotationDb_select)
235
export(BiocFileCache_database)
@@ -36,6 +18,7 @@ export(annotation_source)
3618
export(annotation_table)
3719
export(annotation_upset_chart)
3820
export(annotation_venn_chart)
21+
export(cache_as_is)
3922
export(calc_ppm_diff)
4023
export(calc_rt_diff)
4124
export(cd_source)
@@ -44,7 +27,11 @@ export(combine_columns)
4427
export(combine_records)
4528
export(combine_sources)
4629
export(compute_column)
30+
export(compute_mean)
31+
export(compute_median)
32+
export(compute_mode)
4733
export(compute_record)
34+
export(count_records)
4835
export(database_lookup)
4936
export(eutils_lookup)
5037
export(excel_database)
@@ -53,7 +40,10 @@ export(filter_na)
5340
export(filter_range)
5441
export(filter_records)
5542
export(filter_venn)
43+
export(fuse)
44+
export(fuse_unique)
5645
export(github_file)
46+
export(greek_dictionary)
5747
export(hmdb_lookup)
5848
export(id_counts)
5949
export(import_source)
@@ -69,14 +59,17 @@ export(mz_match)
6959
export(mzrt_match)
7060
export(normalise_lipids)
7161
export(normalise_strings)
62+
export(nothing)
7263
export(openbabel_structure)
7364
export(opsin_lookup)
7465
export(pivot_columns)
66+
export(prioritise)
7567
export(prioritise_columns)
7668
export(pubchem_compound_lookup)
7769
export(pubchem_property_lookup)
7870
export(pubchem_structure)
7971
export(pubchem_widget)
72+
export(racemic_dictionary)
8073
export(rdata_database)
8174
export(rds_cache)
8275
export(rds_database)
@@ -85,11 +78,18 @@ export(rename_columns)
8578
export(rest_api)
8679
export(rt_match)
8780
export(select_columns)
81+
export(select_exact)
82+
export(select_grade)
83+
export(select_match)
84+
export(select_max)
85+
export(select_min)
8886
export(split_column)
8987
export(split_records)
9088
export(sqlite_database)
9189
export(trim_whitespace)
90+
export(tripeptide_dictionary)
9291
export(unique_records)
92+
export(unzip_before_cache)
9393
export(wherever)
9494
exportMethods(chart_plot)
9595
exportMethods(check_for_columns)

R/BiocFileCache_database_class.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
BiocFileCache_database <- function(source,
66
bfc_path = NULL,
77
resource_name,
8-
bfc_fun = .cache_as_is,
8+
bfc_fun = cache_as_is,
99
import_fun = read.csv,
1010
offline = FALSE,
1111
...) {
@@ -78,7 +78,7 @@ BiocFileCache_database <- function(source,
7878
"See [BiocFileCache::bfcdownload()] for details."
7979
),
8080
type = c("function"),
81-
value = .cache_as_is,
81+
value = cache_as_is,
8282
max_length = 1
8383
),
8484
import_fun = entity(

R/BiocFileCache_database_helpers.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
#' M <- BiocFileCache_database(
2626
#' source = tempfile(),
2727
#' resource_name = "example",
28-
#' bfc_fun = .unzip
28+
#' bfc_fun = unzip_before_cache
2929
#' )
3030
#'
3131
#' @export
32-
.unzip <- function(from, to) {
32+
unzip_before_cache <- function(from, to) {
3333
# temp folder
3434
fldr <- tempdir()
3535
# unzip
@@ -51,11 +51,11 @@
5151
#' M <- BiocFileCache_database(
5252
#' source = tempfile(),
5353
#' resource_name = "example",
54-
#' bfc_fun = .cache_as_is
54+
#' bfc_fun = cache_as_is
5555
#' )
5656
#'
5757
#' @export
58-
.cache_as_is <- function(from, to) {
58+
cache_as_is <- function(from, to) {
5959
file.copy(from = from, to = to, overwrite = TRUE)
6060
return(TRUE)
6161
}

R/MTox700plus_database_class.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ MTox700plus_database <- function(version = "latest",
7575
bfc_fun = .set_entity_value(
7676
obj = "BiocFileCache_database",
7777
param_id = "bfc_fun",
78-
value = .cache_as_is
78+
value = cache_as_is
7979
)
8080
)
8181
)

R/PathBank_metabolite_database_class.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ PathBank_metabolite_database <- function(version = "primary",
8282
bfc_fun = .set_entity_value(
8383
"BiocFileCache_database",
8484
"bfc_fun",
85-
value = .unzip
85+
value = unzip_before_cache
8686
)
8787
)
8888
)

R/combine_records_class.R

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#' @export
33
#' @include annotation_source_class.R
44
combine_records <- function(group_by,
5-
default_fcn = .collapse(separator = " || "),
5+
default_fcn = fuse(separator = " || "),
66
fcns = list(),
77
...) {
88
# check fcns are all functions
@@ -206,7 +206,7 @@ NULL
206206
#' and placed last if `ties = FALSE` (values are returned preferentially over
207207
#' NA).
208208
#'
209-
.mode <- function(ties = FALSE, na.rm = TRUE) {
209+
compute_mode <- function(ties = FALSE, na.rm = TRUE) {
210210
fcn <- expr(function(x) {
211211
if (length(x) <= 2) {
212212
return(x[1])
@@ -232,9 +232,9 @@ NULL
232232
#' @export
233233
#' @describeIn combine_records_helper_functions calculates the mean value,
234234
#' excluding NA if `na.rm = TRUE`
235-
.mean <- function() {
235+
compute_mean <- function(na.rm = TRUE) {
236236
fcn <- expr(function(x) {
237-
mean(x, na.rm = TRUE)
237+
mean(x, na.rm = !!na.rm)
238238
})
239239
return(eval(fcn))
240240
}
@@ -243,9 +243,9 @@ NULL
243243
#' @describeIn combine_records_helper_functions calculates the median value,
244244
#' excluding NA if `na.rm = TRUE`
245245
#' @export
246-
.median <- function() {
246+
compute_median <- function(na.rm = TRUE) {
247247
fcn <- expr(function(x) {
248-
stats::median(x, na.rm = TRUE)
248+
stats::median(x, na.rm = !!na.rm)
249249
})
250250
return(eval(fcn))
251251
}
@@ -256,7 +256,7 @@ NULL
256256
#' @param separator (character) a string used to separate multiple matches.
257257
#' @param na_string (character) a string used to represent NA values.
258258
#' @export
259-
.collapse <- function(separator, na_string = "NA") {
259+
fuse <- function(separator, na_string = "NA") {
260260
fcn <- expr(function(x) {
261261
x[is.na(x)] <- !!na_string
262262
paste0(x, collapse = !!separator)
@@ -272,7 +272,7 @@ NULL
272272
#' @param keep_NA (logical) If TRUE then records with NA are returned as well as
273273
#' the record with the maximum value.
274274
#' @export
275-
.select_max <- function(max_col, use_abs = FALSE, keep_NA = FALSE) {
275+
select_max <- function(max_col, use_abs = FALSE, keep_NA = FALSE) {
276276
fcn <- expr(function(x) {
277277
# get values
278278
vals <- as.numeric(pick(!!max_col)[[1]])
@@ -311,7 +311,7 @@ NULL
311311
#' @param keep_NA (logical) If TRUE then records with NA are returned as well as
312312
#' the record with the minimum value.
313313
#' @export
314-
.select_min <- function(min_col, use_abs = FALSE, keep_NA = FALSE) {
314+
select_min <- function(min_col, use_abs = FALSE, keep_NA = FALSE) {
315315
fcn <- expr(function(x) {
316316
# get values
317317
vals <- as.numeric(pick(!!min_col)[[1]])
@@ -342,13 +342,13 @@ NULL
342342
#' Select matching annotations
343343
#' @describeIn combine_records_helper_functions returns all records based on
344344
#' the indices of identical matches in a second column and collapses them
345-
#' useing the provided separator.
345+
#' using the provided separator.
346346
#' @param match_col (character) the name of a column to search for matches to
347347
#' the search column.
348348
#' @param search_col (character) the name of a column to use as a reference for
349349
#' locating values in the matching column.
350350
#' @export
351-
.select_match <- function(match_col, search_col, separator, na_string = "NA") {
351+
select_match <- function(match_col, search_col, separator, na_string = "NA") {
352352
fcn <- expr(function(x) {
353353
x <- x[which(pick(!!search_col)[[1]] == pick(!!match_col)[[1]])]
354354
if (!is.null(!!separator)) {
@@ -374,15 +374,15 @@ NULL
374374
#' # Select matching records
375375
#' M <- combine_records(
376376
#' group_by = "example",
377-
#' default_fcn = .select_exact(
377+
#' default_fcn = select_exact(
378378
#' match_col = "match_column",
379379
#' match = "find_me",
380380
#' separator = ", ",
381381
#' na_string = "NA"
382382
#' )
383383
#' )
384384
#' @export
385-
.select_exact <- function(match_col, match, separator, na_string = "NA") {
385+
select_exact <- function(match_col, match, separator, na_string = "NA") {
386386
fcn <- expr(function(x) {
387387
x <- x[which(pick(!!match_col) == !!match)]
388388

@@ -411,15 +411,15 @@ NULL
411411
#' # Collapse unique values
412412
#' M <- combine_records(
413413
#' group_by = "example",
414-
#' default_fcn = .unique(
414+
#' default_fcn = fuse_unique(
415415
#' digits = 6,
416416
#' separator = ", ",
417417
#' na_string = "NA",
418418
#' sort = FALSE
419419
#' )
420420
#' )
421421
#' @export
422-
.unique <- function(separator,
422+
fuse_unique <- function(separator,
423423
na_string = "NA",
424424
digits = 6,
425425
drop_na = FALSE,
@@ -463,14 +463,14 @@ NULL
463463
#' # Prioritise by source
464464
#' M <- combine_records(
465465
#' group_by = "InChiKey",
466-
#' default_fcn = .prioritise(
466+
#' default_fcn = prioritise(
467467
#' match_col = "source",
468468
#' priority = c("CD", "LS"),
469469
#' separator = " || "
470470
#' )
471471
#' )
472472
#' @export
473-
.prioritise <- function(match_col,
473+
prioritise <- function(match_col,
474474
priority,
475475
separator,
476476
no_match = NA,
@@ -522,10 +522,10 @@ NULL
522522
#' # Do nothing to all columns
523523
#' M <- combine_records(
524524
#' group_by = "InChiKey",
525-
#' default_fcn = .nothing()
525+
#' default_fcn = nothing()
526526
#' )
527527
#' @export
528-
.nothing <- function() {
528+
nothing <- function() {
529529
fcn <- expr(function(x) {
530530
return(x)
531531
})
@@ -542,11 +542,11 @@ NULL
542542
#' M <- combine_records(
543543
#' group_by = "InChiKey",
544544
#' fcns = list(
545-
#' count = .count()
545+
#' count = count_records()
546546
#' )
547547
#' )
548548
#' @export
549-
.count <- function() {
549+
count_records <- function() {
550550
fcn <- expr(function(x) {
551551
y <- pick(everything())
552552
return(nrow(y))
@@ -569,14 +569,14 @@ NULL
569569
#' # Select annotation with highest (best) grade
570570
#' M <- combine_records(
571571
#' group_by = "InChiKey",
572-
#' default_fcn = .select_grade(
572+
#' default_fcn = select_grade(
573573
#' grade_col = "grade",
574574
#' keep_NA = FALSE,
575575
#' upper_case = TRUE
576576
#' )
577577
#' )
578578
#' @export
579-
.select_grade <- function(grade_col, keep_NA = FALSE, upper_case = TRUE) {
579+
select_grade <- function(grade_col, keep_NA = FALSE, upper_case = TRUE) {
580580
fcn <- expr(function(x) {
581581
# get values
582582
vals <- pick(!!grade_col)

R/dictionaries.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
#' M <- normalise_strings(
99
#' search_column = "example",
1010
#' output_column = "result",
11-
#' dictionary = .tripeptide_dictionary
11+
#' dictionary = tripeptide_dictionary
1212
#' )
1313
#'
1414
#' @return A dictionary for use with [`normalise_strings()`]
1515
#' @export
16-
.tripeptide_dictionary <- list(
16+
tripeptide_dictionary <- list(
1717
list(
1818
pattern = "^[ABCDEFGHIJKLMNOPQRSTVWXYZ]{3}$",
1919
replace = function(x) {
@@ -71,12 +71,12 @@
7171
#' M <- normalise_strings(
7272
#' search_column = "example",
7373
#' output_column = "result",
74-
#' dictionary = .racemic_dictionary
74+
#' dictionary = racemic_dictionary
7575
#' )
7676
#'
7777
#' @return A dictionary for use with [`normalise_strings()`]
7878
#' @export
79-
.racemic_dictionary <- list(
79+
racemic_dictionary <- list(
8080
list(pattern = "-(-)-", replace = "-", fixed = TRUE),
8181
list(pattern = "-(+)-", replace = "-", fixed = TRUE),
8282
list(pattern = "^L(+)-", replace = "L-", fixed = TRUE),
@@ -94,12 +94,12 @@
9494
#' M <- normalise_strings(
9595
#' search_column = "example",
9696
#' output_column = "result",
97-
#' dictionary = .greek_dictionary
97+
#' dictionary = greek_dictionary
9898
#' )
9999
#'
100100
#' @return A dictionary for use with [`normalise_strings()`]
101101
#' @export
102-
.greek_dictionary <- list(
102+
greek_dictionary <- list(
103103
list(pattern = "\\x{03b1}", replace = "alpha"),
104104
list(pattern = "\\x{03b2}", replace = "beta"),
105105
list(pattern = "\\x{03b3}", replace = "gamma"),

R/excel_database_class.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ setMethod(
8888
colNames = obj$colNames,
8989
startRow = obj$startRow
9090
)
91-
colnames(IN) <- make.unique(colnames(IN))
91+
colnames(IN) <- makefuse_unique(colnames(IN))
9292
IN$.row_id <- seq_len(nrow(IN))
9393

9494
# return

0 commit comments

Comments
 (0)