Skip to content

Commit

Permalink
fixed problem
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus List committed Nov 9, 2017
1 parent 2332f59 commit 0379c91
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 50 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
*.Rproj
*.cache
65 changes: 30 additions & 35 deletions app/server.r
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
function(input, output) {

#keeping track of he inserted UIs
inserted <- c()

#Adding the UI after choosing the UserID and clicking on the button
observeEvent(input$start_btn, {
id <- input$start_btn
Expand All @@ -18,39 +18,38 @@ function(input, output) {
else{
user <- input$user_key
showNotification(deepblue_echo(user_key = input$user_key), type = "message", duration = 10)
}
}

#progress bar for loading the UI
withProgress(message = "Getting Projects, Epigenetics Marks, Chromosomes and Tests",min = 0,
max = 2, value = 0,
{

incProgress(amount = 1, message = "building input interface")

insertUI(selector = '#addOptions',
where = "afterBegin",
#We wrap the element in a div with id to remove it when the restart buttong pressed
ui = tags$div(

id = id,

selectInput('genome', "Select Genome", c(deepblue_list_genomes(user_key = user)$name,"NULL"),
selected = "NULL"),

selectInput('project', 'Select Project', c(deepblue_list_projects(user_key = user)$name,
"NULL"), selected = "NULL"),

selectInput('epigenetic_mark', 'Select an Epigenetic Mark',
c(deepblue_list_epigenetic_marks(user_key = user)$name, "NULL"), multiple = TRUE,
selected = "NULL"),

actionButton('list_exper_btn', "List Experiments"),



radioButtons("type_of_score", "Choose method to calculate scoring matrix",choices=
c("Annotations" = "annotation", "Tiling Regions" = "tiling")),


conditionalPanel(
condition = "input.type_of_score == 'tiling'",
radioButtons("tiling_size", "Select Tiling Region Size", choices =
Expand All @@ -60,16 +59,16 @@ function(input, output) {
)
inserted <<- c(id, inserted)
incProgress(amount = 1, message = "done")

})
})

#Adding a small UI for choosing the chromosome according the genome chosen
observeEvent(input$genome, {
if(input$genome != "NULL"){
# chromsome <- input$genome
genomes <- deepblue_list_genomes(user_key = input$user_key)

insertUI(selector = '#addChromosomes',
where = "afterEnd",
ui = tags$div(
Expand All @@ -82,8 +81,8 @@ function(input, output) {
)
}
})


#To remove the inserted UI and start again
observeEvent(input$end_btn, {
removeUI(
Expand All @@ -95,37 +94,33 @@ function(input, output) {
selector = '#add_chr', multiple = TRUE
)
})


#List experiments and info for experiments in a list
all_experiments <- eventReactive(input$list_exper_btn, {
#getting experments
browser()
all_experiments <- list_experiments(genome = input$genome, epigenetic_mark = input$epigenetic_mark, project = input$project,
user_key = input$user_key)

})

eventReactive(input$list_exper_btn, {
output$table <- renderTable(all_experiments())

})


output$table <- renderTable(all_experiments()[[1]])


#make a table of metadata
experiments_info_meta <- eventReactive(input$plot_btn, {
browser()
#extract metadata
experiments_info_meta <- extract_metadata(all_experiments()[[2]])

})

#Get the score matrix
filtered_score_matrix <- eventReactive(input$plot_btn, {
#get scoring matrix
score_matrix_tiling_regions(experiments = all_experiments()[[1]], experiments_info_meta = experiments_info_meta(),
genome = input$genome, chr = input$chr, user_key = input$user_key)
genome = input$genome, chr = input$chr, user_key = input$user_key)
})

#plot data
plot_pca <- eventReactive(input$plot_btn, {
#get plot
Expand All @@ -134,7 +129,7 @@ function(input, output) {
filtered_score_matrix = filtered_score_matrix(),
epigenetic_mark = input$epigenetic_mark)
})

output$plot <- renderPlotly(plot_pca())

}
30 changes: 15 additions & 15 deletions app/ui.r
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,36 @@ library(stats)
library(plotly)
library(shiny)

source("/home/fawaz/Desktop/Max_Planck_Job/shiny_apps/shinyApp/functions/extract_metadata.r")
source("/home/fawaz/Desktop/Max_Planck_Job/shiny_apps/shinyApp/functions/list_experiments.r")
source("/home/fawaz/Desktop/Max_Planck_Job/shiny_apps/shinyApp/functions/score_matrix_tiling_regions.r")
source("/home/fawaz/Desktop/Max_Planck_Job/shiny_apps/shinyApp/functions/plot_pca_labels.r")
source("/home/fawaz/Desktop/Max_Planck_Job/shiny_apps/shinyApp/functions/plot_correlation.r")
source("../functions/extract_metadata.r")
source("../functions/list_experiments.r")
source("../functions/score_matrix_tiling_regions.r")
source("../functions/plot_pca_labels.r")
source("../functions/plot_correlation.r")

#JvkPLwsTHbb3Fyi4

fluidPage(

sidebarPanel(

textInput("user_key", "User Key", value = "anonymous_key"),

actionButton('start_btn', "Log-in with your ID and start"),
actionButton('end_btn', 'Start Again'),

tags$div(id = 'addOptions'),
tags$div(id = 'addChromosomes'),
actionButton("plot_btn", "Caclulate and Plot")

actionButton("plot_btn", "Calculate and Plot")

),

mainPanel(
tabsetPanel(type = "tabs",
tabPanel("Table", tableOutput("table")),
tabPanel("Summary", tableOutput("summary")),
tabPanel("Plot", plotlyOutput('plot', width = "100%", height = "600px"))

)
)
)
)

0 comments on commit 0379c91

Please sign in to comment.