PIVOT: platform for interactive analysis and visualization of transcriptomics data

Background Many R packages have been developed for transcriptome analysis but their use often requires familiarity with R and integrating results of different packages requires scripts to wrangle the datatypes. Furthermore, exploratory data analyses often generate multiple derived datasets such as data subsets or data transformations, which can be difficult to track. Results Here we present PIVOT, an R-based platform that wraps open source transcriptome analysis packages with a uniform user interface and graphical data management that allows non-programmers to interactively explore transcriptomics data. PIVOT supports more than 40 popular open source packages for transcriptome analysis and provides an extensive set of tools for statistical data manipulations. A graph-based visual interface is used to represent the links between derived datasets, allowing easy tracking of data versions. PIVOT further supports automatic report generation, publication-quality plots, and program/data state saving, such that all analysis can be saved, shared and reproduced. Conclusions PIVOT will allow researchers with broad background to easily access sophisticated transcriptome analysis tools and interactively explore transcriptome datasets. Electronic supplementary material The online version of this article (10.1186/s12859-017-1994-0) contains supplementary material, which is available to authorized users.


Background
Technologies such as RNA-sequencing measure gene expressions and present them as high-dimensional expression matrixes for downstream analyses. In recent years, many programs have been developed for the statistical analysis of transcriptomics data, such as edgeR [1] and DESeq [2] for differential expression testing, and monocle [3], Seurat [4], SC3 [5] and SCDE [6] for single cell RNA-Seq data analysis. Besides these, the Comprehensive R Archive Network (CRAN) [7] and Bioconductor [8] host various statistical packages addressing different aspects of transcriptomics study and provides recipes for a multitude of analysis workflows. Making use of these R analysis packages requires expertise in R and often custom scripts to integrate the results of different packages. In addition, many exploratory analyses of transcriptome data involve repeated data manipulations such as transformations (e.g., normalizations), filtering, merging, etc., each step generating a derived dataset whose version and provenance must be tracked. Previous efforts to address these problems include designing standardized workflows [9], building a comprehensive package [4] or assembling pipelines into integrative platforms such as Galaxy [10] or Illumina BaseSpace [11]. Designing workflows or using large packages still requires a significant amount of programming skills and it can be difficult to make various components compatible or applicable to specific datasets. Integrative platforms offer greater usability but trades off flexibility, functionality and efficiency due to limitations on data size, parameter choice and computing power. For example, the Galaxy platform is designed as discrete functional modules which require separate file inputs for different analysis. This design not only makes user-end file format conversion complicated and timeconsuming, but also breaks the integrity of the analysis workflow, limiting the sharing of global parameters, filtering criteria and analysis results between modules. Tools such as RNASeqGUI [12], START [13], ASAP [14] and DEApp [15] provide an interactive graphical interface for a small number of packages. But, these and other similar packages all adopt a rigid workflow design, have limited data provenance tracking, and none of the packages provide mechanisms for tracking, saving and sharing analysis results. Furthermore, many web-based applications require users to upload data to a server, which might be prohibited by HIPPA (Health Insurance Portability and Accountability Act of 1996) for clinical data analysis.
Here we developed PIVOT, an R-based platform for exploratory transcriptome data analysis. We leverage the Shiny framework [16] to bridge open source R packages and JavaScript-based web applications, and to design a user-friendly graphical interface that is consistent across statistical packages. The Shiny framework translates user-driven events (e.g. pressing buttons) into R interpretable reactive data objects, and present results as dynamic web content. PIVOT incorporates four key features that assists user interactions, integrative analysis and provenance management: PIVOT directly integrates existing open source packages by wrapping the packages with a uniform user-interface and visual output displays. The user interface replaces command line options of many packages with menus, sliders, and other option controls, while the visual outputs provide extra interactive features such as change of view, active objects, and other user selectable tools. PIVOT provides many tools to manipulate a dataset to derive new datasets including different ways to normalize a dataset, subset a dataset, etc. In particular, PIVOT supports manipulating the datasets using the results of an analysis; for example, a user might use the results of differential gene expression analysis to select all gene satisfying some p-value filter. PIVOT implements a visual data management system, which allows users to create multiple data views and graphically display the linked relationship between data variants, allowing navigation through derived data objects and automated re-analysis. PIVOT dynamically bridges analysis packages to allow results from one package to be used as inputs for another. Thus, it provides a flexible framework for users to combine tools into customizable pipelines for various analysis purposes. PIVOT provides facilities to automatically generate reports, publication-quality figures, and reproducible computations. All analyses and data generated in an interactive session can be packaged as a single R object that can be shared to exactly reproduce any results.

Implementation
PIVOT is written in R and is distributed as an R package. It is developed using the Shiny framework, multiple R packages and a collection of scripts written by members of J. Kim's Lab at University of Pennsylvania.
PIVOT exports multiple Shiny modules [17] which can be used as design blocks for other Shiny apps, as well as R functions for transcriptomics analysis and plotting. A proficient R user can easily access data objects, analysis parameters and results exported by PIVOT and use them in customized scripts. PIVOT has been tested on macOS, Linux and Windows. It can be downloaded from Kim Lab Software Repository (http://kim.bio.upenn.edu/ software/pivot.shtml).

Data input and transformations
Read counts obtained from RNA-Seq quantification tools such as HTSeq [18] or featureCounts [19] can be directly uploaded into PIVOT as text, csv or Excel files. Data generated using the 10× Genomics Cell Ranger pipeline can also be readily read in and processed by PIVOT. PIVOT automatically performs user selected data transformations including normalization, log transformation, or standardization. We have included multiple RNA-Seq data normalization methods including DESeq normalization [20], trimmed mean of M-values (TMM) [21], quantile normalization [22], RPKM/TPM [23], Census normalization [24], and Remove Unwanted Variation (RUVg) [25] (Table 1). If samples contain spike-in control mixes such as ERCC [26], PIVOT will also separately analyze the ERCC count distribution and allow users to normalize the data using the ERCC control. Existing methods can be customized by the user by setting detailed normalization parameters. For example, we implement a modification of the DESeq method by making the inclusion criterion a user set parameter, making it more applicable to sparse expression matrices such as single cell RNA-Seq data [27].
Users can upload experiment design information such as conditions and batches, which can be visualized as annotation attributes (e.g., color points/sidebars) or used as model specification variables for downstream analyses such as differential expression. PIVOT supports flexible operations to filter data for row and column subsets as well as for merging datasets, creating new derived datasets. Multiple summary statistics and quality control plots are automatically generated to help users identify possible outliers. Users can manually select samples for analysis, or specify statistical criteria on analysis results such as expression threshold, dropout rate cutoff, Cook's distance or size factor range to remove unwanted features and samples.

Visual data management with data map
When analyzing large datasets, a common procedure is to first perform quality control to remove low quality elements, then normalize the data and finally generate different data subsets for various analysis purposes. Some analyses require filtering out genes with low expressions, while others are designed to be performed on a subset of the genes such as transcription factors. During secondary analyses, outliers may be detected requiring additional scrutiny. All these data manipulations generate a network of derived datasets from the original data and require a significant amount of effort to track. Failure to track the data lineage could affect the reproducibility and reliability of the study. Furthermore, an investigator might wish to repeat an analysis over a variety of derived datasets, which may be tedious and error-prone to carry out manually. To address this problem, we implemented a graphical data management system in PIVOT.
As the user generates derived datasets with various data manipulations, PIVOT records and presents the data provenance in an interactive tree graph, the "Data Map". As shown in Fig. 1, each node in the data map represents a derived dataset and the edges contain information about the details of the derivation operation. Users can attach analysis results to the data nodes as interactive R markdown reports [28] and switch between different datasets or retrieve analysis reports by simply clicking the nodes. Upon switch to a new dataset selected from the Data Map, PIVOT automatically re-runs analyses and updates parameter choices when needed. Thus, a user can easily compare results of a workflow across derived datasets. The data map is generated with the visNetwork package [29] and can be directly edited, so that users can rename nodes, add notes, or delete data subsets and analysis reports that are no longer Fig. 1 Data management with data map. The map shows the history of the data change and the association between analysis and data nodes. Users can hover over edges to see operation details, or click nodes to get analysis reports or switch active subsets useful. The full data history is also presented as downloadable tables with all sample and feature information as well as data manipulation details.

Comprehensive toolset for exploratory analysis
PIVOT is designed to aid exploratory analysis for both single cell and bulk RNA-Seq data, thus we have incorporated a large set of commonly used tools (see Table 1, also Additional file 1: Table S1 for comparison with other similar applications). PIVOT supports many visual data analytics including QC plots (number of detected genes, total read counts, dropout rates and estimated size factors; Fig. 2a, data from [30]), transcriptome statistics plots (e.g., rank-frequency plots, mean-variability plots, etc.; Fig. 2b), and sample and feature correlation plots (e.g., heatmaps, smoothened scatter plots, etc.). All visual plots feature interactive options and a query function is provided which allows users to search for features sharing similar expression patterns with a target feature. PIVOT provides users extensive control over parameter choices. Each analysis module contains multiple visual controls allowing users to adjust parameters and obtain updated results on the fly.

Integrative analysis and interactive visualization
PIVOT transparently bridges multiple sequences of analyses to form customizable analysis pipelines. For . c The t-SNE module plots 1D, 2D and 3D projections (3D not shown due to space). d Feature heatmap with the top 100 differentially expressed genes reported by DESeq2 likelihood ratio test example, with single cell data collected from heterogeneous tumor or tissue, a user can first perform PCA or t-SNE [31] (Fig. 2c) to visualize the low dimensional embedding of the data. If there is clear clustering pattern, possibly originated from different cell types, the user can directly specify cell clusters by dragging selection boxes on the graph, or perform Kmeans or hierarchical clustering with the projection matrix. One can proceed to run DE or penalized LDA [32] to identify cluster-specific marker genes, which can then be used to filter the datasets for generating a heatmap showing distinctive expression pattern across cell types (Fig. 2d). Within each determined cell type, a user may further apply the walk-trap community detection method [33] to identify densely connected network of cells, which are indicative of potential subpopulations [34].
As another example, for time-series data such as cells collected at different stages of development or differentiation, one can use diffusion pseudotime (DPT) [35], which reconstructs the lineage branching pattern based on the diffusion map algorithm [36], or monocle [3], which implements an unsupervised algorithm for pseudo-temporal ordering of single cells [37]. We have incorporated the latest monocle 2 workflow in PIVOT, including cell state ordering, unsupervised cell clustering, gene clustering by pseudo-temporal expression pattern and cell trajectory analysis. Besides the DE method implemented in monocle, one can also run DESeq, edgeR, SCDE or the Mann-Whitney U test. A user can specify whether to perform basic DE analysis or a multifactorial DE analysis with customized formulae for complex experimental designs such as time-series or controlling for batch effects. Results are presented as dynamic tables including all essential statistics such as maximum likelihood estimation and confidence intervals. Each gene entry in the table can be clicked and visualized as violin plots or box plots, showing the actual expression level across conditions. Once DE results are obtained, the user can further explore the connections between DE genes and identify potential trans-differentiation factors as introduced in the Mogrify algorithm [38]. PIVOT provides several extensions of functionality from the original Mogrify method. The network analysis module allows users to plot the log fold changes (LFC) of DE genes in a protein-protein interaction network obtained from the STRING database (Fig. 3a) [39] or a directed regulatory network graph constructed from the Regnetwork repository (Fig. 3b) [40]. With scoring based on the p-value and log fold change, the graph can be zoomed to only include top-rank genes, showing the regulatory "hot spot" of the network. PIVOT provides users with multiple options for defining the network influence score of transcription factors, and will produce lists of potential trans-differentiation factors based on the final ranking. As shown in Fig. 3c, with the FAN-TOM5 expression data of fibroblasts and ES cells [41], PIVOT correctly reports OCT4 (POU5F1), NANOG and SOX2 as key factors for trans-differentiation [42]. In addition to the DESeq results used by the original Mogrify algorithm, a user can choose to use SCDE or edgeR results to perform trans-differentiation analysis on single cell datasets.
Another useful feature of PIVOT is that it provides users multiple visualization options by exploiting the power of various plotting packages. For example, users can either generate publication-quality heatmap graphs (implemented in gplots package [43]), or interactively explore the heatmap with the heatmaply view [44]. For principal component analysis, PIVOT uses three different packages to present the 2D and 3D projections. The plotly package [45] displays sample names and relevant information as mouse-over labels, while the ggbiplot [46] presents the loadings of each gene on the graph as vectors. The threejs package [47] fully utilizes the power of WebGL and outputs rotatable 3D projections. In the network analysis module, we utilize both igraph [48] and networkD3 [49] package to plot the transcription factor centered local network. The latter provides a force directed layout, which allows users to drag the nodes and visualize the physical simulation of the network response.

Reproducible research and complete provenance capture
PIVOT automatically records all data manipulations and analysis steps. Once an analysis has been performed, users will have the option of pasting related R markdown code to a shinyAce report editor [50], or download the report as either a pdf or interactive html document. All results and associated parameters will be captured and saved to the report along with user-provided comments. PIVOT states are automatically saved in cases of browser refresh, crash or user exit, and can also be manually exported, shared and loaded. Thus, all analyses performed in PIVOT are fully encapsulated and can be shared or disseminated as a single data + provenance object, allowing universally reproducible research.

Conclusions
We developed PIVOT for easy, fast, and exploratory analysis of the transcriptomics data. Toward this goal we have automated the analysis procedures and data management, and we provide users with detailed explanations both in tooltips and a user manual. PIVOT exploits the power of multiple plotting packages and gives users full control of key analysis and plotting parameters. Given user input that leads to function errors, PIVOT will alert the user and provide corrective suggestions. PIVOT states and reports can be shared between researchers to facilitate the discussion of expression analysis and future experimental design. PIVOT is designed to be extensible and future versions will continue to integrate popular transcriptome analysis routines as they are made available to the research community.   The table includes information such as the center transcription factor score, the total number of vertices in its direct neighborhood, and the number of activated neighbors with gene score above a user-specified threshold. Clicking entries on the table will plot the local neighborhood network centered on that TF