From 05c60e0288f980b4d42106342834e6ad7a0b9576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?hinzhao=28=E8=B5=B5=E8=BD=A9=29?= Date: Wed, 1 Sep 2021 10:36:50 +0800 Subject: [PATCH 1/7] fix the bug of calling vaa3d plugin --- shiny_app/server.R | 48 +++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/shiny_app/server.R b/shiny_app/server.R index 86c6824..ff52de6 100644 --- a/shiny_app/server.R +++ b/shiny_app/server.R @@ -79,30 +79,38 @@ shinyServer(function(input, output, session) { for(i in 1:length(inFile$datapath)){ #Xvfb :100 -ac & #export DISPLAY=:100.0 - log0 <- system('Xvfb :100 -ac & export DISPLAY=:100.0', intern=T) - output$console <- renderPrint({ - return(print(log0)) - }) + # log0 <- system('Xvfb :100 -ac & export DISPLAY=:100.0', 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 ',inFile$datapath[i],' #o "',inFile$datapath[i],'"_prep.swc #l 3 #s 2 #r 1"'), - intern=T) - output$console <- renderPrint({ - return(print(log)) - }) - pathswc <- data.frame(file=paste0("SWCFILE=",inFile$datapath[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) + # log0 <- system('ls', intern=T) + # output$console <- renderPrint({ + # return(print(log0)) + # }) + # log <- system(paste0('Vaa3D/vaa3d -x blastneuron -f pre_processing -p "#i ',inFile$datapath[i],' #o "',inFile$datapath[i],'"_prep.swc #l 3 #s 2 #r 1"'), + # intern=T) + # output$console <- renderPrint({ + # return(print(log)) + # }) + # pathswc <- data.frame(file=paste0("SWCFILE=",inFile$datapath[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 output the system command to "tmp.txt" for debug + sink("tmp.txt") + cat(paste0('export DISPLAY=:8463; Xvfb :8463 -auth /dev/null > xvfblog.txt 2>&1 & Vaa3D/vaa3d -x blastneuron -f pre_processing -p "#i ',inFile$datapath[i],' #o ',inFile$datapath[i],'_prep.swc #l 3 #s 2 #r 1"; cat "SWCFILE=',inFile$datapath[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(inFile$name[i],"[.]")[[1]][1]), "*.swc")),' ',inFile$datapath[i],' -o dists/',i,'.txt -p 2')) + sink() + # zx merge all call system to one call + system(paste0('export DISPLAY=:8463; Xvfb :8463 -auth /dev/null > xvfblog.txt 2>&1 & Vaa3D/vaa3d -x blastneuron -f pre_processing -p "#i ',inFile$datapath[i],' #o ',inFile$datapath[i],'_prep.swc #l 3 #s 2 #r 1"; echo "SWCFILE=',inFile$datapath[i],'_prep.swc" > mydatabase.ano; Vaa3D/vaa3d -x blastneuron -f batch_compute -p "#i mydatabase.ano #o features.csv"; Vaa3D/vaa3d -x /home/vaa3d/v3d_external/bin/plugins/neuron_utilities/neuron_distance/libneuron_dist.so -f neuron_distance -i ',Sys.glob(file.path(paste0("gold_163_all_soma_sort_s1_onlyswc/",strsplit(inFile$name[i],"[.]")[[1]][1]), "*.swc")),' ',inFile$datapath[i],' -o dists/',i,'.txt -p 2')) + try(nbdata <- read.csv("features.csv")) try(print(nbdata)) nbdata <- nbdata[c(3:22,36)] @@ -111,9 +119,9 @@ shinyServer(function(input, output, session) { # }) # Add distance metrics - gspath <- Sys.glob(file.path(paste0("gold_163_all_soma_sort_s1_onlyswc/",strsplit(inFile$name[i],"[.]")[[1]][1]), "*.swc")) - log3 <- system(paste0('Vaa3D/vaa3d -x neuron_distance -f neuron_distance -i ',gspath,' ',inFile$datapath[i],' -p 2 -o dists/',i,'.txt'), - intern=T) + # gspath <- Sys.glob(file.path(paste0("gold_163_all_soma_sort_s1_onlyswc/",strsplit(inFile$name[i],"[.]")[[1]][1]), "*.swc")) + # log3 <- system(paste0('Vaa3D/vaa3d -x neuron_distance -f neuron_distance -i ',gspath,' ',inFile$datapath[i],' -p 2 -o dists/',i,'.txt'), + # intern=T) dataFile <- readLines(paste0("dists/",i,".txt")) dfdist <- data.frame(esa1t2=NA,esa2t1=NA,ab_esa=NA,dsa=NA,pds1t2=NA,pds2t1=NA,a_pds=NA) From 9f7f7016413a06bf6bccb8156b89986b08075d08 Mon Sep 17 00:00:00 2001 From: ZX003 <1320435719@qq.com> Date: Wed, 1 Sep 2021 12:27:52 +0800 Subject: [PATCH 2/7] fix the bug of call vaa3d plugin --- shiny_app/server.R | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/shiny_app/server.R b/shiny_app/server.R index ff52de6..d51b887 100644 --- a/shiny_app/server.R +++ b/shiny_app/server.R @@ -109,8 +109,8 @@ shinyServer(function(input, output, session) { cat(paste0('export DISPLAY=:8463; Xvfb :8463 -auth /dev/null > xvfblog.txt 2>&1 & Vaa3D/vaa3d -x blastneuron -f pre_processing -p "#i ',inFile$datapath[i],' #o ',inFile$datapath[i],'_prep.swc #l 3 #s 2 #r 1"; cat "SWCFILE=',inFile$datapath[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(inFile$name[i],"[.]")[[1]][1]), "*.swc")),' ',inFile$datapath[i],' -o dists/',i,'.txt -p 2')) sink() # zx merge all call system to one call - system(paste0('export DISPLAY=:8463; Xvfb :8463 -auth /dev/null > xvfblog.txt 2>&1 & Vaa3D/vaa3d -x blastneuron -f pre_processing -p "#i ',inFile$datapath[i],' #o ',inFile$datapath[i],'_prep.swc #l 3 #s 2 #r 1"; echo "SWCFILE=',inFile$datapath[i],'_prep.swc" > mydatabase.ano; Vaa3D/vaa3d -x blastneuron -f batch_compute -p "#i mydatabase.ano #o features.csv"; Vaa3D/vaa3d -x /home/vaa3d/v3d_external/bin/plugins/neuron_utilities/neuron_distance/libneuron_dist.so -f neuron_distance -i ',Sys.glob(file.path(paste0("gold_163_all_soma_sort_s1_onlyswc/",strsplit(inFile$name[i],"[.]")[[1]][1]), "*.swc")),' ',inFile$datapath[i],' -o dists/',i,'.txt -p 2')) - + # 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 ',inFile$datapath[i],' #o ',inFile$datapath[i],'_prep.swc #l 3 #s 2 #r 1"; echo "SWCFILE=',inFile$datapath[i],'_prep.swc" > mydatabase.ano; Vaa3D/vaa3d -x blastneuron -f batch_compute -p "#i mydatabase.ano #o features.csv"; Vaa3D/vaa3d -x /home/vaa3d/v3d_external/bin/plugins/neuron_utilities/neuron_distance/libneuron_dist.so -f neuron_distance -i ',Sys.glob(file.path(paste0("gold_163_all_soma_sort_s1_onlyswc/",strsplit(inFile$name[i],"[.]")[[1]][1]), "*.swc")),' ',inFile$datapath[i],' -o ',i,'_dists_tmp.txt -p 2; echo test > dists/',i,'_dists_tmp.txt')) try(nbdata <- read.csv("features.csv")) try(print(nbdata)) nbdata <- nbdata[c(3:22,36)] @@ -122,7 +122,9 @@ shinyServer(function(input, output, session) { # gspath <- Sys.glob(file.path(paste0("gold_163_all_soma_sort_s1_onlyswc/",strsplit(inFile$name[i],"[.]")[[1]][1]), "*.swc")) # log3 <- system(paste0('Vaa3D/vaa3d -x neuron_distance -f neuron_distance -i ',gspath,' ',inFile$datapath[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]) From 56add68064b75d9bf99c3b2eeeedc09421049b8f Mon Sep 17 00:00:00 2001 From: ZX003 <1320435719@qq.com> Date: Wed, 1 Sep 2021 20:24:19 +0800 Subject: [PATCH 3/7] merge main branch to docker branch --- shiny_app/server.R | 62 ++++++++++++++++++++++++++++++++++++++-------- shiny_app/ui.R | 8 ++++-- 2 files changed, 58 insertions(+), 12 deletions(-) diff --git a/shiny_app/server.R b/shiny_app/server.R index d51b887..d4588a5 100644 --- a/shiny_app/server.R +++ b/shiny_app/server.R @@ -75,8 +75,14 @@ shinyServer(function(input, output, session) { { # Run blastneuron for each uploaded reconstruction inFile <- input$file1 + + #zx linus changed + IQpaths <- inFile$datapath[grepl(".csv",inFile$datapath)] + SWCpaths <- inFile$datapath[grepl(".swc",inFile$datapath)] + SWCnames <- inFile$name[grepl(".swc",inFile$datapath)] - for(i in 1:length(inFile$datapath)){ + #zx change inFile$datapath to SWCpaths + for(i in 1:length(SWCpaths)){ #Xvfb :100 -ac & #export DISPLAY=:100.0 # log0 <- system('Xvfb :100 -ac & export DISPLAY=:100.0', intern=T) @@ -110,7 +116,7 @@ shinyServer(function(input, output, session) { sink() # 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 ',inFile$datapath[i],' #o ',inFile$datapath[i],'_prep.swc #l 3 #s 2 #r 1"; echo "SWCFILE=',inFile$datapath[i],'_prep.swc" > mydatabase.ano; Vaa3D/vaa3d -x blastneuron -f batch_compute -p "#i mydatabase.ano #o features.csv"; Vaa3D/vaa3d -x /home/vaa3d/v3d_external/bin/plugins/neuron_utilities/neuron_distance/libneuron_dist.so -f neuron_distance -i ',Sys.glob(file.path(paste0("gold_163_all_soma_sort_s1_onlyswc/",strsplit(inFile$name[i],"[.]")[[1]][1]), "*.swc")),' ',inFile$datapath[i],' -o ',i,'_dists_tmp.txt -p 2; echo test > dists/',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 /home/vaa3d/v3d_external/bin/plugins/neuron_utilities/neuron_distance/libneuron_dist.so -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; echo test > dists/',i,'_dists_tmp.txt')) try(nbdata <- read.csv("features.csv")) try(print(nbdata)) nbdata <- nbdata[c(3:22,36)] @@ -137,7 +143,29 @@ 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(inFile$name[i],"[.]")[[1]][1])[1],29:43] + + #zx change 43 to 60 because the column number of data and the column number of idata is different + #zx but I don't know if it is right + #dfim <- data[which(ids==strsplit(inFile$name[i],"[.]")[[1]][1])[1],29:60] + + #zx linus here change to it + dfim <- data[which(ids==strsplit(SWCnames[i],"[.]")[[1]][1])[1],c(29:54)] + + IQ <- read.csv(paste0(IQpaths[i]),header=T) + dfim$FocusScore_swc <- IQ$FocusScore + dfim$MADIntensity_swc <- IQ$MADIntensity + dfim$MaxIntensity_swc <- IQ$MaxIntensity + dfim$MeanIntensity_swc <- IQ$MeanIntensity + dfim$MedianIntensity_swc <- IQ$MedianIntensity + dfim$MinIntensity_swc <- IQ$MinIntensity + dfim$PercentMaximal_swc <- IQ$PercentMaximal + dfim$PercentMinimal_swc <- IQ$PercentMinimal + dfim$StdIntensity_swc <- IQ$StdIntensity + dfim$SNR_mean_swc <- IQ$SNR_mean + dfim$CNR_mean_swc <- IQ$CNR_mean + dfim$ThresholdOtsu_swc <- IQ$ThresholdOtsu + dfim$SNR_otsu_swc <- IQ$SNR_otsu + dfim$CNR_otsu_swc <- IQ$CNR_otsu # Add row to data for each uploaded reconstruction idata = c(as.numeric(nbdata),as.numeric(dfdist),as.numeric(dfim)) @@ -242,16 +270,30 @@ shinyServer(function(input, output, session) { { inFile <- input$file1 - for(i in 1:length(inFile$datapath)){ + #zx linus changed + SWCpaths <- inFile$datapath[grepl(".swc",inFile$datapath)] + SWCnames <- inFile$name[grepl(".swc",inFile$datapath)] + + #zx change inFile$datapath to SWCpaths + for(i in 1:length(SWCpaths)){ # Get dataset, and define group, algorithm and paths - idataset <- groupsdf[which(ids==strsplit(inFile$name[i],"[.]")[[1]][1])[1],1] - igroup <- input$inputalg - ialgorithm <- input$inputalg - ipaths <- paste0("/x/x/x/x/x/x/",strsplit(inFile$name[i],"[.]")[[1]][1]) - iids <- strsplit(inFile$name[i],"[.]")[[1]][1] + # idataset <- groupsdf[which(ids==strsplit(inFile$name[i],"[.]")[[1]][1])[1],1] + # igroup <- input$inputalg + # ialgorithm <- input$inputalg + # ipaths <- paste0("/x/x/x/x/x/x/",strsplit(inFile$name[i],"[.]")[[1]][1]) + # iids <- strsplit(inFile$name[i],"[.]")[[1]][1] + + #zx this sentence make igroupsdf to same column numbers with groupsdf + igroupsdf <- groupsdf[1,] + igroupsdf$dataset <- groupsdf[which(ids==strsplit(SWCnames[i],"[.]")[[1]][1])[1],1] + igroupsdf$group <- input$inputalg + igroupsdf$algorithm <- input$inputalg + igroupsdf$paths <- paste0("/x/x/x/x/x/x/",strsplit(SWCnames[i],"[.]")[[1]][1]) + igroupsdf$ids <- strsplit(SWCnames[i],"[.]")[[1]][1] # Merge with groupsdf data - igroupsdf <- data.frame(dataset=idataset,group=igroup,algorithm=ialgorithm,paths=ipaths,ids=iids) + #igroupsdf <- data.frame(dataset=idataset,group=igroup,algorithm=ialgorithm,paths=ipaths,ids=iids) + groupsdf <- rbind(groupsdf,igroupsdf) } } diff --git a/shiny_app/ui.R b/shiny_app/ui.R index 798527c..13958db 100644 --- a/shiny_app/ui.R +++ b/shiny_app/ui.R @@ -130,9 +130,13 @@ shinyUI(fluidPage( # Horizontal line ---- tags$hr(), # Input: Select a file ---- - fileInput("file1", "Choose SWC Files", + + #zx linus changed + #fileInput("file1", "Choose SWC Files", + fileInput("file1", "Choose SWC and their associated IQ files", multiple = TRUE, - accept = c(".swc",".eswc"))), + #accept = c(".swc",".eswc"))), + accept = c(".swc",".eswc",".txt"))), # # Input: Checkbox # checkboxGroupInput("variableinpdat", "Choose images of uploaded reconstructions","",selected="variableinpdat",inline=TRUE), From 959792c6d0c2312de2cafff7b3dc26de5cf53bc7 Mon Sep 17 00:00:00 2001 From: ZX003 <1320435719@qq.com> Date: Thu, 2 Sep 2021 09:57:16 +0800 Subject: [PATCH 4/7] change txt to csv in ui.R and delete the vaa3d plugin output files --- shiny_app/server.R | 22 +++++++++++++--------- shiny_app/ui.R | 3 ++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/shiny_app/server.R b/shiny_app/server.R index d4588a5..4eb655a 100644 --- a/shiny_app/server.R +++ b/shiny_app/server.R @@ -111,9 +111,10 @@ shinyServer(function(input, output, session) { # }) # zx output the system command to "tmp.txt" for debug - sink("tmp.txt") - cat(paste0('export DISPLAY=:8463; Xvfb :8463 -auth /dev/null > xvfblog.txt 2>&1 & Vaa3D/vaa3d -x blastneuron -f pre_processing -p "#i ',inFile$datapath[i],' #o ',inFile$datapath[i],'_prep.swc #l 3 #s 2 #r 1"; cat "SWCFILE=',inFile$datapath[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(inFile$name[i],"[.]")[[1]][1]), "*.swc")),' ',inFile$datapath[i],' -o dists/',i,'.txt -p 2')) - sink() + # sink("tmp.txt") + # cat(paste0('export DISPLAY=:8463; Xvfb :8463 -auth /dev/null > xvfblog.txt 2>&1 & Vaa3D/vaa3d -x blastneuron -f pre_processing -p "#i ',inFile$datapath[i],' #o ',inFile$datapath[i],'_prep.swc #l 3 #s 2 #r 1"; cat "SWCFILE=',inFile$datapath[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(inFile$name[i],"[.]")[[1]][1]), "*.swc")),' ',inFile$datapath[i],' -o dists/',i,'.txt -p 2')) + # sink() + # 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 /home/vaa3d/v3d_external/bin/plugins/neuron_utilities/neuron_distance/libneuron_dist.so -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; echo test > dists/',i,'_dists_tmp.txt')) @@ -171,13 +172,16 @@ shinyServer(function(input, output, session) { idata = c(as.numeric(nbdata),as.numeric(dfdist),as.numeric(dfim)) data <- rbind(data,idata) + #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 13958db..bb29136 100644 --- a/shiny_app/ui.R +++ b/shiny_app/ui.R @@ -136,7 +136,8 @@ shinyUI(fluidPage( fileInput("file1", "Choose SWC and their associated IQ files", multiple = TRUE, #accept = c(".swc",".eswc"))), - accept = c(".swc",".eswc",".txt"))), + #zx change .txt to .csv + accept = c(".swc",".eswc",".csv"))), # # Input: Checkbox # checkboxGroupInput("variableinpdat", "Choose images of uploaded reconstructions","",selected="variableinpdat",inline=TRUE), From c43846fe5fd7e67293cd5c3ad895779a55924837 Mon Sep 17 00:00:00 2001 From: ZX003 <1320435719@qq.com> Date: Thu, 12 May 2022 08:55:48 +0800 Subject: [PATCH 5/7] fix upload --- shiny_app/server.R | 2 +- shiny_app/ui.R | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/shiny_app/server.R b/shiny_app/server.R index 4eb655a..0779fb9 100644 --- a/shiny_app/server.R +++ b/shiny_app/server.R @@ -117,7 +117,7 @@ shinyServer(function(input, output, session) { # 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 /home/vaa3d/v3d_external/bin/plugins/neuron_utilities/neuron_distance/libneuron_dist.so -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; echo test > dists/',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 /home/vaa3d/v3d_external/bin/plugins/neuron_utilities/neuron_distance/libneuron_dist.so -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)] diff --git a/shiny_app/ui.R b/shiny_app/ui.R index bb29136..a4cfd23 100644 --- a/shiny_app/ui.R +++ b/shiny_app/ui.R @@ -136,8 +136,8 @@ shinyUI(fluidPage( fileInput("file1", "Choose SWC and their associated IQ files", multiple = TRUE, #accept = c(".swc",".eswc"))), - #zx change .txt to .csv - accept = c(".swc",".eswc",".csv"))), + #zx add .csv + accept = c(".swc",".eswc",".txt",".csv"))), # # Input: Checkbox # checkboxGroupInput("variableinpdat", "Choose images of uploaded reconstructions","",selected="variableinpdat",inline=TRUE), From 4c7a9f3c15d0da299e8b453df729f33e840eed75 Mon Sep 17 00:00:00 2001 From: ZX003 <1320435719@qq.com> Date: Thu, 12 May 2022 09:20:51 +0800 Subject: [PATCH 6/7] merger file --- shiny_app/server.R | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/shiny_app/server.R b/shiny_app/server.R index 6cead0b..b3b46af 100644 --- a/shiny_app/server.R +++ b/shiny_app/server.R @@ -291,27 +291,9 @@ shinyServer(function(input, output, session) { SWCpaths <- inFile$datapath[grepl(".swc",inFile$datapath)] SWCnames <- inFile$name[grepl(".swc",inFile$datapath)] -<<<<<<< HEAD - #zx linus changed - SWCpaths <- inFile$datapath[grepl(".swc",inFile$datapath)] - SWCnames <- inFile$name[grepl(".swc",inFile$datapath)] - - #zx change inFile$datapath to SWCpaths - for(i in 1:length(SWCpaths)){ - # Get dataset, and define group, algorithm and paths - # idataset <- groupsdf[which(ids==strsplit(inFile$name[i],"[.]")[[1]][1])[1],1] - # igroup <- input$inputalg - # ialgorithm <- input$inputalg - # ipaths <- paste0("/x/x/x/x/x/x/",strsplit(inFile$name[i],"[.]")[[1]][1]) - # iids <- strsplit(inFile$name[i],"[.]")[[1]][1] - - #zx this sentence make igroupsdf to same column numbers with groupsdf - igroupsdf <- groupsdf[1,] -======= for(i in 1:length(SWCpaths)){ igroupsdf <- groupsdf[1,] # Get dataset, and define group, algorithm and paths ->>>>>>> origin/main igroupsdf$dataset <- groupsdf[which(ids==strsplit(SWCnames[i],"[.]")[[1]][1])[1],1] igroupsdf$group <- input$inputalg igroupsdf$algorithm <- input$inputalg @@ -319,14 +301,9 @@ shinyServer(function(input, output, session) { igroupsdf$ids <- strsplit(SWCnames[i],"[.]")[[1]][1] # Merge with groupsdf data -<<<<<<< HEAD - #igroupsdf <- data.frame(dataset=idataset,group=igroup,algorithm=ialgorithm,paths=ipaths,ids=iids) - -======= # igroupsdf <- data.frame(dataset=idataset,group=igroup,algorithm=ialgorithm,paths=ipaths,ids=iids) # print(names(groupsdf)) # print(names(igroupsdf)) ->>>>>>> origin/main groupsdf <- rbind(groupsdf,igroupsdf) } } From cae55c119ae87ed61843a5f98213ab5e046f5e98 Mon Sep 17 00:00:00 2001 From: ZX003 <1320435719@qq.com> Date: Fri, 13 May 2022 15:37:19 +0800 Subject: [PATCH 7/7] change neuron_distance --- shiny_app/server.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shiny_app/server.R b/shiny_app/server.R index b3b46af..b7b8377 100644 --- a/shiny_app/server.R +++ b/shiny_app/server.R @@ -123,7 +123,7 @@ shinyServer(function(input, output, session) { #}) # 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 /home/vaa3d/v3d_external/bin/plugins/neuron_utilities/neuron_distance/libneuron_dist.so -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')) + 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)]