Giter Site home page Giter Site logo

kaphishiny's People

Contributors

0ldm4j0r avatar artpoon avatar gtng92 avatar

Watchers

 avatar  avatar  avatar  avatar

kaphishiny's Issues

A web session in only able to generate one file name

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.

run.smc can't find config

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.

RShiny failed to launch

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

Shiny: Parallel or Single Threaded

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.

Reorganize app into multiple pages

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:

  1. Splash page and tree input
  • Brief explanation of what Kaphi does
  • Interface for loading a tree (explain what kind of tree needs to be uploaded, i.e., rooted binary)
  • next button
  1. SMC settings
  • Brief explanation of SMC
  • interface for SMC settings
  • previous and next buttons to switch left and right, respectively
  1. Prior settings
  • Brief explanation of Bayesian inference and prior distributions
  • interface for prior distributions
  • same previous and next buttons as before
  1. Review and run
  • summary of tree, SMC and prior settings to review (can navigate back to previous pages)
  • user executes run, starts getting feedback

Use lists to provide help text in app.R script

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"
  ),

downloadHandler is causing some weird stuff on mac

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)
    }
  )

Resetting the distribution of a model's parameter causes the distribution numeric inputs of all parameters to be reset

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.

Errors are generated after successfully dynamically generating inputs for priors & proposals

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.

Require a file to be inputted to process a file

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.

Server persistence of analyses

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:

  1. generate a random unique identifier that is used to label run folder, so that the user can bookmark that page and return to the same analysis later on (e.g., Datamonkey)
  2. Implement a user account system like Django

Errors from the posterior approximation graphs

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)
          )
        })
      )

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.