Commit f2b8aef9 authored by svolant's avatar svolant
Browse files

contaminant in fasta file

parent 9315b536
...@@ -337,16 +337,19 @@ SamplesMasque <- function(input,values) ...@@ -337,16 +337,19 @@ SamplesMasque <- function(input,values)
CreateJSON <- function(input,values){ CreateJSON <- function(input,values){
tmp = tempdir()
path_fasta = paste(tmp,paste(basename(file_path_sans_ext(values$json_name)),"_contaminant.fasta",sep=""),sep = .Platform$file.sep)
if(input$PairedOrNot=='n') if(input$PairedOrNot=='n')
{ {
path_fastq = paste(tempdir(),"Masque_files",sep= .Platform$file.sep) path_fastq = paste(tmp,"Masque_files",sep= .Platform$file.sep)
df = data.frame("paired"=FALSE, df = data.frame("paired"=FALSE,
"path"=path_fastq, "path"=path_fastq,
"host"=input$HostName, "host"=input$HostName,
"type"=input$DataTypeMasque, "type"=input$DataTypeMasque,
"mail"=values$login_email, "mail"=values$login_email,
"contaminant"= "/home/aghozlan/workspace/shaman_bioblend/alienTrimmerPF8contaminants.fasta" "contaminant"= path_fasta
) )
df %>% jsonlite::toJSON() %>% write_lines(values$json_name) df %>% jsonlite::toJSON() %>% write_lines(values$json_name)
...@@ -362,7 +365,7 @@ CreateJSON <- function(input,values){ ...@@ -362,7 +365,7 @@ CreateJSON <- function(input,values){
"host"=input$HostName, "host"=input$HostName,
"type"=input$DataTypeMasque, "type"=input$DataTypeMasque,
"mail"=values$login_email, "mail"=values$login_email,
"contaminant"= "/home/aghozlan/workspace/shaman_bioblend/alienTrimmerPF8contaminants.fasta" "contaminant"= path_fasta
) )
df %>% jsonlite::toJSON() %>% write_lines(values$json_name) df %>% jsonlite::toJSON() %>% write_lines(values$json_name)
} }
......
...@@ -680,27 +680,24 @@ shinyServer(function(input, output,session) { ...@@ -680,27 +680,24 @@ shinyServer(function(input, output,session) {
CreateFasta <- reactive({
# observeEvent(input$submit,{ seq = NULL
# values$fastq_names_only = NULL tmp = tempdir()
# tmp = tempdir() fastaName = paste(tmp,paste(basename(file_path_sans_ext(json_name)),"_contaminant.fasta",sep=""),sep = .Platform$file.sep)
# pathTo = paste(tmp,"Masque_files",sep=.Platform$file.sep)
# if(!file.exists(fastaName)) file.create(fastaName,showWarnings=FALSE)
# if (dir.exists(pathTo)) if(input$PairedOrNot=="y"){seq =paste("#Seq1\n",input$R1primer,"\n \n","#Seq2\n",input$R2primer,sep="")}
# { if(input$PairedOrNot=="n"){seq =input$primerSingle}
# file.remove(list.files(pathTo,full.names =TRUE)) if(!is.null(seq)) write(seq, file=fastaName)
# } else dir.create(pathTo)
# })
# file.copy(from=Sys.glob(path()), to=paste(tmp,"Masque_files",sep= .Platform$file.sep))
# })
#
observeEvent(input$submit,{ observeEvent(input$submit,{
CMP = CheckMasque(input, values) CMP = CheckMasque(input, values)
Error = CMP$Error Error = CMP$Error
values$num = 1 values$num = 1
isJSONalreadyExist = file.exists(paste(curdir,"www","masque","doing",basename(json_name),sep= .Platform$file.sep)) isJSONalreadyExist = file.exists(paste(curdir,"www","masque","doing",basename(json_name),sep= .Platform$file.sep))
CreateFasta()
if(is.null(Error) && !isJSONalreadyExist) if(is.null(Error) && !isJSONalreadyExist)
{ {
tmp = tempdir() tmp = tempdir()
...@@ -938,10 +935,13 @@ shinyServer(function(input, output,session) { ...@@ -938,10 +935,13 @@ shinyServer(function(input, output,session) {
if(file.exists(progress_file)) if(file.exists(progress_file))
{ {
pf = read_lines(progress_file) pf = read_lines(progress_file)
pf = as.numeric(pf) print(pf)
if(!is.na(pf)){ if(!is.null(pf)){
pf = min(pf,100); pf = max(pf,0) pf = as.numeric(pf)
if(isolate(values$num)<pf) {values$num = pf} if(!is.na(pf)){
pf = min(pf,100); pf = max(pf,0)
if(isolate(values$num)<pf) {values$num = pf}
}
} }
} }
......
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