Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Adafede committed Jul 3, 2024
1 parent c8b0d55 commit dce3b79
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 20 deletions.
2 changes: 1 addition & 1 deletion R/parse_yaml_params.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
51 changes: 32 additions & 19 deletions tests/testthat/test-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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(
Expand Down Expand Up @@ -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
Expand All @@ -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"))
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit dce3b79

Please sign in to comment.