diff --git a/DESCRIPTION b/DESCRIPTION index 9b8b892f56214a248981074500bbd8e45cd4ea6d..00207dc77d6c50d8082a811da04a359eec3b46b6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -49,6 +49,7 @@ Collate: 'mix.R' 'extraction.R' 'run.R' + 'api.R' 'shinyUI.R' Depends: RMassBank, @@ -60,6 +61,8 @@ Imports: yaml, mzR, MSnbase, + data.table, + assertthat, ggplot2, cowplot, RColorBrewer, diff --git a/NAMESPACE b/NAMESPACE index 3dff728265df969457d46f13debab4cd01b06f51..ef97b553a634d544bedadf825274c861dee639f6 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,3 +1,4 @@ # Generated by roxygen2: do not edit by hand export(launch) +export(read_conf) diff --git a/R/api.R b/R/api.R new file mode 100644 index 0000000000000000000000000000000000000000..f05a1bb2c17e2c62c48e15f8668005b1a58b022a --- /dev/null +++ b/R/api.R @@ -0,0 +1,27 @@ +## Copyright (C) 2020 by University of Luxembourg + +## Licensed under the Apache License, Version 2.0 (the "License"); +## you may not use this file except in compliance with the License. +## You may obtain a copy of the License at + +## http://www.apache.org/licenses/LICENSE-2.0 + +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. + + + + +read_conf <- function(fn_conf) { + conf <- yaml::yaml.load_file(fn_conf) + conf <- vrfy_conf(conf) + conf +} + +vrfy_conf <- function(conf) { + for (fn in unlist(conf,recursive=T)) assertthat::assert_that(file.exists(fn),msg=paste("Data file does not exist:",fn)) + return(conf) +}