-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First version of app to display atlas
- Loading branch information
Showing
1 changed file
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
library(shiny) | ||
library(dplyr) | ||
library(magrittr) | ||
library(DT) | ||
|
||
if(!exists("mi_atlas")){ | ||
mi_atlas <- read.table("mi-atlas.tsv", header = TRUE, sep = "\t", | ||
stringsAsFactors = FALSE, row.names = 1) | ||
} | ||
|
||
# Define UI | ||
ui <- fluidPage( | ||
lang = "en", | ||
title = "mi-atlas", | ||
fluidRow(column(width = 12, align = "center", | ||
h1("An interactive and evolving microbial interactions catalog"))), | ||
fluidRow( | ||
column( | ||
imageOutput("logo"), | ||
align = "center", alt = "Logo of mi-atlas", width = 1), | ||
column(width = 2), | ||
column(width = 6, | ||
h2("About", align = "center"), | ||
p("Here is the list of interactions occuring between microorganisms that are documented", | ||
"in the versioned catalog (see website).", "This classification is based on a framework", | ||
"suggested by", a(href="https://doi.org/10.1093/femsle/fnz125", | ||
target = "_blank", rel = "noreferrer noopener", | ||
# open in new tab w/ protection | ||
"(Pacheco and Segrè, 2019)."), align = "left"), | ||
p("List of the microbial interactions in the catalog."), | ||
helpText("Details on the column names can be found", | ||
a(href="https://github.com/cpauvert/mi-atlas/blob/main/README.md#attributes-of-microbial-interactions", | ||
target = "_blank", rel = "noreferrer noopener", | ||
# open in new tab w/ protection | ||
"here.")) | ||
), | ||
column(width = 2), | ||
column(align = "center", width = 1, | ||
a(href="https://cpauvert.github.io/mi-atlas/framework.html", | ||
target = "_blank", rel = "noreferrer noopener", | ||
icon("book-open")), br(), | ||
a(href="https://cpauvert.github.io/mi-atlas/framework.html", | ||
target = "_blank", rel = "noreferrer noopener", "Framework"), br(), | ||
a(href="https://cpauvert.github.io/mi-atlas", | ||
target = "_blank", rel = "noreferrer noopener", icon("globe")), br(), | ||
a(href="https://cpauvert.github.io/mi-atlas", | ||
target = "_blank", rel = "noreferrer noopener", "Website"), br(), | ||
a(href="https://github.com/cpauvert/mi-atlas/blob/main/CONTRIBUTING.md", | ||
target = "_blank", rel = "noreferrer noopener", icon("github")), br(), | ||
a(href="https://github.com/cpauvert/mi-atlas/blob/main/CONTRIBUTING.md", | ||
target = "_blank", rel = "noreferrer noopener", "Contribute") | ||
) | ||
), | ||
fluidRow( | ||
column(width = 2), | ||
column(width = 8, DT::dataTableOutput("table")), | ||
column(width = 2) | ||
) | ||
) | ||
|
||
# Define server logic | ||
server <- function(input, output, session) { | ||
output$logo <- renderImage({ | ||
list(src="docs/content/extra/logo.png", | ||
# align="left", width="155", height="179", | ||
align="left", width="77.5", height="89.5", | ||
alt = "Logo of mi-atlas") | ||
}, deleteFile = FALSE) | ||
preview_atlas <- reactive({ | ||
mi_atlas %>% select(Interaction_name, | ||
Participant_1, Participant_2, Participant_3) | ||
}) | ||
output$table <- DT::renderDataTable(preview_atlas(), | ||
extensions = 'Responsive', | ||
selection = 'single', | ||
options = list( | ||
autoWidth = TRUE | ||
) | ||
) | ||
output$wd<-renderText(getwd()) | ||
} | ||
|
||
# Run the application | ||
shinyApp(ui = ui, server = server) | ||
|