poonlab / kaphishiny Goto Github PK
View Code? Open in Web Editor NEWA Shiny web interface for running Kaphi
A Shiny web interface for running Kaphi
When running an analysis via KaphiShiny the result is saved to a tsv file with a unique name, which is the time the tsv was initialized. However, a web session in only able to generate one file name. Therefore, if someone runs a second analysis after an analysis has already finished the tsv of the first analysis is overwritten with the tsv of the second.
The app crashes at the following line (The branch is: initConfig), note that this line is comented out in the last commit, tree used: ((A:1,B:1):1,C:1);
res <- run.smc(ws, model=input$specificModel, verbose=F)
The following error message is generated:
Warning: Error in t: object 'config' not found
Stack trace (innermost first):
69: t
68: is.data.frame
67: write.table
66: run.smc
65: observeEventHandler [/home/fabusard/git/KaphiShiny/app.R#176]
1: runApp
I checked config
in ws
and it is there.
Running on macOS Sierra with R 3.3.2, commit 5eb0274
Warning: Error in serverFuncSource: server.R returned an object of unexpected type: list
Stack trace (innermost first):
1: runApp
Error in serverFuncSource() :
server.R returned an object of unexpected type: list
During today's dev meeting we discussed that while the tsv file is being generated, plots should be created. These two operations running in parallel, but I am not sure whether or not the first operation (generating the tsv) should be run in parallel within itself. As of now, generating the tsv in the shiny app isn't being run in parallel since the machines I am testing on (Nagisa, Mac Mini, My laptop) don't have the same number of threads.
Currently the entire analysis setup is contained on a single page, two columns (interface on left and feedback on right). This looks quite overwhelming for the user, and I think it would be simpler and cleaner to partition this workflow into separate pages as follows:
Now that I can generate inputs dynamically in configNumericInputs. I should pass said inputs to the server to initialize a config, from there I should process the data as in the master branch.
For example:
models <- list(
"Coalescent" = list(
"Constant Coalescent"="help text"
),
and
parameters <- list(
"Constant Coalescent" = list(
"Ne.tau"="Coalescent time: product of effective population size and generation time"
),
So each time I implement a new feature i test it on both linux and mac on google chrome. Everything up to commit 8176ad9 works fine on both, but commit c446428 doesn't always allow Kaphi to run via shiny app on mac. This commit is what is responsible for downloading the tsv result file. Commenting out the downloadHander part (provided below) allows Kaphi to run. However, that will prevent the user from downloading the tsv file since the downloadHandler isn't there anymore.
output$downloadTraceFile <- downloadHandler(
filename = function() {
sprintf("%s.tsv", uniqueTraceFileName)
},
content = function(file) {
file.copy(sprintf("tmp/%s.tsv", uniqueTraceFileName), file)
}
)
I used this format for download handler earlier in the code to download the config file (provided below), and i works fine for both mac and linux, so I am not sure what is going on here.
output$downloadDefaultConfigurationFile <- downloadHandler(
filename = function() {
paste0(input$specificModel, ".yaml")
},
content = function(file) {
file.copy(paste0("configs/", input$specificModel, ".yaml"), file)
}
)
Since I am have been facing difficulties in shiny with dynamically creating inputs for the config (see: #1), I will try to implement other parts of the shiny app using an pre-initialised config.
For multi-parameter models changing the distribution of one parameter causes the other parameters distribution numeric inputs to be reset to the default values.
One way around that is setting the distributions of all model parameters and then setting the numeric inputs of said distributions. Of course, this isn't the way the app should behave. Therefore, I will focus on fixing this bug ASAP.
Process the tsv file in parallel to create graphs for the user to understand the data (can be both diagnostic and parameter based)
When I tried running the compartmental model on a tree generated by the yule model it ran for multiple days as documented in issue #22. I will rerun the tree in an attempt to fix the endless run.
After successfully dealing with issue #1, a bunch of error are thrown:
Warning in structure(x, class = unique(c("AsIs", oldClass(x)))) :
Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
Consider 'structure(list(), *)' instead.
Warning: Error in [[: attempt to select less than one element in get1index
Stack trace (innermost first):
79: renderUI [/home/fabusard/git/KaphiShiny/app.R#352]
78: func
77: origRenderFunc
76: output$Constant CoalescentPriorNe.tauDistributionParameters
1: runApp
Warning in if (!is.na(attribValue)) { :
the condition has length > 1 and only the first element will be used
Warning in charToRaw(enc2utf8(text)) :
argument should be a character vector of length 1
all but the first element will be ignored
Warning in if (!is.na(attribValue)) { :
the condition has length > 1 and only the first element will be used
Warning in charToRaw(enc2utf8(text)) :
argument should be a character vector of length 1
all but the first element will be ignored
I am posting this right after fixing issue #1 so I will clean up the code and see where that gets me.
For example, norm
currently defaults to a mean of 1 and sd of 1
Including package dependencies such as shinyLP
In ~27 hours KaphiShiny has finished 13 iterations. A normal run in R goes for about 120 - 170 iterations.
I have been testing the app with the intention of breaking it, to help detect and deal with any bugs. Similar to issue #20, the app crashes when a file isn't inputted and the user requests the file to be analysed.
How can a user return to an analysis on the server? For example, what if the user closes the browser window or tab associated with their Shiny analysis? There are generally two approaches to this problem that I can think of:
In Kaphi, the format for the yaml config file was changed to account for the distances and constraints. i will change the files i use for testing to correspond to this change.
Focus on #11
I am getting this error when trying to generate posterior approximation graphs:
Warning: Error in plot.xy: object 'pal' not found
Stack trace (innermost first):
64: plot.xy
63: lines.default
62: lines
61: FUN [/Users/faisal/git/KaphiShiny/app.R#524]
60: lapply
59: renderPlot
58: FUN [/Users/faisal/git/KaphiShiny/app.R#512]
57: lapply
56: observerFunc
1: runApp
ERROR: [on_request_read] connection reset by peer
I am using the following code (it is commented out in the master branch as the above error breaks the app):
observe(
lapply(seq_len(length(parameters[[input$specificModel]])), function(i) {
output[[paste0("posteriorApproximationsOf", parameters[[input$specificModel]][[i]])]] <- renderPlot(
pal = rainbow(n=6, start=0, end=0.5, v=1, s=1),
plot(density
(trace[[parameters[[input$specificModel]][[i]]]][trace$n==1], weights=trace$weight[trace$n==1]),
col=pal[1],
lwd=2,
main=paste0(names(parameters[[input$specificModel]]), " ", names(parameters[[input$specificModel]][[i]])),
xlab=paste0(names(parameters[[input$specificModel]]), ' rate parameter (', names(parameters[[input$specificModel]][[i]]), ')'),
cex.lab=1.2
),
lapply(seq_len(5), function(i) {
temp <- trace[trace$n==i*10,]
lines(density(temp[[parameters[[input$specificModel]][[i]]]], weights=temp$weight), col=pal[i+1], lwd=1.5)
}),
lines(density(trace[[parameters[[input$specificModel]][[i]]]][trace$n==max(trace$n)], weights=trace$weight[trace$n==max(trace$n)]), col='black', lwd=2)
)
})
)
If any of the config data is NULL the app crashes. For example, if the information for the proposals are provided but that for the priors aren't, the app crashes.
Latest commit at the time of creating this issue: 7d6f5a3
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.