diff --git a/DESCRIPTION b/DESCRIPTION index f6fe04709..a399f2b62 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -85,6 +85,7 @@ Collate: 'parse_adduct.R' 'calculate_mass_of_m.R' 'clean_bio.R' + 'filter_high_confidence_only.R' 'columns_model.R' 'clean_collapse.R' 'clean_chemo.R' diff --git a/NAMESPACE b/NAMESPACE index fd8d29261..233757687 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -31,6 +31,7 @@ export(fake_hmdb) export(fake_lotus) export(fake_sop_columns) export(filter_annotations) +export(filter_high_confidence_only) export(get_example_sirius) export(get_file) export(get_gnps_tables) diff --git a/NEWS.md b/NEWS.md index 9a7967a40..0833fe60d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,28 +2,29 @@ # timaR 2.9.7 -* Adding possibility to add internal libraries through the GUI (#159) -* Adding number of peaks in spectrum +* Added possibility to add internal libraries through the GUI (#159) +* Added number of peaks in spectrum * Clearer handling of SIRIUS scores (#146, #147) -* Expose more parameters to the GUI (#159) -* Fix adducts and remove nitrogen rule -* Fix number of matched peaks +* Exposed more parameters to the GUI (#159) +* Fixed adducts and remove nitrogen rule +* Fixed number of matched peaks * Improved imports +* Reduced warnings * Updated benchmarking steps # timaR 2.9.6 -* Adding light-switch thanks to `pkgdown 2.1.0`. +* Added light-switch thanks to `pkgdown 2.1.0`. * Attempt to simplify installation -* Fix library/adducts confusion (#123) -* Fix some incorrect adduct differences annotations +* Fixed library/adducts confusion (#123) +* Fixed some incorrect adduct differences annotations * Refactored adducts / neutral losses / dimers annotation to allow for more flexibility (#141, #144) # timaR 2.9.5 * Do not re-package if already the latest version * SIRIUS 6 default and compatible (keeping SIRIUS 5 backward compatibility) -* Update to Massbank version `2024.06` +* Updated to Massbank version `2024.06` # timaR 2.9.4 @@ -31,132 +32,132 @@ * Added an option to remove ties (#134) * Added some details for SIRIUS, add manual workspace addition (#132) * Additional preprocessing (reduction) of noisy spectra +* Dependencies update * Docker updates (#131) * Handle cases when same (feature_id, mslevel) pairs are present within an MGF (#133) * Improved documentation * New working directory at `$HOME/.tima` -* Dependencies update -* Update R and Bioconductor versions +* Updated R and Bioconductor versions # timaR 2.9.3 -* Allow for SIRIUS jobs containing only summaries -* Allow for underscores in job pattern -* Change some default values (less stringent) +* Allowed for SIRIUS jobs containing only summaries +* Allowed for underscores in job pattern +* Changed some default values (less stringent) * Dependencies update -* Migrate app testing to `shinytest2` -* Remove further some inconsistent MS1 annotations -* Remove tests dependencies by default +* Migrated app testing to `shinytest2` +* Removed further some inconsistent MS1 annotations +* Removed tests dependencies by default # timaR 2.9.2 -* Add Nitrogen rule to filter out some annotations +* Added Nitrogen rule to filter out some annotations * Better handling of partial downloads (#118) * Dependencies update (mainly `targets 1.5.1`, will invalidate previous targets) -* Fix some port issues in Shiny (#122) -* Remove completely empty columns from final output to avoid confusion (#120) +* Fixed some port issues in Shiny (#122) +* Removed completely empty columns from final output to avoid confusion (#120) # timaR 2.9.1 -* Add [Waystation](https://caltechlibrary.github.io/waystation/) action -* Add structures from spectral libraries to SOP library (#113) -* Expose all parameters (#107, #108) -* Fix for Zenodo API +* Added [Waystation](https://caltechlibrary.github.io/waystation/) action +* Added structures from spectral libraries to SOP library (#113) +* Exposed all parameters (#107, #108) +* Fixed for Zenodo API * HMDB structures support -* Optimize grep/gsub by adding `perl=TRUE` or `fixed=TRUE` -* Update to Massbank version `2023.11` -* Update SIRIUS preparation (#74, #115) +* Optimized grep/gsub by adding `perl=TRUE` or `fixed=TRUE` +* Updated to Massbank version `2023.11` +* Updated SIRIUS preparation (#74, #115) # timaR 2.9.0 * Added compounds names as parameter * Added MassBank spectral library (#77) -* Allow files outside `data/source` (#89) +* Allowed files outside `data/source` (#89) * Added RT library as annotation library (#86) -* Be less dependent of GNPS by default * Better handling of download errors * Fixed Docker mount path * Improved naming (#91) * Internal variables refactoring +* Multiple Shiny fixes and tests addition (#60) +* Multiple fixes (#71, #81, #82) * New adducts (#79, #80) * Refactored adducts, clusters and neutral losses * Refactored biological and chemical score * Refactored RT matching (#76) * Refactored Sirius scores (#92) -* Multiple Shiny fixes and tests addition (#60) -* Multiple fixes (#71, #81, #82) +* Removed GNPS dependency by default # timaR 2.8.2 -* Change from pbmclapply to pblapply * Added spectral entropy * Added MS1 only possibility * Added Fluorine adduct -* Fix empty chemical classes -* Fix not classified taxa +* Changed from pbmclapply to pblapply +* Documentation improvement +* Fixed empty chemical classes +* Fixed not classified taxa +* Github Actions improvement * [renv](https://rstudio.github.io/renv/index.html) removal * Performance improvement by replacing the [tidyverse](https://www.tidyverse.org) by the [fastverse](https://fastverse.github.io/fastverse) (in progress) -* Github Actions improvement -* Documentation improvement * Reduced warnings (CRAN and jscpd) # timaR 2.8.1 +* Adapted tests * Added `retry` parameter to `get_organism_taxonomy_ott` * Dependencies update -* Replace `extdata` loading +* Minor fixes * Moved `/params` and `paths.yaml` to `/inst` as more standard. (see ) -* Adapted tests * Performance improvement by replacing the [tidyverse](https://www.tidyverse.org) by the [fastverse](https://fastverse.github.io/fastverse) (in progress) -* Minor fixes +* Replaced `extdata` loading # timaR 2.8.0 -* Adding GUI prototype +* Added GUI prototype * Started using [renv](https://rstudio.github.io/renv/index.html) # timaR 2.7.4 +* Clearer vocabulary * ECMDB support * Edges (mass and spectra-based) and components are generated if not present. -* Fix case when no GNPS job ID -* Re-introducing Classyfire support. -* Retention time matching additionally to MS2 if RT present in library -* Parameters refactoring -* Steps refactoring +* Fixed case when no GNPS job ID * Further [Targets](https://books.ropensci.org/targets/) improvements -* Clearer vocabulary * Lot of fixes +* Parameters refactoring +* Re-introduced Classyfire support. +* Retention time matching additionally to MS2 if RT present in library +* Steps refactoring # timaR 2.7.3 -* [Targets](https://books.ropensci.org/targets/) implementation -* Parameters refactoring * Improved calculations over redundant formulas -* Spectral matching update (see ) * Minor fixes +* Parameters refactoring +* Spectral matching update (see ) +* [Targets](https://books.ropensci.org/targets/) implementation # timaR 2.7.2 * Benchmark update (including negative mode) -* Spectral comparison + intensity filtering update -* Switched r-base Docker image to bioconductor with ARM support * Improved parameters documentation * Minor fixes +* Spectral comparison + intensity filtering update +* Switched r-base Docker image to bioconductor with ARM support # timaR 2.7.1 +* Added MONA helpers * Added parallelization on process_spectra * Added sqlite storing for spectra -* Added MONA helpers -* Improved testing time * Improved code documentation +* Improved testing time * Minor fixes # timaR 2.7.0 -* Added MS2 annotation capability (kudos @jorainer for the awesome *Spectra* suite) * Added HMDB helpers for both taxo and ISDB +* Added MS2 annotation capability (kudos @jorainer for the awesome *Spectra* suite) * Minor fixes # timaR 2.6.0 @@ -167,14 +168,14 @@ # timaR 2.5.6 +* Dependencies removal (e.g. metabo-store) * Minor fixes * Partial functions cleanup -* Dependencies removal (e.g. metabo-store) # timaR 2.5.5 -* Minor fixes * Automation and parameters improvement +* Minor fixes # timaR 2.5.4 @@ -197,32 +198,31 @@ # timaR 2.5.0 -* Minor fixes * LOTUS update +* Minor fixes # timaR 2.4.0 -* Minor fixes -* Improved output (#34) * Added chemical names and xlogp to output (#33) * Added support for case when no consensus is found (#30) +* Improved output (#34) +* Minor fixes # timaR 2.3.0 -* Minor fixes * Added support for annotation without MN (#28) * Added support for multi tool annotations (#27) * Added support for classical MN GNPS jobs (#25) * Added support for new version of LOTUS * General improvements for manual inputs -* Updated adducts * Improved tests code coverage +* Minor fixes +* Updated adducts # timaR 2.2.2 +* Additional benchmark figure ([Candidates distribution](https://taxonomicallyinformedannotation.github.io/tima-r/articles/V-actual-performance.html#candidates-distribution)) * Minor fixes -* Additional benchmark - figure ([Candidates distribution](https://taxonomicallyinformedannotation.github.io/tima-r/articles/V-actual-performance.html#candidates-distribution)) # timaR 2.2.1 @@ -230,8 +230,8 @@ # timaR 2.2.0 -* Various fixes * Added benchmark ([here](https://taxonomicallyinformedannotation.github.io/tima-r/articles/V-actual-performance.html)) +* Various fixes # timaR 2.1.0 diff --git a/R/clean_chemo.R b/R/clean_chemo.R index cf8a831af..71076e530 100644 --- a/R/clean_chemo.R +++ b/R/clean_chemo.R @@ -45,6 +45,7 @@ import::from(tidytable, where, .into = environment()) #' #' @include clean_collapse.R #' @include columns_model.R +#' @include filter_high_confidence_only.R #' #' @param annot_table_wei_chemo Table containing your #' chemically weighted annotation @@ -56,6 +57,7 @@ import::from(tidytable, where, .into = environment()) #' @param minimal_ms1_bio Minimal biological score to keep MS1 based annotation #' @param minimal_ms1_chemo Minimal chemical score to keep MS1 based annotation #' @param minimal_ms1_condition Condition to be used. Must be "OR" or "AND". +#' @param high_confidence Report high confidence candidates only. BOOLEAN #' @param remove_ties Remove ties. BOOLEAN #' @param summarise Boolean. summarise results (1 row per feature) #' @@ -76,6 +78,7 @@ clean_chemo <- minimal_ms1_bio = get("minimal_ms1_bio", envir = parent.frame()), minimal_ms1_chemo = get("minimal_ms1_chemo", envir = parent.frame()), minimal_ms1_condition = get("minimal_ms1_condition", envir = parent.frame()), + high_confidence = get("high_confidence", envir = parent.frame()), remove_ties = get("remove_ties", envir = parent.frame()), summarise = get("summarise", envir = parent.frame())) { model <- columns_model() @@ -121,6 +124,11 @@ clean_chemo <- ) } + if (high_confidence) { + df1 <- df1 |> + filter_high_confidence_only() + } + df1 <- df1 |> arrange(desc(score_pondered_chemo)) |> distinct(feature_id, diff --git a/R/filter_high_confidence_only.R b/R/filter_high_confidence_only.R new file mode 100644 index 000000000..b2a65aaf0 --- /dev/null +++ b/R/filter_high_confidence_only.R @@ -0,0 +1,36 @@ +import::from(crayon, red, .into = environment()) +import::from(tidytable, filter, .into = environment()) + +#' @title Filter high confidence only +#' `r lifecycle::badge("experimental")` +#' +#' @description This function filters highly confident annotations only. +#' +#' @importFrom crayon red +#' @importFrom tidytable filter +#' +#' @param df Dataframe +#' @param score_bio_min Minimal biological score. Current default to 0.85. +#' @param score_ini_min Minimal initial score. Current default to 0.75. +#' +#' @return NULL +#' +#' @export +#' +#' @examples NULL +filter_high_confidence_only <- + function(df, + score_bio_min = 0.85, + score_ini_min = 0.75) { + log_debug("Keeping high confidence candidates only...") + before <- nrow(df) + # TODO this is very basic for now but already massively filters. + # TODO Later implement SIRIUS/internal library filters. + df <- df |> + filter(score_biological >= score_bio_min | + candidate_score_pseudo_initial >= score_ini_min) + after <- nrow(df) + log_debug("Removed", red(before - after), "low confidence candidates") + rm(before, after) + return(df) + } diff --git a/R/get_gnps_tables.R b/R/get_gnps_tables.R index 0f7cdeab4..2669d9b9a 100644 --- a/R/get_gnps_tables.R +++ b/R/get_gnps_tables.R @@ -177,24 +177,24 @@ get_gnps_tables <- log_debug("No GNPS job ID provided") log_debug("Returning empty dataframes instead") fake_annotations <- data.frame( - `#Scan#` = NA, - MassDiff = NA, - MZErrorPPM = NA, - Precursor_MZ = NA, - LibraryName = NA, - Compound_Name = NA, - INCHI = NA, - InChIKey = NA, - `InChIKey-Planar` = NA, - ExactMass = NA, - MQScore = NA, - SharedPeaks = NA, - npclassifier_pathway = NA, - npclassifier_superclass = NA, - npclassifier_class = NA, - superclass = NA, - class = NA, - subclass = NA, + `#Scan#` = 0, + MassDiff = 0, + MZErrorPPM = 0, + Precursor_MZ = 0, + LibraryName = "foo", + Compound_Name = "bar", + INCHI = "bim", + InChIKey = "bam", + `InChIKey-Planar` = "bom", + ExactMass = 0, + MQScore = 0, + SharedPeaks = 0, + npclassifier_pathway = "aaa", + npclassifier_superclass = "bbb", + npclassifier_class = "ccc", + superclass = "ddd", + class = "eee", + subclass = "fff", check.names = FALSE ) export_output(x = fake_annotations, file = file.path(path_interim_a, paste0(filename, "_gnps.tsv"))) @@ -216,7 +216,7 @@ get_gnps_tables <- if (length(path_metadata) == 0 || !file.exists(path_metadata)) { path_metadata <- "data/source/metadata.tsv" - fake_metadata <- data.frame(filename = NA, ATTRIBUTE_species = NA) + fake_metadata <- data.frame(filename = "foo", ATTRIBUTE_species = "bar") export_output(x = fake_metadata, file = path_metadata) } diff --git a/R/parse_cli_params.R b/R/parse_cli_params.R index e02b6fd63..6aa578535 100644 --- a/R/parse_cli_params.R +++ b/R/parse_cli_params.R @@ -18,6 +18,9 @@ parse_cli_params <- function(arguments, parameters) { if (!is.null(arguments$ann_ms1only)) { parameters$annotations$ms1only <- as.logical(arguments$ann_ms1only) } + if (!is.null(arguments$ann_ms2_app)) { + parameters$annotations$ms2approx <- as.logical(arguments$ann_ms2_app) + } if (!is.null(arguments$ann_thr_con)) { parameters$annotations$thresholds$consistency <- as.numeric(arguments$ann_thr_con) @@ -34,9 +37,6 @@ parse_cli_params <- function(arguments, parameters) { parameters$annotations$thresholds$ms1$condition <- as.character(arguments$ann_thr_ms1_con) } - if (!is.null(arguments$ann_ms2_app)) { - parameters$annotations$ms2approx <- as.logical(arguments$ann_ms2_app) - } if (!is.null(arguments$ann_thr_ms2_sim_ann)) { parameters$annotations$thresholds$ms2$similarity <- as.numeric(arguments$ann_thr_ms2_sim_ann) @@ -448,6 +448,9 @@ parse_cli_params <- function(arguments, parameters) { if (!is.null(arguments$force)) { parameters$options$force <- as.logical(arguments$force) } + if (!is.null(arguments$high_confidence)) { + parameters$options$high_confidence <- as.logical(arguments$high_confidence) + } if (!is.null(arguments$remove_ties)) { parameters$options$remove_ties <- as.logical(arguments$remove_ties) } diff --git a/R/prepare_libraries_sop_ecmdb.R b/R/prepare_libraries_sop_ecmdb.R index fa027cac9..fde572213 100644 --- a/R/prepare_libraries_sop_ecmdb.R +++ b/R/prepare_libraries_sop_ecmdb.R @@ -45,8 +45,10 @@ prepare_libraries_sop_ecmdb <- perl = TRUE ) - ## Get rid of the annoying incomplete final line warning - ecmdb <- stream_in(con = unz(description = input, filename = file)) |> + ecmdb <- stream_in( + con = unz(description = input, filename = file), + verbose = FALSE + ) |> data.frame() |> as_tidytable() diff --git a/R/prepare_params.R b/R/prepare_params.R index e49dfcfdf..0231e8e05 100644 --- a/R/prepare_params.R +++ b/R/prepare_params.R @@ -175,6 +175,7 @@ prepare_params <- function(params_small = get_params(step = "prepare_params"), wei_che_23 <- params_advanced$weights$chemical$npc$class wei_che_14 <- params_advanced$weights$chemical$cla$parent opt_cpd_nam <- params_advanced$options$compounds_names + opt_hig_con <- params_advanced$options$high_confidence opt_for <- params_advanced$options$force opt_rem_tie <- params_advanced$options$remove_ties opt_sum <- params_advanced$options$summarise @@ -187,6 +188,7 @@ prepare_params <- function(params_small = get_params(step = "prepare_params"), fil_ann_raw_spe_sir <- params_small$files$annotations$raw$spectral$sirius ms_pol <- params_small$ms$polarity org_tax <- params_small$organisms$taxon + opt_hig_con <- params_small$options$high_confidence opt_sum <- params_small$options$summarise if (!is.null(org_tax)) { @@ -630,6 +632,8 @@ prepare_params <- function(params_small = get_params(step = "prepare_params"), opt_cpd_nam yamls_params$weight_annotations$options$force <- opt_for + yamls_params$weight_annotations$options$high_confidence <- + opt_hig_con yamls_params$weight_annotations$options$remove_ties <- opt_rem_tie yamls_params$weight_annotations$options$summarise <- diff --git a/R/prepare_taxa.R b/R/prepare_taxa.R index c331482c1..87d93d1b8 100644 --- a/R/prepare_taxa.R +++ b/R/prepare_taxa.R @@ -118,9 +118,9 @@ prepare_taxa <- } log_debug(x = "Formatting feature table ...") - log_debug(x = "... WARNING: requires 'Peak area' + log_debug(x = "... requires 'Peak area' in columns (MZmine format)") - log_debug(x = "... WARNING: or 'quant_' in columns (SLAW format)") + log_debug(x = "... or 'quant_' in columns (SLAW format)") feature_table <- feature_table_0 |> select(all_of(c(name_features)), matches(" Peak area"), matches("quant_"), ) |> select(-matches("quant_peaktable")) |> diff --git a/R/transform_score_sirius_csi.R b/R/transform_score_sirius_csi.R index 38cdc1150..c7162d218 100644 --- a/R/transform_score_sirius_csi.R +++ b/R/transform_score_sirius_csi.R @@ -6,7 +6,7 @@ #' #' @param csi_score Original CSI score #' @param K Shift -#' @param anyone scale +#' @param scale Scale #' #' @return A mass #' diff --git a/R/weight_annotations.R b/R/weight_annotations.R index 42e435009..2f464b20a 100644 --- a/R/weight_annotations.R +++ b/R/weight_annotations.R @@ -106,6 +106,7 @@ import::from(tidytable, where, .into = environment()) #' @param minimal_ms1_condition Condition to be used. Must be "OR" or "AND". #' @param ms1_only Keep only MS1 annotations. BOOLEAN #' @param compounds_names Report compounds names. Can be very large. BOOLEAN +#' @param high_confidence Report high confidence candidates only. BOOLEAN #' @param remove_ties Remove ties. BOOLEAN #' @param summarise Summarize results (1 row per feature). BOOLEAN #' @param pattern Pattern to identify your job. STRING @@ -159,6 +160,7 @@ weight_annotations <- function(library = get_params(step = "weight_annotations") minimal_ms1_condition = get_params(step = "weight_annotations")$annotations$thresholds$ms1$condition, ms1_only = get_params(step = "weight_annotations")$annotations$ms1only, compounds_names = get_params(step = "weight_annotations")$options$compounds_names, + high_confidence = get_params(step = "weight_annotations")$options$high_confidence, remove_ties = get_params(step = "weight_annotations")$options$remove_ties, summarise = get_params(step = "weight_annotations")$options$summarise, pattern = get_params(step = "weight_annotations")$files$pattern, diff --git a/codemeta.json b/codemeta.json index f2204de6a..8f21a4e8e 100644 --- a/codemeta.json +++ b/codemeta.json @@ -616,7 +616,7 @@ "SystemRequirements": null }, "keywords": ["metaboliteannotation", "chemotaxonomy", "scoringsystem", "naturalproducts", "computationalmetabolomics", "taxonomicdistance", "specializedmetabolome"], - "fileSize": "3168.108KB", + "fileSize": "3222.399KB", "citation": [ { "@type": "ScholarlyArticle", diff --git a/inst/app.R b/inst/app.R index 42e5cd273..3f6158f0d 100644 --- a/inst/app.R +++ b/inst/app.R @@ -23,10 +23,7 @@ options(shiny.maxRequestSize = 2000 * 1024^2) #' #' @examples NULL label_mandatory <- function(label) { - shiny::tagList( - label, - shiny::span("*", class = "mandatory_star") - ) + shiny::tagList(label, shiny::span("*", class = "mandatory_star")) } app_css <- @@ -47,24 +44,16 @@ ui <- shiny::fluidPage( shiny::h1("Taxonomically Informed Metabolite Annotation"), shiny::h4( "This app helps performing TIMA as described in the", - shiny::a( - href = "https://taxonomicallyinformedannotation.github.io/tima-r/", - "following documentation" - ) + shiny::a(href = "https://taxonomicallyinformedannotation.github.io/tima-r/", "following documentation") ), shiny::strong( shiny::span("Created by "), shiny::a("Adriano Rutz", href = "https://adafede.github.io/"), shiny::HTML("•"), - shiny::a("Main publication", - href = "https://doi.org/10.3389/fpls.2019.01329" - ), + shiny::a("Main publication", href = "https://doi.org/10.3389/fpls.2019.01329"), shiny::HTML("•"), shiny::span("Code"), - shiny::a( - "on GitHub", - href = "https://github.com/taxonomicallyinformedannotation/tima-r/" - ) + shiny::a("on GitHub", href = "https://github.com/taxonomicallyinformedannotation/tima-r/") ) ), shiny::fluidPage(shiny::div( @@ -95,14 +84,7 @@ ui <- shiny::fluidPage( shiny::fileInput( inputId = "fil_fea_raw", label = label_mandatory("Features table"), - accept = c( - ".csv", - ".tsv", - ".csv.gz", - ".tsv.gz", - ".csv.zip", - ".tsv.zip" - ) + accept = c(".csv", ".tsv", ".csv.gz", ".tsv.gz", ".csv.zip", ".tsv.zip") ) |> shinyhelper::helper( type = "inline", @@ -116,14 +98,7 @@ ui <- shiny::fluidPage( shiny::fileInput( inputId = "fil_met_raw", label = "Metadata table (mandatory if no taxon name)", - accept = c( - ".csv", - ".tsv", - ".csv.gz", - ".tsv.gz", - ".csv.zip", - ".tsv.zip" - ) + accept = c(".csv", ".tsv", ".csv.gz", ".tsv.gz", ".csv.zip", ".tsv.zip") ) |> shinyhelper::helper( type = "inline", @@ -138,9 +113,7 @@ ui <- shiny::fluidPage( shiny::fileInput( inputId = "fil_ann_raw_sir", label = "SIRIUS project space (optional)", - accept = c( - ".zip" - ) + accept = c(".zip") ) |> shinyhelper::helper( type = "inline", @@ -158,10 +131,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "The SIRIUS version used.", - "We highly recommend 6, the default." - ) + content = c("The SIRIUS version used.", "We highly recommend 6, the default.") ), shiny::textInput( inputId = "fil_pat", @@ -407,9 +377,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "Retention time tolerance (minutes) used for adducts annotation." - ) + content = c("Retention time tolerance (minutes) used for adducts annotation.") ), shiny::sliderInput( inputId = "ms_tol_rt_lib", @@ -454,13 +422,7 @@ ui <- shiny::fluidPage( "[2M+Na]+", "[2M+K]+" ), - selected = list( - "[M+H2]2+", - "[M+H]+", - "[M+H4N]+", - "[M+Na]+", - "[2M+H]+" - ) + selected = list("[M+H2]2+", "[M+H]+", "[M+H4N]+", "[M+Na]+", "[2M+H]+") ) |> shinyhelper::helper( type = "inline", @@ -492,11 +454,7 @@ ui <- shiny::fluidPage( "[2M-H]-", "[3M-H]-" ), - selected = list( - "[M-H2]2-", - "[M-H]-", - "[2M-H]-" - ) + selected = list("[M-H2]2-", "[M-H]-", "[2M-H]-") ) |> shinyhelper::helper( type = "inline", @@ -867,9 +825,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "Name of the `inchikey` column in your file." - ) + content = c("Name of the `inchikey` column in your file.") ), shiny::textInput( inputId = "names_precursor", @@ -905,9 +861,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "Name of the `retention time` column in your rt library file." - ) + content = c("Name of the `retention time` column in your rt library file.") ), shiny::textInput( inputId = "names_smiles", @@ -916,9 +870,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "Name of the `SMILES` column in your file." - ) + content = c("Name of the `SMILES` column in your file.") ), shiny::textInput( inputId = "names_source", @@ -964,9 +916,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "Name of the `adduct` column in your MGF file." - ) + content = c("Name of the `adduct` column in your MGF file.") ), shiny::textInput( inputId = "names_mgf_ce", @@ -975,9 +925,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "Name of the `collision energy` column in your MGF file." - ) + content = c("Name of the `collision energy` column in your MGF file.") ), shiny::textInput( inputId = "names_mgf_ci", @@ -986,9 +934,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "Name of the `compound id` column in your MGF file." - ) + content = c("Name of the `compound id` column in your MGF file.") ), shiny::textInput( inputId = "names_mgf_em", @@ -997,9 +943,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "Name of the `exact mass` column in your MGF file." - ) + content = c("Name of the `exact mass` column in your MGF file.") ), shiny::textInput( inputId = "names_mgf_in", @@ -1008,9 +952,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "Name of the `InChI` column in your MGF file." - ) + content = c("Name of the `InChI` column in your MGF file.") ), shiny::textInput( inputId = "names_mgf_io", @@ -1019,9 +961,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "Name of the `InChI no stereo` column in your MGF file." - ) + content = c("Name of the `InChI no stereo` column in your MGF file.") ), shiny::textInput( inputId = "names_mgf_ik", @@ -1030,9 +970,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "Name of the `InChIKey` column in your MGF file." - ) + content = c("Name of the `InChIKey` column in your MGF file.") ), shiny::textInput( inputId = "names_mgf_il", @@ -1041,9 +979,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "Name of the `InChIKey no stereo` column in your MGF file." - ) + content = c("Name of the `InChIKey no stereo` column in your MGF file.") ), shiny::textInput( inputId = "names_mgf_mf", @@ -1052,9 +988,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "Name of the `molecular formula` column in your MGF file." - ) + content = c("Name of the `molecular formula` column in your MGF file.") ), shiny::textInput( inputId = "names_mgf_na", @@ -1063,9 +997,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "Name of the `name` column in your MGF file." - ) + content = c("Name of the `name` column in your MGF file.") ), shiny::textInput( inputId = "names_mgf_po", @@ -1074,9 +1006,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "Name of the `polarity` column in your MGF file." - ) + content = c("Name of the `polarity` column in your MGF file.") ), shiny::textInput( inputId = "names_mgf_rt", @@ -1085,9 +1015,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "Name of the `retention time` column in your MGF file." - ) + content = c("Name of the `retention time` column in your MGF file.") ), shiny::textInput( inputId = "names_mgf_sm", @@ -1096,9 +1024,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "Name of the `SMILES` column in your MGF file." - ) + content = c("Name of the `SMILES` column in your MGF file.") ), shiny::textInput( inputId = "names_mgf_sn", @@ -1107,9 +1033,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "Name of the `SMILES no stereo` column in your MGF file." - ) + content = c("Name of the `SMILES no stereo` column in your MGF file.") ), shiny::textInput( inputId = "names_mgf_si", @@ -1118,9 +1042,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "Name of the `spectrum ID` column in your MGF file." - ) + content = c("Name of the `spectrum ID` column in your MGF file.") ), shiny::textInput( inputId = "names_mgf_sp", @@ -1129,9 +1051,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "Name of the `SPLASH` column in your MGF file." - ) + content = c("Name of the `SPLASH` column in your MGF file.") ), shiny::textInput( inputId = "names_mgf_sy", @@ -1140,9 +1060,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "Name of the `synonyms` column in your MGF file." - ) + content = c("Name of the `synonyms` column in your MGF file.") ), shiny::textInput( inputId = "names_mgf_xl", @@ -1151,9 +1069,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "Name of the `xlogP` column in your MGF file." - ) + content = c("Name of the `xlogP` column in your MGF file.") ) ), shiny::tabPanel( @@ -1586,6 +1502,15 @@ ui <- shiny::fluidPage( as they are the longest strings." ) ), + shiny::checkboxInput( + inputId = "high_confidence", + label = "High confidence only", + value = TRUE + ) |> + shinyhelper::helper( + type = "inline", + content = c("If ticked, only compounds with high confidence will be reported.") + ), shiny::checkboxInput( inputId = "remove_ties", label = "Remove ties", @@ -1634,14 +1559,7 @@ ui <- shiny::fluidPage( shiny::fileInput( inputId = "lib_tmp_exp_csv", label = "Experimental (CSV)", - accept = c( - ".csv", - ".tsv", - ".csv.gz", - ".tsv.gz", - ".csv.zip", - ".tsv.zip" - ), + accept = c(".csv", ".tsv", ".csv.gz", ".tsv.gz", ".csv.zip", ".tsv.zip"), multiple = TRUE ) |> shinyhelper::helper( @@ -1656,14 +1574,7 @@ ui <- shiny::fluidPage( shiny::fileInput( inputId = "lib_tmp_is_csv", label = "In silico (CSV)", - accept = c( - ".csv", - ".tsv", - ".csv.gz", - ".tsv.gz", - ".csv.zip", - ".tsv.zip" - ), + accept = c(".csv", ".tsv", ".csv.gz", ".tsv.gz", ".csv.zip", ".tsv.zip"), multiple = TRUE ) |> shinyhelper::helper( @@ -1679,9 +1590,7 @@ ui <- shiny::fluidPage( shiny::fileInput( inputId = "lib_spe_exp_mgf", label = "Experimental (MGF)", - accept = c( - ".mgf" - ), + accept = c(".mgf"), multiple = TRUE ) |> shinyhelper::helper( @@ -1695,9 +1604,7 @@ ui <- shiny::fluidPage( shiny::fileInput( inputId = "lib_spe_is_mgf", label = "In silico (MGF)", - accept = c( - ".mgf" - ), + accept = c(".mgf"), multiple = TRUE ) |> shinyhelper::helper( @@ -1716,10 +1623,7 @@ ui <- shiny::fluidPage( ) |> shinyhelper::helper( type = "inline", - content = c( - "Unit of the retention time.", - "Must be `seconds` or `minutes`." - ) + content = c("Unit of the retention time.", "Must be `seconds` or `minutes`.") ), ), shiny::tabPanel( @@ -1765,14 +1669,11 @@ ui <- shiny::fluidPage( ), shinyjs::hidden( shiny::span(id = "save_msg", "Saving parameters..."), - shiny::div( - id = "error", - shiny::div( - shiny::br(), - shiny::tags$b("Error: "), - shiny::span(id = "error_msg") - ) - ) + shiny::div(id = "error", shiny::div( + shiny::br(), + shiny::tags$b("Error: "), + shiny::span(id = "error_msg") + )) ), shiny::actionButton( inputId = "launch", @@ -1780,18 +1681,11 @@ ui <- shiny::fluidPage( class = "btn-primary" ), ), - shinyjs::hidden( - shiny::div( - id = "thankyou_msg", - shiny::h3("Thanks, your parameters were saved successfully!") - ) - ), - shinyjs::hidden( - shiny::div( - id = "job_msg", - shiny::h3("Job is running!") - ) - ) + shinyjs::hidden(shiny::div( + id = "thankyou_msg", + shiny::h3("Thanks, your parameters were saved successfully!") + )), + shinyjs::hidden(shiny::div(id = "job_msg", shiny::h3("Job is running!"))) ) ) @@ -1826,14 +1720,26 @@ save_input <- function(input) { } if (!file.exists(prefil_fea_raw_1)) { - fs::file_copy(path = prefil_fea_raw[[4]], new_path = file.path(prefil_fea_raw_1), overwrite = TRUE) + fs::file_copy( + path = prefil_fea_raw[[4]], + new_path = file.path(prefil_fea_raw_1), + overwrite = TRUE + ) } if (!file.exists(prefil_spe_raw_1)) { - fs::file_copy(path = prefil_spe_raw[[4]], new_path = file.path(prefil_spe_raw_1), overwrite = TRUE) + fs::file_copy( + path = prefil_spe_raw[[4]], + new_path = file.path(prefil_spe_raw_1), + overwrite = TRUE + ) } if (!is.null(prefil_met_raw)) { if (!file.exists(prefil_met_raw_1)) { - fs::file_copy(path = prefil_met_raw[[4]], new_path = file.path(prefil_met_raw_1), overwrite = TRUE) + fs::file_copy( + path = prefil_met_raw[[4]], + new_path = file.path(prefil_met_raw_1), + overwrite = TRUE + ) } } else { prefil_met_raw_1 <- NULL @@ -1842,7 +1748,11 @@ save_input <- function(input) { if (!file.exists(prefil_sir_raw_1)) { ## safety create_dir(paths_data_interim_annotations) - fs::file_copy(path = prefil_sir_raw[[4]], new_path = file.path(prefil_sir_raw_1), overwrite = TRUE) + fs::file_copy( + path = prefil_sir_raw[[4]], + new_path = file.path(prefil_sir_raw_1), + overwrite = TRUE + ) } } else { prefil_sir_raw_1 <- NULL @@ -1864,31 +1774,24 @@ save_input <- function(input) { if (org_tax == "") { org_tax <- NULL } + hig_con <- shiny::isolate(input$high_confidence) + ms_pol <- shiny::isolate(input$ms_pol) + summarise <- shiny::isolate(input$summarise) log_debug(x = "Changing parameters ...") log_debug(x = "... Small") yaml_small <- yamls_params[["inst/params/prepare_params"]] - yaml_small$files$pattern <- - fil_pat - yaml_small$files$features$raw <- - fil_fea_raw - yaml_small$files$metadata$raw <- - fil_met_raw - yaml_small$files$annotations$raw$sirius <- - fil_sir_raw - yaml_small$files$spectral$raw <- - fil_spe_raw - yaml_small$ms$polarity <- - shiny::isolate(input$ms_pol) - yaml_small$organisms$taxon <- - org_tax - yaml_small$options$summarise <- - shiny::isolate(input$summarise) + yaml_small$files$pattern <- fil_pat + yaml_small$files$features$raw <- fil_fea_raw + yaml_small$files$metadata$raw <- fil_met_raw + yaml_small$files$annotations$raw$sirius <- fil_sir_raw + yaml_small$files$spectral$raw <- fil_spe_raw + yaml_small$ms$polarity <- ms_pol + yaml_small$organisms$taxon <- org_tax + yaml_small$options$high_confidence <- hig_con + yaml_small$options$summarise <- summarise create_dir("inst/params") - yaml::write_yaml( - x = yaml_small, - file = parse_yaml_paths()$params$prepare_params - ) + yaml::write_yaml(x = yaml_small, file = parse_yaml_paths()$params$prepare_params) log_debug(x = "... Advanced") yaml_advanced <- yamls_params[["inst/params/prepare_params_advanced"]] @@ -1910,35 +1813,45 @@ save_input <- function(input) { shiny::isolate(input$ann_thr_ms2_sim) yaml_advanced$annotations$thresholds$ms2$similarity$edges <- shiny::isolate(input$edg_thr_ms2_sim) - yaml_advanced$files$pattern <- - fil_pat + yaml_advanced$files$pattern <- fil_pat yaml_advanced$files$annotations$raw$spectral$gnps <- - yaml_advanced$files$annotations$raw$spectral$gnps |> replace_id() + yaml_advanced$files$annotations$raw$spectral$gnps |> + replace_id() yaml_advanced$files$annotations$raw$spectral$spectral <- - yaml_advanced$files$annotations$raw$spectral$spectral |> replace_id() + yaml_advanced$files$annotations$raw$spectral$spectral |> + replace_id() # yaml_advanced$files$annotations$raw$sirius <- - # yaml_advanced$files$annotations$raw$sirius |> replace_id() + # yaml_advanced$files$annotations$raw$sirius |> + # replace_id() yaml_advanced$files$annotations$raw$sirius <- fil_sir_raw yaml_advanced$files$annotations$prepared$canopus <- - yaml_advanced$files$annotations$prepared$canopus |> replace_id() + yaml_advanced$files$annotations$prepared$canopus |> + replace_id() yaml_advanced$files$annotations$prepared$formula <- - yaml_advanced$files$annotations$prepared$formula |> replace_id() + yaml_advanced$files$annotations$prepared$formula |> + replace_id() yaml_advanced$files$annotations$prepared$structural$gnps <- - yaml_advanced$files$annotations$prepared$structural$gnps |> replace_id() + yaml_advanced$files$annotations$prepared$structural$gnps |> + replace_id() yaml_advanced$files$annotations$prepared$structural$ms1 <- - yaml_advanced$files$annotations$prepared$structural$ms1 |> replace_id() + yaml_advanced$files$annotations$prepared$structural$ms1 |> + replace_id() yaml_advanced$files$annotations$prepared$structural$sirius <- - yaml_advanced$files$annotations$prepared$structural$sirius |> replace_id() + yaml_advanced$files$annotations$prepared$structural$sirius |> + replace_id() yaml_advanced$files$annotations$prepared$structural$spectral <- - yaml_advanced$files$annotations$prepared$structural$spectral |> replace_id() + yaml_advanced$files$annotations$prepared$structural$spectral |> + replace_id() yaml_advanced$files$annotations$filtered <- yaml_advanced$files$annotations$filtered |> replace_id() # yaml_advanced$files$annotations$processed <- - # yaml_advanced$files$annotations$processed |> replace_id() + # yaml_advanced$files$annotations$processed |> + # replace_id() yaml_advanced$files$features$raw <- fil_fea_raw yaml_advanced$files$features$prepared <- - yaml_advanced$files$features$prepared |> replace_id() + yaml_advanced$files$features$prepared |> + replace_id() # TODO # yaml_advanced$files$libraries$sop$raw$closed <- # shiny::isolate(input$todo) @@ -1990,23 +1903,26 @@ save_input <- function(input) { # yaml_advanced$files$libraries$temporal$prepared <- # shiny::isolate(input$todo) yaml_advanced$files$networks$spectral$edges$raw$ms1 <- - yaml_advanced$files$networks$spectral$edges$raw$ms1 |> replace_id() + yaml_advanced$files$networks$spectral$edges$raw$ms1 |> + replace_id() yaml_advanced$files$networks$spectral$edges$raw$spectral <- - yaml_advanced$files$networks$spectral$edges$raw$spectral |> replace_id() + yaml_advanced$files$networks$spectral$edges$raw$spectral |> + replace_id() yaml_advanced$files$networks$spectral$edges$prepared <- - yaml_advanced$files$networks$spectral$edges$prepared |> replace_id() + yaml_advanced$files$networks$spectral$edges$prepared |> + replace_id() yaml_advanced$files$networks$spectral$components$raw <- - yaml_advanced$files$networks$spectral$components$raw |> replace_id() + yaml_advanced$files$networks$spectral$components$raw |> + replace_id() yaml_advanced$files$networks$spectral$components$prepared <- - yaml_advanced$files$networks$spectral$components$prepared |> replace_id() - yaml_advanced$files$metadata$raw <- - fil_met_raw + yaml_advanced$files$networks$spectral$components$prepared |> + replace_id() + yaml_advanced$files$metadata$raw <- fil_met_raw yaml_advanced$files$metadata$prepared <- - yaml_advanced$files$metadata$prepared |> replace_id() - yaml_advanced$files$spectral$raw <- - fil_spe_raw - yaml_advanced$gnps$id <- - gnps_job_id + yaml_advanced$files$metadata$prepared |> + replace_id() + yaml_advanced$files$spectral$raw <- fil_spe_raw + yaml_advanced$gnps$id <- gnps_job_id yaml_advanced$gnps$workflow <- shiny::isolate(input$gnps_workflow) yaml_advanced$ms$adducts$neg <- @@ -2019,8 +1935,7 @@ save_input <- function(input) { shiny::isolate(input$ms_clu_pos) yaml_advanced$ms$neutral_losses <- shiny::isolate(input$ms_neu) - yaml_advanced$ms$polarity <- - shiny::isolate(input$ms_pol) + yaml_advanced$ms$polarity <- ms_pol yaml_advanced$ms$thresholds$ms2$intensity <- shiny::isolate(input$ms_thr_ms2_int) yaml_advanced$ms$tolerances$mass$ppm$ms1 <- @@ -2173,12 +2088,12 @@ save_input <- function(input) { shiny::isolate(input$wei_che_14) yaml_advanced$options$compounds_names <- shiny::isolate(input$compounds_names) + yaml_advanced$options$high_confidence <- hig_con yaml_advanced$options$force <- shiny::isolate(input$force) yaml_advanced$options$remove_ties <- shiny::isolate(input$remove_ties) - yaml_advanced$options$summarise <- - shiny::isolate(input$summarise) + yaml_advanced$options$summarise <- summarise if (!is.null(prefil_met_raw)) { yamls_params$prepare_taxa$files$metadata$raw <- fil_met_raw @@ -2208,10 +2123,7 @@ server <- function(input, output, session) { X = fields_mandatory, FUN = function(x) { ## TODO improve - suppressWarnings(any( - !is.null(input[[x]]), - input[[x]] != "" - )) + suppressWarnings(any(!is.null(input[[x]]), input[[x]] != "")) }, FUN.VALUE = logical(1) ) @@ -2224,256 +2136,248 @@ server <- function(input, output, session) { ## Special check for taxon name iv <- shinyvalidate::InputValidator$new() iv$add_rule("org_tax", function(taxon) { - if (!grepl(pattern = "^[[:upper:]]", x = taxon, perl = TRUE)) { + if (!grepl( + pattern = "^[[:upper:]]", + x = taxon, + perl = TRUE + )) { "Please provide your taxon name with capital letter" } }) iv$add_rule("org_tax", function(taxon) { - if (is.na(rotl::tnrs_match_names( - names = taxon, - do_approximate_matching = FALSE - )$ott_id)) { + if (is.na(rotl::tnrs_match_names(names = taxon, do_approximate_matching = FALSE)$ott_id)) { "Taxon not found in Open Tree of Life" } }) iv$enable() ## When the Save button is clicked, save the response - shiny::observeEvent( - eventExpr = input$save, - handlerExpr = { - ## User-experience stuff - shinyjs::show("save_msg") - shinyjs::enable("launch") - shinyjs::hide("error") + shiny::observeEvent(eventExpr = input$save, handlerExpr = { + ## User-experience stuff + shinyjs::show("save_msg") + shinyjs::enable("launch") + shinyjs::hide("error") - ## Save the data (show an error message in case of error) - tryCatch( - expr = { - save_input(input = input) - shinyjs::show("thankyou_msg") - }, - error = function(err) { - shinyjs::html("error_msg", err$message) - shinyjs::show( - id = "error", - anim = TRUE, - animType = "fade" - ) - }, - finally = { - shinyjs::enable("save") - shinyjs::enable("launch") - shinyjs::hide("save_msg") - shinyjs::hide("error") - } - ) - } - ) - - shiny::observeEvent( - eventExpr = input$launch, - handlerExpr = { - shinyjs::show("job_msg") - shinyjs::hide("thankyou_msg") - shinyjs::hide("error") - shinyjs::hide("params") - shinyjs::hide("form") - tryCatch(expr = { - targets::tar_watch( - host = "127.0.0.1", - port = 3839, - display = "graph", - displays = c("summary", "graph"), - level_separation = 300, - degree_from = 8, - outdated = FALSE, - targets_only = TRUE, - supervise = TRUE, - verbose = TRUE, - exclude = c( - "yaml_paths", - "benchmark_ann_fil_ms1_neg", - "benchmark_ann_fil_ms1_pos", - "benchmark_ann_fil_spe_neg", - "benchmark_ann_fil_spe_pos", - "benchmark_ann_fil_spe_ms1_neg", - "benchmark_ann_fil_spe_ms1_pos", - "benchmark_ann_ms1_neg", - "benchmark_ann_ms2_pos", - "benchmark_ann_ms1_pre_neg", - "benchmark_ann_ms1_pre_pos", - "benchmark_ann_pre_ms1_ms2_b_c_neg", - "benchmark_ann_pre_ms1_ms2_b_c_pos", - "benchmark_ann_pre_ms1_ms2_b_neg", - "benchmark_ann_pre_ms1_ms2_b_pos", - "benchmark_ann_pre_ms2_b_c_neg", - "benchmark_ann_pre_ms2_b_c_pos", - "benchmark_ann_pre_ms2_b_neg", - "benchmark_ann_pre_ms2_b_pos", - "benchmark_ann_sir_pre", - "benchmark_ann_sir_pre_can", - "benchmark_ann_sir_pre_for", - "benchmark_ann_sir_pre_str", - "benchmark_ann_spe_neg", - "benchmark_ann_spe_pos", - "benchmark_ann_spe_pre_neg", - "benchmark_ann_spe_pre_pos", - "benchmark_com_neg", - "benchmark_com_pos", - "benchmark_com_pre_neg", - "benchmark_com_pre_pos", - "benchmark_converted", - "benchmark_copy", - "benchmark_def_ann_mas", - "benchmark_def_ann_spe", - "benchmark_def_cre_edg_com", - "benchmark_def_cre_edg_spe", - "benchmark_def_fil_ann", - "benchmark_def_pre_ann_sir", - "benchmark_def_pre_ann_spe", - "benchmark_def_pre_fea_com", - "benchmark_def_pre_fea_edg", - "benchmark_def_wei_ann", - "benchmark_edg_pre_neg", - "benchmark_edg_pre_pos", - "benchmark_edg_spe_neg", - "benchmark_edg_spe_pos", - "benchmark_file", - "benchmark_files_neg", - "benchmark_files_pos", - "benchmark_path_copy", - "benchmark_path_export", - "benchmark_path_mgf_neg", - "benchmark_path_mgf_pos", - "benchmark_path_url", - "benchmark_prepared", - "benchmark_pre_meta_neg", - "benchmark_pre_meta_pos", - "benchmark_pre_mgf_neg", - "benchmark_pre_mgf_pos", - "benchmark_taxed_neg", - "benchmark_taxed_pos", - "benchmark_wei_par", - "paths", - "paths_data_interim_libraries_adducts_path", - "paths_data_source_benchmark_copy", - "paths_data_source_benchmark_mgf_neg", - "paths_data_source_benchmark_mgf_pos", - "paths_data_source_benchmark_set", - "paths_data_source_libraries_sop_ecmdb", - "paths_data_source_libraries_sop_hmdb", - "paths_data_source_libraries_sop_lotus", - "paths_data_source_libraries_spectra_is_lotus_pos", - "paths_data_source_libraries_spectra_is_lotus_neg", - "paths_data_source_spectra", - # "paths_gnps_example_id", - "paths_interim_a", - "paths_interim_f", - "paths_source", - "paths_test_mode", - "paths_urls_benchmarking_set", - "paths_urls_ecmdb_metabolites", - "paths_urls_hmdb_structures", - "paths_urls_lotus_doi", - "paths_urls_lotus_pattern", - "paths_urls_massbank_file", - "paths_urls_massbank_url", - "paths_urls_massbank_version", - "paths_urls_examples_spectra_mini", - "paths_urls_examples_spectral_lib_pos", - "paths_urls_examples_spectral_lib_neg", - "par_def_ann_mas", - "par_def_ann_spe", - "par_def_cre_com", - "par_def_cre_edg_spe", - "par_def_fil_ann", - "par_def_pre_ann_gnp", - "par_def_pre_ann_sir", - "par_def_pre_ann_spe", - "par_def_pre_fea_com", - "par_def_pre_fea_edg", - "par_def_pre_fea_tab", - "par_def_pre_lib_rt", - "par_def_pre_lib_sop_clo", - "par_def_pre_lib_sop_ecm", - "par_def_pre_lib_sop_hmd", - "par_def_pre_lib_sop_lot", - "par_def_pre_lib_sop_mer", - "par_def_pre_lib_spe", - "par_def_pre_tax", - "par_def_wei_ann", - "par_fin_par", - "par_fin_par2", - "par_pre_par", - "par_pre_par2", - "par_usr_ann_mas", - "par_usr_ann_spe", - "par_usr_cre_com", - "par_usr_cre_edg_spe", - "par_usr_fil_ann", - "par_usr_pre_ann_gnp", - "par_usr_pre_ann_sir", - "par_usr_pre_ann_spe", - "par_usr_pre_fea_com", - "par_usr_pre_fea_edg", - "par_usr_pre_fea_tab", - "par_usr_pre_lib_rt", - "par_usr_pre_lib_sop_clo", - "par_usr_pre_lib_sop_ecm", - "par_usr_pre_lib_sop_hmd", - "par_usr_pre_lib_sop_lot", - "par_usr_pre_lib_sop_mer", - "par_usr_pre_lib_spe", - "par_usr_pre_tax", - "par_usr_wei_ann", - "par_ann_mas", - "par_ann_spe", - "par_cre_com", - "par_cre_edg_spe", - "par_fil_ann", - "par_pre_ann_gnp", - "par_pre_ann_sir", - "par_pre_ann_spe", - "par_pre_fea_com", - "par_pre_fea_edg", - "par_pre_fea_tab", - "par_pre_lib_rt", - "par_pre_lib_sop_clo", - "par_pre_lib_sop_ecm", - "par_pre_lib_sop_hmd", - "par_pre_lib_sop_lot", - "par_pre_lib_sop_mer", - "par_pre_lib_spe", - "par_pre_tax", - "par_wei_ann", - ".Random.seed" - ) - ) - targets::tar_make( - names = targets::matches("^ann_pre$"), - garbage_collection = TRUE, - reporter = "verbose_positives" + ## Save the data (show an error message in case of error) + tryCatch( + expr = { + save_input(input = input) + shinyjs::show("thankyou_msg") + }, + error = function(err) { + shinyjs::html("error_msg", err$message) + shinyjs::show( + id = "error", + anim = TRUE, + animType = "fade" ) - }, finally = { - shiny::stopApp() - }) - process <- - shiny::reactiveValues(status = targets::tar_active()) - shiny::observe({ - shiny::invalidateLater(millis = 5000) - process$status <- targets::tar_active() - }) + }, + finally = { + shinyjs::enable("save") + shinyjs::enable("launch") + shinyjs::hide("save_msg") + shinyjs::hide("error") + } + ) + }) - shiny::observeEvent( - eventExpr = process$status, - handlerExpr = { - message("Job finished") - shiny::stopApp() - } + shiny::observeEvent(eventExpr = input$launch, handlerExpr = { + shinyjs::show("job_msg") + shinyjs::hide("thankyou_msg") + shinyjs::hide("error") + shinyjs::hide("params") + shinyjs::hide("form") + tryCatch(expr = { + targets::tar_watch( + host = "127.0.0.1", + port = 3839, + display = "graph", + displays = c("summary", "graph"), + level_separation = 300, + degree_from = 8, + outdated = FALSE, + targets_only = TRUE, + supervise = TRUE, + verbose = TRUE, + exclude = c( + "yaml_paths", + "benchmark_ann_fil_ms1_neg", + "benchmark_ann_fil_ms1_pos", + "benchmark_ann_fil_spe_neg", + "benchmark_ann_fil_spe_pos", + "benchmark_ann_fil_spe_ms1_neg", + "benchmark_ann_fil_spe_ms1_pos", + "benchmark_ann_ms1_neg", + "benchmark_ann_ms2_pos", + "benchmark_ann_ms1_pre_neg", + "benchmark_ann_ms1_pre_pos", + "benchmark_ann_pre_ms1_ms2_b_c_neg", + "benchmark_ann_pre_ms1_ms2_b_c_pos", + "benchmark_ann_pre_ms1_ms2_b_neg", + "benchmark_ann_pre_ms1_ms2_b_pos", + "benchmark_ann_pre_ms2_b_c_neg", + "benchmark_ann_pre_ms2_b_c_pos", + "benchmark_ann_pre_ms2_b_neg", + "benchmark_ann_pre_ms2_b_pos", + "benchmark_ann_sir_pre", + "benchmark_ann_sir_pre_can", + "benchmark_ann_sir_pre_for", + "benchmark_ann_sir_pre_str", + "benchmark_ann_spe_neg", + "benchmark_ann_spe_pos", + "benchmark_ann_spe_pre_neg", + "benchmark_ann_spe_pre_pos", + "benchmark_com_neg", + "benchmark_com_pos", + "benchmark_com_pre_neg", + "benchmark_com_pre_pos", + "benchmark_converted", + "benchmark_copy", + "benchmark_def_ann_mas", + "benchmark_def_ann_spe", + "benchmark_def_cre_edg_com", + "benchmark_def_cre_edg_spe", + "benchmark_def_fil_ann", + "benchmark_def_pre_ann_sir", + "benchmark_def_pre_ann_spe", + "benchmark_def_pre_fea_com", + "benchmark_def_pre_fea_edg", + "benchmark_def_wei_ann", + "benchmark_edg_pre_neg", + "benchmark_edg_pre_pos", + "benchmark_edg_spe_neg", + "benchmark_edg_spe_pos", + "benchmark_file", + "benchmark_files_neg", + "benchmark_files_pos", + "benchmark_path_copy", + "benchmark_path_export", + "benchmark_path_mgf_neg", + "benchmark_path_mgf_pos", + "benchmark_path_url", + "benchmark_prepared", + "benchmark_pre_meta_neg", + "benchmark_pre_meta_pos", + "benchmark_pre_mgf_neg", + "benchmark_pre_mgf_pos", + "benchmark_taxed_neg", + "benchmark_taxed_pos", + "benchmark_wei_par", + "paths", + "paths_data_interim_libraries_adducts_path", + "paths_data_source_benchmark_copy", + "paths_data_source_benchmark_mgf_neg", + "paths_data_source_benchmark_mgf_pos", + "paths_data_source_benchmark_set", + "paths_data_source_libraries_sop_ecmdb", + "paths_data_source_libraries_sop_hmdb", + "paths_data_source_libraries_sop_lotus", + "paths_data_source_libraries_spectra_is_lotus_pos", + "paths_data_source_libraries_spectra_is_lotus_neg", + "paths_data_source_spectra", + # "paths_gnps_example_id", + "paths_interim_a", + "paths_interim_f", + "paths_source", + "paths_test_mode", + "paths_urls_benchmarking_set", + "paths_urls_ecmdb_metabolites", + "paths_urls_hmdb_structures", + "paths_urls_lotus_doi", + "paths_urls_lotus_pattern", + "paths_urls_massbank_file", + "paths_urls_massbank_url", + "paths_urls_massbank_version", + "paths_urls_examples_spectra_mini", + "paths_urls_examples_spectral_lib_pos", + "paths_urls_examples_spectral_lib_neg", + "par_def_ann_mas", + "par_def_ann_spe", + "par_def_cre_com", + "par_def_cre_edg_spe", + "par_def_fil_ann", + "par_def_pre_ann_gnp", + "par_def_pre_ann_sir", + "par_def_pre_ann_spe", + "par_def_pre_fea_com", + "par_def_pre_fea_edg", + "par_def_pre_fea_tab", + "par_def_pre_lib_rt", + "par_def_pre_lib_sop_clo", + "par_def_pre_lib_sop_ecm", + "par_def_pre_lib_sop_hmd", + "par_def_pre_lib_sop_lot", + "par_def_pre_lib_sop_mer", + "par_def_pre_lib_spe", + "par_def_pre_tax", + "par_def_wei_ann", + "par_fin_par", + "par_fin_par2", + "par_pre_par", + "par_pre_par2", + "par_usr_ann_mas", + "par_usr_ann_spe", + "par_usr_cre_com", + "par_usr_cre_edg_spe", + "par_usr_fil_ann", + "par_usr_pre_ann_gnp", + "par_usr_pre_ann_sir", + "par_usr_pre_ann_spe", + "par_usr_pre_fea_com", + "par_usr_pre_fea_edg", + "par_usr_pre_fea_tab", + "par_usr_pre_lib_rt", + "par_usr_pre_lib_sop_clo", + "par_usr_pre_lib_sop_ecm", + "par_usr_pre_lib_sop_hmd", + "par_usr_pre_lib_sop_lot", + "par_usr_pre_lib_sop_mer", + "par_usr_pre_lib_spe", + "par_usr_pre_tax", + "par_usr_wei_ann", + "par_ann_mas", + "par_ann_spe", + "par_cre_com", + "par_cre_edg_spe", + "par_fil_ann", + "par_pre_ann_gnp", + "par_pre_ann_sir", + "par_pre_ann_spe", + "par_pre_fea_com", + "par_pre_fea_edg", + "par_pre_fea_tab", + "par_pre_lib_rt", + "par_pre_lib_sop_clo", + "par_pre_lib_sop_ecm", + "par_pre_lib_sop_hmd", + "par_pre_lib_sop_lot", + "par_pre_lib_sop_mer", + "par_pre_lib_spe", + "par_pre_tax", + "par_wei_ann", + ".Random.seed" + ) ) - } - ) + targets::tar_make( + names = targets::matches("^ann_pre$"), + garbage_collection = TRUE, + reporter = "verbose_positives" + ) + }, finally = { + shiny::stopApp() + }) + process <- + shiny::reactiveValues(status = targets::tar_active()) + shiny::observe({ + shiny::invalidateLater(millis = 5000) + process$status <- targets::tar_active() + }) + + shiny::observeEvent(eventExpr = process$status, handlerExpr = { + message("Job finished") + shiny::stopApp() + }) + }) } url <- "" log_debug("Please, open:", url, "on your favorite browser, but not Edge.") diff --git a/inst/params/default/weight_annotations.yaml b/inst/params/default/weight_annotations.yaml index f6567f316..9c5147100 100644 --- a/inst/params/default/weight_annotations.yaml +++ b/inst/params/default/weight_annotations.yaml @@ -184,6 +184,9 @@ options: #' Do not use it. BOOLEAN force: no + #' Filter high confidence candidates only. BOOLEAN + high_confidence: yes + #' Remove ties. BOOLEAN remove_ties: no diff --git a/inst/params/prepare_params.yaml b/inst/params/prepare_params.yaml index bc8011638..374fcd74c 100644 --- a/inst/params/prepare_params.yaml +++ b/inst/params/prepare_params.yaml @@ -30,5 +30,7 @@ organisms: #' Example: "Homo sapiens". STRING taxon: ~ options: + #' Filter high confidence candidates only. BOOLEAN + high_confidence: yes #' Do you want to summarize all candidates per feature to a single row? BOOLEAN summarise: no diff --git a/inst/params/prepare_params_advanced.yaml b/inst/params/prepare_params_advanced.yaml index 1c82cd8c3..3fe4474d8 100644 --- a/inst/params/prepare_params_advanced.yaml +++ b/inst/params/prepare_params_advanced.yaml @@ -714,6 +714,9 @@ options: #' Do not use it. BOOLEAN force: no + #' Filter high confidence candidates only. BOOLEAN + high_confidence: yes + #' Remove ties. BOOLEAN remove_ties: no diff --git a/inst/pipelines/_targets.R b/inst/pipelines/_targets.R index 836be5d6b..a96576426 100644 --- a/inst/pipelines/_targets.R +++ b/inst/pipelines/_targets.R @@ -1835,6 +1835,7 @@ list( par_wei_ann$annotations$thresholds$ms1$condition, ms1_only = par_wei_ann$annotations$ms1only, compounds_names = par_wei_ann$options$compounds_names, + high_confidence = par_wei_ann$options$high_confidence, remove_ties = par_wei_ann$options$remove_ties, summarise = par_wei_ann$options$summarise, pattern = par_wei_ann$files$pattern, @@ -2693,6 +2694,7 @@ list( minimal_ms1_condition = benchmark_def_wei_ann$annotations$thresholds$ms1$condition, compounds_names = benchmark_def_wei_ann$options$compounds_names, + high_confidence = FALSE, remove_ties = benchmark_def_wei_ann$options$remove_ties, summarise = benchmark_def_wei_ann$options$summarise, pattern = benchmark_def_wei_ann$files$pattern, diff --git a/inst/scripts/docopt/weight_annotations.txt b/inst/scripts/docopt/weight_annotations.txt index b6ab80e19..e2d7d8a9e 100644 --- a/inst/scripts/docopt/weight_annotations.txt +++ b/inst/scripts/docopt/weight_annotations.txt @@ -2,7 +2,7 @@ You can use this script with the following example: Rscript inst/scripts/weight_annotations.R Usage: - weight_annotations.R [--ann-can-fin=] [--ann-ms1only=] [--ann-thr-ms1-bio=] [--ann-thr-ms1-che=] [--ann-thr-ms1-con=] [--ann-thr-con=] [--fil-ann-fil=] [--fil-ann-pre-can=] [--fil-ann-pre-for=] [--fil-ann-pro=] [--fil-lib-sop-mer=] [--fil-net-spe-edg-pre=] [--fil-met-pre=] [--wei-glo-bio=] [--wei-glo-che=] [--wei-glo-spe=] [--wei-bio-01=] [--wei-bio-02=] [--wei-bio-03=] [--wei-bio-04=] [--wei-bio-05=] [--wei-bio-06=] [--wei-bio-07=] [--wei-bio-08=] [--wei-bio-09=] [--wei-bio-10=] [--wei-bio-11=] [--wei-bio-12=] [--wei-bio-13=] [--wei-bio-14=] [--wei-bio-15=] [--wei-che-11=] [--wei-che-12=] [--wei-che-13=] [--wei-che-14=] [--wei-che-21=] [--wei-che-22=] [--wei-che-23=] [--compounds-names=] [--remove-ties=] [--summarise=] [--force=] + weight_annotations.R [--ann-can-fin=] [--ann-ms1only=] [--ann-thr-ms1-bio=] [--ann-thr-ms1-che=] [--ann-thr-ms1-con=] [--ann-thr-con=] [--fil-ann-fil=] [--fil-ann-pre-can=] [--fil-ann-pre-for=] [--fil-ann-pro=] [--fil-lib-sop-mer=] [--fil-net-spe-edg-pre=] [--fil-met-pre=] [--wei-glo-bio=] [--wei-glo-che=] [--wei-glo-spe=] [--wei-bio-01=] [--wei-bio-02=] [--wei-bio-03=] [--wei-bio-04=] [--wei-bio-05=] [--wei-bio-06=] [--wei-bio-07=] [--wei-bio-08=] [--wei-bio-09=] [--wei-bio-10=] [--wei-bio-11=] [--wei-bio-12=] [--wei-bio-13=] [--wei-bio-14=] [--wei-bio-15=] [--wei-che-11=] [--wei-che-12=] [--wei-che-13=] [--wei-che-14=] [--wei-che-21=] [--wei-che-22=] [--wei-che-23=] [--compounds-names=] [--high-confidence=] [--remove-ties=] [--summarise=] [--force=] Arguments: ann-can-fin Number of final candidates. INTEGER @@ -11,7 +11,7 @@ Arguments: ann-thr-ms1-che Minimal chemical score to keep MS1 only annotation. FLOAT ann-thr-ms1-con Condition to be used to retain candidates. Must be "OR" or "AND". Example: Minimum 0.5 biological AND 0.5 chemical. STRING ann-thr-con Minimal consistency score (chemical) to consider a class. FLOAT - + fil-ann-fil Filtered annotation file. STRING fil-ann-pre-can List of prepared canopus annotations. STRING fil-ann-pre-for List of prepared formula annotations. STRING @@ -50,6 +50,7 @@ Arguments: compounds-names Report compounds names. Can be very large. BOOLEAN force Do not use it. BOOLEAN + high-confidence Report high confidence candidates only. BOOLEAN remove-ties Remove ties. BOOLEAN summarise Summarize results (1 row per feature). BOOLEAN diff --git a/man/clean_chemo.Rd b/man/clean_chemo.Rd index fe338b0c9..24c6e9ed0 100644 --- a/man/clean_chemo.Rd +++ b/man/clean_chemo.Rd @@ -14,6 +14,7 @@ clean_chemo( minimal_ms1_bio = get("minimal_ms1_bio", envir = parent.frame()), minimal_ms1_chemo = get("minimal_ms1_chemo", envir = parent.frame()), minimal_ms1_condition = get("minimal_ms1_condition", envir = parent.frame()), + high_confidence = get("high_confidence", envir = parent.frame()), remove_ties = get("remove_ties", envir = parent.frame()), summarise = get("summarise", envir = parent.frame()) ) @@ -37,6 +38,8 @@ structure - organism pairs} \item{minimal_ms1_condition}{Condition to be used. Must be "OR" or "AND".} +\item{high_confidence}{Report high confidence candidates only. BOOLEAN} + \item{remove_ties}{Remove ties. BOOLEAN} \item{summarise}{Boolean. summarise results (1 row per feature)} diff --git a/man/filter_high_confidence_only.Rd b/man/filter_high_confidence_only.Rd new file mode 100644 index 000000000..ff297f05b --- /dev/null +++ b/man/filter_high_confidence_only.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/filter_high_confidence_only.R +\name{filter_high_confidence_only} +\alias{filter_high_confidence_only} +\title{Filter high confidence only +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}}} +\usage{ +filter_high_confidence_only(df, score_bio_min = 0.85, score_ini_min = 0.75) +} +\arguments{ +\item{df}{Dataframe} + +\item{score_bio_min}{Minimal biological score. Current default to 0.85.} + +\item{score_ini_min}{Minimal initial score. Current default to 0.75.} +} +\description{ +This function filters highly confident annotations only. +} +\examples{ +NULL +} diff --git a/man/transform_score_sirius_csi.Rd b/man/transform_score_sirius_csi.Rd index c21384488..469e8a4e4 100644 --- a/man/transform_score_sirius_csi.Rd +++ b/man/transform_score_sirius_csi.Rd @@ -11,7 +11,7 @@ transform_score_sirius_csi(csi_score, K = 50, scale = 10) \item{K}{Shift} -\item{anyone}{scale} +\item{scale}{Scale} } \value{ A mass diff --git a/man/weight_annotations.Rd b/man/weight_annotations.Rd index e5c5f9f17..d38bb5f38 100644 --- a/man/weight_annotations.Rd +++ b/man/weight_annotations.Rd @@ -76,6 +76,7 @@ weight_annotations( "weight_annotations")$annotations$thresholds$ms1$condition, ms1_only = get_params(step = "weight_annotations")$annotations$ms1only, compounds_names = get_params(step = "weight_annotations")$options$compounds_names, + high_confidence = get_params(step = "weight_annotations")$options$high_confidence, remove_ties = get_params(step = "weight_annotations")$options$remove_ties, summarise = get_params(step = "weight_annotations")$options$summarise, pattern = get_params(step = "weight_annotations")$files$pattern, @@ -189,6 +190,8 @@ match (should be lower than \verb{NPC class})} \item{compounds_names}{Report compounds names. Can be very large. BOOLEAN} +\item{high_confidence}{Report high confidence candidates only. BOOLEAN} + \item{remove_ties}{Remove ties. BOOLEAN} \item{summarise}{Summarize results (1 row per feature). BOOLEAN} diff --git a/tests/testthat/_snaps/shinytest2/001.json b/tests/testthat/_snaps/shinytest2/001.json index 19711411d..f41f6d800 100644 --- a/tests/testthat/_snaps/shinytest2/001.json +++ b/tests/testthat/_snaps/shinytest2/001.json @@ -44,6 +44,7 @@ "force": false, "gnps_id": "", "gnps_workflow": "fbmn", + "high_confidence": true, "launch": 0, "lib_spe_exp_mgf": null, "lib_spe_is_mgf": null, diff --git a/tests/testthat/test-functions.R b/tests/testthat/test-functions.R index 405fef835..dfa504397 100644 --- a/tests/testthat/test-functions.R +++ b/tests/testthat/test-functions.R @@ -47,6 +47,11 @@ test_that(desc = "Test functions", code = { user_gnps = "", user_filename = "Foo" ) + replace_id( + x = "example/123456_features.tsv", + user_gnps = "Foo", + user_filename = "Foo" + ) ## Get all files ### Features table @@ -388,6 +393,9 @@ test_that(desc = "Test functions", code = { prepare_features_tables() ## Performing MS1 annotation + ### Adducts + parse_adduct("foo bar") # to check for error + ## TODO check values later on calculate_mass_of_m(adduct_string = "[2M1-2H2O+NaCl+H]2+", mz = 123.456) calculate_mass_of_m(adduct_string = "[M+Na]+", mz = 123.456) @@ -529,20 +537,21 @@ test_that(desc = "Test functions", code = { candidates_final = 1, minimal_ms1_bio = 0.8, minimal_ms1_condition = "AND", - compounds_names = TRUE + compounds_names = TRUE, + high_confidence = FALSE ) ## CLI arguments check arguments <- character() - arguments$ann_can_fin <- "x" - arguments$ann_ms1only <- "x" - arguments$ann_ms2_app <- "x" - arguments$ann_thr_con <- "x" - arguments$ann_thr_ms1_bio <- "x" - arguments$ann_thr_ms1_che <- "x" + arguments$ann_can_fin <- 0 + arguments$ann_ms1only <- TRUE + arguments$ann_ms2_app <- TRUE + arguments$ann_thr_con <- 0 + arguments$ann_thr_ms1_bio <- 0 + arguments$ann_thr_ms1_che <- 0 arguments$ann_thr_ms1_con <- "x" - arguments$ann_thr_ms2_sim_ann <- "x" - arguments$ann_thr_ms2_sim_edg <- "x" + arguments$ann_thr_ms2_sim_ann <- 0 + arguments$ann_thr_ms2_sim_edg <- 0 arguments$fil_pat <- "x" arguments$fil_ann_raw_spe <- "x" arguments$fil_ann_raw_spe_gnp <- "x" @@ -588,15 +597,15 @@ test_that(desc = "Test functions", code = { arguments$ms_clu_pos <- "x" arguments$ms_neu <- "x" arguments$ms_pol <- "x" - arguments$ms_thr_ms2_int <- "x" - arguments$ms_tol_mas_ppm_ms1 <- "x" - arguments$ms_tol_mas_ppm_ms2 <- "x" - arguments$ms_tol_mas_dal_ms1 <- "x" - arguments$ms_tol_mas_dal_ms2 <- "x" - arguments$ms_tol_rt_add <- "x" - arguments$ms_tol_rt_lib <- "x" + arguments$ms_thr_ms2_int <- 0 + arguments$ms_tol_mas_ppm_ms1 <- 0 + arguments$ms_tol_mas_ppm_ms2 <- 0 + arguments$ms_tol_mas_dal_ms1 <- 0 + arguments$ms_tol_mas_dal_ms2 <- 0 + arguments$ms_tol_rt_add <- 0 + arguments$ms_tol_rt_lib <- 0 arguments$names_adduct <- "x" - arguments$names_extension <- "x" + arguments$names_extension <- TRUE arguments$names_features <- "x" arguments$names_filename <- "x" arguments$names_inchikey <- "x" @@ -627,47 +636,48 @@ test_that(desc = "Test functions", code = { arguments$names_source <- "x" arguments$names_target <- "x" arguments$names_taxon <- "x" - arguments$org_can <- "x" - arguments$org_fil_mod <- "x" + arguments$org_can <- 0 + arguments$org_fil_mod <- TRUE arguments$org_fil_lev <- "x" arguments$org_fil_val <- "x" arguments$org_tax <- "x" arguments$too_met <- "x" arguments$too_net_spe_com <- "x" arguments$too_net_spe_edg <- "x" + arguments$too_sir_ver <- 0 arguments$too_tax_bio <- "x" arguments$too_tax_che <- "x" arguments$units_rt <- "x" - arguments$wei_glo_bio <- "x" - arguments$wei_glo_che <- "x" - arguments$wei_glo_spe <- "x" - arguments$wei_bio_01 <- "x" - arguments$wei_bio_02 <- "x" - arguments$wei_bio_03 <- "x" - arguments$wei_bio_04 <- "x" - arguments$wei_bio_05 <- "x" - arguments$wei_bio_06 <- "x" - arguments$wei_bio_07 <- "x" - arguments$wei_bio_08 <- "x" - arguments$wei_bio_09 <- "x" - arguments$wei_bio_10 <- "x" - arguments$wei_bio_11 <- "x" - arguments$wei_bio_12 <- "x" - arguments$wei_bio_13 <- "x" - arguments$wei_bio_14 <- "x" - arguments$wei_bio_15 <- "x" - arguments$wei_che_11 <- "x" - arguments$wei_che_12 <- "x" - arguments$wei_che_13 <- "x" - arguments$wei_che_14 <- "x" - arguments$wei_che_21 <- "x" - arguments$wei_che_22 <- "x" - arguments$wei_che_23 <- "x" - arguments$compounds_names <- "x" - arguments$force <- "x" - arguments$nit_rul <- "x" - arguments$remove_ties <- "x" - arguments$summarise <- "x" + arguments$wei_glo_bio <- 0 + arguments$wei_glo_che <- 0 + arguments$wei_glo_spe <- 0 + arguments$wei_bio_01 <- 0 + arguments$wei_bio_02 <- 0 + arguments$wei_bio_03 <- 0 + arguments$wei_bio_04 <- 0 + arguments$wei_bio_05 <- 0 + arguments$wei_bio_06 <- 0 + arguments$wei_bio_07 <- 0 + arguments$wei_bio_08 <- 0 + arguments$wei_bio_09 <- 0 + arguments$wei_bio_10 <- 0 + arguments$wei_bio_11 <- 0 + arguments$wei_bio_12 <- 0 + arguments$wei_bio_13 <- 0 + arguments$wei_bio_14 <- 0 + arguments$wei_bio_15 <- 0 + arguments$wei_che_11 <- 0 + arguments$wei_che_12 <- 0 + arguments$wei_che_13 <- 0 + arguments$wei_che_14 <- 0 + arguments$wei_che_21 <- 0 + arguments$wei_che_22 <- 0 + arguments$wei_che_23 <- 0 + arguments$compounds_names <- TRUE + arguments$force <- TRUE + arguments$high_confidence <- TRUE + arguments$remove_ties <- TRUE + arguments$summarise <- TRUE # Useless keep_peaks(x = 0, prop = 0)