# famat

# Introduction

The aim of famat is to allow users to determine functional links between metabolites and genes. These metabolites and genes lists may be related to a specific experiment/study, but famat only needs a gene symbols list and a Kegg Compound ids list. Using these lists, famat performs pathway enrichment analysis, direct interactions between elements inside pathways extraction, GO terms enrichment analysis, calculation of user’s elements centrality (number of direct interactions between an element and others inside a pathway) and extraction of information related to user’s elements.

Functions available are:

- path_enrich : pathways enrichment analysis
- interactions : direct interactions and centrality
- compl_data : GO terms enrichment analysis and user’s elements data extraction
- rshiny : use of previous function’s data in a shiny interface

# Installation

Run this command line to install famat.

    if (!requireNamespace("BiocManager", quietly = TRUE))
        install.packages("BiocManager")

    BiocManager::install("famat")

Then, load famat using library.

    library(famat)
    library(mgcv)

# path_enrich

This function uses the metabolite list and the gene list provided by user to perform pathway enrichment analysis. Metabolites ids need to be Kegg compound ids, and genes ids need to be gene symbols. Three pathway databases are available: Kegg (“KEGG”), Wikipathways (“WP”) and Reactome (“REAC”).

    data(genes)
    data(meta)

    listr=path_enrich("REAC", meta, genes)

    ##

    ## 'select()' returned 1:1 mapping between keys and columns

    ## Loading required package: org.Hs.eg.db

    ## Loading required package: AnnotationDbi

    ## Loading required package: stats4

    ## Loading required package: BiocGenerics

    ## Loading required package: generics

    ##
    ## Attaching package: 'generics'

    ## The following objects are masked from 'package:base':
    ##
    ##     as.difftime, as.factor, as.ordered, intersect, is.element, setdiff,
    ##     setequal, union

    ##
    ## Attaching package: 'BiocGenerics'

    ## The following objects are masked from 'package:stats':
    ##
    ##     IQR, mad, sd, var, xtabs

    ## The following objects are masked from 'package:base':
    ##
    ##     Filter, Find, Map, Position, Reduce, anyDuplicated, aperm, append,
    ##     as.data.frame, basename, cbind, colnames, dirname, do.call,
    ##     duplicated, eval, evalq, get, grep, grepl, is.unsorted, lapply,
    ##     mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int,
    ##     rank, rbind, rownames, sapply, saveRDS, table, tapply, unique,
    ##     unsplit, which.max, which.min

    ## Loading required package: Biobase

    ## Welcome to Bioconductor
    ##
    ##     Vignettes contain introductory material; view with
    ##     'browseVignettes()'. To cite Bioconductor, see
    ##     'citation("Biobase")', and for packages 'citation("pkgname")'.

    ## Loading required package: IRanges

    ## Loading required package: S4Vectors

    ##
    ## Attaching package: 'S4Vectors'

    ## The following object is masked from 'package:utils':
    ##
    ##     findMatches

    ## The following objects are masked from 'package:base':
    ##
    ##     I, expand.grid, unname

    ##
    ## Attaching package: 'IRanges'

    ## The following object is masked from 'package:nlme':
    ##
    ##     collapse

    ## your input componentList have 2 components in background

    ## your input componentList have 2 components in network

Results are then stored into a list. This list must be used in “interactions” function. Pathways enrichment analysis is performed on genes using gprofiler2 and on metabolites using MPINet.

# interactions

“Interactions” find all direct interactions between genes and metabolites of user’s lists in pathways obtained through pathways enrichment analysis, performed on KEGG, Reactome and Wikipathways pathways. So, this function needs results of “path_enrich” function performed on all these databases. Using direct interactions, centrality of a user’s element inside a pathway is calculated.

    data(listk)
    data(listr)
    data(listw)
    data(all_compounds_chebi)
    interactions_result = interactions(listk, listr, listw)

Results are then stored into a list. This list must be used in “compl_data” function. Direct interactions were collected from BioPax, KGML and GPML files parsed with PaxtoolsR, graphite and author’s parsers. “Interactions” just get interactions of enriched pathways from this direct interactions list.

# compl_data

This function complete information about elements and pathway obtained with “path_enrich” and “interactions”. A GO term enrichment analysis is performed on genes, pathways obtained through pathways enrichment analysis are filtered (they must contain at least 1/5 elements in user’s lists or a direct interaction between user’s elements) and a hierarchy parent-child is built with pathways and enriched GO terms. GO terms enrichment analysis is performed using clusterProfiler. Then, dataframes containing information about elements, interactions and GO terms are created, with an heatmap showing which user’s elements are in which pathways.

    data(interactions_result)

    compl_data_result <- compl_data(interactions_result)

Results are then stored into a list. This list must be used in “rshiny” function.

# rshiny

All results obtained with the three previous functions can be visualized using “rshiny” function. shiny is a R package allowing to create interfaces.

    data(compl_data_result)

    rshiny(compl_data_result)

After using this command line, the shiny interface appear.

Interface’s tabs are:

- Elements : Genes, metabolites, interactions, and information related to these elements. Also, filters can be applied to get pathways/enriched GO terms containing (or not) only certain elements.
- Pathways : Heatmap showing pathways hierarchies and user’s elements in these pathways. Filters can be applied to get pathways corresponding to certain pathways or interactions types, or to filter genes by their type or enriched GO terms. Also, the heatmap can be colored using interactions types or centrality. Finally, click on a heatmap’s cell makes a pop up appear, with information about the pathway selected.
- GO Molecular Function : Enriched GO MF terms hierarchies with information about them. Click on a GO term makes a pop up appear with data about the GO term selected.
- GO Biological Process : Enriched GO BP terms hierarchies with information about them. Click on a GO term makes a pop up appear with data about the GO term selected.
- History : Every time a filter is applied, new results are saved in history. So, user can go back if a mistake was done.
- Elements not in pathways : some user’s elements may not be in pathways obtained by pathways enrichment analysis and filtered by compl_data function. So, they are printed in this tab to show they were taken into account.

Finally, a “Reset” button was made to go back to the initial results.

# Conclusion: how to use famat

To conclude, famat has four important functions which have to be used one after another:

    data(genes)
    data(meta)
    data(all_compounds_chebi)

    listk <- path_enrich("KEGG", meta, genes)
    listr <- path_enrich("REAC", meta, genes)
    listw <- path_enrich("WP", meta, genes)

    interactions_result <- interactions(listk, listr, listw)

    compl_data_result <- compl_data(interactions_result)

    rshiny(compl_data_result)

# References

- Yanjun Xu, Chunquan Li and Xia Li (2013). MPINet: The package can implement the network-based metabolite pathway identification of pathways.. R package version 1.0. https://CRAN.R-project.org/package=MPINet
- Liis Kolberg and Uku Raudvere (2020). gprofiler2: Interface to the ‘g:Profiler’ Toolset. R package version 0.2.0. https://CRAN.R-project.org/package=gprofiler2
- Luna, A., Babur, O., Aksoy, A. B, Demir, E., Sander, C. (2015). “PaxtoolsR: Pathway Analysis in R Using Pathway Commons.” Bioinformatics.
- Sales G, Calura E, Cavalieri D, Romualdi C (2012). “graphite - a Bioconductor package to convert pathway topology to gene network.” BMC Bioinformatics. https://bmcbioinformatics.biomedcentral.com/articles/10 . 1186/1471-2105-13-20.
- Guangchuang Yu, Li-Gen Wang, Yanyan Han and Qing-Yu He.clusterProfiler: an R package for comparing biological themes among gene clusters. OMICS: A Journal of Integrative Biology 2012, 16(5):284-287

# Session Info

    sessionInfo()

    ## R version 4.5.2 (2025-10-31)
    ## Platform: x86_64-pc-linux-gnu
    ## Running under: Ubuntu 24.04.4 LTS
    ##
    ## Matrix products: default
    ## BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
    ## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so;  LAPACK version 3.12.0
    ##
    ## locale:
    ##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
    ##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=C
    ##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
    ##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
    ##  [9] LC_ADDRESS=C               LC_TELEPHONE=C
    ## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
    ##
    ## time zone: Etc/UTC
    ## tzcode source: system (glibc)
    ##
    ## attached base packages:
    ## [1] stats4    stats     graphics  grDevices utils     datasets  methods
    ## [8] base
    ##
    ## other attached packages:
    ##  [1] org.Hs.eg.db_3.22.0  AnnotationDbi_1.72.0 IRanges_2.44.0
    ##  [4] S4Vectors_0.48.0     Biobase_2.70.0       BiocGenerics_0.56.0
    ##  [7] generics_0.1.4       mgcv_1.9-4           nlme_3.1-168
    ## [10] famat_1.20.3         BiocStyle_2.38.0
    ##
    ## loaded via a namespace (and not attached):
    ##   [1] RColorBrewer_1.1-3      sys_3.4.3               jsonlite_2.0.0
    ##   [4] tidydr_0.0.6            magrittr_2.0.4          ggtangle_0.1.1
    ##   [7] farver_2.1.2            rmarkdown_2.30          fs_1.6.6
    ##  [10] vctrs_0.7.1             memoise_2.0.1           ggtree_4.0.4
    ##  [13] htmltools_0.5.9         gridGraphics_0.5-1      sass_0.4.10
    ##  [16] bslib_0.10.0            htmlwidgets_1.6.4       plyr_1.8.9
    ##  [19] cachem_1.1.0            buildtools_1.0.0        igraph_2.2.2
    ##  [22] lifecycle_1.0.5         pkgconfig_2.0.3         Matrix_1.7-4
    ##  [25] R6_2.6.1                fastmap_1.2.0           gson_0.1.0
    ##  [28] digest_0.6.39           aplot_0.2.9             enrichplot_1.30.4
    ##  [31] ggnewscale_0.5.2        patchwork_1.3.2         RSQLite_2.4.6
    ##  [34] httr_1.4.8              polyclip_1.10-7         compiler_4.5.2
    ##  [37] bit64_4.6.0-1           fontquiver_0.2.1        withr_3.0.2
    ##  [40] S7_0.2.1                graphite_1.56.0         BiocParallel_1.44.0
    ##  [43] viridis_0.6.5           DBI_1.2.3               ggforce_0.5.0
    ##  [46] R.utils_2.13.0          MASS_7.3-65             rappdirs_0.3.4
    ##  [49] tools_4.5.2             otel_0.2.0              ape_5.8-1
    ##  [52] scatterpie_0.2.6        R.oo_1.27.1             glue_1.8.0
    ##  [55] GOSemSim_2.36.0         grid_4.5.2              cluster_2.1.8.2
    ##  [58] reshape2_1.4.5          fgsea_1.36.2            gtable_0.3.6
    ##  [61] R.methodsS3_1.8.2       tidyr_1.3.2             data.table_1.18.2.1
    ##  [64] tidygraph_1.3.1         XVector_0.50.0          ggrepel_0.9.6
    ##  [67] pillar_1.11.1           stringr_1.6.0           yulab.utils_0.2.4
    ##  [70] splines_4.5.2           dplyr_1.2.0             tweenr_2.0.3
    ##  [73] treeio_1.34.0           lattice_0.22-9          bit_4.6.0
    ##  [76] tidyselect_1.2.1        fontLiberation_0.1.0    GO.db_3.22.0
    ##  [79] maketools_1.3.2         Biostrings_2.78.0       reactome.db_1.95.0
    ##  [82] knitr_1.51              fontBitstreamVera_0.1.1 gridExtra_2.3
    ##  [85] Seqinfo_1.0.0           xfun_0.56               graphlayouts_1.2.3
    ##  [88] stringi_1.8.7           lazyeval_0.2.2          ggfun_0.2.0
    ##  [91] yaml_2.3.12             ReactomePA_1.54.0       evaluate_1.0.5
    ##  [94] codetools_0.2-20        ggraph_2.2.2            gdtools_0.5.0
    ##  [97] tibble_3.3.1            qvalue_2.42.0           BiocManager_1.30.27
    ## [100] graph_1.88.1            ggplotify_0.1.3         cli_3.6.5
    ## [103] ontologyIndex_2.12      systemfonts_1.3.1       jquerylib_0.1.4
    ## [106] Rcpp_1.1.1              png_0.1-8               parallel_4.5.2
    ## [109] ggplot2_4.0.2           blob_1.3.0              clusterProfiler_4.18.4
    ## [112] DOSE_4.4.0              viridisLite_0.4.3       tidytree_0.4.7
    ## [115] ggiraph_0.9.6           scales_1.4.0            purrr_1.2.1
    ## [118] crayon_1.5.3            rlang_1.1.7             cowplot_1.2.0
    ## [121] fastmatch_1.1-8         KEGGREST_1.50.0