Skip to content

Commit

Permalink
fix cmd check issues
Browse files Browse the repository at this point in the history
  • Loading branch information
grlloyd committed Sep 25, 2024
1 parent 2257df5 commit 96f7667
Show file tree
Hide file tree
Showing 119 changed files with 813 additions and 1,469 deletions.
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Collate:
'calc_rt_diff_class.R'
'lcms_table_class.R'
'cd_source_class.R'
'chart_plot_doc.R'
'rest_api_parsers.R'
'rest_api_class.R'
'classyfire_lookup_class.R'
Expand All @@ -94,6 +95,7 @@ Collate:
'kegg_lookup_class.R'
'lipidmaps_lookup_class.R'
'ls_source_class.R'
'model_apply_doc.R'
'mspurity_source_class.R'
'mwb_compound_lookup_class.R'
'mwb_refmet_database_class.R'
Expand Down
674 changes: 0 additions & 674 deletions LICENSE

This file was deleted.

2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ exportMethods(model_apply)
exportMethods(read_database)
exportMethods(read_source)
exportMethods(required_cols)
exportMethods(show)
exportMethods(vertical_join)
exportMethods(write_database)
import(cowplot, except = theme_map)
Expand All @@ -110,6 +109,7 @@ import(methods)
import(rlang)
import(struct)
importFrom(scales,manual_pal)
importFrom(stats,setNames)
importFrom(utils,URLencode)
importFrom(utils,capture.output)
importFrom(utils,modifyList)
Expand Down
1 change: 1 addition & 0 deletions R/AnnotationDb_database.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ AnnotationDb_database <- function(
)

#' @export
#' @rdname read_database
setMethod(
f = "read_database",
signature = c("AnnotationDb_database"), definition = function(obj) {
Expand Down
2 changes: 1 addition & 1 deletion R/AnnotationDb_select_class.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ AnnotationDb_select <- function(
)



#' @export
#' @template model_apply
setMethod(
f = "model_apply",
signature = c("AnnotationDb_select", "annotation_source"),
Expand Down
1 change: 1 addition & 0 deletions R/BiocFileCache_database_class.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ BiocFileCache_database <- function(
)

#' @export
#' @rdname read_database
setMethod(
f = "read_database",
signature = c("BiocFileCache_database"),
Expand Down
4 changes: 2 additions & 2 deletions R/BiocFileCache_database_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#' @return TRUE if successful
#' @examples
#' M <- BiocFileCache_database(
#' path = tempfile(),
#' source = tempfile(),
#' resource_name = "example",
#' bfc_fun = .unzip
#' )
Expand All @@ -49,7 +49,7 @@
#' @return TRUE if successful
#' @examples
#' M <- BiocFileCache_database(
#' path = tempfile(),
#' source = tempfile(),
#' resource_name = "example",
#' bfc_fun = .cache_as_is
#' )
Expand Down
1 change: 1 addition & 0 deletions R/CompoundDb_source_class.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ CompoundDb_source <- function(
)

#' @export
#' @template model_apply
setMethod(
f = "model_apply",
signature = c("CompoundDb_source", "annotation_source"),
Expand Down
7 changes: 4 additions & 3 deletions R/MTox700plus_database_class.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ MTox700plus_database <- function(
name = "MTox700+ version number",
description = paste0(
"The version number of the MTox700+ database to import. ",
"Available versions are listed here: ",
'[https://github.com/michabohealthscience/MTox700plus/',
'releases].',
"Available versions are listed ",
'\\href{https://github.com/michabohealthscience/MTox700plus/',
'releases}{here}.',
' `version` should match the tag of the release e.g. `"v1.0"`.',
' For convenience `version = "latest"` will always retrieve ',
"the most recent release. To prevent unecessary downloads ",
Expand All @@ -84,6 +84,7 @@ MTox700plus_database <- function(


#' @export
#' @rdname read_database
setMethod(
f = "read_database",
signature = c("MTox700plus_database"), definition = function(obj) {
Expand Down
1 change: 1 addition & 0 deletions R/MetMashR-package.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#' @import struct
#' @importFrom utils URLencode modifyList read.csv stack unzip
#' @importFrom stats setNames
#' @keywords internal
"_PACKAGE"

Expand Down
3 changes: 2 additions & 1 deletion R/PathBank_metabolite_database_class.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ PathBank_metabolite_database <- function(
" Hasan and Pon, Allison and Budinski, Zachary and ",
"Patron, ",
"Jonas and Lipton, Debra and Cao, Xuan and Oler, Eponine ",
"and Li, Krissa and Paccoud, Maïlys and Hong, Chelsea and ",
"and Li, Krissa and Paccoud, Ma\u00EFlys and Hong, Chelsea and ",
"Guo, An C and Chan, Christopher and Wei, William and ",
"Ramirez-Gaona, Miguel"
)),
Expand Down Expand Up @@ -91,6 +91,7 @@ PathBank_metabolite_database <- function(


#' @export
#' @rdname read_database
setMethod(
f = "read_database",
signature = c("PathBank_metabolite_database"), definition = function(obj) {
Expand Down
11 changes: 9 additions & 2 deletions R/add_columns_class.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
#' @include annotation_source_class.R
#' @seealso [dplyr::left_join()]
add_columns <- function(new_columns, by, ...) {

if (nrow(new_columns)==0 & ncol(new_columns)==0) {
new_columns = data.frame(id=NA)
colnames(new_columns)[1]=by[1]
}

check <- all(by %in% colnames(new_columns))
if (!check) {
stop('parameter "by" must be a column name of the "new_columns",
" data.frame')
}

out <- struct::new_struct(
"add_columns",
new_columns = new_columns,
Expand Down Expand Up @@ -53,7 +59,7 @@ add_columns <- function(new_columns, by, ...) {
"annotation table. Can also be an annotation_database."
),
type = c("data.frame", "annotation_database"),
value = data.frame(id = NA)
value = data.frame(value = NA)
),
by = entity(
name = "By",
Expand All @@ -71,6 +77,7 @@ add_columns <- function(new_columns, by, ...) {


#' @export
#' @template model_apply
setMethod(
f = "model_apply",
signature = c("add_columns", "annotation_source"),
Expand Down
2 changes: 2 additions & 0 deletions R/add_labels_class.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ add_labels <- function(labels, replace = FALSE, ...) {
)

setValidity("add_labels", method = function(object) {
check = FALSE
if (length(object$labels) > 0) {
check <- is.null(names(object$labels))
}
Expand All @@ -81,6 +82,7 @@ setValidity("add_labels", method = function(object) {
})

#' @export
#' @template model_apply
setMethod(
f = "model_apply",
signature = c("add_labels", "annotation_source"),
Expand Down
3 changes: 2 additions & 1 deletion R/annotation_bar_chart.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' @eval get_description('annotation_pie_chart')
#' @eval get_description('annotation_bar_chart')
#' @include annotation_source_class.R
#' @export
annotation_bar_chart <- function(
Expand Down Expand Up @@ -103,6 +103,7 @@ annotation_bar_chart <- function(
)

#' @export
#' @template chart_plot
setMethod(
f = "chart_plot",
signature = c("annotation_bar_chart", "annotation_source"),
Expand Down
6 changes: 6 additions & 0 deletions R/annotation_database_class.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ annotation_database <- function(


#' @export
#' @rdname is_writable
setMethod(
f = "is_writable",
signature = c("annotation_database"),
Expand All @@ -47,6 +48,7 @@ setMethod(
)

#' @export
#' @rdname read_source
setMethod(
f = "read_source",
signature = c("annotation_database"),
Expand All @@ -58,6 +60,8 @@ setMethod(


#' @export
#' @rdname write_database
#' @param df (data.frame) the data.frame to store in the database.
setMethod(
f = "write_database",
signature = c("annotation_database"), definition = function(obj, df) {
Expand All @@ -76,6 +80,8 @@ setMethod(
}
)

#' @export
#' @rdname read_database
setMethod(
f = "read_database",
signature = c("annotation_database"),
Expand Down
1 change: 1 addition & 0 deletions R/annotation_histogram2d_class.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ annotation_histogram2d <- function(


#' @export
#' @template chart_plot
setMethod(
f = "chart_plot",
signature = c("annotation_histogram2d", "annotation_source"),
Expand Down
1 change: 1 addition & 0 deletions R/annotation_histogram_class.R
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ annotation_histogram <- function(
)

#' @export
#' @template chart_plot
setMethod(
f = "chart_plot",
signature = c("annotation_histogram", "annotation_source"),
Expand Down
1 change: 1 addition & 0 deletions R/annotation_pie_chart.R
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ annotation_pie_chart <- function(
)

#' @export
#' @template chart_plot
setMethod(
f = "chart_plot",
signature = c("annotation_pie_chart", "annotation_source"),
Expand Down
27 changes: 22 additions & 5 deletions R/annotation_source_class.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' @eval get_description("annotation_database")
#' @eval get_description("annotation_source")
#' @include zzz.R generics.R
#' @family {annotation databases}
#' @export
Expand Down Expand Up @@ -67,6 +67,7 @@ annotation_source <- function(


#' @export
#' @template model_apply
setMethod(
f = "model_apply",
signature = c("model", "annotation_source"),
Expand All @@ -79,7 +80,7 @@ setMethod(
}
)

#' @export
#' @template model_apply
setMethod(
f = "model_apply",
signature = c("model", "list"),
Expand All @@ -92,7 +93,7 @@ setMethod(
}
)

#' @export
#' @template model_apply
setMethod(
f = "model_apply",
signature = c("model_seq", "list"),
Expand All @@ -105,7 +106,7 @@ setMethod(
}
)

#' @export
#' @template model_apply
setMethod(
f = "model_apply",
signature = c("model_seq", "annotation_source"),
Expand Down Expand Up @@ -142,7 +143,6 @@ setMethod(
}
)

#' @export
setMethod(
f = "show",
signature = c("annotation_source"),
Expand All @@ -160,6 +160,7 @@ setMethod(
)

#' @export
#' @rdname read_source
setMethod(
f = "read_source",
signature = c("annotation_source"),
Expand All @@ -173,6 +174,7 @@ setMethod(
)

#' @export
#' @rdname check_for_columns
setMethod(
f = "check_for_columns",
signature = c("annotation_source"),
Expand Down Expand Up @@ -213,6 +215,18 @@ setMethod(


#' @export
#' @param matching_columns (list) a named list of column names that all contain
#' the same information. All columns named in the same list element will be
#' merged into a single column with the same name as the list element.
#' @param keep_cols (character) a list of column names to keep in the final
#' joined table. All other columns will be dropped.
#' @param source_col (character) the name of a new column that will contain the
#' tags of the original source object for each row in the joined table.
#' @param exclude_cols (character) the names of columns to exclude from the
#' joined table.
#' @param as (character) the type of object the joined table should be returned
#' as e.g. "lcms_table".
#' @rdname vertical_join
setMethod(
f = "vertical_join",
signature = c("annotation_source", "annotation_source"),
Expand Down Expand Up @@ -278,6 +292,7 @@ setMethod(
)

#' @export
#' @rdname vertical_join
setMethod(
f = "vertical_join",
signature = c("list", "missing"),
Expand Down Expand Up @@ -345,7 +360,9 @@ setValidity(
}
)


#' @export
#' @rdname required_cols
setMethod(
f = "required_cols",
signature = c("annotation_source"),
Expand Down
23 changes: 21 additions & 2 deletions R/annotation_table_class.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,28 @@ annotation_table <- function(
tag = "",
id_column = NULL,
...) {

# create id column if NULL
if (is.null(id_column)) {
data$.MetMashR_id <- seq_len(nrow(data))
id_column <- ".MetMashR_id"
id_column = '.MetMashR_id'
if (nrow(data)>0) {
data[[id_column]]=seq_len(nrow(data))
}
}

# create data if null
if (is.null(data)) {
data = data.frame()
}

# create id column if no rows or columns
if (nrow(data)==0 & ncol(data)==0) {
data <- data.frame(
id = character(0)
)
colnames(data) <- c(
id_column
)
}

# new object
Expand Down
Loading

0 comments on commit 96f7667

Please sign in to comment.