Giter Club home page Giter Club logo

foundrshiny's Introduction

foundrShiny

Shiny app tools companion package for foundr package. To install:

install.packages("devtools")
devtools::install_github("byandell/foundr", ref = "foundrBase")
devtools::install_github("byandell/foundrShiny")

This package can be used to build shiny apps for analysis and visualization of founder data. It is part of a (planned) collection of packages. See Foundr App Developer Guide for an overview of package(s) use and components.

Improvements Planned

  • order module list on contrast by p-values
  • SD and logp calc and guideline defaults
  • add pct eigenvalue from module
  • larger points on several plots
  • need to rethink foundr::ggplot_conditionContrasts, which is now bloated
  • added panelApp() as a diagnostic tool to investigate tabs and panels

foundrShiny Modular Organization

The foundrShiny package is completely organized using Shiny modules. All files in the R function directory have built-in apps following shiny module naming conventions. A useful guide is Mastering Shiny.

The app has a primary module foundr with secondary modules for the tab panels trait, contrast, stats, time and about.

Specialized modules are called from these modules. Two additional files that are not modules are the following:

  • foundr_helpers.R: helper functions
  • foundrSetup.R: setup data for all apps (requires data access)

foundrShiny Parameters

Parameters are organized into sets

  • main_par global parameters
  • panel_par panel-specific parameters
  • plot_par plot-specific parameters

These sets of parameters are reactiveValues placed in Shiny modules to simplify code readability through reuse.

The parameter sets are served up via servers, which depend on some data object,

main_par <- mainParServer("main_par", traitSignal)
panel_par <- panelParServer("panel_par", main_par, traitSignal)
plot_par <- plotParServer("plot_par", contrast_table)

and deployed via three UIs, which input parameter values. Each set is organized in its own shiny module, complete with app.

Global Parameters (main_par)

The main parameters main_par are set in the main app in foundr.R and flow through to the panels

mainParInput("main_par"), # dataset
mainParUI("main_par"), # order
mainParOutput("main_par"), # plot_table, height

Plot-specific Parameters (plot_par)

This set is used in the contrastPlot.R module, which is reused to develop contrast plots across traits.

plotParInput("plot_par") # ordername, interact
plotParUI("plot_par"), # volsd, volvert (sliders)
plotParOutput("plot_par"), # rownames (strains/terms)

These parameters are used in the three types of plots called via contrastPlot

which are deployed in the contrast and stats panels via the following modules

Panel-specific Parameters (panel_par)

Panel parameters are reused in different panels in slightly different ways. It made sense to allow these to let the user set these separately within each panel. This is in development and not yet implemented. Note that some modules have input$trait or input$traits. I have begun migrating to panelPar in traitTable.

  panelParInput("panel_par"), # Strains, Facet
  panelParUI("panel_par"), # Traits
  panelParOutput("panel_par") # Sexes (B/F/M/C)

Some parameters are passed as lists from one module to another. For instance, the traitTable module returns a

  • trait
    • traitTable: strains
    • traitSolos: facet
    • traitPairs: facet
  • stats
    • contrastPlot: sex
  • time
    • timePlot: strains, facet
    • timeTable: strains
    • timeTraits: contrast (traits)
  • contrast
    • contrastSex: sex
    • contrastTime: contrast, strains
    • timePlot: strains, facet
    • contrastGroup: sex, group
    • contrastPlot: sex, strain (via volcano?)

Careful that contrastPlot and its sub-modules (volcano,biplot,dotplot) us rownames from plotPar, which is substitute for strain. Volcano may have wrong call for strain.

Panel sub-modules

Panels deploy sub-modules, which in turn might deploy other sub-modules. By convention, each module has a Server and one or more of Input, UI, Output. Several sub-modules return reactive objects, which might be used by other sub-modules.

Trait module

  • traitOrder
  • traitNames (used twice)
  • corTable
  • corPlot
  • traitTable
  • traitSolos
  • traitPairs

Stats module

  • contrastPlot

Time module

  • timeTable
    • traitOrder (reused from trait module)
    • timeTraits
  • timePlot

Contrast module

  • contrastTable (used three times)
    • traitOrder (reused from trait module)
  • contrastSex
    • contrastPlot
  • contrastTime
    • timeTraits
  • timePlot (reused from time module)
  • contrastGroup
    • contrastPlot
foundrSetup(data_subset = "Physio",
  dirpath = "~/Documents/Research/attie_alan/FounderDietStudy/deployLiver")

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.