Get started with limpca.

R-CMD-check

Installation

remotes::install_github("ManonMartin/limpca", dependencies = TRUE)
library("limpca")

Note that if you would like to build the vignettes, you have to install BiocStyle (from Bioconductor) and rmarkdown packages before installing limpca with the following command: remotes::install_github("ManonMartin/limpca", dependencies = TRUE, build_vignettes = TRUE).

For any enquiry, you can send an email to the package authors: bernadette.govaerts@uclouvain.be ; michel.thiel@uclouvain.be or manon.martin@uclouvain.be

Short application on the UCH dataset

Data object

UCH contains a multivariate matrix (outcomes), a design data.frame and a formula as a character string:

data("UCH")
str(UCH)
#> List of 3
#>  $ design  :'data.frame':    34 obs. of  5 variables:
#>   ..$ Hippurate: Factor w/ 3 levels "0","1","2": 1 1 1 1 1 1 2 2 2 2 ...
#>   ..$ Citrate  : Factor w/ 3 levels "0","2","4": 1 1 2 2 3 3 1 1 2 2 ...
#>   ..$ Dilution : Factor w/ 1 level "diluted": 1 1 1 1 1 1 1 1 1 1 ...
#>   ..$ Day      : Factor w/ 2 levels "2","3": 1 1 1 1 1 1 1 1 1 1 ...
#>   ..$ Time     : Factor w/ 2 levels "1","2": 1 2 1 2 1 2 1 2 1 2 ...
#>  $ outcomes: num [1:34, 1:600] 0.0312 0.0581 0.027 0.0341 0.0406 ...
#>   ..- attr(*, "dimnames")=List of 2
#>   .. ..$   : chr [1:34] "M2C00D2R1" "M2C00D2R2" "M2C02D2R1" "M2C02D2R2" ...
#>   .. ..$ X1: chr [1:600] "9.9917004" "9.9753204" "9.9590624" "9.9427436" ...
#>  $ formula : chr "outcomes ~ Hippurate + Citrate + Time + Hippurate:Citrate + Time:Hippurate + Time:Citrate + Hippurate:Citrate:Time"

Data visualisation

The design can be visualised with plotDesign().

# design
plotDesign(
    design = UCH$design, x = "Hippurate",
    y = "Citrate", rows = "Time",
    title = "Design of the UCH dataset"
)


# row 3 of outcomes
plotLine(
    Y = UCH$outcomes,
    title = "H-NMR spectrum",
    rows = c(3),
    xlab = "ppm",
    ylab = "Intensity"
)

PCA

ResPCA <- pcaBySvd(UCH$outcomes)
pcaScreePlot(ResPCA, nPC = 6)

pcaScorePlot(
    resPcaBySvd = ResPCA, axes = c(1, 2),
    title = "PCA scores plot: PC1 and PC2",
    design = UCH$design,
    color = "Hippurate", shape = "Citrate",
    points_labs_rn = FALSE
)

Model estimation and effect matrix decomposition

# Model matrix generation
resMM <- lmpModelMatrix(UCH)

# Model estimation and effect matrices decomposition
resEM <- lmpEffectMatrices(resMM)

Effect matrix test of significance and importance measure

# Effects importance
resEM$varPercentagesPlot


# Bootstrap tests
resBT <- lmpBootstrapTests(resLmpEffectMatrices = resEM, nboot = 100)
resBT$resultsTable
#>                        % of variance (T III) Bootstrap p-values
#> Hippurate                              39.31             < 0.01
#> Citrate                                29.91             < 0.01
#> Time                                   16.24             < 0.01
#> Hippurate:Citrate                       1.54               0.15
#> Hippurate:Time                          6.23             < 0.01
#> Citrate:Time                            0.54               0.48
#> Hippurate:Citrate:Time                  1.68               0.08
#> Residuals                               4.30                  -

ASCA decomposition

# ASCA decomposition
resASCA <- lmpPcaEffects(resLmpEffectMatrices = resEM, method = "ASCA")

# Scores Plot for the hippurate
lmpScorePlot(resASCA,
    effectNames = "Hippurate",
    color = "Hippurate", shape = "Hippurate"
)


# Loadings Plot for the hippurate
lmpLoading1dPlot(resASCA,
    effectNames = c("Hippurate"),
    axes = 1, xlab = "ppm"
)


# Scores ScatterPlot matrix
lmpScoreScatterPlotM(resASCA,
    PCdim = c(1, 1, 1, 1, 1, 1, 1, 2),
    modelAbbrev = TRUE,
    varname.colorup = "Citrate",
    varname.colordown = "Time",
    varname.pchup = "Hippurate",
    varname.pchdown = "Time",
    title = "ASCA scores scatterplot matrix"
)

sessionInfo

sessionInfo()
#> R Under development (unstable) (2024-03-06 r86056)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 22.04.4 LTS
#> 
#> Matrix products: default
#> BLAS:   /home/biocbuild/bbs-3.19-bioc/R/lib/libRblas.so 
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_GB              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: America/New_York
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] car_3.1-2        carData_3.0-5    pander_0.6.5     gridExtra_2.3   
#> [5] limpca_0.99.5    ggplot2_3.5.0    BiocStyle_2.31.0
#> 
#> loaded via a namespace (and not attached):
#>  [1] sass_0.4.9          utf8_1.2.4          generics_0.1.3     
#>  [4] tidyr_1.3.1         stringi_1.8.3       digest_0.6.35      
#>  [7] magrittr_2.0.3      evaluate_0.23       grid_4.4.0         
#> [10] bookdown_0.38       iterators_1.0.14    fastmap_1.1.1      
#> [13] foreach_1.5.2       doParallel_1.0.17   plyr_1.8.9         
#> [16] jsonlite_1.8.8      ggrepel_0.9.5       tidyverse_2.0.0    
#> [19] formatR_1.14        BiocManager_1.30.22 purrr_1.0.2        
#> [22] fansi_1.0.6         scales_1.3.0        codetools_0.2-19   
#> [25] jquerylib_0.1.4     abind_1.4-5         cli_3.6.2          
#> [28] rlang_1.1.3         munsell_0.5.0       withr_3.0.0        
#> [31] cachem_1.0.8        yaml_2.3.8          tools_4.4.0        
#> [34] parallel_4.4.0      reshape2_1.4.4      dplyr_1.1.4        
#> [37] colorspace_2.1-0    vctrs_0.6.5         R6_2.5.1           
#> [40] lifecycle_1.0.4     stringr_1.5.1       pkgconfig_2.0.3    
#> [43] pillar_1.9.0        bslib_0.6.1         gtable_0.3.4       
#> [46] glue_1.7.0          Rcpp_1.0.12         highr_0.10         
#> [49] xfun_0.42           tibble_3.2.1        tidyselect_1.2.1   
#> [52] knitr_1.45          farver_2.1.1        htmltools_0.5.7    
#> [55] labeling_0.4.3      rmarkdown_2.26      ggsci_3.0.2        
#> [58] compiler_4.4.0