Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding an interactive table to OMA? #515

Open
jkc9886 opened this issue Jun 9, 2024 · 5 comments
Open

Adding an interactive table to OMA? #515

jkc9886 opened this issue Jun 9, 2024 · 5 comments
Assignees

Comments

@jkc9886
Copy link
Contributor

jkc9886 commented Jun 9, 2024

Hello, a newbie summer intern here, wanted some advice!!

While I was making some grammatical and technical edits to the differential data analysis(DAA) chapter, I was wondering how it will be like to add an interactive table to the part on comparing different DAA tools ?

If I were to add it (I did the following homework about it), I am unsure if it could be added and would appreciate suggestions and opinions. Also one thing is since deployment is involved, if we add it, this has to be an entire new section in the OMA book. Please suggest if it could be added to the chapter itself in any way?

Also, feel free to build this locally and check if the table would be worthy?

`---
title: "Differential Abundance Analysis"
output: html_document
runtime: shiny

Interactive Comparison of Differential Abundance Analysis Methods

This section includes an interactive tool for comparing the results of different Differential Abundance Analysis (DAA) methods, such as ALDEx2, ANCOM-BC, and MaAsLin2. By selecting different methods, you can visualize and compare the differentially abundant taxa identified by each, along with their p-values and effect sizes.

Use the checkboxes to choose the methods you want to compare and observe how the results align or differ across these methods. This hands-on feature enhances your understanding of each method's strengths and limitations in microbiome data analysis.

library(shiny)
library(dplyr)
library(DT)

# Simulated example data (replace with your actual results)
aldex2_res <- data.frame(
  Taxa = c("Taxon1", "Taxon2", "Taxon3"),
  PValue = c(0.01, 0.2, 0.03),
  EffectSize = c(1.5, 0.8, 2.0)
)

ancombc_res <- data.frame(
  Taxa = c("Taxon1", "Taxon4", "Taxon3"),
  PValue = c(0.02, 0.15, 0.04),
  EffectSize = c(1.4, 1.2, 2.1)
)

maaslin2_res <- data.frame(
  Taxa = c("Taxon2", "Taxon3", "Taxon5"),
  PValue = c(0.05, 0.01, 0.3),
  EffectSize = c(1.0, 1.7, 0.9)
)

ui <- fluidPage(
  titlePanel("Comparison of Differential Abundance Analysis Methods"),
  
  sidebarLayout(
    sidebarPanel(
      checkboxGroupInput("methods", "Select DAA Methods:",
                         choices = list("ALDEx2" = "aldex2", "ANCOM-BC" = "ancombc", "MaAsLin2" = "maaslin2"),
                         selected = "aldex2")
    ),
    
    mainPanel(
      DTOutput("comparisonTable")
    )
  )
)

server <- function(input, output) {
  output$comparisonTable <- renderDT({
    combined_res <- full_join(aldex2_res, ancombc_res, by = "Taxa", suffix = c("_ALDEx2", "_ANCOMBC")) %>%
      full_join(maaslin2_res, by = "Taxa") %>%
      rename(PValue_Maaslin2 = PValue, EffectSize_Maaslin2 = EffectSize)
    
    selected_cols <- c("Taxa")
    if ("aldex2" %in% input$methods) {
      selected_cols <- c(selected_cols, "PValue_ALDEx2", "EffectSize_ALDEx2")
    }
    if ("ancombc" %in% input$methods) {
      selected_cols <- c(selected_cols, "PValue_ANCOMBC", "EffectSize_ANCOMBC")
    }
    if ("maaslin2" %in% input$methods) {
      selected_cols <- c(selected_cols, "PValue_Maaslin2", "EffectSize_Maaslin2")
    }
    
    comparison_table <- combined_res %>%
      select(all_of(selected_cols))
    
    datatable(comparison_table, options = list(pageLength = 10, autoWidth = TRUE))
  })
}

shinyApp(ui = ui, server = server)
`



@antagomir
Copy link
Member

antagomir commented Jun 10, 2024

It's an interesting idea. I am not sure if we have tested it with the book yet. You could first try to have it as a "hidden" chapter (not linked to the table of contents but otherwise available via direct URL)? We could then see if it can be included, and if yes, how to best organize.

@AxelDgn and @Insaynoah have recently added interactive tables with other methods, they might be able to provide some support but that is best taking place via online chat (e.g. Slack)

@jkc9886
Copy link
Contributor Author

jkc9886 commented Jun 10, 2024

Sure, the hidden chapter would be a good place to start with. I shall work on that and also reach out to the mentioned people via Slack for help :)) Thank you.

@antagomir
Copy link
Member

@jkc9886 what's the status of this one?

@jkc9886
Copy link
Contributor Author

jkc9886 commented Jul 24, 2024

@jkc9886 what's the status of this one?

This is under progress, not finalised yet. Shall keep everyone updated about it through this issue.

@antagomir
Copy link
Member

We can discuss if this is needed but depends also how far it alredy is

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants