PoonLab / KaphiShiny

A Shiny web interface for running Kaphi
0 stars 0 forks source link

Reorganize app into multiple pages #8

Closed ArtPoon closed 6 years ago

ArtPoon commented 7 years ago

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
  2. SMC settings
    • Brief explanation of SMC
    • interface for SMC settings
    • previous and next buttons to switch left and right, respectively
  3. Prior settings
    • Brief explanation of Bayesian inference and prior distributions
    • interface for prior distributions
    • same previous and next buttons as before
  4. Review and run
    • summary of tree, SMC and prior settings to review (can navigate back to previous pages)
    • user executes run, starts getting feedback
0ldM4j0r commented 7 years ago

The following link shows the app layouts achievable via shiny.

The app layouts are:

0ldM4j0r commented 6 years ago

A basic implementation of a multipage app is on the multiPageApp branch, now i need to automate graph generation from the tsv file.

0ldM4j0r commented 6 years ago

I am trying to generate graphs from the tsv file after its creation (just to reduce complexity, eventually this will happen during creation), but I get the error:Error in xy.coords: 'x' is a list, but does not have components 'x' and 'y' when using the following code:

observe(
        lapply(seq_len(length(parameters[[input$specificModel]])), function(i) {
          output[[paste0("meanTrajectoryOf", parameters[[input$specificModel]][[i]])]] <- renderPlot(
            plot(
              sapply(split(trace[[parameters[[input$specificModel]][[i]]]]*trace$weight, trace$n), sum),
              ylim=c(0, 2),
              type='o',
              xlab='Iteration',
              ylab=paste0('Mean', parameters[[input$specificModel]][[i]]),
              cex.lab=1,
              main=paste0('Trajectory of Mean ',  parameters[[input$specificModel]][[i]], ' (',  input$specificModel, ' Model)')
            )
          )
        })
      )

which is based on the following code from the example-yule.R file:

plot(
  sapply(split(trace$lambda*trace$weight, trace$n), sum), 
  ylim=c(0, 2), 
  type='o',
  xlab='Iteration', 
  ylab='Mean lambda',
  cex.lab=1,
  main='Trajectory of Mean Lambda (Yule Model, 1000 particles)'
)
0ldM4j0r commented 6 years ago

I commented out the following four lines but that didn't change the error:

ylim=c(0, 2),
type='o',
xlab='Iteration',
ylab=paste0('Mean', parameters[[input$specificModel]][[i]]),
cex.lab=1,
main=paste0('Trajectory of Mean ',  parameters[[input$specificModel]][[i]], ' (',  input$specificModel, ' Model)')

I plotted rnorm(100) just to check that the plot outputting is working fine and it is. After that I hard coded it and the error still occurs, code used:

output[[paste0("meanTrajectoryOflambda")]] <- renderPlot(
        plot( sapply(split(trace$lambda*trace$weight, trace$n), sum))
)
gtng92 commented 6 years ago

A comment on the error below mentioned earlier in this thread:

Error in xy.coords(x, y, xlabel, ylabel, log) : 
  'x' is a list, but does not have components 'x' and 'y'

This occurs when the .tsv file contains only the header row, and no data. Usually when either the run breaks, or the run isn't finished and hasn't fully completed creating the file.

0ldM4j0r commented 6 years ago

I will be closing this issue since I managed to reorganize the app in multiple pages. I also managed to plot the mean trajectory of the parameters after the tsv generation.

I will be opening two issues one to workout the errors from the posterior approximation graphs, and the other to implement plotting mean trajectory and posterior approximation graphs during tsv generation.