Commit f2b8aef9 authored by svolant's avatar svolant
Browse files

contaminant in fasta file

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