Skip to content

updated charts on main page #261

Merged
merged 1 commit into from Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
87 changes: 60 additions & 27 deletions app/app.R
Expand Up @@ -85,16 +85,47 @@ disease2gene <- readRDS("data/disease2gene.Rds")

genedata <- readRDS("data/genedata/genedata.Rds")
diseases <- disease2gene$Disease
studydata <- readRDS("data/studydata/studydata.Rds")
levels(studydata$Type) <- c(levels(studydata$Type), "phytochemicals")
studydata$Type[studydata$Type=="polyphenol"] <- "phytochemicals"
studydata <- readRDS("data/studydata/studydata.Rds")
levels(studydata$Type) <- c(levels(studydata$Type), "phytochemical")
studydata$Type[studydata$Type=="polyphenol"] <- "phytochemical"
studydata$Type[grepl('extract', studydata$Type)] <- "whole food extract"
studydata$Type[grepl('extract', studydata$Nutrient)] <- "whole food extract"
studydata$Type[grepl('blackberry', studydata$Nutrient)] <- "whole food extract"
studydata$Type[studydata$Nutrient=="egg yolks"] <- "whole food"


levels(studydata$Nutrient) <- c(levels(studydata$Nutrient), "soy extract")
levels(studydata$Nutrient) <- c(levels(studydata$Nutrient), "rosemary extract")
levels(studydata$Nutrient) <- c(levels(studydata$Nutrient), "yellow onion extract")
levels(studydata$Nutrient) <- c(levels(studydata$Nutrient), "aspera leaves extract")
levels(studydata$Nutrient) <- c(levels(studydata$Nutrient), "passionfruit extract")

studydata$Nutrient[studydata$Nutrient=="rosemary"] <- "rosemary extract"
studydata$Nutrient[studydata$Nutrient=="yellow onion"] <- "yellow onion extract"
studydata$Nutrient[studydata$Nutrient=="aaspera leaves"] <- "aspera leaves extract"
studydata$Nutrient[studydata$Nutrient=="passionfruit juice"] <- "passionfruit extract"
studydata$Type[studydata$Nutrient=="aspera leaves extract"] <- "whole food extract"
studydata$Type[studydata$Nutrient=="cinnamon"] <- "phytochemical"
studydata$Nutrient[studydata$Nutrient=="soy"] <- "soy extract"
studydata$Type[studydata$Nutrient=="soy extract"] <- "whole food extract"
print(studydata$Nutrient)

studydata <- studydata %>% drop_na(Nutrient)

nutrient_info <- read_csv("data/nutrient_info_lesscategories.csv")

nutrient_info$Category[grepl('extract', nutrient_info$Nutrient)] <- "whole food extract"
nutrient_info$Description[nutrient_info$Nutrient=="orange juice"] <- "Orange juice is a popular beverage that is enjoyed worldwide. Nutritionally, it is high in potassium, folate, and vitamin C as well as other antioxidants and important nutrients. At least some studies have associated its regular consumption with numerous health benefits including anti-inflammation, heart health, prevention of kidney stones, and wound healing. However, it is also high in sugar and calories and so should be taken in moderation.
"
levels(nutrient_info$Nutrient) <- c(levels(nutrient_info$Nutrient), "grape extract")
nutrient_info$Type[nutrient_info$Nutrient=="grape"] <- "grape extract"
levels(nutrient_info$Nutrient) <- c(levels(nutrient_info$Nutrient), "casei")
nutrient_info$Type[nutrient_info$Nutrient=="casei"] <- "l. casei"


levels(nutrient_info$Nutrient) <- c(levels(nutrient_info$Nutrient), "rosemary extract")
nutrient_info$Nutrient[nutrient_info$Nutrient=="rosemary"] <- "rosemary extract"


join.gene <- inner_join(disease2gene, genedata, c('Gene'='Gene', 'Expression'='Expression'))
diseases_with_matches <- as.factor(unique(as.character(join.gene$Disease)))
Expand Down Expand Up @@ -155,10 +186,10 @@ ui <- fluidPage(theme = Eat4Genes_theme,
sidebarPanel(
tags$style(".well {background-color:#818589;}"),
h1("Our Mission:", style = "color:white"),
p("Almost half of the world’s population has one or more chronic diseases with resultant
p("Much of the world’s population has one or more chronic diseases with resultant
pain and suffering as well as the vast majority of health care spending. Drug
treatments are often expensive and can include a wide range of side- and long term- effects. Alternative approaches such as diet that reduce cost and improve health thus have major potential value in health care.", style = "color:white"),
p("Eat4Genes is a dietary guide for patients, community, and healthcare providers to aid in the
p("Eat4Genes is a dietary guide for patients, community, healthcare providers, and researchers to aid in the
selection of healthy diet to help treat and prevent numerous pathologies and
conditions. It is based on the evaluation of clinically-relevant gene expression in
response to healthy diet with an emphasis on whole foods and whole food extracts.", style = "color:white"),
Expand All @@ -178,8 +209,7 @@ nutrition in the form of personalized confirmation of our suggested diet.", styl
img(src = "picOfWholeFoodsTweak.jpg", width = 450),
br(),
br(),
h3("Almost half of the world’s population has one or
more chronic diseases with the vast majority of health care spending."),
h3("Sixty percent of Americans have at least one chronic disease and a third of the world’s population has more than one. These are responsible for the vast majority of health care spending."),
h3("Eat4Genes is a dietary guide that aids in
the selection of healthy diet to help treat and prevent
numerous pathologies and conditions.")
Expand Down Expand Up @@ -215,7 +245,7 @@ nutrition in the form of personalized confirmation of our suggested diet.", styl
h3("Navigate Page:", style = "color:white"),
p("The plots to the right relate the nutrients with their associated ranking.", style = "color:white"),
p("The ranking represents the strength of the evidence
prensented for that dietary nutrient based on the details of the study(s) the
presented for that dietary nutrient based on the details of the study(s) the
data is from.", style = "color:white"),
p("Click the 'Toggle Plot/Bubble View' button to switch between a Bar graph and a Bubble Plot.", style = "color:white"),
p("For more information about each dietary nutrient, see table below.", style = "color:white"),
Expand Down Expand Up @@ -243,8 +273,8 @@ nutrition in the form of personalized confirmation of our suggested diet.", styl
br(),
DTOutput("foodstable"),
p("The Ranking represents the strength of the evidence
prensented for that dietary nutrient based on the study the
data is from."),
presented for that dietary nutrient based on the study the
data is from. See “Ranking System” under homepage “About” menu for details."),
#actionButton("jump2genes","Next"),
),

Expand All @@ -262,11 +292,11 @@ nutrition in the form of personalized confirmation of our suggested diet.", styl
p(icon("arrow-down"),
strong("Downregulation"),
"is the process by which a cell decreases the quantity
of a cellular component.", style = "color:white"),
of a gene product, most commonly RNA.", style = "color:white"),
p(icon("arrow-up"),
strong("Upregulation"),
"is the process by which a cell increases the quantity
of a cellular component.", style = "color:white"),
of a gene product, most commonly RNA.", style = "color:white"),
br(),
h5(textOutput("riskgene_string"), style = "color:white"),
br(),
Expand Down Expand Up @@ -302,7 +332,7 @@ nutrition in the form of personalized confirmation of our suggested diet.", styl
downloadButton("report", "Download A Detailed Report"),
br(),
br(),
h2(" Target Genes"),
h2(" Targeted Genes and Desired Expressions"),
br(),
p("The key genes analyzed for this selected disease or condition include:"),
uiOutput("genes"),
Expand Down Expand Up @@ -389,7 +419,7 @@ nutrition in the form of personalized confirmation of our suggested diet.", styl
h3("Navigate Page:", style = "color:white"),
p("The plots to the right relate the nutrients with their associated ranking.", style = "color:white"),
p("The ranking represents the strength of the evidence
prensented for that dietary nutrient based on the details of the study(s) the
presented for that dietary nutrient based on the details of the study(s) the
data is from.", style = "color:white"),
p("Click the 'Toggle Plot/Bubble View' button to switch between a Bar graph and a Bubble Plot.", style = "color:white"),
p("For more information about each dietary nutrient, see table below.", style = "color:white"),
Expand Down Expand Up @@ -417,8 +447,8 @@ nutrition in the form of personalized confirmation of our suggested diet.", styl
br(),
DTOutput("foodstable_g"),
p("The Ranking represents the strength of the evidence
prensented for that dietary nutrient based on the study the
data is from.")
presented for that dietary nutrient based on the study the
data is from. See “Ranking System” under homepage “About” menu for details.")
),

tabPanel("Data Sources", value = "studies",
Expand Down Expand Up @@ -517,8 +547,8 @@ server <- function(input,output, session){
#render home-page plots

#render pie chart
piedata <- data.frame(typePie = c('With Chronic Conditions', 'Without Chronic Conditions'),percentPie = c(48,52))
output$piePlot <- renderPlot({ ggplot(data = data.frame(typePie = c('With Chronic Conditions', 'Without Chronic Conditions'),percentPie = c(48,52)),
piedata <- data.frame(typePie = c('With Chronic Conditions', 'Without Chronic Conditions'),percentPie = c(100*1/3,100*2/3))
output$piePlot <- renderPlot({ ggplot(data = data.frame(typePie = c('With Chronic Conditions', 'Without Chronic Conditions'),percentPie = c(100*1/3,100*2/3)),
aes(x="", y=percentPie, fill=typePie)) +
geom_bar(width = 1, stat = "identity", color = "white") +
coord_polar("y", start = 0) +
Expand All @@ -529,9 +559,10 @@ server <- function(input,output, session){
plot.title = element_text(size = 20,
face = "bold",
hjust = 0.5,
lineheight = 0.9)) +
labs(title = "Percent of World Population \nwith a Chronic Condition",
caption = "data source TODO")
lineheight = 0.9),
plot.caption = element_text(hjust = 0.5)) +
labs(title = "Percent of World Population \nwith Multiple Chronic Conditions",
caption = "From: Hajat C, Stein E. The global burden of multiple chronic conditions: \n A narrative review. Prev Med Rep. 2018 Oct 19;12:284-293.")
},
height = 300)

Expand All @@ -546,7 +577,8 @@ server <- function(input,output, session){
plot.title = element_text(size = 20,
face = "bold",
hjust = 0.5,
lineheight = 0.9))+
lineheight = 0.9),
plot.caption = element_text(hjust = 0.5))+
labs(x = "",
y = "U.S.Health Care Costs (% GDP)" )+
scale_fill_viridis(discrete = TRUE, option = "D") +
Expand All @@ -566,7 +598,8 @@ server <- function(input,output, session){
plot.title = element_text(size = 20,
face = "bold",
hjust = 0.5,
lineheight = 0.9)) +
lineheight = 0.9),
plot.caption = element_text(hjust = 0.5)) +
labs(x = "",
y = "U.S.Health Care Costs (% GDP)" ) +
labs(title ="Rising U.S. Health Care Costs",
Expand Down Expand Up @@ -893,7 +926,7 @@ server <- function(input,output, session){
mutate(Expression = ifelse(Expression == "up",
as.character(icon("arrow-up")),
as.character(icon("arrow-down"))
)) )
)))


# Output risk genes
Expand Down Expand Up @@ -1056,7 +1089,7 @@ server <- function(input,output, session){
# even_body = "#E9F3FC") %>%
font(fontname = "Arial", part = "all") %>%
autofit() %>%
add_header_lines(values = "Target Genes", top = TRUE) %>%
add_header_lines(values = "Targeted Genes and Desired Expressions", top = TRUE) %>%
htmltools_value()})

output$p_table <- renderUI({
Expand Down Expand Up @@ -1389,14 +1422,14 @@ server <- function(input,output, session){
options = list( order = list(0, "desc"),
dom = 'Bfrtip',
buttons = c('csv', 'excel', 'pdf')),
caption = htmltools::tags$caption(
caption = htmltools::tags$caption(
style = 'caption-side: top;
text-align: center;
color:black;
font-size:200% ;',
'Studies Referenced for Food Guide'),
extensions = "Buttons",
colnames = c("Ranking", "Nutrient", "Study Name", "Link", "Summary", "In vitro / In vivo", "Type of Nutrient", "Concentration", "Sample Size"),
colnames = c("Ranking", "Nutrient", "Study Name", "Link", "Summary", "In vitro / vivo", "Type of Nutrient", "Concentration", "Sample Size"),
escape = FALSE,
rownames = FALSE)

Expand Down