diff --git a/shiny_app/server.R b/shiny_app/server.R index 6f3239c..b7b8377 100644 --- a/shiny_app/server.R +++ b/shiny_app/server.R @@ -97,30 +97,33 @@ shinyServer(function(input, output, session) { # print(SWCpaths[i]) #Xvfb :100 -ac & #export DISPLAY=:100.0 - log0 <- system('export DISPLAY=:8469; Xvfb :8469 -auth /dev/null > xvfblog.txt 2>&1 &', intern=T) - output$console <- renderPrint({ - return(print(log0)) - }) + #log0 <- system('export DISPLAY=:8469; Xvfb :8469 -auth /dev/null > xvfblog.txt 2>&1 &', intern=T) + #output$console <- renderPrint({ + # return(print(log0)) + #}) # log0 <- system('xhost local:allencenter', intern=T) # output$console <- renderPrint({ # return(print(log0)) # }) - log0 <- system('ls', intern=T) - output$console <- renderPrint({ - return(print(log0)) - }) - log <- system(paste0('Vaa3D/vaa3d -x blastneuron -f pre_processing -p "#i ',SWCpaths[i],' #o "',SWCpaths[i],'"_prep.swc #l 3 #s 2 #r 1"'), - intern=T) - output$console <- renderPrint({ - return(print(log)) - }) - pathswc <- data.frame(file=paste0("SWCFILE=",SWCpaths[i],"_prep.swc")) - write.table(pathswc,file="mydatabase.ano",col.names=F,row.names=F,quote=F) - log2 <- system('Vaa3D/vaa3d -x blastneuron -f batch_compute -p \"#i mydatabase.ano #o features.csv"', - intern=T) - output$console <- renderPrint({ - return(print(log2)) - }) + #log0 <- system('ls', intern=T) + #output$console <- renderPrint({ + # return(print(log0)) + #}) + #log <- system(paste0('Vaa3D/vaa3d -x blastneuron -f pre_processing -p "#i ',SWCpaths[i],' #o "',SWCpaths[i],'"_prep.swc #l 3 #s 2 #r 1"'), + # intern=T) + #output$console <- renderPrint({ + # return(print(log)) + #}) + #pathswc <- data.frame(file=paste0("SWCFILE=",SWCpaths[i],"_prep.swc")) + #write.table(pathswc,file="mydatabase.ano",col.names=F,row.names=F,quote=F) + #log2 <- system('Vaa3D/vaa3d -x blastneuron -f batch_compute -p \"#i mydatabase.ano #o features.csv"', + # intern=T) + #output$console <- renderPrint({ + # return(print(log2)) + #}) + # zx merge all call system to one call + # zx It seems that the dists folder cannot be written in shinyapp, so change path to i._dists_tmp.txt + system(paste0('export DISPLAY=:8463; Xvfb :8463 -auth /dev/null > xvfblog.txt 2>&1 & Vaa3D/vaa3d -x blastneuron -f pre_processing -p "#i ',SWCpaths[i],' #o ',SWCpaths[i],'_prep.swc #l 3 #s 2 #r 1"; echo "SWCFILE=',SWCpaths[i],'_prep.swc" > mydatabase.ano; Vaa3D/vaa3d -x blastneuron -f batch_compute -p "#i mydatabase.ano #o features.csv"; Vaa3D/vaa3d -x neuron_distance -f neuron_distance -i ',Sys.glob(file.path(paste0("gold_163_all_soma_sort_s1_onlyswc/",strsplit(SWCnames[i],"[.]")[[1]][1]), "*.swc")),' ',SWCpaths[i],' -o ',i,'_dists_tmp.txt -p 2')) try(nbdata <- read.csv("features.csv")) try(print(nbdata)) nbdata <- nbdata[c(3:22,36)] @@ -129,10 +132,12 @@ shinyServer(function(input, output, session) { # }) # Add distance metrics - gspath <- Sys.glob(file.path(paste0("gold_163_all_soma_sort_s1_onlyswc/",strsplit(SWCnames[i],"[.]")[[1]][1]), "*.swc")) - log3 <- system(paste0('Vaa3D/vaa3d -x neuron_distance -f neuron_distance -i ',gspath,' ',SWCpaths[i],' -p 2 -o dists/',i,'.txt'), - intern=T) - dataFile <- readLines(paste0("dists/",i,".txt")) + #gspath <- Sys.glob(file.path(paste0("gold_163_all_soma_sort_s1_onlyswc/",strsplit(SWCnames[i],"[.]")[[1]][1]), "*.swc")) + #log3 <- system(paste0('Vaa3D/vaa3d -x neuron_distance -f neuron_distance -i ',gspath,' ',SWCpaths[i],' -p 2 -o dists/',i,'.txt'), + # intern=T) + #dataFile <- readLines(paste0("dists/",i,".txt")) + #zx change path to i._dists_tmp.txt + dataFile <- readLines(paste0(i,"_dists_tmp.txt")) dfdist <- data.frame(esa1t2=NA,esa2t1=NA,ab_esa=NA,dsa=NA,pds1t2=NA,pds2t1=NA,a_pds=NA) dfdist$esa1t2 <- as.numeric(strsplit(dataFile[3],'=')[[1]][2]) @@ -145,6 +150,7 @@ shinyServer(function(input, output, session) { # Add image metrics # which(ids=="5") this is index for data to get image metrics + dfim <- data[which(ids==strsplit(SWCnames[i],"[.]")[[1]][1])[1],c(29:54)] IQ <- read.csv(paste0(IQpaths[i]),header=T) @@ -172,13 +178,16 @@ shinyServer(function(input, output, session) { data <- rbind(data,idata) # print("Rbind done") + #zx remove vaa3d plugins output files + system("rm *_dists_tmp.txt features.csv mydatabase.ano") + # Remove remote files - system("rm dists/*", - intern=T) - system("rm features.csv", - intern=T) - system("rm mydatabase.ano", - intern=T) + # system("rm dists/*", + # intern=T) + # system("rm features.csv", + # intern=T) + # system("rm mydatabase.ano", + # intern=T) } } diff --git a/shiny_app/ui.R b/shiny_app/ui.R index 041156b..34905de 100644 --- a/shiny_app/ui.R +++ b/shiny_app/ui.R @@ -136,7 +136,9 @@ shinyUI(fluidPage( # Input: Select a file ---- fileInput("file1", "Choose SWC and their associated IQ files", multiple = TRUE, - accept = c(".swc",".eswc",".txt"))), + #accept = c(".swc",".eswc",".txt"))), + #zx add .csv + accept = c(".swc",".eswc",".txt",".csv"))), # # Input: Checkbox # checkboxGroupInput("variableinpdat", "Choose images of uploaded reconstructions","",selected="variableinpdat",inline=TRUE),