iSEEde 1.5.0
In this example, we use the ?airway
data set.
We briefly adjust the reference level of the treatment factor to the untreated condition.
library("airway")
data("airway")
airway$dex <- relevel(airway$dex, "untrt")
To generate some example results, we run a standard edgeR analysis using glmFit()
and
glmLRT()
.
The differential expression results are fetched using topTags()
.
library("edgeR")
design <- model.matrix(~ 0 + dex + cell, data = colData(airway))
fit <- glmFit(airway, design, dispersion = 0.1)
lrt <- glmLRT(fit, contrast = c(-1, 1, 0, 0, 0))
res_edger <- topTags(lrt, n = Inf)
head(res_edger)
#> Coefficient: -1*dexuntrt 1*dextrt
#> gene_id gene_name entrezid gene_biotype gene_seq_start
#> ENSG00000109906 ENSG00000109906 ZBTB16 NA protein_coding 113930315
#> ENSG00000179593 ENSG00000179593 ALOX15B NA protein_coding 7942335
#> ENSG00000127954 ENSG00000127954 STEAP4 NA protein_coding 87905744
#> ENSG00000152583 ENSG00000152583 SPARCL1 NA protein_coding 88394487
#> ENSG00000250978 ENSG00000250978 RP11-357D18.1 NA processed_transcript 66759637
#> ENSG00000163884 ENSG00000163884 KLF15 NA protein_coding 126061478
#> gene_seq_end seq_name seq_strand seq_coord_system symbol logFC logCPM
#> ENSG00000109906 114121398 11 1 NA ZBTB16 7.183385 4.132638
#> ENSG00000179593 7952452 17 1 NA ALOX15B 10.015847 1.627629
#> ENSG00000127954 87936206 7 -1 NA STEAP4 5.087069 3.672567
#> ENSG00000152583 88452213 4 -1 NA SPARCL1 4.498698 5.510213
#> ENSG00000250978 66771420 5 -1 NA RP11-357D18.1 6.128131 1.377260
#> ENSG00000163884 126076285 3 -1 NA KLF15 4.367962 4.681216
#> LR PValue FDR
#> ENSG00000109906 238.3947 8.805179e-54 5.606874e-49
#> ENSG00000179593 181.0331 2.883024e-41 9.179116e-37
#> ENSG00000127954 146.9725 7.957020e-34 1.688931e-29
#> ENSG00000152583 140.2205 2.382274e-32 3.792402e-28
#> ENSG00000250978 137.4681 9.526183e-32 1.213198e-27
#> ENSG00000163884 129.2203 6.069471e-30 6.441428e-26
Then, we embed this set of differential expression results in the airway
object using the embedContrastResults()
method.
The results embedded in the airway object can be accessed using the contrastResults()
function.
library(iSEEde)
airway <- embedContrastResults(res_edger, airway, name = "edgeR")
contrastResults(airway)
#> DataFrame with 63677 rows and 1 column
#> edgeR
#> <iSEEedgeRResults>
#> ENSG00000000003 <iSEEedgeRResults>
#> ENSG00000000005 <iSEEedgeRResults>
#> ENSG00000000419 <iSEEedgeRResults>
#> ENSG00000000457 <iSEEedgeRResults>
#> ENSG00000000460 <iSEEedgeRResults>
#> ... ...
#> ENSG00000273489 <iSEEedgeRResults>
#> ENSG00000273490 <iSEEedgeRResults>
#> ENSG00000273491 <iSEEedgeRResults>
#> ENSG00000273492 <iSEEedgeRResults>
#> ENSG00000273493 <iSEEedgeRResults>
contrastResults(airway, "edgeR")
#> iSEEedgeRResults with 63677 rows and 5 columns
#> logFC logCPM LR PValue FDR
#> <numeric> <numeric> <numeric> <numeric> <numeric>
#> ENSG00000000003 -0.4628153 5.05930 2.018481 0.155394 1
#> ENSG00000000005 0.0000000 -3.45546 0.000000 1.000000 1
#> ENSG00000000419 0.1247724 4.60783 0.146545 0.701860 1
#> ENSG00000000457 -0.0445216 3.48326 0.018241 0.892565 1
#> ENSG00000000460 -0.1618126 1.48518 0.210342 0.646500 1
#> ... ... ... ... ... ...
#> ENSG00000273489 2.48209 -3.28549 3.02143 0.082171 1
#> ENSG00000273490 0.00000 -3.45546 0.00000 1.000000 1
#> ENSG00000273491 0.00000 -3.45546 0.00000 1.000000 1
#> ENSG00000273492 -1.24012 -3.36894 0.91097 0.339857 1
#> ENSG00000273493 -1.75243 -3.36862 1.57193 0.209928 1
Differential expression methods generally return precise numeric values with several digits after the decimal point. This level of precision can be unnecessarily overwhelming and users may wish to round numeric values to a limited number of significant digits.
The builtin default configuration for rounding in iSEEde is RoundDigit = FALSE
and SignifDigits = 3
.
In other words, numeric values are not rounded, and if users do activate the rounding functionality, numeric values are rounded to three significant digits.
Those defaults can be changed using the panelDefaults()
function.
panelDefaults(RoundDigits = TRUE, SignifDigits = 2L)
With the default panel settings configured, we use the DETable()
function to display the contrast results with rounded numeric values.
library(iSEE)
app <- iSEE(airway, initial = list(
DETable(ContrastName="edgeR", HiddenColumns = c("logCPM", "LR"),
PanelWidth = 12L)
))
if (interactive()) {
shiny::runApp(app)
}
The default rounding configuration can be overridden in individual panel configurations.
The slots RoundDigits
and SignifDigits
can be set directly in the individual calls to the DETable()
constructor function.
In the example below, we add two tables, one rounding numeric values to the default value of two significant digits set above, the other rounding the same values to three significant digits.
library(iSEE)
app <- iSEE(airway, initial = list(
DETable(ContrastName="edgeR", HiddenColumns = c("logCPM", "LR"),
PanelWidth = 6L, RoundDigits = TRUE),
DETable(ContrastName="edgeR", HiddenColumns = c("logCPM", "LR"),
PanelWidth = 6L, RoundDigits = TRUE, SignifDigits = 3L)
))
if (interactive()) {
shiny::runApp(app)
}