Commit 3163642e authored by svolant's avatar svolant
Browse files

modif project status

parent c774dd66
...@@ -25,99 +25,100 @@ Project_box_result <- function(masque_key,curdir){ ...@@ -25,99 +25,100 @@ Project_box_result <- function(masque_key,curdir){
res = NULL res = NULL
PS = Project_status(masque_key,curdir) PS = Project_status(masque_key,curdir)
if(PS$passOK){
if(PS$status=="done") if(PS$status=="done")
{
res = list()
json_file = PS$file
folder_name = paste('file',masque_key,sep="")
### Paste file name as folder
annot_process = paste(curdir,"www","masque","done",folder_name,"shaman_annotation_process.tsv",sep= .Platform$file.sep)
## Waiting for file creation (max 3min)
start = Sys.time(); diff = 0
while(!file.exists(annot_process) && diff<180){
annot_process = paste(curdir,"www","masque","done",folder_name,"shaman_annotation_process.tsv",sep= .Platform$file.sep)
tmp = Sys.time()
diff = tmp-start
}
if(file.exists(annot_process))
{ {
ap = read.csv(annot_process,sep="\t") res = list()
build_process = paste(curdir,"www","masque","done",folder_name,"shaman_annotation_process.tsv",sep= .Platform$file.sep) json_file = PS$file
folder_name = paste('file',masque_key,sep="")
res[[1]] = fluidRow( ### Paste file name as folder
HTML('<center><h1><strong>Your project is done !</strong></h1> <br/> <em><h4> Hereafter is a summary of the building and annotation processes</h4> </em><br/> </center>'), annot_process = paste(curdir,"www","masque","done",folder_name,"shaman_annotation_process.tsv",sep= .Platform$file.sep)
br(),
column(width=5,
valueBox(ap$Count[1],tags$strong(tags$h5("Number of amplicons", style = "width: 70%;")), color = "light-blue",width=NULL,icon = uiOutput("amplicon_icon")), ## Waiting for file creation (max 3min)
valueBox(ap$Count[2],tags$strong(tags$h5("Remaining amplicons after dereplication", style = "width: 70%;")), color = "light-blue",width=NULL,icon = uiOutput("dereplication_icon")), start = Sys.time(); diff = 0
valueBox(ap$Count[3],tags$strong(tags$h5("Remaining amplicons after removing singletons", style = "width: 70%;")), color = "light-blue",width=NULL,icon = uiOutput("singleton_icon")), while(!file.exists(annot_process) && diff<180){
valueBox(ap$Count[4],tags$strong(tags$h5("Remaining amplicons after removing chimera", style = "width: 70%;")), color = "light-blue",width=NULL,icon = uiOutput("chimera_icon")) annot_process = paste(curdir,"www","masque","done",folder_name,"shaman_annotation_process.tsv",sep= .Platform$file.sep)
), tmp = Sys.time()
column(width=5,offset = 2, diff = tmp-start
box(title="Upload the results",width = NULL, background = "light-blue", }
selectInput("masque_database","Select the database",choices=c("Silva" = "silva","Greengenes" = "greengenes")),
tags$style(type='text/css', "#masque-database { width:100%; margin-top: 5px;}"), if(file.exists(annot_process))
actionButton("RunResMasque",label = "Upload the results",icon=icon('upload')), {
tags$style(type='text/css', "#RunResMasque { width:100%; margin-top: 15px;}") ap = read.csv(annot_process,sep="\t")
), build_process = paste(curdir,"www","masque","done",folder_name,"shaman_annotation_process.tsv",sep= .Platform$file.sep)
box(id="box-zip",title="Download .zip file",width = NULL, status = "success",
downloadButton('Download_masque_zip', 'Download the results'),
tags$style(type='text/css', "#Download_masque_zip { width:100%; margin-top: 15px;}")
)
res[[1]] = fluidRow(
HTML('<center><h1><strong>Your project is done !</strong></h1> <br/> <em><h4> Hereafter is a summary of the building and annotation processes</h4> </em><br/> </center>'),
br(),
column(width=5,
valueBox(ap$Count[1],tags$strong(tags$h5("Number of amplicons", style = "width: 70%;")), color = "light-blue",width=NULL,icon = uiOutput("amplicon_icon")),
valueBox(ap$Count[2],tags$strong(tags$h5("Remaining amplicons after dereplication", style = "width: 70%;")), color = "light-blue",width=NULL,icon = uiOutput("dereplication_icon")),
valueBox(ap$Count[3],tags$strong(tags$h5("Remaining amplicons after removing singletons", style = "width: 70%;")), color = "light-blue",width=NULL,icon = uiOutput("singleton_icon")),
valueBox(ap$Count[4],tags$strong(tags$h5("Remaining amplicons after removing chimera", style = "width: 70%;")), color = "light-blue",width=NULL,icon = uiOutput("chimera_icon"))
),
column(width=5,offset = 2,
box(title="Upload the results",width = NULL, background = "light-blue",
selectInput("masque_database","Select the database",choices=c("Silva" = "silva","Greengenes" = "greengenes")),
tags$style(type='text/css', "#masque-database { width:100%; margin-top: 5px;}"),
actionButton("RunResMasque",label = "Upload the results",icon=icon('upload')),
tags$style(type='text/css', "#RunResMasque { width:100%; margin-top: 15px;}")
),
box(id="box-zip",title="Download .zip file",width = NULL, status = "success",
downloadButton('Download_masque_zip', 'Download the results'),
tags$style(type='text/css', "#Download_masque_zip { width:100%; margin-top: 15px;}")
)
)
)
)
) } else{res =HTML('<center><h1><strong>Your project is done !</strong></h1> <br/> <em><h4> Hereafter is a summary of the building and annotation processes</h4> </em> </center>')}
build_process = paste(curdir,"www","masque","done",folder_name,"shaman_build_process.tsv",sep= .Platform$file.sep)
if(file.exists(build_process))
{
ap = read.csv(build_process,sep="\t")
res[[2]] = fluidRow(column(width=12,strong(h3("Building process table")),DT::dataTableOutput("build_process_table")))
}
} else{res =HTML('<center><h1><strong>Your project is done !</strong></h1> <br/> <em><h4> Hereafter is a summary of the building and annotation processes</h4> </em> </center>')}
build_process = paste(curdir,"www","masque","done",folder_name,"shaman_build_process.tsv",sep= .Platform$file.sep)
if(file.exists(build_process))
{
ap = read.csv(build_process,sep="\t")
res[[2]] = fluidRow(column(width=12,strong(h3("Building process table")),DT::dataTableOutput("build_process_table")))
} }
if(PS$status=="doing"){
res = fluidRow(
HTML('<center><h1><strong>Your project is currently running !</strong></h1> <br/> <br/> </center>'),
inlineCSS(gaugeCSS),
gaugeOutput("gaugeMasque_progress", width = "100%", height = "100%")
)
}
} if(PS$status=="error"){
error_message = "Failed"
json_file = PS$file
error_file = paste(curdir,"www","masque","error",paste('file',masque_key,"_error",".txt",sep=""),sep= .Platform$file.sep)
if(PS$status=="doing"){ if(file.exists(error_file)){error_message = read_lines(error_file)}
res = fluidRow(
HTML('<center><h1><strong>Your project is currently running !</strong></h1> <br/> <br/> </center>'),
inlineCSS(gaugeCSS),
gaugeOutput("gaugeMasque_progress", width = "100%", height = "100%")
)
}
if(PS$status=="error"){
error_message = "Failed"
json_file = PS$file
error_file = paste(curdir,"www","masque","error",paste('file',masque_key,"_error",".txt",sep=""),sep= .Platform$file.sep)
if(file.exists(error_file)){error_message = read_lines(error_file)}
res = fluidRow(
HTML('<center><h1><strong>Sorry, the workflow failed during progression</strong></h1> <br/> <em><h4> Hereafter is the message error.</h4> </em> <br/> </center>'),
column(width = 12, res = fluidRow(
div(style = "background-color: white; margin: 0 auto;width: 50%; text-align:center;border:1px solid red", HTML('<center><h1><strong>Sorry, the workflow failed during progression</strong></h1> <br/> <em><h4> Hereafter is the message error.</h4> </em> <br/> </center>'),
h4(strong("Error message")),
hr(style = "width: 70%;"), column(width = 12,
HTML(paste(error_message,collapse = " <br/> ")), div(style = "background-color: white; margin: 0 auto;width: 50%; text-align:center;border:1px solid red",
br() h4(strong("Error message")),
) hr(style = "width: 70%;"),
) HTML(paste(error_message,collapse = " <br/> ")),
) br()
)
)
)
}
} }
return(list(box=res,PS=PS)) return(list(box=res,PS=PS))
......
...@@ -1441,19 +1441,21 @@ shinyServer(function(input, output,session) { ...@@ -1441,19 +1441,21 @@ shinyServer(function(input, output,session) {
output$gaugeMasque_progress <- renderGauge({ output$gaugeMasque_progress <- renderGauge({
PS = Project_status()
res = NULL res = NULL
if(PS$status=="doing"){ PS = Project_status(values$masque_key,values$curdir)
json_file = PS$file if(PS$passOK){
progress_file = paste(values$curdir,"www","masque","doing",paste(basename(file_path_sans_ext(json_file)),"_progress",".txt",sep=""),sep= .Platform$file.sep) if(PS$status=="doing"){
if(file.exists(progress_file)) json_file = PS$file
{ progress_file = paste(values$curdir,"www","masque","doing",paste(basename(file_path_sans_ext(json_file)),"_progress",".txt",sep=""),sep= .Platform$file.sep)
pf = read_lines(progress_file) if(file.exists(progress_file))
pf = round(as.numeric(pf),1) {
if(!is.na(pf)){ pf = read_lines(progress_file)
pf = min(pf,100); pf = max(pf,0) pf = round(as.numeric(pf),1)
if(!is.na(pf)){
pf = min(pf,100); pf = max(pf,0)
}
res = gauge(min(pf,100), 0,100,symbol = '%',label= "Progress...")
} }
res = gauge(min(pf,100), 0,100,symbol = '%',label= "Progress...")
} }
} }
return(res) return(res)
......
Supports Markdown
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