# Get Started

Compiled date: 2026-02-23

Last edited: 2024-01-21

License: GPL-3

# Installation

To install the Bioconductor version of the POMA package, run the following code:

    # install.packages("BiocManager")
    BiocManager::install("POMA")

# Load POMA

    library(POMA)
    library(ggtext)
    library(magrittr)

# The POMA Workflow

The `POMA` package functions are organized into three sequential, distinct blocks: Data Preparation, Pre-processing, and Statistical Analysis.

## Data Preparation

The `SummarizedExperiment` package from Bioconductor offers well-defined computational data structures for representing various types of omics experiment data (Morgan et al. 2020). Utilizing these data structures can significantly improve data analysis. `POMA` leverages `SummarizedExperiment` objects, enhancing the reusability of existing methods for this class and contributing to more robust and reproducible workflows.

The workflow begins with either loading or creating a `SummarizedExperiment` object. Typically, your data might be stored in separate matrices and/or data frames. The `PomaCreateObject` function simplifies this step by quickly building a SummarizedExperiment object for you.

    # create an SummarizedExperiment object from two separated data frames
    target <- readr::read_csv("your_target.csv")
    features <- readr::read_csv("your_features.csv")

    data <- PomaCreateObject(metadata = target, features = features)

Alternatively, if your data is already in a `SummarizedExperiment` object, you can proceed directly to the pre-processing step. This vignette uses example data provided in `POMA`.

    # load example data
    data("st000336")

    st000336
    > class: SummarizedExperiment
    > dim: 31 57
    > metadata(0):
    > assays(1): ''
    > rownames(31): x1_methylhistidine x3_methylhistidine ... pyruvate
    >   succinate
    > rowData names(0):
    > colnames(57): 1 2 ... 56 57
    > colData names(2): group steroids

## Pre Processing

### Missing Value Imputation

    imputed <- st000336 %>%
      PomaImpute(method = "knn", zeros_as_na = TRUE, remove_na = TRUE, cutoff = 20)
    > 2 features removed.

    imputed
    > class: SummarizedExperiment
    > dim: 29 57
    > metadata(0):
    > assays(1): ''
    > rownames(29): x1_methylhistidine x3_methylhistidine ... pyruvate
    >   succinate
    > rowData names(0):
    > colnames(57): 1 2 ... 56 57
    > colData names(2): group steroids

### Normalization

    normalized <- imputed %>%
      PomaNorm(method = "log_pareto")

    normalized
    > class: SummarizedExperiment
    > dim: 29 57
    > metadata(0):
    > assays(1): ''
    > rownames(29): x1_methylhistidine x3_methylhistidine ... pyruvate
    >   succinate
    > rowData names(0):
    > colnames(57): 1 2 ... 56 57
    > colData names(2): group steroids

#### Normalization effect

    PomaBoxplots(imputed, x = "samples") # data before normalization

    PomaBoxplots(normalized, x = "samples") # data after normalization

    PomaDensity(imputed, x = "features") # data before normalization

    PomaDensity(normalized, x = "features") # data after normalization

### Outlier Detection

    PomaOutliers(normalized)$polygon_plot

    pre_processed <- PomaOutliers(normalized)$data
    pre_processed
    > class: SummarizedExperiment
    > dim: 29 52
    > metadata(0):
    > assays(1): ''
    > rownames(29): x1_methylhistidine x3_methylhistidine ... pyruvate
    >   succinate
    > rowData names(0):
    > colnames(52): 1 2 ... 56 57
    > colData names(2): group steroids

    # pre_processed %>%
    #   PomaUnivariate(method = "ttest") %>%
    #   magrittr::extract2("result")

    # imputed %>%
    #   PomaVolcano(pval = "adjusted", labels = TRUE)

    # pre_processed %>%
    #   PomaUnivariate(method = "mann") %>%
    #   magrittr::extract2("result")

    # PomaLimma(pre_processed, contrast = "Controls-DMD", adjust = "fdr")

    # poma_pca <- PomaMultivariate(pre_processed, method = "pca")

    # poma_pca$scoresplot +
    #   ggplot2::ggtitle("Scores Plot")

    # poma_plsda <- PomaMultivariate(pre_processed, method = "plsda")

    # poma_plsda$scoresplot +
    #   ggplot2::ggtitle("Scores Plot")

    # poma_plsda$errors_plsda_plot +
    #   ggplot2::ggtitle("Error Plot")

    # poma_cor <- PomaCorr(pre_processed, label_size = 8, coeff = 0.6)
    # poma_cor$correlations
    # poma_cor$corrplot
    # poma_cor$graph

    # PomaCorr(pre_processed, corr_type = "glasso", coeff = 0.6)$graph

    # alpha = 1 for Lasso
    # PomaLasso(pre_processed, alpha = 1, labels = TRUE)$coefficientPlot

    # poma_rf <- PomaRandForest(pre_processed, ntest = 10, nvar = 10)
    # poma_rf$error_tree

    # poma_rf$confusionMatrix$table

    # poma_rf$MeanDecreaseGini_plot

# Session Information

    sessionInfo()
    > R version 4.5.2 (2025-10-31)
    > Platform: x86_64-pc-linux-gnu
    > Running under: Ubuntu 24.04.3 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] stats     graphics  grDevices utils     datasets  methods   base
    >
    > other attached packages:
    > [1] magrittr_2.0.4   patchwork_1.3.2  ggtext_0.1.2     POMA_1.20.0
    > [5] BiocStyle_2.38.0
    >
    > loaded via a namespace (and not attached):
    >  [1] SummarizedExperiment_1.40.0 gtable_0.3.6
    >  [3] impute_1.84.0               xfun_0.56
    >  [5] bslib_0.10.0                ggplot2_4.0.2
    >  [7] Biobase_2.70.0              lattice_0.22-9
    >  [9] vctrs_0.7.1                 tools_4.5.2
    > [11] generics_0.1.4              parallel_4.5.2
    > [13] stats4_4.5.2                tibble_3.3.1
    > [15] cluster_2.1.8.2             pkgconfig_2.0.3
    > [17] Matrix_1.7-4                RColorBrewer_1.1-3
    > [19] S7_0.2.1                    S4Vectors_0.48.0
    > [21] lifecycle_1.0.5             compiler_4.5.2
    > [23] farver_2.1.2                stringr_1.6.0
    > [25] Seqinfo_1.0.0               permute_0.9-10
    > [27] litedown_0.9                htmltools_0.5.9
    > [29] sys_3.4.3                   buildtools_1.0.0
    > [31] sass_0.4.10                 yaml_2.3.12
    > [33] pillar_1.11.1               jquerylib_0.1.4
    > [35] tidyr_1.3.2                 MASS_7.3-65
    > [37] cachem_1.1.0                DelayedArray_0.36.0
    > [39] vegan_2.7-2                 abind_1.4-8
    > [41] nlme_3.1-168                commonmark_2.0.0
    > [43] tidyselect_1.2.1            digest_0.6.39
    > [45] stringi_1.8.7               dplyr_1.2.0
    > [47] purrr_1.2.1                 splines_4.5.2
    > [49] maketools_1.3.2             labeling_0.4.3
    > [51] fastmap_1.2.0               grid_4.5.2
    > [53] cli_3.6.5                   SparseArray_1.10.8
    > [55] S4Arrays_1.10.1             withr_3.0.2
    > [57] scales_1.4.0                rmarkdown_2.30
    > [59] XVector_0.50.0              matrixStats_1.5.0
    > [61] otel_0.2.0                  evaluate_1.0.5
    > [63] knitr_1.51                  GenomicRanges_1.62.1
    > [65] IRanges_2.44.0              viridisLite_0.4.3
    > [67] mgcv_1.9-4                  markdown_2.0
    > [69] rlang_1.1.7                 gridtext_0.1.6
    > [71] Rcpp_1.1.1                  glue_1.8.0
    > [73] BiocManager_1.30.27         xml2_1.5.2
    > [75] BiocGenerics_0.56.0         jsonlite_2.0.0
    > [77] R6_2.6.1                    MatrixGenerics_1.22.0

# References

Morgan, Martin, Valerie Obenchain, Jim Hester, and Hervé Pagès. 2020. SummarizedExperiment: SummarizedExperiment Container. https://bioconductor.org/packages/SummarizedExperiment.