Commit 4d98a95e authored by peguerin's avatar peguerin
Browse files

update with credits and debug

parent 05df8063
......@@ -8,6 +8,15 @@ library(sp)
library(rgdal)
library(rgeos)
library(htmlwidgets)
library(htmltools)
library(sf)
library(tidyverse)
library(shinythemes)
library(DT)
library(shinydashboard)
source("prepare_data.R")
......@@ -29,11 +38,12 @@ server <- function(input, output, session) {
#selected_data= marineRect %>% dplyr::select(input$cell_datatype)
#############################################################################
## LEAFLET
output$mymap <- output$map <- renderLeaflet({
selected_wt= cellsDat %>% filter(watertype == input$watertype)
selected_data=selected_wt %>% select(input$cell_datatype) %>% pull()
selected_data=selected_wt %>% dplyr::select(input$cell_datatype) %>% pull()
......@@ -41,19 +51,25 @@ server <- function(input, output, session) {
maFillColor=colorBin(bin_col_palette, selected_data, bins=c(2,4,5,10, max(selected_data)) )(selected_data)
selected_interval_data=c(2,4,5,10, max(selected_data))
conpal=colorBin(bin_col_palette, selected_data, bins=c(2,4,5,10, max(selected_data)) )
titre_legende="Number of species"
} else if(input$cell_datatype =="mean_genetic_diversity") {
maFillColor= colorQuantile(gradiant_col_palette, selected_data,n=7 )(selected_data)
selected_interval_data=c(min(selected_data),max(selected_data))
conpal = colorQuantile(palette = gradiant_col_palette, domain = selected_interval_data,n=7)
bins_gd = c(0,0.001,0.002,0.003,0.005,0.01,0.025,max(selected_data))
maFillColor= colorBin(gradiant_col_palette, selected_data, bins=bins_gd)(selected_data)
selected_interval_data=bins_gd
conpal = colorBin(gradiant_col_palette, selected_data, bins=bins_gd)
titre_legende="Mean genetic diversity"
} else if(input$cell_datatype =="temperature") {
maFillColor= colorNumeric(gradiant_col_palette, selected_data )(selected_data)
selected_interval_data=c(min(selected_data),max(selected_data))
conpal = colorNumeric(palette = gradiant_col_palette, domain = selected_interval_data)
titre_legende="Mean surface temperature (°C)"
} else {
## number of sequences by species
maFillColor=colorBin(bin_col_palette, selected_data, bins=c(2,5,10,20,30, max(selected_data)) )(selected_data)
selected_interval_data=c(2,5,10,20,30, max(selected_data))
conpal=colorBin(bin_col_palette,selected_data, bins=c(2,5,10,20,30, max(selected_data)) )
titre_legende="Mean number of individual sequences per species"
}
leaflet() %>%
......@@ -73,8 +89,24 @@ server <- function(input, output, session) {
addLegend(conpal,
selected_interval_data,
opacity = 1,
title = input$cell_datatype,
title = titre_legende,
position = "bottomright")
})
#############################################################################
## TABLE
# Clickable object: create a null reactive value to store the ID of the layer
SelectedID <- reactiveVal(NULL)
# Observe statement
observe({
event <- input$map_shape_click
req(event)
SelectedID(event$id)
#print(event$id) # Verification
})
}
......@@ -42,26 +42,31 @@ ui <- dashboardPage(
# Select data type
selectInput("cell_datatype",
label = "Cell data you want to display",
label = "Cell values",
choices = choices_datatype,
selected = "mean_genetic_diversity"),
hr(),
# Link for source code
tags$a("Source code repository", href="https://github.com/Grelot/global_fish_genetic_diversity", target="_blank"),
tags$a("Developped by Pierre-Edouard GUERIN", href="https://github.com/Grelot/global_fish_genetic_diversity", target="_blank"),
# Explanation
tags$footer(tags$p("Developped by Pierre-Edouard GUERIN")),
tags$footer(tags$p("")),
# Link for paper
tags$a("Manel et al. 'Global patterns of fish genetic diversity' published in Nature Communication", href="", target="_blank"),
tags$a("Manel et al. 'Global determinants of freshwater and marine fish genetic diversity' Nature Communication", href="https://doi.org/10.1038/s41467-020-14409-7", target="_blank"),
hr(),
# Update info
tags$footer(tags$p("Last updated in February 2020", class = "credit"))
# Credits
tags$a("Template inspired by the GAPeDNA app", href="https://github.com/virginiemarques/GAPeDNA", target="_blank"),
# Update info
tags$footer(tags$p("Last updated in February 2020 with kind help of Virginie Marques", class = "credit"))
)
)
),
dashboardBody(
fluidRow(
## the worldmap
leafletOutput("mymap",height=640,width=960)
)
)
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment