# amanida_UserGuide

### v0.2.3

#### 2022-03-29

This vignette illustrates Amanida R package, which contains a collection of functions for computing a weighted meta-analysis in R using significance, relative change and study size. It explains how to conduct the meta-analysis, visualize the results and draw conclusions.

## Introduction

The widespread of metabolomics as a potential tool for clinical diagno-sis has increased the systematic reviews and meta-analysis on this topic. Meta-analysis is the statistical combination in a single estimate for results from primary studies answering the same question, which is a common practice in medical research. When raw data is not available to perform a meta-analysis, there are different approaches that can be applied but them require the standard deviation, that is used for effect size estimate calculation and weighted methods. Nowadays, there isn’t a tool to perform a weighted meta-analysis which could be applied to a dataset of overall results without the standard deviation. Meta-analysis tools base the study of effect size using the difference of means, but in case of metabolomics we found that the comparison between groups is disclosed using relative change. The purpose of amanida is to perform a weighted meta-analysis combining overall results based on statistical significance, relative change and study size. In Amanida, statistical significance and relative change are combined using weighted methods which do no require standard deviation, weighted Fisher for p-values and weighted average for fold-change, where the weight comes from study size.

Furthermore, Amanida also computes qualitative meta-analysis performing a vote-counting for compounds, including the option of only using identifier and trend labels.

### Installation

Amanida can be installed from CRAN repository, by:

install.packages("amanida")

library(amanida)

## Amanida meta-analysis: a tutorial

Here we show how to conduct a meta-analysis using Amanida approach. We are using a dataset obtained in systematic review and meta-analysis: Comprehensive Volatilome and Metabolome Signatures of Colorectal Cancer in Urine: A Systematic Review and Meta-Analysis Mallafré et al. Cancers 2021, 13(11), 2534; https://doi.org/10.3390/cancers13112534.

Before using Amanida is important the curation of the identifiers. The objective of a meta-analysis is to combine the different results of a same feature, therefore, it is important that all identifiers are in the same format.

### Import data

Dataset to analyse must include the following columns: identifier, p-value, fold-change, study size (N) and reference.

Once we have the dataset in a supported format (xls/xlsx, csv or txt), we import as follows:

coln = c("Compound Name", "P-value", "Fold-change", "N total", "References")
input_file <- getsampleDB()
datafile <- amanida_read(input_file, mode = "quan", coln, separator=";")
#> Loaded dataset with 143 rows which contains 120 different identifiers. There are 18 rows skipped from original dataset because contained NA values.

It creates a tibble which contain the data needed to perform the amanida meta-analysis. Note: missing data is ignored and negative values of fold-change are transformed to positive (1/value).

### Analysis

In this step will be performed the combination of overall results weightening by study size. Methods for combine results are:

• P-value: weighted p-values combination, which is a variant of Fisher’s method. A gamma distribution is used to assign non-integral weights proportional to study size to each p-value.

• Fold-change: logarithmic transformation (base 2) and then averaged with weighting by study size.

Note: Only with the object created by amanida_read function in mode = "quan" are able to compute the amanida meta-analysis.

It is also included a qualitative analysis, the vote-counting, that is computed by the sum of votes assigned as follows: votes are +1 for up-regulation, -1 for down-regulation and 0 if no trend.

amanida_result <- compute_amanida(datafile)

Note: The output include compound identifiers from public repositories such as PubChem or the Human Metabolite DataBase, if compounds are not used this could be avoided with comp.inf = F.

### Results and visualization

Combination results are disclosed in two tables

• meta-analysis results acces by amanida_result@stat
• vote-counting results acces by amanida_results@vote

#### Quantitative results

Amanida meta-analysis gives the combination for p-value and fold-change for each feature.

Trend variable correspond to the direrction of the combination, 1 means that the feature is increased in case group and -1 the opposite. N_total is the sum of the study sizes for that feature, which are disclosed in reference variable.

head(amanida_result@stat)
#> # A tibble: 6 × 6
#>   id                                      trend     pval    fc N_total reference
#>   <chr>                                   <dbl>    <dbl> <dbl>   <int> <chr>
#> 1 1,1,6-Trimethyl-1,2-dihydronaphthalene     -1 0.000391 0.224      60 [29] Por…
#> 2 1,3-Dithiane                                1 0.0189   3.43       60 [29] Por…
#> 3 1,5,5-Trimethyl-6-methylene-cyclohexene    -1 0.0342   0.596      60 [29] Por…
#> 4 1,6,7-Trimethylnaphthalene                 -1 0.000194 0.320      60 [29] Por…
#> 5 2,2,6-Trimethylcyclohexanone               -1 0.0298   0.348      60 [29] Por…
#> 6 2,3-Butanediol                             -1 0.000091 0.271     135 [43] Lie…

To observe the results of meta-analysis graphically is done with a volcano plot, where the log10(p-values) are plotted against the log2(fold-change). The cut-offs can be selected by the user, in case of fold-change we recommend values higher than 2, where it is considered to have biological meaningfulness.

Note: cut-off have to be indicated without log scale.

volcano_plot(amanida_result, cutoff = c(0.05,3.5))
#> The cut-off used are 0.05 for p-value (1.3 in log10 scale) and 3.5 for fold-change (1.81 in log2 scale).

We will consider that a feature have statistical significance if it is over the cut-offs threshold (dashed lines).

#### Qualitative results

Optionally we van observe the qualitative results. A bar plot shows the result of vote-counting.

Note: output is restricted to 30 compounds to facilitate the readability. To visualize less compounds increase counts parameter.

vote_plot(amanida_result, counts = 1)
#> Cut-off for votes is 1.
#> Too much values, only showing 30 highest values. Please check counts parameter.

Note: The output include compound identifiers from public repositories such as PubChem or the Human Metabolite DataBase, if compounds are not used this could be avoided with comp.inf = F.

With vote plot discrepancies in compounds behaviour are not detected at first glance, and we suggest to combine the results with the explore plot. Discrepancies in results are shown when type = "mix" is used:

• counts parameter: this value indicate the minimum votes to show the results.

Note: output is restricted to 25 compounds to facilitate the readability. To visualize less compounds increase counts parameter.

explore_plot(sample_data, type = "mix", counts = 1)
#> Cut-off for votes is 1.

In sample data we observe some compounds over the cut-off threshold, then we check the consistency of result. In this case, compounds with more than one report and statistical significance are Hippuric acid and Phenol. Both of them have consistency as all reports results are in the same trend. We can conclude that for Hippuric acid and Phenol have evidences to reject the null hypothesis.

Note: compounds with both up-regulated and down-regulated tendencies points to low consistency.

## Amanida report

All computations and functions discussed above can be obtained straightforward in an html document. From scratch amanida_report computes the meta-analysis and display the results graphically.

It needs the following parameters:

• file: path to the dataset where is the data to import it. It is the original file xlsx, xls, csv or txt.
• separator: symbol used in the dataset to separate the different items, i.e. if you have a csv file you will use separator = “,”.
• analysis_type: parameter to choose which type of meta-analysis perform.
• “quan-qual”: for quantitative and qualitative meta-analysis
• “quan”: for quantitative meta-analysis
• “qual”: for qualitative meta-analysis
• column_id: vector containing the name of columns to select from the original dataset. It has to be in order identification, p-values, fold-changes, sample size and reference.
• pvalue_cutoff: numerical value to indicate the threshold on p-values. Recommended 0.05.
• fc_cutoff: numerical value to indicate the threshold on fold-change. Recommended to use values > 2.
• votecount_lim: numerical value to indicate the threshold for qualitative graphics.
• path: path to save the html created, otherwise the file will be saved in a temporal folder.
• comp_inf: to include information about metabolites from public databases such as PubChem, HMDB or KEGG.
column_id = c("Compound Name", "P-value", "Fold-change", "N total", "References")
input_file <- getsampleDB()

amanida_report(input_file,
separator = ";",
analysis_type = "quan-qual",
column_id = column_id,
pvalue_cutoff = 0.05,
fc_cutoff = 4,
votecount_lim = 2,
comp_inf = F)

The report will be saved in the working directory.

## Session Info

sessionInfo()
#> R version 4.1.0 (2021-05-18)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Big Sur 10.16
#>
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] C/es_ES.UTF-8/es_ES.UTF-8/C/es_ES.UTF-8/es_ES.UTF-8
#>
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base
#>
#> other attached packages:
#> [1] amanida_0.2.3
#>
#> loaded via a namespace (and not attached):
#>  [1] ggrepel_0.9.1     Rcpp_1.0.8        svglite_2.1.0     lubridate_1.8.0
#>  [5] tidyr_1.2.0       assertthat_0.2.1  digest_0.6.29     utf8_1.2.2
#>  [9] R6_2.5.1          cellranger_1.1.0  backports_1.4.1   reprex_2.0.1
#> [13] evaluate_0.14     highr_0.9         httr_1.4.2        ggplot2_3.3.5
#> [17] pillar_1.7.0      rlang_1.0.1       readxl_1.3.1      rstudioapi_0.13
#> [21] jquerylib_0.1.4   rmarkdown_2.11    labeling_0.4.2    webshot_0.5.2
#> [25] readr_2.1.2       stringr_1.4.0     bit_4.0.4         munsell_0.5.0
#> [29] broom_0.7.12      compiler_4.1.0    modelr_0.1.8      xfun_0.29
#> [33] pkgconfig_2.0.3   systemfonts_1.0.4 htmltools_0.5.2   tidyselect_1.1.1
#> [37] tibble_3.1.6      webchem_1.1.2     fansi_1.0.2       viridisLite_0.4.0
#> [41] crayon_1.5.0      dplyr_1.0.8       tzdb_0.2.0        dbplyr_2.1.1
#> [45] withr_2.4.3       grid_4.1.0        jsonlite_1.7.3    gtable_0.3.0
#> [49] lifecycle_1.0.1   DBI_1.1.2         magrittr_2.0.2    scales_1.1.1
#> [53] vroom_1.5.7       cli_3.2.0         stringi_1.7.6     farver_2.1.0
#> [57] fs_1.5.2          tidyverse_1.3.1   xml2_1.3.3        bslib_0.3.1
#> [61] ellipsis_0.3.2    generics_0.1.2    vctrs_0.3.8       kableExtra_1.3.4
#> [65] data.tree_1.0.0   tools_4.1.0       forcats_0.5.1     bit64_4.0.5
#> [69] glue_1.6.1        purrr_0.3.4       hms_1.1.1         parallel_4.1.0
#> [73] fastmap_1.1.0     yaml_2.2.2        colorspace_2.0-2  rvest_1.0.2
#> [77] knitr_1.37        haven_2.4.3       sass_0.4.0