This is an HTML report generated by Biome-Shiny. It will generate an HTML file containing all generated plots and tables. Note that any plot whose variables have not been set by the user will use default variables.

1. Phyloseq File Summary

Basic information about the loaded dataset.

  as.character(summarize_phyloseq_mod(datasetInput()))
  as.character(list_sample_variables(datasetInput()))

2. Core Abundance Heatmap

Heatmap comparing abundance values for each OTU per sample.

  plot_heatmap(datasetInput())

3. Community Composition

Community composition plots show the abundance values for the species belonging to a certain taxonomic rank.

3.1. Abundance Plot (Counts)

    taxglom <- tax_glom(datasetInput(), taxrank=input$v4)
        if(input$communityPlotFacetWrap == FALSE){
      compositionplot <- plot_bar(taxglom, x=input$z1, y="Abundance", fill=input$v4, title=paste0("Abundance by ", input$v4, " in ", input$z1))  + geom_bar(stat="identity") + theme_pubr(base_size = 10, margin = TRUE, legend = "right", x.text.angle = 90) + rremove("xlab") + rremove("ylab")
    } else {
      compositionplot <- plot_bar(taxglom, x=input$z1, y="Abundance", fill=input$v4, title=paste0("Abundance by ", input$v4, " in ", input$z1))  + geom_bar(stat="identity") + theme_pubr(base_size = 10, margin = TRUE, legend = "right", x.text.angle = 90) + facet_grid(paste('~',input$z2), scales = "free", space = "free") + rremove("xlab") + rremove("ylab")
    }
    if(input$transparentCommunityPlot == TRUE){
      compositionplot <- compositionplot +
        theme(panel.background = element_rect(fill = "transparent", colour = NA), plot.background = element_rect(fill = "transparent", colour = NA), legend.background = element_rect(fill = "transparent", colour = NA), legend.box.background = element_rect(fill = "transparent", colour = NA))
    }
    p <- compositionplot
print(p)

3.2. Abundance Plot (Relative)

    taxglom <- tax_glom(microbiome::transform(datasetInput(), "compositional"), taxrank=input$v4)
    compositionplot <- plot_bar(taxglom, x=input$z1, fill=input$v4, 
                        title=paste0("Relative abundance by ", input$v4, " in ", input$z1))  +  
                        geom_bar(stat="identity") +
                        guides(fill = guide_legend(ncol = 1)) +
                        scale_y_percent() +
                        theme_pubr(base_size = 10, margin = TRUE, legend = "right", x.text.angle = 90)
    if(input$communityPlotFacetWrap == TRUE){
      compositionplot <- compositionplot + facet_grid(paste('~',input$z2),scales = "free", space = "free")
    }
    if(input$transparentCommunityPlot == TRUE){
      compositionplot <- compositionplot +
        theme(panel.background = element_rect(fill = "transparent", colour = NA), 
              plot.background = element_rect(fill = "transparent", colour = NA), 
              legend.background = element_rect(fill = "transparent", colour = NA), 
              legend.box.background = element_rect(fill = "transparent", colour = NA))
    }
  print(compositionplot)

4. Alpha Diversity

Alpha diversity is an index that measures diversity within a sample. The tables below show only the head, not the full table. To download the the full tables in .csv format, use the download button from Biome-Shiny.

4.1. Evenness Table

Evenness measures how close, in numbers, each species is in the sample.

  a <- as.data.frame(evenness(datasetInput()))
  colnames(a) <- c("Camargo","Pielou","Simpson","Smith and Wilson's Evar","Bulla")
  knitr::kable(head(a))

Abundance can be measured either by the absolute number of a given species in the sample (counts) or by a ratio of the species relative to the total number of species in the sample (relative abundance).

4.2.Abundance Table (Counts)

  a <- as.data.frame(abundances(datasetInput()))
  knitr::kable(head(a))

4.3. Abundance Table (Relative)

  a <- as.data.frame(abundances(datasetInput(), transform = "compositional"))
  knitr::kable(head(a))

4.4. Diversity Measures Table

    a <- estimate_richness(datasetInput(), measures = c("Observed","Chao1","Ace","Shannon","Simpson","InvSimpson","Fisher"))
    colnames(a) <- c("Observed species", "Chao1", "Standard error (Chao1)", "ACE", "Standard error (ACE)", "Shannon's diversity index","Simpson's diversity index","Inverse Simpson","Fisher's alpha")
    knitr::kable(head(a))

4.5. Metadata Table

    knitr::kable(head(as.data.frame(sample_data(datasetInput()))))

4.6. Richness Plot

    if(input$richnessPlotGridWrap == FALSE){
      richnessplot <- plot_richness(
        datasetInput(),
        x = input$x2,
        measures = input$richnessChoices,
        color = input$x3
      ) + theme_pubr(base_size = 10, margin = TRUE, legend = "right", x.text.angle = 90)
    } else {
      richnessplot <- plot_richness(
        datasetInput(),
        x = input$x2,
        measures = input$richnessChoices,
        color = input$x3 ) +
        facet_grid(paste('~',input$x),scales = "free", space = "free") + theme_pubr(base_size = 10, margin = TRUE, legend = "right", x.text.angle = 90)
    }
print(richnessplot)

5. Beta Diversity

Beta diversity is the index that measures diversity between samples.

5.1. Sample Ordination Plot

Beta diversity ordination plots are measure diversity between samples based on their general microbial composition. Samples which are closer

    if (ncol(sample_data(datasetInput())) > 1){
      p <- phyloseq::plot_ordination(datasetInput(), ordinateData(), color = input$xb, label = NULL ) + geom_point(size = input$geom.size) + theme_pubr(base_size = 10, margin = TRUE, legend = "right")
    } else {
      a <- datasetInput()
      sample_data(a)[,2] <- sample_data(a)[,1]
      p <- phyloseq::plot_ordination(a, ordinateData(), color = input$xb, label = NULL ) + geom_point(size = input$geom.size) + theme_pubr(base_size = 10, margin = TRUE, legend = "right")
    }
    if(input$transparentOrdinatePlot){
      p <- p +
        theme(panel.background = element_rect(fill = "transparent", colour = NA), plot.background = element_rect(fill = "transparent", colour = NA), legend.background = element_rect(fill = "transparent", colour = NA), legend.box.background = element_rect(fill = "transparent", colour = NA))
    }
print(p)

5.2. Taxa Ordination Plot

The ordination plot for taxa measures the similarity in genetic composition between species. Species which are more similar to eachother are more closely grouped in the plot than species which are more genetically different.

    taxaOrdplot <-
      plot_ordination(
        datasetInput(),
        ordinateDataTaxa(),
        type = "taxa",
        title = "Ordination Plot",
        color = input$zb,
        label = input$xb
      ) + geom_point(size = input$geom.size.taxa) + theme_pubr(base_size = 10, margin = TRUE, legend = "right")
    if(input$transparentTaxaOrd){
      taxaOrdplot <- taxaOrdplot +
        theme(panel.background = element_rect(fill = "transparent", colour = NA), 
              plot.background = element_rect(fill = "transparent", colour = NA), 
              legend.background = element_rect(fill = "transparent", colour = NA), 
              legend.box.background = element_rect(fill = "transparent", colour = NA))
    }

6. PERMANOVA test

6.1. PERMANOVA P-value and Homogeniety Tables

The PERMANOVA test can be used to determine the importance of a variable in affecting the samples' diversity.

  permanova()
  homogenietyParams()

6.2. Top Factors Plot

A plot determining the OTUs which are most relevant for composition differences in samples.

  topFactorPlotParams <- reactive({
    otu <- abundances(compositionalInput())
    meta <- meta(compositionalInput())
    permnumber <- input$permanovaPermutationsFac
    metadata <- input$permanovaColumnFac
    column <- meta[[metadata]]
    permanova <- adonis(t(otu) ~ column,
                        data = meta, permutations = permnumber, method = "bray"
    )
    coef <- coefficients(permanova)["column1",]
    top.coef <- coef[rev(order(abs(coef)))[1:20]] #top 20 coefficients
    par(mar = c(3, 14, 2, 1))
     p <- barplot(sort(top.coef), horiz = T, las = 1, main = "Top taxa")
    print(p)
  })
  plot(topFactorPlotParams())

6.3. Network Plot

The network plot can be used to find relations between samples.

      n <- make_network(compositionalInput(), type = "samples", distance = input$permanovaDistanceMethodNet, max.dist = 0.2)
      p <- plot_network(n, compositionalInput(), type = "samples", shape = input$permanovaMetaShapeNet, color = input$permanovaMetadataNet, line_weight = 0.4)

    if(input$transparentPermanova == TRUE){
      p <- p + theme(panel.background = element_rect(fill = "transparent", colour = NA), plot.background = element_rect(fill = "transparent", colour = NA), legend.background = element_rect(fill = "transparent", colour = NA), legend.box.background = element_rect(fill = "transparent", colour = NA))
    }
print(p)


BioData-PT/Biome-Shiny documentation built on May 11, 2024, 11:12 a.m.