# Introduction

# Introduction to MiscMetabar: an R package to facilitate visualization and reproducibility in metabarcoding analysis

## Raison d’être

- Complete R packages dada2 and phyloseq
- Useful visualizations (`biplot_pq`, `circle_pq`, `upset_pq`, `ggvenn_pq`)
- Facilitate the use of targets package

## Quick overview

For an introduction to metabarcoding in R, Please visite the state of the field vignettes. The import, export and track vignette explains how import and export `phyloseq` object. Its also show how to summarize useful information (number of sequences, samples and clusters) across bioinformatic pipelines.

If you are interested in ecological metrics, see the vignettes describing alpha-diversity and beta-diversity analysis. The vignette filter taxa and samples describes some data-filtering processes using MiscMetabar and the reclustering tutorial introduces the different way of clustering already-clustered OTU/ASV. The vignette tengeler explore the dataset from Tengeler et al. (2020) using some MiscMetabar functions.

For developers, I also wrote a vignette describing som rules of codes.

### Summarize a physeq object

    library("MiscMetabar")
    library("phyloseq")
    data("data_fungi")
    summary_plot_pq(data_fungi)

### Create an interactive table of the tax_table

    data("GlobalPatterns", package = "phyloseq")
    tax_datatable(subset_taxa(
      GlobalPatterns,
      rowSums(GlobalPatterns@otu_table) > 100000
    ))

### Sankey diagram of the tax_table

    gp <- subset_taxa(GlobalPatterns, GlobalPatterns@tax_table[, 1] == "Archaea")
    sankey_pq(gp, taxa = c(1:5))

### Upset plot for visualize distribution of taxa in function of samples variables

    if(packageVersion("ggplot2") < "4.0.0"){
      upset_pq(gp, "SampleType", taxa = "Class")
    }

# References

Tengeler, A.C., Dam, S.A., Wiesmann, M. et al. Gut microbiota from persons with attention-deficit/hyperactivity disorder affects the brain in mice. Microbiome 8, 44 (2020). https://doi.org/10.1186/s40168-020-00816-x

# Session inform

    sessionInfo()
    #> R Under development (unstable) (2025-09-27 r88882)
    #> Platform: x86_64-pc-linux-gnu
    #> Running under: Kali GNU/Linux Rolling
    #>
    #> 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.29.so;  LAPACK version 3.12.0
    #>
    #> locale:
    #>  [1] LC_CTYPE=fr_FR.UTF-8       LC_NUMERIC=C
    #>  [3] LC_TIME=fr_FR.UTF-8        LC_COLLATE=C
    #>  [5] LC_MONETARY=fr_FR.UTF-8    LC_MESSAGES=fr_FR.UTF-8
    #>  [7] LC_PAPER=fr_FR.UTF-8       LC_NAME=C
    #>  [9] LC_ADDRESS=C               LC_TELEPHONE=C
    #> [11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C
    #>
    #> time zone: Europe/Paris
    #> tzcode source: system (glibc)
    #>
    #> attached base packages:
    #> [1] stats     graphics  grDevices utils     datasets  methods   base
    #>
    #> other attached packages:
    #> [1] MiscMetabar_0.14.4 purrr_1.1.0        dplyr_1.1.4        dada2_1.37.0
    #> [5] Rcpp_1.1.0         ggplot2_4.0.0      phyloseq_1.53.0
    #>
    #> loaded via a namespace (and not attached):
    #>  [1] bitops_1.0-9                deldir_2.0-4
    #>  [3] permute_0.9-8               rlang_1.1.6
    #>  [5] magrittr_2.0.4              ade4_1.7-23
    #>  [7] matrixStats_1.5.0           compiler_4.6.0
    #>  [9] mgcv_1.9-3                  png_0.1-8
    #> [11] vctrs_0.6.5                 reshape2_1.4.4
    #> [13] stringr_1.5.2               pwalign_1.5.0
    #> [15] pkgconfig_2.0.3             crayon_1.5.3
    #> [17] fastmap_1.2.0               XVector_0.49.0
    #> [19] labeling_0.4.3              Rsamtools_2.25.0
    #> [21] rmarkdown_2.30              UCSC.utils_1.5.0
    #> [23] xfun_0.53                   cachem_1.1.0
    #> [25] GenomeInfoDb_1.45.4         jsonlite_2.0.0
    #> [27] biomformat_1.37.0           rhdf5filters_1.21.0
    #> [29] DelayedArray_0.35.1         Rhdf5lib_1.31.0
    #> [31] BiocParallel_1.43.3         jpeg_0.1-11
    #> [33] data.tree_1.2.0             parallel_4.6.0
    #> [35] cluster_2.1.8.1             R6_2.6.1
    #> [37] bslib_0.9.0                 stringi_1.8.7
    #> [39] RColorBrewer_1.1-3          GenomicRanges_1.61.0
    #> [41] jquerylib_0.1.4             SummarizedExperiment_1.39.0
    #> [43] iterators_1.0.14            knitr_1.50
    #> [45] IRanges_2.43.0              Matrix_1.7-4
    #> [47] splines_4.6.0               igraph_2.1.4
    #> [49] tidyselect_1.2.1            abind_1.4-8
    #> [51] yaml_2.3.10                 vegan_2.7-1
    #> [53] codetools_0.2-20            hwriter_1.3.2.1
    #> [55] lattice_0.22-7              tibble_3.3.0
    #> [57] plyr_1.8.9                  Biobase_2.69.0
    #> [59] withr_3.0.2                 ShortRead_1.67.0
    #> [61] S7_0.2.0                    evaluate_1.0.5
    #> [63] survival_3.8-3              RcppParallel_5.1.11-1
    #> [65] Biostrings_2.77.1           pillar_1.11.1
    #> [67] MatrixGenerics_1.21.0       DT_0.34.0
    #> [69] foreach_1.5.2               stats4_4.6.0
    #> [71] generics_0.1.4              S4Vectors_0.47.0
    #> [73] scales_1.4.0                glue_1.8.0
    #> [75] tools_4.6.0                 interp_1.1-6
    #> [77] data.table_1.17.8           GenomicAlignments_1.45.0
    #> [79] rhdf5_2.53.1                grid_4.6.0
    #> [81] ape_5.8-1                   crosstalk_1.2.2
    #> [83] latticeExtra_0.6-31         nlme_3.1-168
    #> [85] networkD3_0.4.1             cli_3.6.5
    #> [87] S4Arrays_1.9.1              gtable_0.3.6
    #> [89] sass_0.4.10                 digest_0.6.37
    #> [91] BiocGenerics_0.55.0         SparseArray_1.9.0
    #> [93] htmlwidgets_1.6.4           farver_2.1.2
    #> [95] htmltools_0.5.8.1           multtest_2.65.0
    #> [97] lifecycle_1.0.4             httr_1.4.7
    #> [99] MASS_7.3-65