```{css, echo=FALSE, eval=TRUE} pre code { white-space: pre !important; overflow-x: scroll !important; word-break: keep-all !important; word-wrap: initial !important; }
body { max-width: 2000px !important; }
.main-container { max-width: 1800px !important; margin-left: auto; margin-right: auto; }
```r options(width=80, max.print=1000) knitr::opts_chunk$set( eval=as.logical(Sys.getenv("KNITR_EVAL", "TRUE")), cache=as.logical(Sys.getenv("KNITR_CACHE", "TRUE")), tidy.opts=list(width.cutoff=60), tidy=TRUE, eval = FALSE) # shiny::tagList(rmarkdown::html_dependency_font_awesome())
suppressPackageStartupMessages(library(systemPipeShiny))
cat("<style>") cat(readLines(system.file("app/www/css/sps.css", package = "systemPipeShiny")),sep = "\n") cat("</style>")
knitr::include_graphics(path = "../inst/app/www/img/sps.png")
systemPipeShiny
(SPS) extends the widely used systemPipeR
(SPR) workflow
environment with a versatile graphical user interface provided by a Shiny
App. This allows non-R users, such as
experimentalists, to run many systemPipeR's workflow designs, control, and
visualization functionalities interactively without requiring knowledge of R.
Most importantly, SPS
has been designed as a general purpose framework for
interacting with other R packages in an intuitive manner. Like most Shiny Apps,
SPS can be used on both local computers as well as centralized server-based
deployments that can be accessed remotely as a public web service for using
SPR's functionalities with community and/or private data. The framework can
integrate many core packages from the R/Bioconductor ecosystem. Examples of
SPS' current functionalities include: (a) interactive creation of experimental
designs and metadata using an easy to use tabular editor or file uploader; (b)
visualization of workflow topologies combined with auto-generation of R
Markdown preview for interactively designed workflows; (c) access to a wide
range of data processing routines; (d) and an extendable set of visualization
functionalities. Complex visual results can be managed on a 'Canvas Workbench'
allowing users to organize and to compare plots in an efficient manner combined
with a session snapshot feature to continue work at a later time. The present
suite of pre-configured visualization examples include different methods to
plot a count table. The modular design of
SPR makes it easy to design custom functions without any knowledge of Shiny,
as well as extending the environment in the future with contributions from
the community.
An example web instance for testing SPS
online is available
here{target="_blank"}. At the
time of writing, there are five interactive tutorials embedded in this instance
that users can access from the upper-right corner. Each tutorial introduces
major functionalities of SPS.
The systemPipeShiny
package can be installed from a user's R console as follows.
if (!requireNamespace("BiocManager", quietly=TRUE)) install.packages("BiocManager") BiocManager::install("systemPipeShiny") # or use "pak" if (!requireNamespace("pak", quietly=TRUE)) install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/") pak::pkg_install("systemPipeShiny")
If the user's OS is Linux then one may need to install the following dependencies before installing SPS. The following example applies to Ubuntu.
```{bash, eval=FALSE} sudo apt-get install -y libcurl4-openssl-dev sudo apt-get install -y libssl-dev sudo apt-get install -y libv8-dev
sudo apt-get install -y libicu-dev sudo apt-get install -y pandoc sudo apt-get install -y make sudo apt-get install -y libglpk-dev sudo apt-get install -y libgmp3-dev sudo apt-get install -y zlib1g-dev
Most likely you only need to install first 3, *libcurl4-openssl-dev* may not be required for Ubuntu > 18.04. In case any other problem happens, try to install other system dependencies. On other Linux distributions, the install commands may be slightly different. # Main functionalities Currently, `SPS` includes 3 main functional categories (*Fig 1*): 1. Some pre-defined modules include: a. A workbench for designing and configuring data analysis workflows, b. Downstream analysis and visualization tools for RNA-Seq, and c. A space to make quick ggplots. 2. A section with user custom tabs: users define their own shiny tabs. 3. An image editing tab "Canvas" which allows users to edit plots made from the previous two categories. Besides, SPS provides many functions to extend the default Shiny development, like more UI components, server functions. Also, SPS has some useful general R ulitlies like error catching, logging, and more. <center id="sps_structure"> ![SPS_structure](./img/sps_structure.jpg) </center> **Figure 1.** Design of `systemPipeShiny.` The framework provides an interactive web interface for workflow management and data visualization. Within the functional categories, `SPS` functions are modularized in sub-components, here referred to as **SPS tabs** that are similar to menu tabs in other GUI applications that organize related and inter-connected functionalies into groups. On the backend, **SPS tabs** are based on [Shiny modules](https://shiny.rstudio.com/articles/modules.html), that are stored in separate files. This modular structure is highly extensible and greatly simplifies the design of new `SPS` tabs by both users and/or developers. Details about extending existing tabs and designing new ones are provided in [advanced sections on our website](https://systempipe.org/sps/). # SPS example usage The following instructions go through use each module step by step. Please read our website: <https://systempipe.org/sps/> for full instructions, animations, videos, and advanced sections. ## Load package Load the `systemPipeShiny` package in your R session. ```r library(systemPipeShiny)
SPS
projectBefore launching the SPS
application, a project environment needs to be created with the
following command.
spsInit()
For this toy example, the project directory structure is written to a temporary directory on a user's system. For a real project, it should be written to a defined and user controlled location on a system rather than a temporary directory.
sps_tmp_dir <- tempdir() spsInit(app_path = sps_tmp_dir, change_wd = FALSE, project_name = "SPSProject") sps_dir <- file.path(sps_tmp_dir, "SPSProject")
The file and directory structure of an SPS project is organized as follows.
SPS_xx/ ├── server.R | ├── global.R | Most important server, UI and global files, unless special needs, `global.R` is the only file you need to edit manually ├── ui.R | ├── deploy.R | Deploy helper file ├── config | Important app config files. Do not edit them if you don't know │ ├── sps.db | SPS database │ ├── sps_options.yaml | SPS default option list │ └── tabs.csv | SPS tab information ├── data | App example data files │ ├── xx.csv ├── R | All SPS additional tab files and helper R function files │ ├── tab_xx.R ├── README.md ├── results | Not in use for this current version, you can store some data been generated from the app │ └── README.md └── www | Internet resources ├── about | About tab information │ └── xx.md ├── css | CSS files │ └── sps.css ├── img | App image resources │ └── xx.png ├── js | Javascripts │ └── xx.js ├── loading_themes | Loading screen files │ └── xx.html └── plot_list | Image files for plot gallery └── plot_xx.jpg
SPS
By default, the working directory will be set inside the project folder automatically.
To launch the SPS
Shiny application, one only needs to execute the following command.
shiny::runApp()
After the SPS app has been launched, clicking the "Continue to app" button on the welcome screen will open the main dashboard (Fig.2).
Alternatively, when using RStudio one can click the Run App
button in the top right corner.
In addition, in Rstudio the global.R file will be automatically
opened when the SPS
project is created. Custom changes can be made inside this file
before the app launches. The advanced section explains how
to change and create new custom tabs.
The workflow management module in SPS
allows one to modify or create the
configuration files required for running data analysis workflows in
systemPipeR (SPR). This includes
three types of important files: a sample metadata (targets) file, a
workflow file (in R Markdown format) defining the workflow steps, and workflow running
files in Common Workflow Language (CWL) format. In SPS, one can easily create
these files under the "Workflow Management" module, located in navigation bar
on the left of the dashboard (Fig2 - 2).
The current version of SPS
allows to:
The targets file defines all input file paths and other sample information of
analysis workflows. To better undertand the structure of this file, one can
consult the "Structure of targets
file"
section in the SPR vignette. Essentially, this is the tabular file representation
of the colData
slot in an SummarizedExperiment
object which stores sample
IDs and other meta information.
The following step-by-step instructions explain how to create and/or modify targets files using RNA-Seq as an example (Fig.3 A):
data
directory. Choose any column you want from the dropdown to check and watch the statistics bar change in this section.In SPR, workflows are defined in Rmarkdown files, you can read details and obtain them here.
Now let us follow the order below to see how SPS helps you to prepare a workflow file for a RNAseq project (Fig.3 B):
In the new version of SPR, all individual system workflow steps are called by the CWL files. Each SPR workflow has a set of CWL files and normally users do not need to make any change. In case you want to learn more about CWL and create some new CWL files, Step 4 is a good place to practice.
To run a CWL step in SPR, 3 files are required:
SPR is the parser between R and CWL by injecting sample information from targets
to CWL input
file and then CWL parser translates it to bash code.
Up until this step, congratulations, the workflow is prepared. You can choose to download the workflow project files as a bundle or continue to run the workflow.
This is a module which takes a raw count table to do normalization, Differential gene expression (DEG) analysis, and finally helps users to generate different plots to visualize the results.
To start, we require two files, the metadata file (targets) and a raw count table (Fig. 5).
SampleName
should be a unique character
string without space for each row. Factor
is the experiment design factors, or
conditions, or treatments. Note: For the count table, the first column will be used as gene names. Other column
names will be treated as sample names, and values in these columns are treated as
raw counts. Make sure columns except the first one are numeric, and replace NA
with 0
.
Upon successfully confirm targets and count table, you should see the "Normalize Data" subtab is enabled. You can click on the top navigation or click the pop-up for the next step.
If this UI is displayed, that means your targets and count table are accepted by SPS (Fig 6). On this sub-tab, you can choose:
These two options are independent.
SPS RNAseq module provides 6 different plot options to cluster transformed count table.
SPS Canvas
tab. Or clicking the down-arrow button to directly save current plot to a png or jpg. This is a special sub-tab designed to filter and visualize DEG results. This sub-tab can be accessed once the DEG is calculated on the "Normalize Data" sub-tab.
If you are familiar with R and want to continue other analysis after these, simple stop SPS:
spsRNA_trans
object stored in your R
environment. raw
method gives you a normalized count table. Other two methods
give you a DESeq2
class object. You can use it for other analysis.spsDEG.
It is a summerizedExperiment
object which has all individual tables from all
DEG comparisons. You can use it for other downstream analysis.If you are using SPS from a remote server, you can choose to download results from
"Normalize Data" sub-tab. Choose results in tabular format or summerizedExperiment
format which is saved in a .rds
file.
This module enables you to quickly upload datasets and make a {ggplot} in a second by using some functionalities from {Esquisse}.
For a more specific guide, read Esquisse official guide.
SPS Canvas is a place to display and edit scrennshots from different plots. To start to use Canvas, you need to take some screenshots but clicking "To Canvas" buttons on different tabs/modules. After clicking, the screenshots will be automatically sent from these places to this Canvas.
Figure 9 Canvas
Keyboard shortcuts are also enabled with SPS Canvas. Go to "help" menu to see these options.
To read the detailed advanced features, please to go our website.
sessionInfo()
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.