From dce3b79f02a1112739664a43f8344a85014ff7b2 Mon Sep 17 00:00:00 2001 From: Adriano Rutz Date: Wed, 3 Jul 2024 12:27:43 +0200 Subject: [PATCH] fix --- R/parse_yaml_params.R | 2 +- tests/testthat/test-functions.R | 51 +++++++++++++++++++++------------ 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/R/parse_yaml_params.R b/R/parse_yaml_params.R index 0ac93a3d6..0d69f5337 100644 --- a/R/parse_yaml_params.R +++ b/R/parse_yaml_params.R @@ -17,7 +17,7 @@ parse_yaml_params <- function(def = get("default_path", envir = parent.frame() )) { ## Read the default YAML fil - params <- yaml::read_yaml(file = def)) + params <- yaml::read_yaml(file = def) ## If a user-specified YAML file exists, ## read it and overwrite the default values with the user-specified ones diff --git a/tests/testthat/test-functions.R b/tests/testthat/test-functions.R index 57827b401..12de98c1c 100644 --- a/tests/testthat/test-functions.R +++ b/tests/testthat/test-functions.R @@ -37,14 +37,18 @@ test_that(desc = "Test functions", code = { prepare_params() ## replace id - replace_id(x = "example/123456_features.tsv", - user_gnps = "", - user_filename = "Foo") + replace_id( + x = "example/123456_features.tsv", + user_gnps = "", + user_filename = "Foo" + ) ## Get all files ### Features table - get_file(url = paths$urls$examples$features, - export = paths$data$source$features) + get_file( + url = paths$urls$examples$features, + export = paths$data$source$features + ) get_gnps_tables( filename = "example", path_features = paths$data$source$features, @@ -53,8 +57,10 @@ test_that(desc = "Test functions", code = { gnps_job_id = params$gnps$id ) ### Metadata table - get_file(url = paths$urls$examples$metadata, - export = paths$data$source$metadata) + get_file( + url = paths$urls$examples$metadata, + export = paths$data$source$metadata + ) get_file( url = paths$urls$examples$metadata |> gsub( @@ -294,9 +300,11 @@ test_that(desc = "Test functions", code = { ) ) #### If does not exist - prepare_libraries_spectra(input = "doesNotExists.txt", - output_pos = "data/interim/libraries/spectra/exp/nope_pos.rds", - output_neg = "data/interim/libraries/spectra/exp/nope_neg.rds",) + prepare_libraries_spectra( + input = "doesNotExists.txt", + output_pos = "data/interim/libraries/spectra/exp/nope_pos.rds", + output_neg = "data/interim/libraries/spectra/exp/nope_neg.rds", + ) #### Classical prepare_libraries_spectra() #### Again @@ -322,9 +330,11 @@ test_that(desc = "Test functions", code = { temp_exp = paths$data$source$libraries$rt$example_mini ) ## Check wrong SMILES - tidytable::tidytable("rt" = 0.1, - "smiles" = "wrongSMILES", - "inchikey" = NA) |> + tidytable::tidytable( + "rt" = 0.1, + "smiles" = "wrongSMILES", + "inchikey" = NA + ) |> tidytable::fwrite("data/source/libraries/rt/example_bad.tsv") prepare_libraries_rt(temp_exp = "data/source/libraries/rt/example_bad.tsv") expect_warning(object = prepare_libraries_rt(temp_exp = "data/source/libraries/rt/example_bad.tsv")) @@ -424,13 +434,16 @@ test_that(desc = "Test functions", code = { ) ## Create MS2 based edges - create_edges_spectra(## shallow tolerance to speed up tests - ppm = 1, dalton = 0.001) + create_edges_spectra( ## shallow tolerance to speed up tests + ppm = 1, dalton = 0.001 + ) ## if MS1 only - create_edges_spectra(input = "data/source/example_spectra_ms1.mgf", - ## shallow tolerance to speed up tests - ppm = 1, - dalton = 0.001) + create_edges_spectra( + input = "data/source/example_spectra_ms1.mgf", + ## shallow tolerance to speed up tests + ppm = 1, + dalton = 0.001 + ) ### GNPS results prepare_annotations_gnps(input = "fileDoesNotExist")