Commit 7026a73d authored by svolant's avatar svolant
Browse files

modif selection dossier

parent 868c392d
...@@ -249,10 +249,10 @@ CheckMasque <- function(input,values) ...@@ -249,10 +249,10 @@ CheckMasque <- function(input,values)
} }
## At least one fastq is detected ## At least one fastq is detected
if(is.null(Error) && input$LoadFiles>0 && length(values$fastq_names_only)==0){ # if(is.null(Error) && input$LoadFiles>0 && length(values$fastq_names_only)==0){
Error = "<h6><strong>The selected directory must contain at least one file in the following format : fastq, fastq.gz, or fq.</strong></h6>" # Error = "<h6><strong>The selected directory must contain at least one file in the following format : fastq, fastq.gz, or fq.</strong></h6>"
HowTo = "<h6><strong>Change the working directory and check the format of the files</strong></h6>" # HowTo = "<h6><strong>Change the working directory and check the format of the files</strong></h6>"
} # }
if(is.null(Error) && input$PairedOrNot=='y' && input$MatchFiles_button>0){ if(is.null(Error) && input$PairedOrNot=='y' && input$MatchFiles_button>0){
if(length(values$R2fastQ) !=length(values$R2fastQ)){ if(length(values$R2fastQ) !=length(values$R2fastQ)){
......
...@@ -30,7 +30,7 @@ shinyServer(function(input, output,session) { ...@@ -30,7 +30,7 @@ shinyServer(function(input, output,session) {
## Reactive target ## Reactive target
values <- reactiveValues(TargetWorking = target,labeled=NULL,fastq_names_only=NULL,R1fastQ=NULL,R2fastQ=NULL, values <- reactiveValues(TargetWorking = target,labeled=NULL,fastq_names_only=NULL,R1fastQ=NULL,R2fastQ=NULL,
json_name=json_name,num=0,pass=pass,login_email = NULL,is.valid =NULL, json_name=json_name,num=0,pass=pass,login_email = NULL,is.valid =NULL,
biom_masque = NULL,tree_masque=NULL,masque_key = NULL) biom_masque = NULL,tree_masque=NULL,masque_key = NULL,paths_fastq_tmp=NULL)
## Counts file ## Counts file
dataInputCounts <-reactive({ dataInputCounts <-reactive({
...@@ -663,23 +663,38 @@ shinyServer(function(input, output,session) { ...@@ -663,23 +663,38 @@ shinyServer(function(input, output,session) {
############################################################# #############################################################
## Select a folder (for MASQUE) ## Select a folder (for MASQUE)
shinyDirChoose(input, 'dir', roots = c(dir=""),filetypes = c('', 'fastq','gz','fgz')) shinyDirChoose(input, 'dir', roots = c(dir=""),filetypes = c('', 'fastq','gz','fgz'))
dir <- reactive(input$dir)
output$dirSel <- renderText({
home <- normalizePath("~") # output$dirSel <- renderText({
home <- "" # print(input$dir2)
path_glob = file.path(home, paste(unlist(dir()$path[-1]), collapse = .Platform$file.sep)) # home <- normalizePath("~")
}) # home <- ""
# path_glob = file.path(home, paste(unlist(dir()$path[-1]), collapse = .Platform$file.sep))
# })
#
path <- reactive({ observeEvent(input$dir,{
inFiles <- input$dir
home <- normalizePath("~") if (!is.null(inFiles)){
home <- "" # values$fastq_names_only = unique(paste(values$fastq_names_only,inFiles$name))
file.path(home, paste(unlist(dir()$path[-1]), collapse = .Platform$file.sep),"*.f*q*") values$paths_fastq_tmp = rbind(isolate(values$paths_fastq_tmp),inFiles)
values$fastq_names_only = isolate(unique(values$paths_fastq_tmp[,"name"]))
}
}) })
#
# path <- reactive({
#
# home <- normalizePath("~")
# home <- ""
# file.path(home, paste(unlist(dir()$path[-1]), collapse = .Platform$file.sep),"*.f*q*")
# })
CreateFasta <- reactive({ CreateFasta <- reactive({
seq = NULL seq = NULL
...@@ -706,7 +721,7 @@ shinyServer(function(input, output,session) { ...@@ -706,7 +721,7 @@ shinyServer(function(input, output,session) {
tmp = tempdir() tmp = tempdir()
home <- normalizePath("~") home <- normalizePath("~")
home <- "" home <- ""
path_glob = file.path(home, paste(unlist(dir()$path[-1]), collapse = .Platform$file.sep)) # path_glob = file.path(home, paste(unlist(dir()$path[-1]), collapse = .Platform$file.sep))
## Paired-end ## Paired-end
...@@ -720,9 +735,18 @@ shinyServer(function(input, output,session) { ...@@ -720,9 +735,18 @@ shinyServer(function(input, output,session) {
if(dir.exists(pathToR1)){file.remove(list.files(pathToR1,full.names =TRUE))} else dir.create(pathToR1) if(dir.exists(pathToR1)){file.remove(list.files(pathToR1,full.names =TRUE))} else dir.create(pathToR1)
if(dir.exists(pathToR2)){file.remove(list.files(pathToR2,full.names =TRUE))} else dir.create(pathToR2) if(dir.exists(pathToR2)){file.remove(list.files(pathToR2,full.names =TRUE))} else dir.create(pathToR2)
for(i in values$R1fastQ){
for(i in values$R1fastQ){file.copy(from=paste(path_glob,i,sep=.Platform$file.sep), to=paste(tmp,"Masque_files_R1",sep= .Platform$file.sep));cmp = cmp +1;incProgress(cmp/nfiles, detail = "Forward fastq files...")} ind=which(i==values$paths_fastq_tmp[,"name"])[1]
for(i in values$R2fastQ){file.copy(from=paste(path_glob,i,sep=.Platform$file.sep), to=paste(tmp,"Masque_files_R2",sep= .Platform$file.sep));cmp = cmp +1;incProgress(cmp/nfiles, detail = "Reverse fastq files...")} file.copy(from=values$paths_fastq_tmp[,"datapath"][ind], to=paste(tmp,"Masque_files_R1",i,sep= .Platform$file.sep))
cmp = cmp +1
incProgress(cmp/nfiles, detail = "Forward fastq files...")
}
for(i in values$R2fastQ){
ind=which(i==values$paths_fastq_tmp[,"name"])[1]
file.copy(from=values$paths_fastq_tmp[,"datapath"][ind], to=paste(tmp,"Masque_files_R2",i,sep= .Platform$file.sep))
cmp = cmp +1
incProgress(cmp/nfiles, detail = "Reverse fastq files...")
}
}) })
} else{ } else{
...@@ -736,7 +760,9 @@ shinyServer(function(input, output,session) { ...@@ -736,7 +760,9 @@ shinyServer(function(input, output,session) {
if(dir.exists(pathTo)){file.remove(list.files(pathTo,full.names =TRUE))} else dir.create(pathTo) if(dir.exists(pathTo)){file.remove(list.files(pathTo,full.names =TRUE))} else dir.create(pathTo)
for(i in values$fastq_names_only){file.copy(from=paste(path_glob,i,sep=.Platform$file.sep), to=paste(tmp,"Masque_files",sep= .Platform$file.sep));cmp = cmp +1;incProgress(cmp/nfiles)} for(i in values$fastq_names_only){
ind=which(i==values$paths_fastq_tmp[,"name"])[1]
file.copy(from=values$paths_fastq_tmp[,"datapath"][ind], to=paste(tmp,"Masque_files",i,sep= .Platform$file.sep));cmp = cmp +1;incProgress(cmp/nfiles)}
}) })
} }
...@@ -760,39 +786,40 @@ shinyServer(function(input, output,session) { ...@@ -760,39 +786,40 @@ shinyServer(function(input, output,session) {
## FastQ list ## FastQ list
output$FastQList_out <- renderUI({ output$FastQList_out <- renderUI({
FastqLoad() res = NULL
NullBox = h3(strong("0 FastQ file detected"),style="color:red; text-align: center") if(!is.null(input$dir)){
res = NullBox NullBox = h3(strong("0 FastQ file detected"),style="color:red; text-align: center")
res = NullBox
if(length(values$fastq_names_only)>0)
{ if(length(values$fastq_names_only)>0)
res =list(selectInput("FastQList",label = "List of the fastq files in the selected directory",values$fastq_names_only,multiple =TRUE,selectize=FALSE,size = 6), {
actionButton("RemoveFastQbut",'Remove file(s)',icon=icon("remove"))) res =list(selectInput("FastQList",label = "List of the fastq files in the selected directory",isolate(values$fastq_names_only),multiple =TRUE,selectize=FALSE,size = 6),
} else res = NullBox actionButton("RemoveFastQbut",'Remove file(s)',icon=icon("remove")))
} else res = NullBox
}
return(res) return(res)
}) })
#
FastqLoad <- reactive({ # FastqLoad <- reactive({
input$LoadFiles # input$LoadFiles
## Reinitializing # ## Reinitializing
if(!is.null(isolate(values$fastq_names_only))) values$fastq_names_only = NULL # if(!is.null(isolate(values$fastq_names_only))) values$fastq_names_only = NULL
#
#
## Get the fastq names # ## Get the fastq names
home <- normalizePath("~") # home <- normalizePath("~")
home <- "" # home <- ""
path_glob = file.path(home, paste(unlist(isolate(dir()$path[-1])), collapse = .Platform$file.sep)) # # path_glob = file.path(home, paste(unlist(isolate(dir()$path[-1])), collapse = .Platform$file.sep))
#
fastq_names = Sys.glob(isolate(path())) # fastq_names = Sys.glob(isolate(path()))
#
if(length(fastq_names)>0 && isolate(input$LoadFiles>0)) # if(length(fastq_names)>0 && isolate(input$LoadFiles>0))
{ # {
if(is.null(isolate(values$fastq_names_only)) || length(isolate(values$fastq_names_only))==0) values$fastq_names_only = gsub(pattern = path_glob,x = fastq_names,replacement = "") # if(is.null(isolate(values$fastq_names_only)) || length(isolate(values$fastq_names_only))==0) values$fastq_names_only = gsub(pattern = path_glob,x = fastq_names,replacement = "")
} # }
#
}) # })
## Remove FastQ function ## Remove FastQ function
...@@ -802,6 +829,7 @@ shinyServer(function(input, output,session) { ...@@ -802,6 +829,7 @@ shinyServer(function(input, output,session) {
{ {
ind = which(values$fastq_names_only%in% input$FastQList) ind = which(values$fastq_names_only%in% input$FastQList)
values$fastq_names_only = values$fastq_names_only[-ind] values$fastq_names_only = values$fastq_names_only[-ind]
values$paths_fastq_tmp = values$paths_fastq_tmp[-ind,]
updateSelectInput(session, "FastQList","List of the fastq files in the selected directory",values$fastq_names_only) updateSelectInput(session, "FastQList","List of the fastq files in the selected directory",values$fastq_names_only)
} }
}) })
...@@ -1056,12 +1084,12 @@ shinyServer(function(input, output,session) { ...@@ -1056,12 +1084,12 @@ shinyServer(function(input, output,session) {
output$infoBoxFastQ <- renderInfoBox({ output$infoBoxFastQ <- renderInfoBox({
FastqLoad() # FastqLoad()
res = NULL res = NULL
res = infoBox("Fastq files","Load the fastq files ", color = "light-blue",width=NULL,icon = icon("play"),fill = TRUE) res = infoBox("Fastq files","Load the fastq files ", color = "light-blue",width=NULL,icon = icon("play"),fill = TRUE)
if(input$LoadFiles>=1){ if(!is.null(input$dir)){
if(length(unique(values$fastq_names_only))==0) res = infoBox("Fastq files","Select a working directory with at least one fastq file", color = "red",width=NULL,icon = icon("play"),fill = TRUE) if(length(unique(values$fastq_names_only))==0) res = infoBox("Fastq files","Select at least one fastq file", color = "red",width=NULL,icon = icon("play"),fill = TRUE)
if(length(unique(values$fastq_names_only))>0) res = infoBox("Fastq files",paste(length(unique(values$fastq_names_only)), "files are loaded"), color = "green",width=NULL,icon = icon("play"),fill = TRUE) if(length(unique(values$fastq_names_only))>0) res = infoBox("Fastq files",paste(length(unique(values$fastq_names_only)), "files are loaded"), color = "green",width=NULL,icon = icon("play"),fill = TRUE)
} }
return(res) return(res)
...@@ -1112,7 +1140,6 @@ shinyServer(function(input, output,session) { ...@@ -1112,7 +1140,6 @@ shinyServer(function(input, output,session) {
Error = CMP$Error Error = CMP$Error
if(is.null(Error) && isolate(values$num)<100){ if(is.null(Error) && isolate(values$num)<100){
values$num = isolate(values$num)*100
progress_file = paste(curdir,"www","masque","doing",paste(basename(file_path_sans_ext(json_name)),"_progress",".txt",sep=""),sep= .Platform$file.sep) progress_file = paste(curdir,"www","masque","doing",paste(basename(file_path_sans_ext(json_name)),"_progress",".txt",sep=""),sep= .Platform$file.sep)
if(file.exists(progress_file)) if(file.exists(progress_file))
{ {
...@@ -1463,17 +1490,11 @@ shinyServer(function(input, output,session) { ...@@ -1463,17 +1490,11 @@ shinyServer(function(input, output,session) {
textMASQUE <- reactive({ textMASQUE <- reactive({
samp = SamplesMasque(input,values) samp = SamplesMasque(input,values)
home <- normalizePath("~")
home <- ""
path_glob = file.path(home, paste(unlist(dir()$path[-1]), collapse = .Platform$file.sep))
# text ='<h4><b>Summary of your analysis:</b></h4> <hr color="white">'
text = paste("<b>Type of data:</b>",input$DataTypeMasque,"<br /> <br /> ", text = paste("<b>Type of data:</b>",input$DataTypeMasque,"<br /> <br /> ",
"<b>Paired-end sequencing:</b>",input$PairedOrNot) "<b>Paired-end sequencing:</b>",input$PairedOrNot)
text = paste(text,"<br /> <br /> ","<b>Number of samples:</b>",length(samp$samples)) text = paste(text,"<br /> <br /> ","<b>Number of samples:</b>",length(samp$samples))
text = paste(text,"<br /> <br /> ","<b>Removed samples:</b>",length(samp$samples_removed)) text = paste(text,"<br /> <br /> ","<b>Removed samples:</b>",length(samp$samples_removed))
text = paste(text,"<br /> <br /> ","<b>Working directory:</b>",path_glob)
if(isValidEmail(input$to)) text = paste(text,"<br /> <br /> ","<b>Email:</b>",input$to) if(isValidEmail(input$to)) text = paste(text,"<br /> <br /> ","<b>Email:</b>",input$to)
......
...@@ -236,9 +236,7 @@ body <- dashboardBody( ...@@ -236,9 +236,7 @@ body <- dashboardBody(
img_src="helpPopPup/GetKey_button.png") img_src="helpPopPup/GetKey_button.png")
), ),
column(width=3, column(width=3,
withPopup(infoBoxOutput("infoBoxFastQ",width=NULL), infoBoxOutput("infoBoxFastQ",width=NULL)
title="Once you have selected your working directory you must click on this button:",
img_src="helpPopPup/LoadFiles_button.png",width_img = "60%",height_img = "60%")
), ),
column(width=3, column(width=3,
infoBoxOutput("infoBoxFastQ_match",width=NULL) infoBoxOutput("infoBoxFastQ_match",width=NULL)
...@@ -339,19 +337,19 @@ body <- dashboardBody( ...@@ -339,19 +337,19 @@ body <- dashboardBody(
), ),
box(title="Directory containing the FastQ files ",width = NULL, status = "primary", box(title="Directory containing the FastQ files ",width = NULL, status = "primary",
column(width=12,verbatimTextOutput("dirSel")), # column(width=12,verbatimTextOutput("dirSel")),
br(), # br(),
column(width=12, column(width=12,
shinyDirButton("dir", "Select a directory", "Upload",buttonType = "primary"),
HTML("&nbsp;"), fileInput("dir",label = 'Select your fastq files',accept = c(".fastq,.fastq.gz,.fgz,.gz"),multiple = TRUE),
actionButton("LoadFiles",'Load',icon=icon("play")) # shinyDirButton("dir", "Select a directory", "Upload",buttonType = "primary")
),
conditionalPanel(condition="input.LoadFiles>=1", # tags$input(id = "dir2", webkitdirectory = TRUE, type = "file", onchange="pressed()"),
br(), # HTML("&nbsp;"),
hr(), # actionButton("LoadFiles",'Load',icon=icon("play"))
br(), uiOutput("FastQList_out")
column(width=12,uiOutput("FastQList_out")) )
)
), ),
box(id="box-match",title=" Match the paired files (only for paired-end sequencing)",width = NULL, status = "primary", box(id="box-match",title=" Match the paired files (only for paired-end sequencing)",width = NULL, status = "primary",
......
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