diff --git a/DESCRIPTION b/DESCRIPTION
index af00acf..3dbde2c 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,7 +1,7 @@
Package: dgeAnalysis
Type: Package
Title: dgeAnalysis
-Version: 1.3.1
+Version: 1.3.2
Author@R:
person("Tom", "Kuipers", email = "t.b.kuipers@outlook.com", role = c("aut", "cre"))
Description:
diff --git a/MANUAL.pdf b/MANUAL.pdf
index b814323..907a5e0 100644
Binary files a/MANUAL.pdf and b/MANUAL.pdf differ
diff --git a/R/de.R b/R/de.R
index c2de0ab..9350397 100644
--- a/R/de.R
+++ b/R/de.R
@@ -8,12 +8,12 @@
#' @param data_samples Dataframe, Containing all sample data
#'
#' @return se, (SummerizedExperiment) With counts
-#'
+#'
#' @export
readCountsFromTable <- function(data_counts, data_samples) {
out <- as.matrix(data_counts[, colnames(data_counts) %in% rownames(data_samples)])
- se <- SummarizedExperiment(assays=list(counts=out))
+ se <- SummarizedExperiment(assays = list(counts = out))
se
}
@@ -24,14 +24,14 @@ readCountsFromTable <- function(data_counts, data_samples) {
#' @param data_samples Dataframe, Containing all sample data
#'
#' @return se, (SummerizedExperiment) With samples and counts
-#'
+#'
#' @export
-addSamplesFromTableToSE <- function(se, data_samples){
+addSamplesFromTableToSE <- function(se, data_samples) {
data_samples <- droplevels(data_samples)
samples <- intersect(colnames(se), rownames(data_samples))
- se <- se[,samples]
- colData(se) <- DataFrame(data_samples[samples,, drop = FALSE])
+ se <- se[, samples]
+ colData(se) <- DataFrame(data_samples[samples, , drop = FALSE])
se
}
@@ -42,13 +42,13 @@ addSamplesFromTableToSE <- function(se, data_samples){
#' @param data_annotation Dataframe, Containing all annotation data
#'
#' @return se, (SummerizedExperiment) With samples, counts and annotation
-#'
+#'
#' @export
-addAnnotationsFromTableToSE <- function(se, data_annotation){
+addAnnotationsFromTableToSE <- function(se, data_annotation) {
features <- intersect(rownames(se), rownames(data_annotation))
- se <- se[features,]
- rowData(se) <- DataFrame(data_annotation[features,])
+ se <- se[features, ]
+ rowData(se) <- DataFrame(data_annotation[features, ])
se
}
@@ -63,14 +63,14 @@ addAnnotationsFromTableToSE <- function(se, data_annotation){
#' @param raw Dataframe, Containing count data
#'
#' @return Integer, With total counted reads
-#'
+#'
#' @export
-getCount <- function(x, raw){
+getCount <- function(x, raw) {
if (x["feature"] %in% rownames(raw)) {
return(raw[x["feature"], x["sample"]])
} else {
- features <- rownames(raw)[! grepl("^__", rownames(raw))]
+ features <- rownames(raw)[!grepl("^__", rownames(raw))]
return(sum(raw[features, x["sample"]]))
}
}
@@ -81,12 +81,13 @@ getCount <- function(x, raw){
#' @param se SummerizedExperiment, With samples, counts (and annotation)
#'
#' @return out, (Dataframe) With total counts per available mapping feature
-#'
+#'
#' @export
-alignmentSummary <- function(se){
- specialFeatures <- rownames(se)[ grepl( "^__", rownames(se) ) ]
- out <- expand.grid(feature=c("aligned", specialFeatures), sample=colnames(se))
+alignmentSummary <- function(se) {
+ specialFeatures <- rownames(se)[grepl("^__", rownames(se))]
+ out <- expand.grid(feature = c("aligned", specialFeatures),
+ sample = colnames(se))
out$count <- apply(out, 1, getCount, assays(se)$counts)
out
}
@@ -98,19 +99,20 @@ alignmentSummary <- function(se){
#' @param max Integer, The maximum rank that is used
#'
#' @return out, (Dataframe) With total read counts per gene
-#'
+#'
#' @export
-complexityData <- function(se, max){
- features <- rownames(se)[ ! grepl( "^__", rownames(se) ) ]
+complexityData <- function(se, max) {
+ features <- rownames(se)[!grepl("^__", rownames(se))]
ranks <- c(1:max)
- out <- expand.grid(rank=ranks, sample=colnames(se))
- for (x in colnames(se)){
- values <- as.vector(assay(se)[features,x])
+ out <- expand.grid(rank = ranks, sample = colnames(se))
+ for (x in colnames(se)) {
+ values <- as.vector(assay(se)[features, x])
sorted <- sort(values, T)
total <- sum(sorted)
out[out$sample == x, "value"] <- cumsum(sorted)[1:max]
- out[out$sample == x, "fraction"] <- out[out$sample == x, "value"] /total
+ out[out$sample == x, "fraction"] <-
+ out[out$sample == x, "value"] / total
}
out
}
@@ -122,10 +124,10 @@ complexityData <- function(se, max){
#' @param max Integer, The maximum rank that is used
#'
#' @return count, (Dataframe) With mapping feature, sample and LogCPM
-#'
+#'
#' @export
-stackDge <- function(dge){
+stackDge <- function(dge) {
count <- stack(dge$counts)
names(count) <- c("feature", "sample", "logCPM")
count
@@ -139,7 +141,7 @@ stackDge <- function(dge){
#' @param biasColumn String, Value on which to calculate confidence
#'
#' @return prediction, (Vector) With coordinates of prediction locations (line plot)
-#'
+#'
#' @export
gamConfidenceFit <- function(deTab, biasColumn) {
@@ -147,19 +149,21 @@ gamConfidenceFit <- function(deTab, biasColumn) {
method.args$method <- "REML"
formula <- avgLog2FC ~ s(columnHere, bs = "cs")
- formula <- paste(gsub("columnHere", parse(text=biasColumn), formula))
- formula <- eval(parse(text = gsub("\\", "", paste(formula[2], formula[3], sep=" ~ "), fixed=TRUE)))
+ formula <- paste(gsub("columnHere", parse(text = biasColumn), formula))
+ formula <- eval(parse(text = gsub(
+ "\\", "", paste(formula[2], formula[3], sep = " ~ "), fixed = TRUE
+ )))
base.args <- list(quote(formula), data = quote(deTab))
gamModel <- do.call(mgcv::gam, c(base.args, method.args))
prediction <- deTab[, c(biasColumn, "avgLog2FC")]
- prediction <- cbind(prediction, predict(gamModel, se.fit=TRUE))
- prediction <- prediction[order(prediction[[biasColumn]]), ]
+ prediction <- cbind(prediction, predict(gamModel, se.fit = TRUE))
+ prediction <- prediction[order(prediction[[biasColumn]]),]
setRange <- range(1, nrow(prediction))
result <- round(seq(setRange[1], setRange[2], length.out = 500))
- prediction <- prediction[c(result),]
+ prediction <- prediction[c(result), ]
}
## --------------------------------------------------------------------------
diff --git a/R/de_plots.R b/R/de_plots.R
index 66eb698..d1883fe 100644
--- a/R/de_plots.R
+++ b/R/de_plots.R
@@ -11,17 +11,17 @@
#' @param perc Boolean, Data in percentages
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
-alignmentSummaryPlot <- function(se, sort_value="None", perc=T){
+alignmentSummaryPlot <- function(se, sort_value = "None", perc = T) {
lse <- alignmentSummary(se)
lse$feature <- gsub("_", " ", gsub("__", "", lse$feature))
if (sort_value != "None") {
for (sample in lse$sample) {
lse$order[lse$sample == sample] <- se[[sort_value]][colnames(se) == sample]
}
- lse <- lse[order(lse$order, lse$sample, method="radix"),]
+ lse <- lse[order(lse$order, lse$sample, method = "radix"), ]
lse$sample <- factor(lse$sample, levels = unique(lse$sample))
} else {
lse$order <- "Sample"
@@ -29,46 +29,70 @@ alignmentSummaryPlot <- function(se, sort_value="None", perc=T){
if (perc) {
for (var in unique(lse$sample)) {
- temp <- lse[lse$sample == var, ]
- lse$count[lse$sample == var] <- temp$count/(sum(temp$count))
+ temp <- lse[lse$sample == var,]
+ lse$count[lse$sample == var] <- temp$count / (sum(temp$count))
}
}
plot_list <- c()
for (order in unique(lse$order)) {
- temp <- lse[lse$order == order,]
+ temp <- lse[lse$order == order, ]
p <- plot_ly(
data = temp,
- x = ~count,
- y = ~sample,
- color = ~feature,
+ x = ~ count,
+ y = ~ sample,
+ color = ~ feature,
orientation = 'h',
- alignmentgroup = ~order,
- legendgroup = ~feature,
+ alignmentgroup = ~ order,
+ legendgroup = ~ feature,
type = "bar",
- showlegend = if(order==unique(lse$order)[1]) {TRUE} else{FALSE},
- text = if(perc){~paste(sample,
- '\n', round(count*100, 2),
- '%', feature)
- } else {~paste(sample, '\n', formatC(count,
- format="f",
- big.mark=".",
- digits=0),
- 'Reads', feature)},
- hoverinfo = 'text') %>%
- group_by(order) %>%
+ showlegend = if (order == unique(lse$order)[1]) {
+ TRUE
+ } else{
+ FALSE
+ },
+ text = if (perc) {
+ ~ paste(sample,
+ '\n', round(count * 100, 2),
+ '%', feature)
+ } else {
+ ~ paste(
+ sample,
+ '\n',
+ formatC(
+ count,
+ format = "f",
+ big.mark = ".",
+ digits = 0
+ ),
+ 'Reads',
+ feature
+ )
+ },
+ hoverinfo = 'text'
+ ) %>%
+ group_by(order) %>%
plotly::layout(
barmode = 'stack',
title = "Count assignments",
- xaxis = if(perc) {list(title = 'Counts',
- tickformat = "%")
- } else {list(title = 'Counts')},
- yaxis = if(sort_value != "None") {list(title = "",
- tickmode = "array",
- tickvals = length(unique(temp$sample))/2-0.5,
- ticktext = ~paste(order, " "))
- } else {list(title = "")},
- legend = list(tracegroupgap=0)) %>%
+ xaxis = if (perc) {
+ list(title = 'Counts',
+ tickformat = "%")
+ } else {
+ list(title = 'Counts')
+ },
+ yaxis = if (sort_value != "None") {
+ list(
+ title = "",
+ tickmode = "array",
+ tickvals = length(unique(temp$sample)) / 2 - 0.5,
+ ticktext = ~ paste(order, " ")
+ )
+ } else {
+ list(title = "")
+ },
+ legend = list(tracegroupgap = 0)
+ ) %>%
config(
toImageButtonOptions = list(
format = "png",
@@ -82,7 +106,7 @@ alignmentSummaryPlot <- function(se, sort_value="None", perc=T){
plotly::subplot(
plot_list,
nrows = length(unique(lse$order)),
- shareY=T,
+ shareY = T,
shareX = T,
margin = 0.005
)
@@ -99,77 +123,120 @@ alignmentSummaryPlot <- function(se, sort_value="None", perc=T){
#' @param rank Integer, The number of genes/rank (min=10)
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
-complexityPlot <- function(se, group_color="None", perc=T, rank=1000) {
- compData <- complexityData(se, rank)
-
- p <- plot_ly(
- type = 'scattergl',
- mode = "lines+markers") %>%
- plotly::layout(
- title = "Gene complexity %",
- xaxis = list(title = 'Rank', type="log"),
- yaxis = if (perc){list(tickformat = "%", title = 'Cumulative fraction of total reads till rank')}
- else {list(title = 'Cumulative reads till rank')},
- legend = list(tracegroupgap=0)) %>%
- config(
- toImageButtonOptions = list(
- format = "png",
- filename = "countdistline",
- width = 1500,
- height = 1000
+complexityPlot <- function(se, group_color = "None", perc = T, rank = 1000) {
+ compData <- complexityData(se, rank)
+
+ p <- plot_ly(type = 'scattergl',
+ mode = "lines+markers") %>%
+ plotly::layout(
+ title = "Gene complexity %",
+ xaxis = list(title = 'Rank', type = "log"),
+ yaxis = if (perc) {
+ list(tickformat = "%", title = 'Cumulative fraction of total reads till rank')
+ }
+ else {
+ list(title = 'Cumulative reads till rank')
+ },
+ legend = list(tracegroupgap = 0)
+ ) %>%
+ config(
+ toImageButtonOptions = list(
+ format = "png",
+ filename = "countdistline",
+ width = 1500,
+ height = 1000
+ )
)
- )
-
- legend_duplic <- c()
- for (var in colnames(se)) {
- temp <- compData[compData$sample == var, ]
- if (group_color != "None") {
- p <- add_trace(
- p,
- x = temp$rank,
- y = if (perc){temp$fraction} else {temp$value},
- showlegend = if(!se[[group_color]][colnames(se) == var] %in% legend_duplic) {TRUE
- } else{FALSE},
- legendgroup = se[[group_color]][colnames(se) == var],
- color = rep(se[[group_color]][colnames(se) == var], rank),
- text = if (perc){paste(temp$sample,
- "\n", temp$rank, "Genes\n",
- round(temp$fraction*100, 2),
- '% Reads\n')
- } else {paste(temp$sample,
- "\n", temp$rank, "Genes\n",
- formatC(temp$value,
- format="f",
- big.mark=".",
- digits=0),
- 'Reads\n')},
- hoverinfo = 'text')
- legend_duplic <- c(legend_duplic, se[[group_color]][colnames(se) == var])
- } else {
- p <- add_trace(
- p,
- x = temp$rank,
- y = if (perc){temp$fraction} else {temp$value},
- color = var,
- text = if (perc){paste(temp$sample,
- "\n", temp$rank, "Genes\n",
- round(temp$fraction*100, 2),
- '% Reads\n')
- } else {paste(temp$sample,
- "\n", temp$rank, "Genes\n",
- formatC(temp$value,
- format="f",
- big.mark=".",
- digits=0),
- 'Reads\n')},
- hoverinfo = 'text')
+
+ legend_duplic <- c()
+ for (var in colnames(se)) {
+ temp <- compData[compData$sample == var,]
+ if (group_color != "None") {
+ p <- add_trace(
+ p,
+ x = temp$rank,
+ y = if (perc) {
+ temp$fraction
+ } else {
+ temp$value
+ },
+ showlegend = if (!se[[group_color]][colnames(se) == var] %in% legend_duplic) {
+ TRUE
+ } else{
+ FALSE
+ },
+ legendgroup = se[[group_color]][colnames(se) == var],
+ color = rep(se[[group_color]][colnames(se) == var], rank),
+ text = if (perc) {
+ paste(
+ temp$sample,
+ "\n",
+ temp$rank,
+ "Genes\n",
+ round(temp$fraction * 100, 2),
+ '% Reads\n'
+ )
+ } else {
+ paste(
+ temp$sample,
+ "\n",
+ temp$rank,
+ "Genes\n",
+ formatC(
+ temp$value,
+ format = "f",
+ big.mark = ".",
+ digits = 0
+ ),
+ 'Reads\n'
+ )
+ },
+ hoverinfo = 'text'
+ )
+ legend_duplic <- c(legend_duplic, se[[group_color]][colnames(se) == var])
+ } else {
+ p <- add_trace(
+ p,
+ x = temp$rank,
+ y = if (perc) {
+ temp$fraction
+ } else {
+ temp$value
+ },
+ color = var,
+ text = if (perc) {
+ paste(
+ temp$sample,
+ "\n",
+ temp$rank,
+ "Genes\n",
+ round(temp$fraction * 100, 2),
+ '% Reads\n'
+ )
+ } else {
+ paste(
+ temp$sample,
+ "\n",
+ temp$rank,
+ "Genes\n",
+ formatC(
+ temp$value,
+ format = "f",
+ big.mark = ".",
+ digits = 0
+ ),
+ 'Reads\n'
+ )
+ },
+ hoverinfo = 'text'
+ )
+ }
}
+ p
}
- p
-}
## --------------------------------------------------------------------------
@@ -183,20 +250,20 @@ complexityPlot <- function(se, group_color="None", perc=T, rank=1000) {
#' @param dge DGE list object, containing samples and counts
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
-countDistributionLinePlot <- function(dge){
+countDistributionLinePlot <- function(dge) {
stackCounts <- data.frame(stackDge(dge))
- p <- plot_ly(
- type = 'scattergl',
- mode = 'lines',
- source = "dist_line") %>%
+ p <- plot_ly(type = 'scattergl',
+ mode = 'lines',
+ source = "dist_line") %>%
plotly::layout(
title = "Gene count distribution",
xaxis = list(title = 'Log2CPM'),
- yaxis = list(title = 'Density')) %>%
+ yaxis = list(title = 'Density')
+ ) %>%
config(
toImageButtonOptions = list(
format = "png",
@@ -206,7 +273,7 @@ countDistributionLinePlot <- function(dge){
)
)
for (var in unique(stackCounts$sample)) {
- temp <- stackCounts[stackCounts$sample == var, ]
+ temp <- stackCounts[stackCounts$sample == var,]
density <- density(temp$logCPM)
p <- add_trace(
p,
@@ -216,7 +283,8 @@ countDistributionLinePlot <- function(dge){
text = var,
hoverinfo = 'text',
fill = 'tozeroy',
- alpha = 0.05)
+ alpha = 0.05
+ )
}
p
}
@@ -228,15 +296,14 @@ countDistributionLinePlot <- function(dge){
#' @param dge DGE list object, containing samples and counts
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
-countDistributionBoxPlot <- function(dge){
+countDistributionBoxPlot <- function(dge) {
stackCounts <- data.frame(stackDge(dge))
- p <- plot_ly(
- type = 'box',
- boxpoints = FALSE) %>%
+ p <- plot_ly(type = 'box',
+ boxpoints = FALSE) %>%
config(
toImageButtonOptions = list(
format = "png",
@@ -246,16 +313,16 @@ countDistributionBoxPlot <- function(dge){
)
)
for (var in unique(stackCounts$sample)) {
- temp <- stackCounts[stackCounts$sample == var, ]
- p <- add_trace(
- p,
- y = temp$logCPM,
- name = var,
- alpha = 0.5) %>%
+ temp <- stackCounts[stackCounts$sample == var,]
+ p <- add_trace(p,
+ y = temp$logCPM,
+ name = var,
+ alpha = 0.5) %>%
plotly::layout(
title = "Gene count distribution",
xaxis = list(title = ''),
- yaxis = list(title = 'Log2CPM'))
+ yaxis = list(title = 'Log2CPM')
+ )
}
p
}
@@ -268,44 +335,45 @@ countDistributionBoxPlot <- function(dge){
#' @param sourceId plot ID, depends on raw/normalized counts
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
-voomPlot <- function(dge, sourceId){
- v <- voom(2^(dge$counts), save.plot = TRUE)
+voomPlot <- function(dge, sourceId) {
+ v <- voom(2 ^ (dge$counts), save.plot = TRUE)
p <- plot_ly(
- x = ~v$voom.xy$x,
- y = ~v$voom.xy$y,
+ x = ~ v$voom.xy$x,
+ y = ~ v$voom.xy$y,
type = "scattergl",
mode = "markers",
color = "Voom",
alpha = 0.75,
text = names(v$voom.xy$x),
hoverinfo = 'text',
- key = ~names(v$voom.xy$x),
- source = sourceId) %>%
+ key = ~ names(v$voom.xy$x),
+ source = sourceId
+ ) %>%
add_trace(
mode = "lines",
x = v$voom.line$x,
y = v$voom.line$y,
hoverinfo = 'none',
line = list(color = "rgba(7, 164, 181, 1)"),
- name = "Voom average") %>%
+ name = "Voom average"
+ ) %>%
plotly::layout(
title = "Voom",
xaxis = list(title = 'Average Log2 Count'),
yaxis = list(title = 'SQRT(Standard Deviation)'),
clickmode = "event+select",
- dragmode = "select") %>%
- config(
- toImageButtonOptions = list(
- format = "png",
- filename = sourceId,
- width = 1500,
- height = 1000
- )
- )
+ dragmode = "select"
+ ) %>%
+ config(toImageButtonOptions = list(
+ format = "png",
+ filename = sourceId,
+ width = 1500,
+ height = 1000
+ ))
p
}
@@ -319,42 +387,42 @@ voomPlot <- function(dge, sourceId){
#' @param sourceId plot ID, depends on raw/normalized counts
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
-multidimensionalScaling2dPlot <- function(dge, color, sourceId){
- logFC <- plotMDS(dge$counts, ndim = ncol(dge)-1)
+multidimensionalScaling2dPlot <- function(dge, color, sourceId) {
+ logFC <- plotMDS(dge$counts, ndim = ncol(dge) - 1)
for_plots <- data.frame(logFC$cmdscale.out)
- for_plots$group <- dge$samples[,color]
+ for_plots$group <- dge$samples[, color]
p <- plot_ly(
data = for_plots,
- x = ~X1,
- y = ~X2,
+ x = ~ X1,
+ y = ~ X2,
type = "scattergl",
mode = "markers",
- color = ~for_plots$group,
+ color = ~ for_plots$group,
text = rownames(for_plots),
hoverinfo = 'text',
- marker = list(size=15,
+ marker = list(size = 15,
line = list(color = '#999999',
width = 1)),
- key = ~rownames(for_plots),
- source = sourceId) %>%
+ key = ~ rownames(for_plots),
+ source = sourceId
+ ) %>%
plotly::layout(
title = paste("MDS Plot 2D"),
xaxis = list(title = 'MDS1'),
yaxis = list(title = 'MDS2'),
clickmode = "event+select",
- dragmode = "select") %>%
- config(
- toImageButtonOptions = list(
- format = "png",
- filename = sourceId,
- width = 1500,
- height = 1000
- )
- )
+ dragmode = "select"
+ ) %>%
+ config(toImageButtonOptions = list(
+ format = "png",
+ filename = sourceId,
+ width = 1500,
+ height = 1000
+ ))
p
}
@@ -367,38 +435,38 @@ multidimensionalScaling2dPlot <- function(dge, color, sourceId){
#' @param color String, Column on wich colors should be based
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
-multidimensionalScaling3dPlot <- function(dge, color){
- logFC <- plotMDS(dge$counts, ndim = ncol(dge)-1)
+multidimensionalScaling3dPlot <- function(dge, color) {
+ logFC <- plotMDS(dge$counts, ndim = ncol(dge) - 1)
for_plots <- data.frame(logFC$cmdscale.out)
- for_plots$group <- dge$samples[,color]
+ for_plots$group <- dge$samples[, color]
p <- plot_ly(
data = for_plots,
- x = ~X1,
- y = ~X2,
- z = ~X3,
- color = ~for_plots$group,
+ x = ~ X1,
+ y = ~ X2,
+ z = ~ X3,
+ color = ~ for_plots$group,
text = rownames(for_plots),
- hoverinfo = 'text') %>%
- add_markers(marker = list(size=5, opacity = 0.75)) %>%
+ hoverinfo = 'text'
+ ) %>%
+ add_markers(marker = list(size = 5, opacity = 0.75)) %>%
plotly::layout(
title = paste("MDS Plot 3D"),
scene = list(
xaxis = list(title = 'MDS1'),
yaxis = list(title = 'MDS2'),
- zaxis = list(title = 'MDS3'))
- ) %>%
- config(
- toImageButtonOptions = list(
- format = "png",
- filename = "mds3d",
- width = 1500,
- height = 1000
+ zaxis = list(title = 'MDS3')
)
- )
+ ) %>%
+ config(toImageButtonOptions = list(
+ format = "png",
+ filename = "mds3d",
+ width = 1500,
+ height = 1000
+ ))
p
}
@@ -415,25 +483,27 @@ multidimensionalScaling3dPlot <- function(dge, color){
#' @param dge DGE list object, containing samples and counts
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
-variancePcaPlot <- function(dge){
+variancePcaPlot <- function(dge) {
tdge <- t(dge$counts)
tdge[!is.finite(tdge)] <- 0
- pca <- prcomp(tdge, center=TRUE)
- percent <- data.frame(summary( pca )$importance[2,])
+ pca <- prcomp(tdge, center = TRUE)
+ percent <- data.frame(summary(pca)$importance[2, ])
colnames(percent) <- "percent"
p <- plot_ly(
data = percent,
x = rownames(percent),
- y = ~percent,
- type = "bar") %>%
+ y = ~ percent,
+ type = "bar"
+ ) %>%
plotly::layout(
title = "PCA Scree",
- xaxis = list(title = 'Component', categoryorder='trace'),
- yaxis = list(title = 'Percentage', tickformat = ".2%")) %>%
+ xaxis = list(title = 'Component', categoryorder = 'trace'),
+ yaxis = list(title = 'Percentage', tickformat = ".2%")
+ ) %>%
config(
toImageButtonOptions = list(
format = "png",
@@ -457,47 +527,51 @@ variancePcaPlot <- function(dge){
#' @param getPC2 String, Selected PC to be plotted on y-axis
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
-samplePca2dPlot <- function(dge, color, getPC1, getPC2){
+samplePca2dPlot <- function(dge, color, getPC1, getPC2) {
tdge <- t(dge$counts)
tdge[!is.finite(tdge)] <- 0
- pca <- prcomp(tdge, center=TRUE)
- percent <- data.frame(summary( pca )$importance[2,])
+ pca <- prcomp(tdge, center = TRUE)
+ percent <- data.frame(summary(pca)$importance[2, ])
colnames(percent) <- "percent"
- pca <- data.frame(scale(tdge, center=T, scale=F)%*%pca$rotation)
- pca$group <- dge$samples[,color]
+ pca <- data.frame(scale(tdge, center = T, scale = F) %*% pca$rotation)
+ pca$group <- dge$samples[, color]
p <- plot_ly(
data = pca,
x = pca[[getPC1]],
- y = pca[[getPC2]],
+ y = pca[[getPC2]],
type = "scattergl",
mode = "markers",
- color=~pca$group,
+ color = ~ pca$group,
text = rownames(pca),
hoverinfo = 'text',
- marker = list(size=15,
+ marker = list(size = 15,
line = list(color = '#999999',
width = 1)),
- key = ~rownames(pca),
- source = "pca_pca2d") %>%
+ key = ~ rownames(pca),
+ source = "pca_pca2d"
+ ) %>%
plotly::layout(
title = 'PCA 2D',
- xaxis = list(title = paste0(getPC1, " (", round(percent[getPC1,]*100, 2), "%)")),
- yaxis = list(title = paste0(getPC2, " (", round(percent[getPC2,]*100, 2), "%)")),
+ xaxis = list(title = paste0(
+ getPC1, " (", round(percent[getPC1, ] * 100, 2), "%)"
+ )),
+ yaxis = list(title = paste0(
+ getPC2, " (", round(percent[getPC2, ] * 100, 2), "%)"
+ )),
clickmode = "event+select",
- dragmode = "select") %>%
- config(
- toImageButtonOptions = list(
- format = "png",
- filename = "pca2d",
- width = 1500,
- height = 1000
- )
- )
+ dragmode = "select"
+ ) %>%
+ config(toImageButtonOptions = list(
+ format = "png",
+ filename = "pca2d",
+ width = 1500,
+ height = 1000
+ ))
p
}
@@ -514,43 +588,47 @@ samplePca2dPlot <- function(dge, color, getPC1, getPC2){
#' @param getPC3 String, Selected PC to be plotted on z-axis
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
-samplePca3dPlot <- function(dge, color, getPC1, getPC2, getPC3){
+samplePca3dPlot <- function(dge, color, getPC1, getPC2, getPC3) {
tdge <- t(dge$counts)
tdge[!is.finite(tdge)] <- 0
- pca <- prcomp(tdge, center=TRUE)
- percent <- data.frame(summary( pca )$importance[2,])
+ pca <- prcomp(tdge, center = TRUE)
+ percent <- data.frame(summary(pca)$importance[2, ])
colnames(percent) <- "percent"
- pca <- data.frame(scale(tdge, center=T, scale=F)%*%pca$rotation)
- pca$group <- dge$samples[,color]
+ pca <- data.frame(scale(tdge, center = T, scale = F) %*% pca$rotation)
+ pca$group <- dge$samples[, color]
p <- plot_ly(
data = pca,
x = pca[[getPC1]],
y = pca[[getPC2]],
z = pca[[getPC3]],
- color = ~pca$group,
+ color = ~ pca$group,
text = rownames(pca),
- hoverinfo = 'text') %>%
- add_markers(marker = list(size=5, opacity = 0.75)) %>%
- plotly::layout(
- title = 'PCA 3D',
- scene = list(
- xaxis = list(title = paste0(getPC1, " (", round(percent[getPC1,]*100, 2), "%)")),
- yaxis = list(title = paste0(getPC2, " (", round(percent[getPC2,]*100, 2), "%)")),
- zaxis = list(title = paste0(getPC3, " (", round(percent[getPC3,]*100, 2), "%)")))
- ) %>%
- config(
- toImageButtonOptions = list(
- format = "png",
- filename = "pca3d",
- width = 1500,
- height = 1000
- )
- )
+ hoverinfo = 'text'
+ ) %>%
+ add_markers(marker = list(size = 5, opacity = 0.75)) %>%
+ plotly::layout(title = 'PCA 3D',
+ scene = list(
+ xaxis = list(title = paste0(
+ getPC1, " (", round(percent[getPC1, ] * 100, 2), "%)"
+ )),
+ yaxis = list(title = paste0(
+ getPC2, " (", round(percent[getPC2, ] * 100, 2), "%)"
+ )),
+ zaxis = list(title = paste0(
+ getPC3, " (", round(percent[getPC3, ] * 100, 2), "%)"
+ ))
+ )) %>%
+ config(toImageButtonOptions = list(
+ format = "png",
+ filename = "pca3d",
+ width = 1500,
+ height = 1000
+ ))
p
}
@@ -568,44 +646,53 @@ samplePca3dPlot <- function(dge, color, getPC1, getPC2, getPC3){
#' @param amount Integer, The number of genes shown in plot
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
-variableHeatmapPlot <- function(dge, group_col, amount){
+variableHeatmapPlot <- function(dge, group_col, amount) {
lcpm <- dge$counts
var_genes <- apply(lcpm, 1, var)
- select_var <- names(sort(var_genes, decreasing=TRUE))[1:amount]
- high_var_cpm <- lcpm[select_var,]
+ select_var <- names(sort(var_genes, decreasing = TRUE))[1:amount]
+ high_var_cpm <- lcpm[select_var, ]
high_var_cpm <- as.data.frame(stack(high_var_cpm))
if (group_col != "None") {
order <- as.data.frame(as.character(dge$samples[[group_col]]), rownames(dge$samples))
colnames(order) <- "group"
- order <- order[order(order$group),, drop=F]
- high_var_cpm <- high_var_cpm[order(match(high_var_cpm$col,rownames(order))),]
+ order <- order[order(order$group), , drop = F]
+ high_var_cpm <- high_var_cpm[order(match(high_var_cpm$col, rownames(order))), ]
}
p <- plot_ly(
data = high_var_cpm,
- x = ~col,
- y = ~row,
- z = ~value,
- colorbar = list(title = "Log2CPM", len=1),
+ x = ~ col,
+ y = ~ row,
+ z = ~ value,
+ colorbar = list(title = "Log2CPM", len = 1),
type = "heatmap",
hoverinfo = 'text',
- text = paste("Sample:", high_var_cpm$col,
- "
Gene:", high_var_cpm$row,
- "
Log2CPM:", high_var_cpm$value)
- ) %>%
+ text = paste(
+ "Sample:",
+ high_var_cpm$col,
+ "
Gene:",
+ high_var_cpm$row,
+ "
Log2CPM:",
+ high_var_cpm$value
+ )
+ ) %>%
plotly::layout(
title = "Most variable genes",
- xaxis = list(title = '',
- categoryorder = "array",
- categoryarray = ~col),
+ xaxis = list(
+ title = '',
+ categoryorder = "array",
+ categoryarray = ~ col
+ ),
yaxis = list(
title = '',
categoryorder = "array",
- autorange = "reversed")) %>%
+ autorange = "reversed"
+ )
+ ) %>%
config(
toImageButtonOptions = list(
format = "png",
@@ -628,44 +715,53 @@ variableHeatmapPlot <- function(dge, group_col, amount){
#' @param amount Integer, The number of genes shown in plot
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
-topDgeHeatmapPlot <- function(deTab, dge, group_col, amount){
- sortdeTab <- deTab[order(rank(deTab$FDR)),]
+topDgeHeatmapPlot <- function(deTab, dge, group_col, amount) {
+ sortdeTab <- deTab[order(rank(deTab$FDR)), ]
sortdeTab <- head(sortdeTab, amount)
- getnorm <- dge[rownames(sortdeTab),]
+ getnorm <- dge[rownames(sortdeTab), ]
getnorm <- getnorm$counts
getnorm <- as.data.frame(stack(getnorm))
if (group_col != "None") {
order <- as.data.frame(as.character(dge$samples[[group_col]]), rownames(dge$samples))
colnames(order) <- "group"
- order <- order[order(order$group),, drop=F]
- getnorm <- getnorm[order(match(getnorm$col,rownames(order))),]
+ order <- order[order(order$group), , drop = F]
+ getnorm <- getnorm[order(match(getnorm$col, rownames(order))), ]
}
p <- plot_ly(
data = getnorm,
- x = ~col,
- y = ~row,
- z = ~value,
- colorbar = list(title = "Log2CPM", len=1),
+ x = ~ col,
+ y = ~ row,
+ z = ~ value,
+ colorbar = list(title = "Log2CPM", len = 1),
type = "heatmap",
hoverinfo = 'text',
- text = paste("Sample:", getnorm$col,
- "
Gene:", getnorm$row,
- "
Log2CPM:", getnorm$value)
- ) %>%
+ text = paste(
+ "Sample:",
+ getnorm$col,
+ "
Gene:",
+ getnorm$row,
+ "
Log2CPM:",
+ getnorm$value
+ )
+ ) %>%
plotly::layout(
title = "Most expressed genes",
- xaxis = list(title = '',
- categoryorder = "array",
- categoryarray = ~col),
+ xaxis = list(
+ title = '',
+ categoryorder = "array",
+ categoryarray = ~ col
+ ),
yaxis = list(
title = '',
categoryorder = "array",
- autorange = "reversed")) %>%
+ autorange = "reversed"
+ )
+ ) %>%
config(
toImageButtonOptions = list(
format = "png",
@@ -689,30 +785,31 @@ topDgeHeatmapPlot <- function(deTab, dge, group_col, amount){
#' @param deTab Dataframe, with all analysis results
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
-deRatioPlot <- function(deTab){
- defeatures <- aggregate(deTab$DE, by=list(category=deTab$DE), FUN=length)
- defeatures$perc <- defeatures[,2]/sum(defeatures[,2])
-
- defeatures$category <- c("Down regulated","Not sign.","Up regulated")[match(defeatures$category, c(-1,0,1))]
+deRatioPlot <- function(deTab) {
+ defeatures <- aggregate(deTab$DE, by = list(category = deTab$DE), FUN = length)
+ defeatures$perc <- defeatures[, 2] / sum(defeatures[, 2])
+ defeatures$category <- c("Down regulated", "Not sign.", "Up regulated")[match(defeatures$category, c(-1, 0, 1))]
p <- plot_ly(
data = defeatures,
x = "",
- y = ~perc,
- color = ~category,
+ y = ~ perc,
+ color = ~ category,
type = "bar",
- text = paste(defeatures[,2], "Genes\n", round(defeatures$perc*100, 2), "%"),
+ text = paste(defeatures[, 2], "Genes\n", round(defeatures$perc * 100, 2), "%"),
textposition = "auto",
- textfont = list(color="black"),
- hovertext = ~category,
- hoverinfo = 'text') %>%
+ textfont = list(color = "black"),
+ hovertext = ~ category,
+ hoverinfo = 'text'
+ ) %>%
plotly::layout(
title = "Differential expression ratio",
xaxis = list(title = ""),
- yaxis = list(tickformat = "%", title = "Ratio")) %>%
+ yaxis = list(tickformat = "%", title = "Ratio")
+ ) %>%
config(
toImageButtonOptions = list(
format = "png",
@@ -732,66 +829,69 @@ deRatioPlot <- function(deTab){
#' @param deTab Dataframe, with all analysis results
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
-ma_plot <- function(deTab){
+ma_plot <- function(deTab) {
prediction <- gamConfidenceFit(deTab, "avgLog2CPM")
p <- plot_ly(
- data = deTab[deTab$DE == 0,],
- x = ~avgLog2CPM,
- y = ~avgLog2FC,
+ data = deTab[deTab$DE == 0, ],
+ x = ~ avgLog2CPM,
+ y = ~ avgLog2FC,
type = "scattergl",
mode = "markers",
- color = ~as.character(DE),
+ color = ~ as.character(DE),
alpha = 0.75,
- text = rownames(deTab[deTab$DE == 0,]),
+ text = rownames(deTab[deTab$DE == 0, ]),
hoverinfo = 'text',
- key = ~rownames(deTab[deTab$DE == 0,]),
- source = "analysis_ma") %>%
+ key = ~ rownames(deTab[deTab$DE == 0, ]),
+ source = "analysis_ma"
+ ) %>%
add_trace(
- x = ~deTab[deTab$DE != 0,]$avgLog2CPM,
- y = ~deTab[deTab$DE != 0,]$avgLog2FC,
- color = as.character(deTab[deTab$DE != 0,]$DE),
+ x = ~ deTab[deTab$DE != 0, ]$avgLog2CPM,
+ y = ~ deTab[deTab$DE != 0, ]$avgLog2FC,
+ color = as.character(deTab[deTab$DE != 0, ]$DE),
alpha = 0.75,
- text = rownames(deTab[deTab$DE != 0,]),
+ text = rownames(deTab[deTab$DE != 0, ]),
hoverinfo = 'text',
- key = ~rownames(deTab[deTab$DE != 0,])) %>%
+ key = ~ rownames(deTab[deTab$DE != 0, ])
+ ) %>%
add_trace(
data = prediction,
mode = "lines",
- x = ~avgLog2CPM,
- y = ~fit,
+ x = ~ avgLog2CPM,
+ y = ~ fit,
text = NA,
key = NA,
color = "Fitted",
line = list(color = 'rgba(7, 164, 181, 1)'),
- name = "Fitted") %>%
+ name = "Fitted"
+ ) %>%
add_ribbons(
data = prediction,
- ymin = ~fit - 1.96 * se.fit,
- ymax = ~fit + 1.96 * se.fit,
+ ymin = ~ fit - 1.96 * se.fit,
+ ymax = ~ fit + 1.96 * se.fit,
fillcolor = "rgba(7, 164, 181, 0.25)",
text = NA,
key = NA,
color = "Standard Error",
line = list(color = 'rgba(0, 0, 0, 0)'),
- name = "Standard Error") %>%
+ name = "Standard Error"
+ ) %>%
plotly::layout(
title = "MA",
xaxis = list(title = 'Average Log2 CPM'),
yaxis = list(title = 'Average Log2 FC'),
clickmode = "event+select",
- dragmode = "select") %>%
- config(
- toImageButtonOptions = list(
- format = "png",
- filename = "ma",
- width = 1500,
- height = 1000
- )
- )
+ dragmode = "select"
+ ) %>%
+ config(toImageButtonOptions = list(
+ format = "png",
+ filename = "ma",
+ width = 1500,
+ height = 1000
+ ))
p
}
@@ -804,45 +904,65 @@ ma_plot <- function(deTab){
#' @param PCut Integer, Pvalue cutoff for line
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
-volcanoPlot <- function(deTab, LogCut, PCut){
+volcanoPlot <- function(deTab, LogCut, PCut) {
p <- plot_ly(
- data = deTab[deTab$DE == 0,],
- x = ~avgLog2FC,
- y = ~-log10(FDR),
+ data = deTab[deTab$DE == 0, ],
+ x = ~ avgLog2FC,
+ y = ~ -log10(FDR),
type = "scattergl",
mode = "markers",
- color = ~as.character(DE),
+ color = ~ as.character(DE),
alpha = 0.75,
- text = rownames(deTab[deTab$DE == 0,]),
+ text = rownames(deTab[deTab$DE == 0, ]),
hoverinfo = 'text',
- key = ~rownames(deTab[deTab$DE == 0,]),
- source = "analysis_volcano") %>%
+ key = ~ rownames(deTab[deTab$DE == 0, ]),
+ source = "analysis_volcano"
+ ) %>%
add_trace(
- x = ~deTab[deTab$DE != 0,]$avgLog2FC,
- y = ~-log10(deTab[deTab$DE != 0,]$FDR),
- color = as.character(deTab[deTab$DE != 0,]$DE),
+ x = ~ deTab[deTab$DE != 0, ]$avgLog2FC,
+ y = ~ -log10(deTab[deTab$DE != 0, ]$FDR),
+ color = as.character(deTab[deTab$DE != 0, ]$DE),
alpha = 0.75,
- text = rownames(deTab[deTab$DE != 0,]),
+ text = rownames(deTab[deTab$DE != 0, ]),
hoverinfo = 'text',
- key = ~rownames(deTab[deTab$DE != 0,])) %>%
+ key = ~ rownames(deTab[deTab$DE != 0, ])
+ ) %>%
plotly::layout(
title = "Volcano",
xaxis = list(title = 'Average Log2 FC'),
yaxis = list(title = '- Log10 P-Value'),
shapes = list(
- list(type = "line", line = list(color = "red"),
- x0 = 0, x1 = 1, xref = "paper",
- y0 = PCut, y1 = PCut),
+ list(
+ type = "line",
+ line = list(color = "red"),
+ x0 = 0,
+ x1 = 1,
+ xref = "paper",
+ y0 = PCut,
+ y1 = PCut
+ ),
- list(type = "line", line = list(color = "red"),
- x0 = LogCut, x1 = LogCut,
- y0 = 0, y1 = 1, yref = "paper"),
- list(type = "line", line = list(color = "red"),
- x0 = -LogCut, x1 = -LogCut,
- y0 = 0, y1 = 1, yref = "paper")
+ list(
+ type = "line",
+ line = list(color = "red"),
+ x0 = LogCut,
+ x1 = LogCut,
+ y0 = 0,
+ y1 = 1,
+ yref = "paper"
+ ),
+ list(
+ type = "line",
+ line = list(color = "red"),
+ x0 = -LogCut,
+ x1 = -LogCut,
+ y0 = 0,
+ y1 = 1,
+ yref = "paper"
+ )
),
clickmode = "event+select",
dragmode = "select"
@@ -872,13 +992,13 @@ volcanoPlot <- function(deTab, LogCut, PCut){
#' @param selected Vector, Extra selected rownames
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
barcodePlot <- function(deTab, dge, color, amount, selected) {
- sortdeTab <- deTab[order(rank(deTab$FDR)),]
+ sortdeTab <- deTab[order(rank(deTab$FDR)), ]
sortdeTab <- head(sortdeTab, amount)
- getnorm <- dge[c(rownames(sortdeTab), selected),]
+ getnorm <- dge[c(rownames(sortdeTab), selected), ]
getnorm$counts <- getnorm$counts
stack1 <- as.data.frame(stack(getnorm$counts))
stack1$group <- getnorm$samples[[color]][stack1$col]
@@ -890,23 +1010,30 @@ barcodePlot <- function(deTab, dge, color, amount, selected) {
p <- plot_ly(
type = "scattergl",
mode = "markers",
- marker = list(symbol = "line-ns-open",
- size = 250/(amount+length(selected)),
- line = list(width=2)))
+ marker = list(
+ symbol = "line-ns-open",
+ size = 250 / (amount + length(selected)),
+ line = list(width = 2)
+ )
+ )
p <- add_trace(
p,
- x = ~stack1$value,
- y = ~stack1$row,
- color = ~stack1$group,
+ x = ~ stack1$value,
+ y = ~ stack1$row,
+ color = ~ stack1$group,
text = stack1$col,
- hoverinfo = 'text') %>%
+ hoverinfo = 'text'
+ ) %>%
plotly::layout(
title = "Barcode",
xaxis = list(title = 'Log2 CPM'),
- yaxis = list(title = '',
- categoryorder = "array",
- autorange = "reversed"),
- autosize = T) %>%
+ yaxis = list(
+ title = '',
+ categoryorder = "array",
+ autorange = "reversed"
+ ),
+ autosize = T
+ ) %>%
config(
toImageButtonOptions = list(
format = "png",
@@ -926,30 +1053,30 @@ barcodePlot <- function(deTab, dge, color, amount, selected) {
#' @param deTab Dataframe, with all analysis results
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
-pValuePlot <- function(deTab){
- pvalue <- round(deTab$P.Value, digits=2)
- pvalue <- aggregate(pvalue, by=list(p=pvalue), FUN=length)
+pValuePlot <- function(deTab) {
+ pvalue <- round(deTab$P.Value, digits = 2)
+ pvalue <- aggregate(pvalue, by = list(p = pvalue), FUN = length)
p <- plot_ly(
data = pvalue,
- x = ~p,
- y = ~x,
- type = "bar") %>%
+ x = ~ p,
+ y = ~ x,
+ type = "bar"
+ ) %>%
plotly::layout(
title = "P-Value",
xaxis = list(title = 'P-Value'),
- yaxis = list(title = 'Count')) %>%
- config(
- toImageButtonOptions = list(
- format = "png",
- filename = "pvalue",
- width = 1500,
- height = 1000
- )
- )
+ yaxis = list(title = 'Count')
+ ) %>%
+ config(toImageButtonOptions = list(
+ format = "png",
+ filename = "pvalue",
+ width = 1500,
+ height = 1000
+ ))
p
}
@@ -967,7 +1094,7 @@ pValuePlot <- function(deTab){
#' @param log Boolean, Show plot in Log scale
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
biasPlot <- function(deTab, biasColumn, log, tick, sourceId) {
@@ -978,51 +1105,58 @@ biasPlot <- function(deTab, biasColumn, log, tick, sourceId) {
p <- plot_ly(
data = deTab,
- x = ~get(biasColumn),
- y = ~avgLog2FC,
+ x = ~ get(biasColumn),
+ y = ~ avgLog2FC,
type = 'scattergl',
mode = "markers",
- color = ~FDR,
+ color = ~ FDR,
alpha = 0.75,
showlegend = FALSE,
text = rownames(deTab),
hoverinfo = 'text',
key = rownames(deTab),
- source = sourceId) %>%
+ source = sourceId
+ ) %>%
add_trace(
data = prediction,
mode = "lines",
- x = ~get(biasColumn),
- y = ~fit,
+ x = ~ get(biasColumn),
+ y = ~ fit,
text = NA,
key = NA,
color = "green",
line = list(color = 'rgba(7, 164, 181, 1)'),
- name = "Fitted") %>%
+ name = "Fitted"
+ ) %>%
add_ribbons(
data = prediction,
- ymin = ~fit - 1.96 * se.fit,
- ymax = ~fit + 1.96 * se.fit,
+ ymin = ~ fit - 1.96 * se.fit,
+ ymax = ~ fit + 1.96 * se.fit,
fillcolor = "rgba(7, 164, 181, 0.25)",
text = NA,
key = NA,
color = "green",
line = list(color = 'rgba(0, 0, 0, 0)'),
- name = "Standard Error") %>%
+ name = "Standard Error"
+ ) %>%
plotly::layout(
title = paste("Bias based on", biasColumn),
- xaxis = list(title = biasColumn, type = log, tickformat = tick), #, type = "log"),
+ xaxis = list(
+ title = biasColumn,
+ type = log,
+ tickformat = tick
+ ),
+ #, type = "log"),
yaxis = list(title = 'Average Log2 FC'),
clickmode = "event+select",
- dragmode = "select") %>%
- config(
- toImageButtonOptions = list(
- format = "png",
- filename = "bias",
- width = 1500,
- height = 1000
- )
- )
+ dragmode = "select"
+ ) %>%
+ config(toImageButtonOptions = list(
+ format = "png",
+ filename = "bias",
+ width = 1500,
+ height = 1000
+ ))
p
}
@@ -1033,30 +1167,32 @@ biasPlot <- function(deTab, biasColumn, log, tick, sourceId) {
#' @param deTab Dataframe, with all analysis results
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
geneStrandBar <- function(deTab) {
- geneStrand <- as.data.frame(table(deTab$strand, deTab$DE, dnn = c("strand", "DE")))
- geneStrand$DE <- c("Down regulated","Not sign.","Up regulated")[match(geneStrand$DE, c(-1,0,1))]
- geneStrand$perc <- geneStrand$Freq/sum(geneStrand$Freq)
+ geneStrand <- as.data.frame(table(deTab$geneStrand, deTab$DE, dnn = c("strand", "DE")))
+ geneStrand$DE <- c("Down regulated", "Not sign.", "Up regulated")[match(geneStrand$DE, c(-1, 0, 1))]
+ geneStrand$perc <- geneStrand$Freq / sum(geneStrand$Freq)
p <- plot_ly(
data = geneStrand,
- x = ~strand,
- y = ~Freq,
- color = ~DE,
+ x = ~ strand,
+ y = ~ Freq,
+ color = ~ DE,
orientation = 'v',
type = "bar",
- text = ~paste(Freq, "Genes\n", round(perc*100, 2), "%"),
+ text = ~ paste(Freq, "Genes\n", round(perc * 100, 2), "%"),
textposition = "auto",
- textfont = list(color="black"),
- hovertext = ~DE,
- hoverinfo = 'text') %>%
+ textfont = list(color = "black"),
+ hovertext = ~ DE,
+ hoverinfo = 'text'
+ ) %>%
plotly::layout(
title = "Gene strand",
- xaxis = list(title = 'Gene strand'), #, type = "log"),
- yaxis = list(title = 'Number of genes')) %>%
+ xaxis = list(title = 'Gene strand'),
+ yaxis = list(title = 'Number of genes')
+ ) %>%
config(
toImageButtonOptions = list(
format = "png",
@@ -1078,7 +1214,7 @@ geneStrandBar <- function(deTab) {
#' @param infoText String, Explanation of a plot
#'
#' @return Shiny Box object
-#'
+#'
#' @export
informationBox <- function(infoText) {
@@ -1090,10 +1226,8 @@ informationBox <- function(infoText) {
width = 12,
collapsible = TRUE,
collapsed = FALSE,
- span(
- infoText,
- style = "padding-left: 5px; text-align: justify; display: block;"
- ),
+ span(infoText,
+ style = "padding-left: 5px; text-align: justify; display: block;"),
style = "padding-left: unset;"
)
}, error = function(err) {
diff --git a/R/enrichment.R b/R/enrichment.R
index 3124d1f..5936095 100644
--- a/R/enrichment.R
+++ b/R/enrichment.R
@@ -10,10 +10,10 @@
#' @param deTab Dataframe, with all analysis results
#'
#' @return geneList, (Vector) Named vector containing gene names and LogFC values
-#'
+#'
#' @export
-get_geneList <- function(deTab){
+get_geneList <- function(deTab) {
geneList <- deTab$avgLog2FC
names(geneList) <- as.character(deTab$entrez)
geneList <- sort(geneList, decreasing = TRUE)
@@ -30,7 +30,7 @@ get_geneList <- function(deTab){
#' @param showCategory Integer, number of pathways
#'
#' @return n, (Integer) Updated number of pathways to show
-#'
+#'
#' @export
update_n <- function(x, showCategory) {
@@ -57,7 +57,7 @@ update_n <- function(x, showCategory) {
#' @param selected Vector, Contains manually selected pathways
#'
#' @return geneSets, (vector) Genes found in corresponding pathways
-#'
+#'
#' @export
extract_geneSets <- function(enrich, slider, selected) {
@@ -79,12 +79,12 @@ extract_geneSets <- function(enrich, slider, selected) {
#' @param inputList Vector, containing Gene names and LogFC
#'
#' @return g, (Igraph object) Graph with links between genes
-#'
+#'
#' @export
list2graph <- function(inputList) {
ldf <- list2df(inputList)
- g <- igraph::graph.data.frame(ldf, directed=FALSE)
+ g <- igraph::graph.data.frame(ldf, directed = FALSE)
return(g)
}
@@ -96,15 +96,14 @@ list2graph <- function(inputList) {
#' @param inputList Vector, containing Gene names and LogFC
#'
#' @return ldf, (Dataframe) With all in use genes
-#'
+#'
#' @export
list2df <- function(inputList) {
ldf <- lapply(1:length(inputList), function(i) {
- data.frame(
- categoryID=rep(names(inputList[i]),
- length(inputList[[i]])),
- Gene=inputList[[i]])
+ data.frame(categoryID = rep(names(inputList[i]),
+ length(inputList[[i]])),
+ Gene = inputList[[i]])
})
do.call('rbind', ldf)
@@ -119,13 +118,13 @@ list2df <- function(inputList) {
#' @param y Vector, genes relative to y axis
#'
#' @return n, (Integer) Number of overlapping values
-#'
+#'
#' @export
overlap_ratio <- function(x, y) {
x <- unlist(x)
y <- unlist(y)
- n <- length(intersect(x, y))/length(unique(c(x,y)))
+ n <- length(intersect(x, y)) / length(unique(c(x, y)))
n
}
@@ -136,17 +135,17 @@ overlap_ratio <- function(x, y) {
#' @param deTab Dataframe, with all analysis results
#'
#' @return id, (String) Organism ID value
-#'
+#'
#' @export
-get_organismID <- function(deTab){
+get_organismID <- function(deTab) {
tryCatch({
if ("geneName" %in% colnames(inUse_deTab)) {
id <- rownames(deTab)[nrow(deTab)]
} else {
id <- deTab$geneId[nrow(deTab)]
}
- id <- gsub("[^A-Za-z]","", id)
+ id <- gsub("[^A-Za-z]", "", id)
id <- sub(".{1}$", "", id)
id
}, error = function(err) {
@@ -168,38 +167,45 @@ get_organismID <- function(deTab){
#' @param value String, Value with the column name to be used (p-, q- or adjP value)
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
-enrichBarplot <- function(enrich, amount, value){
- enrich <- na.omit(enrich[0:amount,])
+enrichBarplot <- function(enrich, amount, value) {
+ enrich <- na.omit(enrich[0:amount, ])
enrich$Description <- factor(enrich$Description,
levels = unique(enrich$Description)[order(enrich[[value]],
enrich$Description,
decreasing = TRUE)])
- color <- seq(from=min(enrich[[value]]),
- to=max(enrich[[value]]),
- length.out = 10)[2:9]
+ color <- seq(
+ from = min(enrich[[value]]),
+ to = max(enrich[[value]]),
+ length.out = 10
+ )[2:9]
p <- plot_ly(
- enrich,
- x = ~Count,
- y = ~Description,
- orientation='h',
+ data = enrich,
+ x = ~ Count,
+ y = ~ Description,
+ orientation = 'h',
type = "bar",
- hoverinfo= 'text',
+ hoverinfo = 'text',
text = paste("# Genes:", enrich$Count),
- marker=list(color=-enrich[[value]],
- colorscale='Viridis',
- colorbar=list(
- title=value,
- tickmode="array",
- tickvals=-color,
- ticktext=floor(color) + signif(color %% 1, 4)),
- reversescale=FALSE)) %>%
+ marker = list(
+ color = -enrich[[value]],
+ colorscale = 'Viridis',
+ colorbar = list(
+ title = value,
+ tickmode = "array",
+ tickvals = -color,
+ ticktext = floor(color) + signif(color %% 1, 4)
+ ),
+ reversescale = FALSE
+ )
+ ) %>%
plotly::layout(
xaxis = list(title = 'Gene counts'),
title = "Enrichment barplot",
- yaxis = list(title = '')) %>%
+ yaxis = list(title = '')
+ ) %>%
config(
toImageButtonOptions = list(
format = "png",
@@ -219,36 +225,38 @@ enrichBarplot <- function(enrich, amount, value){
#' @param enrich Enrich result, A enrichment results
#'
#' @return g, (Igraph object) containing links between pathways
-#'
+#'
#' @export
-emap_plotly <- function(enrich){
+emap_plotly <- function(enrich) {
geneSets <- geneInCategory(enrich)
if (is.null(dim(enrich)) | nrow(enrich) == 1) {
- g <- graph.empty(0, directed=FALSE)
+ g <- graph.empty(0, directed = FALSE)
g <- add_vertices(g, nv = 1)
V(g)$name <- as.character(enrich$Description)
V(g)$color <- "red"
} else {
- id <- enrich[,"ID"]
+ id <- enrich[, "ID"]
geneSets <- geneSets[id]
n <- nrow(enrich) #
- w <- matrix(NA, nrow=n, ncol=n)
+ w <- matrix(NA, nrow = n, ncol = n)
colnames(w) <- rownames(w) <- enrich$Description
- for (i in seq_len(n-1)) {
- for (j in (i+1):n) {
- w[i,j] <- overlap_ratio(geneSets[id[i]], geneSets[id[j]])
+ for (i in seq_len(n - 1)) {
+ for (j in (i + 1):n) {
+ w[i, j] <- overlap_ratio(geneSets[id[i]], geneSets[id[j]])
}
}
wd <- melt(w)
- wd <- wd[wd[,1] != wd[,2],]
- wd <- wd[!is.na(wd[,3]),]
- g <- graph.data.frame(wd[,-3], directed=FALSE)
- E(g)$width=sqrt(wd[,3] * 5)
- g <- delete.edges(g, E(g)[wd[,3] < 0.2])
- idx <- unlist(sapply(V(g)$name, function(x) which(x == enrich$Description)))
+ wd <- wd[wd[, 1] != wd[, 2], ]
+ wd <- wd[!is.na(wd[, 3]), ]
+ g <- graph.data.frame(wd[, -3], directed = FALSE)
+ E(g)$width = sqrt(wd[, 3] * 5)
+ g <- delete.edges(g, E(g)[wd[, 3] < 0.2])
+ idx <-
+ unlist(sapply(V(g)$name, function(x)
+ which(x == enrich$Description)))
cnt <- sapply(geneSets[idx], length)
V(g)$size <- cnt
@@ -271,10 +279,10 @@ emap_plotly <- function(enrich){
#' @param geneSets Martrix object, containing all pathways with corresponding genes
#'
#' @return g, (Igraph object) containing links of genes multiple pathways
-#'
+#'
#' @export
-cnetPlotly <- function(enrich, geneSets, deTab){
+cnetPlotly <- function(enrich, geneSets, deTab) {
g <- list2graph(geneSets)
g_id <- as.data.frame(V(g)$name[V(g)$name %in% deTab$entrez])
@@ -284,11 +292,15 @@ cnetPlotly <- function(enrich, geneSets, deTab){
deTab$geneName <- rownames(deTab)
}
- g_id <- merge(g_id, deTab[c("entrez", "geneName", "avgLog2FC")], by = "entrez", all.x=TRUE)
- g_id <- g_id[order(match(g_id$entrez, V(g)$name[!V(g)$name %in% names(geneSets)])), ]
+ g_id <-
+ merge(g_id, deTab[c("entrez", "geneName", "avgLog2FC")], by = "entrez", all.x =
+ TRUE)
+ g_id <-
+ g_id[order(match(g_id$entrez, V(g)$name[!V(g)$name %in% names(geneSets)])),]
V(g)$color <- g_id$avgLog2FC
- V(g)$name[V(g)$name %in% g_id$entrez] <- as.character(g_id$geneName)
+ V(g)$name[V(g)$name %in% g_id$entrez] <-
+ as.character(g_id$geneName)
g
}
@@ -303,18 +315,33 @@ cnetPlotly <- function(enrich, geneSets, deTab){
#' @param geneSets Martrix object, containing all pathways with corresponding genes
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
heatplotly <- function(geneSets, deTab) {
genelist <- list2df(geneSets)
- genelist <- merge(genelist, deTab[c("entrez", "avgLog2FC")], by.x = "Gene", by.y = "entrez", all.x=TRUE)
- genelist <- merge(genelist, rev(sort(table(genelist$Gene))), by.x = "Gene", by.y = "Var1")
- if (length(rev(sort(table(genelist$categoryID)))) == 1) {
- genelist <- merge(genelist, rev(sort(table(genelist$categoryID))), by.x = "categoryID", by.y = "row.names")
- colnames(genelist)[colnames(genelist) %in% c("Freq", "y")] <- c("Freq.x", "Freq.y")
+ genelist <-
+ merge(genelist,
+ deTab[c("entrez", "avgLog2FC")],
+ by.x = "Gene",
+ by.y = "entrez",
+ all.x = TRUE)
+ genelist <-
+ merge(genelist, rev(sort(table(genelist$Gene))), by.x = "Gene", by.y = "Var1")
+ if (length(rev(sort(table(
+ genelist$categoryID
+ )))) == 1) {
+ genelist <-
+ merge(genelist, rev(sort(table(
+ genelist$categoryID
+ ))), by.x = "categoryID", by.y = "row.names")
+ colnames(genelist)[colnames(genelist) %in% c("Freq", "y")] <-
+ c("Freq.x", "Freq.y")
} else {
- genelist <- merge(genelist, rev(sort(table(genelist$categoryID))), by.x = "categoryID", by.y = "Var1")
+ genelist <-
+ merge(genelist, rev(sort(table(
+ genelist$categoryID
+ ))), by.x = "categoryID", by.y = "Var1")
}
for (pathway in unique(genelist$categoryID)) {
@@ -327,27 +354,44 @@ heatplotly <- function(geneSets, deTab) {
deTab$geneName <- rownames(deTab)
}
- genelist <- merge(genelist, deTab[c("entrez", "geneName")], by.x = "Gene", by.y = "entrez", all.x=TRUE)
- genelist <- genelist[order(-genelist$match, -genelist$Freq.y, genelist$avgLog2FC), ]
+ genelist <-
+ merge(genelist,
+ deTab[c("entrez", "geneName")],
+ by.x = "Gene",
+ by.y = "entrez",
+ all.x = TRUE)
+ genelist <-
+ genelist[order(-genelist$match,-genelist$Freq.y, genelist$avgLog2FC),]
p <- plot_ly(
- x = ~genelist$categoryID,
- y = ~genelist$geneName,
- z = ~genelist$avgLog2FC,
- colorbar = list(title = "Log2FC", len=1),
+ x = ~ genelist$categoryID,
+ y = ~ genelist$geneName,
+ z = ~ genelist$avgLog2FC,
+ colorbar = list(title = "Log2FC", len = 1),
type = "heatmap",
hoverinfo = 'text',
- text = paste("Pathway:", genelist$categoryID,
- "
Gene:", genelist$geneName,
- "
Log2FC:", genelist$avgLog2FC)) %>%
+ text = paste(
+ "Pathway:",
+ genelist$categoryID,
+ "
Gene:",
+ genelist$geneName,
+ "
Log2FC:",
+ genelist$avgLog2FC
+ )
+ ) %>%
plotly::layout(
title = "Genes in pathway",
- xaxis = list(title = '',
- categoryorder = "array",
- categoryarray = genelist$categoryID),
- yaxis = list(title = '',
- categoryorder = "array",
- categoryarray = genelist$geneName)) %>%
+ xaxis = list(
+ title = '',
+ categoryorder = "array",
+ categoryarray = genelist$categoryID
+ ),
+ yaxis = list(
+ title = '',
+ categoryorder = "array",
+ categoryarray = genelist$geneName
+ )
+ ) %>%
config(
toImageButtonOptions = list(
format = "png",
@@ -376,42 +420,45 @@ heatplotly <- function(geneSets, deTab) {
#' @param annoG Boolean, Show gene labels yes or no
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
-plotlyGraph <- function(g, pwName, getColor, cnet, annoP, annoG){
+plotlyGraph <- function(g, pwName, getColor, cnet, annoP, annoG) {
G <- g
L <- as.data.frame(layout.kamada.kawai(G))
vs <- V(G)
es <- as.data.frame(get.edgelist(G))
rownames(L) <- names(vs)
- L_cnet <- L[0:cnet,]
- L_genes <- L[(cnet+1):nrow(L),]
+ L_cnet <- L[0:cnet, ]
+ L_genes <- L[(cnet + 1):nrow(L), ]
vs <- vs[!is.na(vs$color)]
Ne <- length(es[1]$V1)
network <- plot_ly(
- x = ~L_genes$V1,
- y = ~L_genes$V2,
+ x = ~ L_genes$V1,
+ y = ~ L_genes$V2,
type = "scattergl",
mode = "markers",
marker = list(
size = 12,
color = as.numeric(vs$color),
colorscale = 'Viridis',
- colorbar = list(title=getColor)),
+ colorbar = list(title = getColor)
+ ),
text = rownames(L_genes),
key = rownames(L_genes),
hoverinfo = "text",
- showlegend = FALSE) %>%
+ showlegend = FALSE
+ ) %>%
add_trace(
x = L_cnet$V1,
y = L_cnet$V2,
marker = list(
size = 20,
color = "red",
- colorbar = FALSE),
+ colorbar = FALSE
+ ),
text = rownames(L_cnet),
key = rownames(L_cnet),
hoverinfo = "text",
@@ -419,14 +466,14 @@ plotlyGraph <- function(g, pwName, getColor, cnet, annoP, annoG){
)
edge_shapes <- list()
- for(i in 1:Ne) {
- v0 <- L[as.character(es[i,]$V1),]
- v1 <- L[as.character(es[i,]$V2),]
+ for (i in 1:Ne) {
+ v0 <- L[as.character(es[i, ]$V1), ]
+ v1 <- L[as.character(es[i, ]$V2), ]
edge_shape = list(
type = "line",
line = list(color = "#030303", width = 0.2),
- layer='below',
+ layer = 'below',
showarrow = TRUE,
x0 = v0$V1,
y0 = v0$V2,
@@ -437,14 +484,21 @@ plotlyGraph <- function(g, pwName, getColor, cnet, annoP, annoG){
edge_shapes[[i]] <- edge_shape
}
- axis <- list(title = "", showgrid = FALSE, showticklabels = FALSE, zeroline = FALSE)
+ axis <-
+ list(
+ title = "",
+ showgrid = FALSE,
+ showticklabels = FALSE,
+ zeroline = FALSE
+ )
p <- plotly::layout(
network,
title = pwName,
shapes = edge_shapes,
xaxis = axis,
- yaxis = axis) %>%
+ yaxis = axis
+ ) %>%
config(
toImageButtonOptions = list(
format = "png",
@@ -467,8 +521,8 @@ plotlyGraph <- function(g, pwName, getColor, cnet, annoP, annoG){
if (isTRUE(annoG)) {
p <- add_annotations(
p,
- x = ~L_genes$V1,
- y = ~L_genes$V2,
+ x = ~ L_genes$V1,
+ y = ~ L_genes$V2,
text = rownames(L_genes),
showarrow = TRUE,
arrowwidth = 1,
diff --git a/R/markdown.R b/R/markdown.R
index 0d7766f..207f5ca 100644
--- a/R/markdown.R
+++ b/R/markdown.R
@@ -15,7 +15,7 @@
#' @param matrix_v2 Vector, containing the right matrix values
#'
#' @return getdesign, (String) String with the design formula
-#'
+#'
#' @export
createDesign <- function(dge, dbase, dvalue, matrix_v1, matrix_v2) {
@@ -24,7 +24,9 @@ createDesign <- function(dge, dbase, dvalue, matrix_v1, matrix_v2) {
getdesign <- "~"
tryCatch({
- if (isTRUE(all.equal(sort(unique(matrix)), sort(as.vector(unique(dge[[dbase]])))))) {
+ if (isTRUE(all.equal(sort(unique(matrix)), sort(as.vector(unique(
+ dge[[dbase]]
+ )))))) {
getdesign <- "~0+"
}
}, error = function(err) {
@@ -63,20 +65,23 @@ createDesign <- function(dge, dbase, dvalue, matrix_v1, matrix_v2) {
#' @param matrix_v2 Vector, containing the right matrix values
#'
#' @return dge, (DGE list object) containing samples and counts
-#'
+#'
#' @export
-relevelSamples <- function(dge, dbase, dvalue, matrix_v1, matrix_v2) {
- columns <- c(dbase, dvalue)
- for (value in columns) {
- newRef <- as.character(dge$samples[[value]][!dge$samples[[value]] %in% c(matrix_v1, matrix_v2)][1])
- if (is.na(newRef)) {
- newRef <- as.character(dge$samples[[value]][1])
+relevelSamples <-
+ function(dge, dbase, dvalue, matrix_v1, matrix_v2) {
+ columns <- c(dbase, dvalue)
+ for (value in columns) {
+ newRef <-
+ as.character(dge$samples[[value]][!dge$samples[[value]] %in% c(matrix_v1, matrix_v2)][1])
+ if (is.na(newRef)) {
+ newRef <- as.character(dge$samples[[value]][1])
+ }
+ dge$samples[[value]] <-
+ relevel(as.factor(dge$samples[[value]]), ref = newRef)
}
- dge$samples[[value]] <- relevel(as.factor(dge$samples[[value]]), ref = newRef)
+ dge
}
- dge
-}
#' Getbase column and use this to create right matrix.
@@ -88,7 +93,7 @@ relevelSamples <- function(dge, dbase, dvalue, matrix_v1, matrix_v2) {
#' @param matrix Vector, containing the matrix values
#'
#' @return dge, (DGE list object) containing samples and counts
-#'
+#'
#' @export
createMatrix <- function(dge, dbase, dvalue, matrix) {
@@ -126,7 +131,7 @@ createMatrix <- function(dge, dbase, dvalue, matrix) {
#' @param matrix_v2 Vector, containing the right matrix values
#'
#' @return contrast, (vector) containing the contrasts (0, 1, -1)
-#'
+#'
#' @export
createContrast <- function(design, matrix_v1, matrix_v2) {
diff --git a/R/runApp.R b/R/runApp.R
index 5cd0af6..a2eb5e4 100644
--- a/R/runApp.R
+++ b/R/runApp.R
@@ -1,24 +1,35 @@
+
+## ----- START THE APPLICATION -----
+
+
#' Start dgeAnalysis application.
#'
#' @return Opens application in default web browser
-#'
+#'
#' @export
-startApp <- function(launch.browser=TRUE) {
+startApp <- function(launch.browser = TRUE) {
appDir <- system.file("src", package = "dgeAnalysis")
if (appDir == "") {
- stop("Could not find 'dgeAnalysis'. Try re-installing 'dgeAnalysis'.", call. = FALSE)
+ stop("Could not find 'dgeAnalysis'. Try re-installing 'dgeAnalysis'.",
+ call. = FALSE)
}
library("dgeAnalysis")
- options(shiny.maxRequestSize = 50*1024^2)
+ options(shiny.maxRequestSize = 50 * 1024 ^ 2)
options(spinner.color = "#0088cc")
options(warn = -1)
message("Initializing dgeAnalysis...")
- suppressWarnings(rm(list=c("deTab", "normDge", "inUse_deTab", "inUse_normDge"), envir=.GlobalEnv))
+ suppressWarnings(rm(
+ list = c("deTab", "normDge", "inUse_deTab", "inUse_normDge"),
+ envir = .GlobalEnv
+ ))
suppressMessages(source(system.file("src/lib/libraries.R", package = "dgeAnalysis")))
- shiny::runApp(appDir, host="0.0.0.0", port=1402, launch.browser=launch.browser)
+ shiny::runApp(appDir,
+ host = "0.0.0.0",
+ port = 1402,
+ launch.browser = launch.browser)
}
diff --git a/R/wcgna.R b/R/wcgna.R
index 9a3bcf5..5e843ff 100644
--- a/R/wcgna.R
+++ b/R/wcgna.R
@@ -1,6 +1,4 @@
-## --------------------------------------------------------------------------
-
## ----- TREE PLOTS -----
@@ -12,71 +10,102 @@
#' @param tree Hclust object, tree object
#'
#' @return new, (Dataframe) dataframe with all dendrogram line coordinates
-#'
+#'
#' @export
-get_dendrogram_data <- function(tree, labels = NULL,
- horiz = FALSE, reverseDirection = FALSE,
- hang = 0.1, xlab = "", ylab = "", axes = TRUE,
- cex.labels = 1, ..., adjustRange = FALSE) {
- hang.gr = hang;
- if (hang < 0) hang.gr = 0.1;
- n = length(tree$order);
- heights = tree$height;
- range = range(heights);
- hang.scaled = hang.gr * (max(heights) - min(heights));
- range[1] = range[1] - hang.scaled;
+get_dendrogram_data <- function(tree,
+ labels = NULL,
+ horiz = FALSE,
+ reverseDirection = FALSE,
+ hang = 0.1,
+ xlab = "",
+ ylab = "",
+ axes = TRUE,
+ cex.labels = 1,
+ ...,
+ adjustRange = FALSE) {
+ hang.gr = hang
+ if (hang < 0)
+ hang.gr = 0.1
+ n = length(tree$order)
+ heights = tree$height
+ range = range(heights)
+ hang.scaled = hang.gr * (max(heights) - min(heights))
+ range[1] = range[1] - hang.scaled
- indexLim = c(0.5, n+0.5);
+ indexLim = c(0.5, n + 0.5)
if (adjustRange)
{
- ctr = mean(indexLim);
- indexLim = ctr + (indexLim - ctr)/1.08;
+ ctr = mean(indexLim)
+ indexLim = ctr + (indexLim - ctr) / 1.08
}
- nMerge = n-1;
- if (is.null(labels)) labels = tree$labels;
- if (is.null(labels)) labels = rep("", n);
- if (is.na(labels[1])) labels = rep("", n);
- if (is.logical(labels) && labels[1]=="FALSE") labels = rep("", n);
+ nMerge = n - 1
+ if (is.null(labels))
+ labels = tree$labels
+ if (is.null(labels))
+ labels = rep("", n)
+ if (is.na(labels[1]))
+ labels = rep("", n)
+ if (is.logical(labels) && labels[1] == "FALSE")
+ labels = rep("", n)
- singleton.x = rep(NA, n);
- singleton.x[tree$order] = c(1:n);
- cluster.x = rep(NA, n);
+ singleton.x = rep(NA, n)
+ singleton.x[tree$order] = c(1:n)
+ cluster.x = rep(NA, n)
- new <- data.frame(matrix(ncol=5, nrow=0, dimnames=list(NULL, c("label", "x", "y", "xend", "yend"))))
+ new <- data.frame(matrix(
+ ncol = 5,
+ nrow = 0,
+ dimnames = list(NULL, c("label", "x", "y", "xend", "yend"))
+ ))
for (m in 1:nMerge) {
o1 = tree$merge[m, 1]
o2 = tree$merge[m, 2]
- h = heights[m];
- hh = if (hang>0) h-hang.scaled else range[1];
- h1 = if (o1 < 0) hh else heights[o1];
- h2 = if (o2 < 0) hh else heights[o2];
+ h = heights[m]
+ hh = if (hang > 0)
+ h - hang.scaled
+ else
+ range[1]
+ h1 = if (o1 < 0)
+ hh
+ else
+ heights[o1]
+ h2 = if (o2 < 0)
+ hh
+ else
+ heights[o2]
- x1 = if (o1 < 0) singleton.x[-o1] else cluster.x[o1]
- x2 = if (o2 < 0) singleton.x[-o2] else cluster.x[o2]
+ x1 = if (o1 < 0)
+ singleton.x[-o1]
+ else
+ cluster.x[o1]
+ x2 = if (o2 < 0)
+ singleton.x[-o2]
+ else
+ cluster.x[o2]
- cluster.x[m] = mean(c(x1, x2));
+ cluster.x[m] = mean(c(x1, x2))
label1 <- labels[-o1]
label2 <- labels[-o2]
if (length(label1) > 1) {
label1 <- ""
- }
+ }
if (length(label2) > 1) {
label2 <- ""
}
if (!is.na(x1)) {
- new[nrow(new) + 1,] <- c(label1, x1, h1, x1, h)
+ new[nrow(new) + 1, ] <- c(label1, x1, h1, x1, h)
if (!is.na(x2)) {
- new[nrow(new) + 1,] <- c("", x1, h, x2, h)
- new[nrow(new) + 1,] <- c(label2, x2, h2, x2, h)
+ new[nrow(new) + 1, ] <- c("", x1, h, x2, h)
+ new[nrow(new) + 1, ] <- c(label2, x2, h2, x2, h)
}
}
}
new[2:5] <- sapply(new[2:5], as.double)
- new <- new[order(new$x),]
+ new <- new[order(new$x), ]
return(new)
}
@@ -89,7 +118,7 @@ get_dendrogram_data <- function(tree, labels = NULL,
#' @param color_list Vector, Color genes
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
plotly_dendrogram <- function(d, color, color_list) {
@@ -97,39 +126,40 @@ plotly_dendrogram <- function(d, color, color_list) {
p <- plot_ly(
data = dendro_data,
- x = ~x,
- y = ~y,
- color = I("black"),
- hoverinfo = "none") %>%
- add_segments(
- xend = ~xend,
- yend = ~yend,
- showlegend = FALSE) %>%
+ x = ~ x,
+ y = ~ y,
+ color = I("black"),
+ hoverinfo = "none"
+ ) %>%
+ add_segments(xend = ~ xend,
+ yend = ~ yend,
+ showlegend = FALSE) %>%
add_markers(
- data = dendro_data[dendro_data$label != "",],
- x = ~x,
- y = ~y,
+ data = dendro_data[dendro_data$label != "", ],
+ x = ~ x,
+ y = ~ y,
color = color,
- marker = list(
- size = 10,
- color = color_list
- ),
- text = ~label,
- hoverinfo = 'text') %>%
+ marker = list(size = 10,
+ color = color_list),
+ text = ~ label,
+ hoverinfo = 'text'
+ ) %>%
plotly::layout(
dragmode = "zoom",
title = "Dendrogram with normalized log2CPM values",
- xaxis = list(title = "", showticklabels = FALSE, zeroline = FALSE),
+ xaxis = list(
+ title = "",
+ showticklabels = FALSE,
+ zeroline = FALSE
+ ),
yaxis = list(title = "Height")
) %>%
- config(
- toImageButtonOptions = list(
- format = "png",
- filename = "dendro",
- width = 1500,
- height = 1000
- )
- )
+ config(toImageButtonOptions = list(
+ format = "png",
+ filename = "dendro",
+ width = 1500,
+ height = 1000
+ ))
p
}
@@ -144,12 +174,12 @@ plotly_dendrogram <- function(d, color, color_list) {
#' @param trait Dataframe, dataframe with all trait values
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
plot_trait_heat <- function(trait) {
heatmap_list <- list()
- for(column in colnames(trait)) {
+ for (column in colnames(trait)) {
p <- plot_ly(
x = rownames(trait),
y = column,
@@ -157,9 +187,17 @@ plot_trait_heat <- function(trait) {
type = "heatmap",
showscale = FALSE,
hoverinfo = 'text',
- text = matrix(paste("Sample:", rownames(trait),
- "
Column:", rep(c(column), nrow(trait)),
- "
Value:", t(trait[[column]])), ncol = nrow(trait))
+ text = matrix(
+ paste(
+ "Sample:",
+ rownames(trait),
+ "
Column:",
+ rep(c(column), nrow(trait)),
+ "
Value:",
+ t(trait[[column]])
+ ),
+ ncol = nrow(trait)
+ )
)
heatmap_list[[column]] <- p
}
@@ -186,7 +224,7 @@ plot_trait_heat <- function(trait) {
#' @param data_TOM WGCNA object, Topology Overlap Matrix
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
plotly_dendro_heat <- function(data_TOM) {
@@ -194,8 +232,9 @@ plotly_dendro_heat <- function(data_TOM) {
x = rownames(data_TOM),
y = colnames(data_TOM),
z = data_TOM,
- colorbar = list(title = "Adjacency", len=1),
- type = "heatmap") %>%
+ colorbar = list(title = "Adjacency", len = 1),
+ type = "heatmap"
+ ) %>%
plotly::layout(
title = "Network heatmap",
xaxis = list(title = ''),
@@ -212,37 +251,46 @@ plotly_dendro_heat <- function(data_TOM) {
#' @param moduleTraitPvalue Dataframe, dataframe with all trait p-values
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
plot_module_trait_relation_heat <- function(moduleTraitCor, moduleTraitPvalue) {
- p <- plot_ly(
- x = colnames(moduleTraitCor),
- y = rownames(moduleTraitCor),
- z = moduleTraitCor,
- colorbar = list(title = "Correlation", len=1),
- type = "heatmap",
- hoverinfo = 'text',
- text = matrix(paste(#"Trait:", colnames(moduleTraitCor),
- "
Module:", rownames(moduleTraitCor),
- "
Correlation:", signif(moduleTraitCor, 2),
- "
P-value:", signif(moduleTraitPvalue, 1)
- ), nrow = nrow(moduleTraitCor), ncol = ncol(moduleTraitCor))) %>%
- plotly::layout(
- title = "Module & Trait relation",
- xaxis = list(title = ''),
- yaxis = list(title = '')
+ p <- plot_ly(
+ x = colnames(moduleTraitCor),
+ y = rownames(moduleTraitCor),
+ z = moduleTraitCor,
+ colorbar = list(title = "Correlation", len = 1),
+ type = "heatmap",
+ hoverinfo = 'text',
+ text = matrix(
+ paste(
+ #"Trait:", colnames(moduleTraitCor),
+ "
Module:",
+ rownames(moduleTraitCor),
+ "
Correlation:",
+ signif(moduleTraitCor, 2),
+ "
P-value:",
+ signif(moduleTraitPvalue, 1)
+ ),
+ nrow = nrow(moduleTraitCor),
+ ncol = ncol(moduleTraitCor)
+ )
) %>%
- config(
- toImageButtonOptions = list(
- format = "png",
- filename = "trait_relation",
- width = 1500,
- height = 1000
+ plotly::layout(
+ title = "Module & Trait relation",
+ xaxis = list(title = ''),
+ yaxis = list(title = '')
+ ) %>%
+ config(
+ toImageButtonOptions = list(
+ format = "png",
+ filename = "trait_relation",
+ width = 1500,
+ height = 1000
+ )
)
- )
- p
-}
+ p
+ }
## --------------------------------------------------------------------------
@@ -256,40 +304,46 @@ plot_module_trait_relation_heat <- function(moduleTraitCor, moduleTraitPvalue) {
#' @param cutoff Integer, R^2 cutoff value
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
plot_power <- function(soft, cutoff) {
soft_combined <- data.frame(
- pwr = soft$fitIndices[,1],
- value = -sign(soft$fitIndices[,3])*soft$fitIndices[,2])
+ pwr = soft$fitIndices[, 1],
+ value = -sign(soft$fitIndices[, 3]) * soft$fitIndices[, 2]
+ )
p <- plot_ly(
data = soft_combined,
- x = ~pwr,
- y = ~value,
+ x = ~ pwr,
+ y = ~ value,
type = "scattergl",
mode = "markers",
- text = ~paste("Power:", pwr),
- hoverinfo = 'text') %>%
+ text = ~ paste("Power:", pwr),
+ hoverinfo = 'text'
+ ) %>%
plotly::layout(
title = "Scale independence",
xaxis = list(title = "Soft Threshold (power)"),
yaxis = list(title = "Scale Free Topology Model Fit, signed R^2"),
shapes = list(
- list(type = "line", line = list(color = "red"),
- x0 = 0, x1 = 1, xref = "paper",
- y0 = cutoff, y1 = cutoff)
+ list(
+ type = "line",
+ line = list(color = "red"),
+ x0 = 0,
+ x1 = 1,
+ xref = "paper",
+ y0 = cutoff,
+ y1 = cutoff
+ )
)
) %>%
- config(
- toImageButtonOptions = list(
- format = "png",
- filename = "power1",
- width = 1500,
- height = 1000
- )
- )
+ config(toImageButtonOptions = list(
+ format = "png",
+ filename = "power1",
+ width = 1500,
+ height = 1000
+ ))
p
}
@@ -299,35 +353,33 @@ plot_power <- function(soft, cutoff) {
#' @param soft Dataframe, soft threshold values per power
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
plot_soft <- function(soft) {
- soft_combined <- data.frame(
- pwr = soft$fitIndices[,1],
- value = soft$fitIndices[,5])
+ soft_combined <- data.frame(pwr = soft$fitIndices[, 1],
+ value = soft$fitIndices[, 5])
p <- plot_ly(
data = soft_combined,
- x = ~pwr,
- y = ~value,
+ x = ~ pwr,
+ y = ~ value,
type = "scattergl",
mode = "markers",
- text = ~paste("Power: ", pwr),
- hoverinfo = 'text') %>%
+ text = ~ paste("Power: ", pwr),
+ hoverinfo = 'text'
+ ) %>%
plotly::layout(
title = "Mean connectivity",
xaxis = list(title = "Soft Threshold (power)"),
yaxis = list(title = "Mean Connectivity")
) %>%
- config(
- toImageButtonOptions = list(
- format = "png",
- filename = "power2",
- width = 1500,
- height = 1000
- )
- )
+ config(toImageButtonOptions = list(
+ format = "png",
+ filename = "power2",
+ width = 1500,
+ height = 1000
+ ))
p
}
@@ -343,36 +395,41 @@ plot_soft <- function(soft) {
#' @param color Vector, all module colors of all used genes
#'
#' @return p, (Plotly object) plot
-#'
+#'
#' @export
plot_modules <- function(color) {
colorTable <- data.frame(table(color))
- colorTable <- colorTable[order(match(colorTable$color, unique(color))),]
- colorTable$perc <- colorTable$Freq/sum(colorTable$Freq)
+ colorTable <- colorTable[order(match(colorTable$color, unique(color))), ]
+ colorTable$perc <- colorTable$Freq / sum(colorTable$Freq)
colorTable$color <- factor(colorTable$color, levels = colorTable$color)
p <- plot_ly(
data = colorTable,
- x = ~perc,
+ x = ~ perc,
y = NULL,
type = "bar",
- color = ~color,
+ color = ~ color,
marker = list(color = colorTable$color),
- text = ~paste(Freq, "Genes"),
- hoverinfo = "text") %>%
+ text = ~ paste(Freq, "Genes"),
+ hoverinfo = "text"
+ ) %>%
plotly::layout(
barmode = "stack",
showlegend = FALSE,
- xaxis = list(title = "",
- zeroline = FALSE,
- showline = FALSE,
- showticklabels = FALSE,
- showgrid = FALSE),
- yaxis = list(zeroline = FALSE,
- showline = FALSE,
- showticklabels = FALSE,
- showgrid = FALSE)
+ xaxis = list(
+ title = "",
+ zeroline = FALSE,
+ showline = FALSE,
+ showticklabels = FALSE,
+ showgrid = FALSE
+ ),
+ yaxis = list(
+ zeroline = FALSE,
+ showline = FALSE,
+ showticklabels = FALSE,
+ showgrid = FALSE
+ )
)
p
}
diff --git a/README.md b/README.md
index fce1a34..e196294 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# dgeAnalysis
-This R package contains the R-Shiny application v1.3.1 developed to perform differential gene expression analysis.
+This R package contains the R-Shiny application v1.3.2 developed to perform differential gene expression analysis.
* dgeAnalysis manual: https://github.com/LUMC/dgeAnalysis/blob/master/MANUAL.pdf
## Installing
diff --git a/inst/app.R b/inst/app.R
index a48b18b..cc649a7 100644
--- a/inst/app.R
+++ b/inst/app.R
@@ -1,8 +1,8 @@
## USE ONLY FOR DEVELOPMENT!!!
-options(shiny.maxRequestSize = 50*1024^2)
-options(spinner.color="#0088cc")
+options(shiny.maxRequestSize = 50 * 1024 ^ 2)
+options(spinner.color = "#0088cc")
# suppressWarnings(rm(list=c("deTab", "normDge", "inUse_deTab", "inUse_normDge"), envir=.GlobalEnv))
options(warn = -1)
@@ -13,4 +13,9 @@ source("R/markdown.R", local = TRUE)
source("R/de_plots.R", local = TRUE)
source("R/wcgna.R", local = TRUE)
-shiny::runApp("inst/src/", host="0.0.0.0", port=1402, launch.browser=TRUE)
+shiny::runApp(
+ appDir = "inst/src/",
+ host = "0.0.0.0",
+ port = 1402,
+ launch.browser = TRUE
+)
diff --git a/inst/src/css/styles.css b/inst/src/css/styles.css
index 3698deb..c4fd588 100644
--- a/inst/src/css/styles.css
+++ b/inst/src/css/styles.css
@@ -423,5 +423,3 @@ table.dataTable tr.selected td{
}
/* --- plotly */
-
-
diff --git a/inst/src/markdown/analysisDESeq2.Rmd b/inst/src/markdown/analysisDESeq2.Rmd
index 16233a6..5d3b741 100644
--- a/inst/src/markdown/analysisDESeq2.Rmd
+++ b/inst/src/markdown/analysisDESeq2.Rmd
@@ -61,9 +61,8 @@ alpha <- params$alpha
```{r filterData}
-# FILTER DATA IF NESSECARY
+# FILTER DATA IF NECESSARY
-#Filter if nessecary
data_samples <- data_samples[!rownames(data_samples) %in% excluded_samples, , drop=FALSE]
data_counts <- data_counts[,!colnames(data_counts) %in% excluded_samples]
@@ -103,14 +102,16 @@ complexityPlot(se)
```{r filesIntoSE}
# READ ALL FILES INTO SE
-se <- readCountsFromTable(data_counts[!grepl('^__', rownames(data_counts)),], data_samples)
+se <- readCountsFromTable(data_counts[!grepl('^__', rownames(data_counts)), ], data_samples)
se <- addSamplesFromTableToSE(se, data_samples)
if (!is.null(data_annotation)) {
se <- addAnnotationsFromTableToSE(se, data_annotation)
}
-dge <- DGEList(counts = assay(se), samples = colData(se), genes = rowData(se))
-dge <- dge[ rowSums( abs( dge$counts ) ) > 1, ]
+dge <- DGEList(counts = assay(se),
+ samples = colData(se),
+ genes = rowData(se))
+dge <- dge[rowSums(abs(dge$counts)) > 1,]
tempDge <- dge
tempDge$counts <- cpm(dge, log = TRUE)
@@ -129,16 +130,17 @@ The design matrix is created and the raw data is filtered based on the input val
get_design <- createDesign(dge$samples, design_base, design_value, matrix_v1, matrix_v2)
get_design
dge <- relevelSamples(dge, design_base, design_value, matrix_v1, matrix_v2)
-design <- model.matrix(eval(parse(text=get_design)), dge$samples)
+design <- model.matrix(eval(parse(text = get_design)), dge$samples)
design
analysis <- DESeqDataSet(se, design = design)
-analysis <- analysis[ rowSums( abs( assay(analysis) ) ) > 1, ]
+analysis <- analysis[rowSums(abs(assay(analysis))) > 1,]
# FILTER IF NESSECARY
counts <- cpm(counts(analysis), log = TRUE)
-selectedFeatures <- rownames( analysis )[ apply( counts, 1, function( v ) sum( v >= cpm_value ) ) >= 1/4 * ncol( counts ) ]
-analysis <- analysis[selectedFeatures,]
+selectedFeatures <- rownames(analysis)[apply(counts, 1, function(v)
+ sum(v >= cpm_value)) >= 1 / 4 * ncol(counts)]
+analysis <- analysis[selectedFeatures, ]
```
@@ -159,7 +161,7 @@ Extract the normalized data from the analysis results.
# GET NORMALIZED COUNTS
getSize <- estimateSizeFactors(analysis)
-normCounts <- cpm(data.frame(counts(getSize, normalized=TRUE)))
+normCounts <- cpm(data.frame(counts(getSize, normalized = TRUE)))
normDge <- DGEList(counts = normCounts, samples = dge$samples)
normDge$counts <- log2(normDge$counts)
normDge$counts[is.infinite(normDge$counts)] <- 0
@@ -193,7 +195,7 @@ summary(deTab)
```{r create_deTab}
# CREATE deTab TABLE
-deTab <- data.frame(deTab[,c("log2FoldChange", "pvalue", "padj")])
+deTab <- data.frame(deTab[, c("log2FoldChange", "pvalue", "padj")])
colnames(deTab) <- c("avgLog2FC", "P.Value", "adj.P.Val")
deTab$avgLog2CPM <- rowMeans(normDge$counts)
@@ -210,21 +212,21 @@ deTab$DE[deTab$adj.P.Val < alpha & deTab$avgLog2FC > 0] <- 1
# ADD ANNOTATION TO deTab
if (!is.null(data_annotation)) {
- deTab <- merge(data_annotation, deTab, by=0, all=FALSE)
+ deTab <- merge(data_annotation, deTab, by = 0, all = FALSE)
rownames(deTab) <- deTab$Row.names
deTab$Row.names <- NULL
}
# MAKE BOTH TABLES EQUAL
-deTab <- deTab[intersect(rownames(deTab), rownames(normDge$counts)),]
-normDge$counts <- normDge$counts[intersect(rownames(deTab), rownames(normDge$counts)),]
+deTab <- deTab[intersect(rownames(deTab), rownames(normDge$counts)), ]
+normDge$counts <- normDge$counts[intersect(rownames(deTab), rownames(normDge$counts)), ]
#ORDER deTab TABLE
deTab <- rename(deTab, "FDR" = "adj.P.Val")
deOrder <- c("avgLog2CPM", "avgLog2FC", "P.Value", "FDR", "DE")
if (!is.null(data_annotation)) {
deTab <- deTab[colnames(deTab)
- [c(1, match(deOrder,names(deTab)), 2:(ncol(deTab)-5))]]
+ [c(1, match(deOrder, names(deTab)), 2:(ncol(deTab) - 5))]]
} else {
deTab <- deTab[deOrder]
}
@@ -233,11 +235,11 @@ if (!is.null(data_annotation)) {
```{r changeToSymbol}
-# CHANGE GENE ID TO SYMBOL IF NESSECARY
+# CHANGE GENE ID TO SYMBOL IF NECESSARY
if (setGeneName == "symbol" && !is.null(data_annotation)) {
tempCol <- rownames(deTab)
- rownames(deTab) <- make.names(deTab$geneName, unique=TRUE)
+ rownames(deTab) <- make.names(deTab$geneName, unique = TRUE)
deTab$geneName <- tempCol
colnames(deTab)[1] <- "geneId"
rownames(normDge$counts) <- rownames(deTab)
@@ -261,7 +263,7 @@ Results are saved, so they can be retrieved by the application.
```{r save}
# SAVE ANALYSIS
-save(deTab, normDge, file="analysis.RData")
+save(deTab, normDge, file = "analysis.RData")
```
diff --git a/inst/src/markdown/analysisEdgeR.Rmd b/inst/src/markdown/analysisEdgeR.Rmd
index 2b9e8b8..6fb943b 100644
--- a/inst/src/markdown/analysisEdgeR.Rmd
+++ b/inst/src/markdown/analysisEdgeR.Rmd
@@ -61,11 +61,10 @@ alpha <- params$alpha
```{r filterData}
-# FILTER DATA IF NESSECARY
+# FILTER DATA IF NECESSARY
-#Filter if nessecary
-data_samples <- data_samples[!rownames(data_samples) %in% excluded_samples, , drop=FALSE]
-data_counts <- data_counts[,!colnames(data_counts) %in% excluded_samples]
+data_samples <- data_samples[!rownames(data_samples) %in% excluded_samples, , drop = FALSE]
+data_counts <- data_counts[, !colnames(data_counts) %in% excluded_samples]
```
@@ -102,7 +101,7 @@ complexityPlot(se)
```{r filesIntoSE}
# ADD ANNOTATION TO SE IF PRESENT
-se <- readCountsFromTable(data_counts[!grepl('^__', rownames(data_counts)),], data_samples)
+se <- readCountsFromTable(data_counts[!grepl('^__', rownames(data_counts)), ], data_samples)
se <- addSamplesFromTableToSE(se, data_samples)
if (!is.null(data_annotation)) {
se <- addAnnotationsFromTableToSE(se, data_annotation)
@@ -115,10 +114,12 @@ if (!is.null(data_annotation)) {
```{r dge}
# GET AND CREATE DGE
-dge <- DGEList(counts = assay(se), samples = colData(se), genes = rowData(se))
+dge <- DGEList(counts = assay(se),
+ samples = colData(se),
+ genes = rowData(se))
row.names(dge$genes) <- row.names(dge$counts)
-dge <- dge[ rowSums( abs( dge$counts ) ) > 1, ]
+dge <- dge[rowSums(abs(dge$counts)) > 1,]
tempDge <- dge
tempDge$counts <- cpm(dge, log = TRUE)
@@ -132,9 +133,10 @@ The raw data is filtered based on the input values provided.
```{r selectedFeatures}
# GET SELECTED FEATURES
-edger <- calcNormFactors( dge, method = "TMM")
+edger <- calcNormFactors(dge, method = "TMM")
counts <- cpm(edger, log = TRUE)
-selectedFeatures <- rownames( edger )[ apply( counts, 1, function( v ) sum( v >= cpm_value ) ) >= 1/4 * ncol( counts ) ]
+selectedFeatures <- rownames(edger)[apply(counts, 1, function(v)
+ sum(v >= cpm_value)) >= 1 / 4 * ncol(counts)]
```
@@ -142,7 +144,7 @@ selectedFeatures <- rownames( edger )[ apply( counts, 1, function( v ) sum( v >=
```{r highExpressed}
# GET HIGH EXPRESSED FEATURES
-highExprDge <- dge[ selectedFeatures,, keep.lib.sizes = FALSE ]
+highExprDge <- dge[selectedFeatures, , keep.lib.sizes = FALSE]
```
@@ -152,7 +154,7 @@ The filtered data is normalized using TMM.
```{r normalize}
# NORMALIZE DATA
-normDge <- calcNormFactors( highExprDge, method = "TMM")
+normDge <- calcNormFactors(highExprDge, method = "TMM")
tempDge <- normDge
tempDge$counts <- cpm(normDge, log = TRUE)
@@ -170,7 +172,7 @@ The design matrix and contrasts are created, based on input values.
get_design <- createDesign(normDge$samples, design_base, design_value, matrix_v1, matrix_v2)
get_design
normDge <- relevelSamples(normDge, design_base, design_value, matrix_v1, matrix_v2)
-design <- model.matrix(eval(parse(text=get_design)), normDge$samples)
+design <- model.matrix(eval(parse(text = get_design)), normDge$samples)
design
get_matrix1 <- createMatrix(normDge, design_base, design_value, matrix_v1)
@@ -203,9 +205,9 @@ summary(efit$DE)
```{r create_deTab}
# CREATE deTab TABLE
-deTab <- topTags(efit, n=Inf)$table
-deTab <- deTab[order(rownames(deTab)),]
-deTab$DE <- c(efit$DE[order(rownames(efit$DE)),])
+deTab <- topTags(efit, n = Inf)$table
+deTab <- deTab[order(rownames(deTab)), ]
+deTab$DE <- c(efit$DE[order(rownames(efit$DE)), ])
#ORDER deTab TABLE
deTab$F <- NULL
@@ -215,7 +217,7 @@ deTab <- rename(deTab, "P.Value" = "PValue")
deOrder <- c("avgLog2CPM", "avgLog2FC", "P.Value", "FDR", "DE")
if (!is.null(data_annotation)) {
deTab <- deTab[colnames(deTab)
- [c(1, match(deOrder,names(deTab)), 2:(ncol(deTab)-5))]]
+ [c(1, match(deOrder, names(deTab)), 2:(ncol(deTab) - 5))]]
} else {
deTab <- deTab[deOrder]
}
@@ -224,11 +226,11 @@ if (!is.null(data_annotation)) {
```{r changeToSymbol}
-# CHANGE GENE ID TO SYMBOL IF NESSECARY
+# CHANGE GENE ID TO SYMBOL IF NECESSARY
if (setGeneName == "symbol" && !is.null(data_annotation)) {
tempCol <- rownames(deTab)
- rownames(deTab) <- make.names(deTab$geneName, unique=TRUE)
+ rownames(deTab) <- make.names(deTab$geneName, unique = TRUE)
deTab$geneName <- tempCol
colnames(deTab)[1] <- "geneId"
rownames(normDge$counts) <- rownames(deTab)
@@ -253,7 +255,7 @@ Results are saved, so they can be retrieved by the application.
# SAVE ANALYSIS
normDge$counts <- cpm(normDge, log = TRUE)
-save(deTab, normDge, file="analysis.RData")
+save(deTab, normDge, file = "analysis.RData")
```
diff --git a/inst/src/markdown/analysisLimma.Rmd b/inst/src/markdown/analysisLimma.Rmd
index 4090aab..2b0f02a 100644
--- a/inst/src/markdown/analysisLimma.Rmd
+++ b/inst/src/markdown/analysisLimma.Rmd
@@ -61,11 +61,10 @@ alpha <- params$alpha
```{r filterData}
-# FILTER DATA IF NESSECARY
+# FILTER DATA IF NECESSARY
-#Filter if nessecary
-data_samples <- data_samples[!rownames(data_samples) %in% excluded_samples, , drop=FALSE]
-data_counts <- data_counts[,!colnames(data_counts) %in% excluded_samples]
+data_samples <- data_samples[!rownames(data_samples) %in% excluded_samples, , drop = FALSE]
+data_counts <- data_counts[, !colnames(data_counts) %in% excluded_samples]
```
@@ -102,7 +101,7 @@ complexityPlot(se)
```{r filesIntoSE}
# READ ALL FILES INTO SE
-se <- readCountsFromTable(data_counts[!grepl('^__', rownames(data_counts)),], data_samples)
+se <- readCountsFromTable(data_counts[!grepl('^__', rownames(data_counts)), ], data_samples)
se <- addSamplesFromTableToSE(se, data_samples)
if (!is.null(data_annotation)) {
se <- addAnnotationsFromTableToSE(se, data_annotation)
@@ -115,10 +114,12 @@ if (!is.null(data_annotation)) {
```{r dge}
# GET AND CREATE DGE
-dge <- DGEList(counts = assay(se), samples = colData(se), genes = rowData(se))
+dge <- DGEList(counts = assay(se),
+ samples = colData(se),
+ genes = rowData(se))
row.names(dge$genes) <- row.names(dge$counts)
-
-dge <- dge[ rowSums( abs( dge$counts ) ) > 1, ]
+
+dge <- dge[rowSums(abs(dge$counts)) > 1,]
tempDge <- dge
tempDge$counts <- cpm(dge, log = TRUE)
@@ -132,9 +133,10 @@ The raw data is filtered based on the input values provided.
```{r selectedFeatures}
# GET SELECTED FEATURES
-limmaV <- calcNormFactors( dge, method = "TMM")
+limmaV <- calcNormFactors(dge, method = "TMM")
counts <- cpm(limmaV, log = TRUE)
-selectedFeatures <- rownames( limmaV )[ apply( counts, 1, function( v ) sum( v >= cpm_value ) ) >= 1/4 * ncol( counts ) ]
+selectedFeatures <- rownames(limmaV)[apply(counts, 1, function(v)
+ sum(v >= cpm_value)) >= 1 / 4 * ncol(counts)]
```
@@ -142,7 +144,7 @@ selectedFeatures <- rownames( limmaV )[ apply( counts, 1, function( v ) sum( v >
```{r highExpressed}
# GET HIGH EXPRESSED FEATURES
-highExprDge <- dge[ selectedFeatures,, keep.lib.sizes = FALSE ]
+highExprDge <- dge[selectedFeatures, , keep.lib.sizes = FALSE]
```
@@ -152,7 +154,7 @@ The filtered data is normalized using TMM.
```{r normalize}
# NORMALIZE DATA
-normDge <- calcNormFactors( highExprDge, method = "TMM")
+normDge <- calcNormFactors(highExprDge, method = "TMM")
tempDge <- normDge
tempDge$counts <- cpm(normDge, log = TRUE)
@@ -170,7 +172,7 @@ The design matrix and contrasts are created, based on input values.
get_design <- createDesign(normDge$samples, design_base, design_value, matrix_v1, matrix_v2)
get_design
normDge <- relevelSamples(normDge, design_base, design_value, matrix_v1, matrix_v2)
-design <- model.matrix(eval(parse(text=get_design)), normDge$samples)
+design <- model.matrix(eval(parse(text = get_design)), normDge$samples)
design
get_matrix1 <- createMatrix(normDge, design_base, design_value, matrix_v1)
@@ -204,9 +206,9 @@ summary(efit$DE)
```{r create_deTab}
# CREATE deTab TABLE
-deTab <- data.frame(topTable(efit, coef=1, n=Inf))
-deTab <- deTab[order(rownames(deTab)),]
-deTab$DE <- c(efit$DE[order(rownames(efit$DE)),])
+deTab <- data.frame(topTable(efit, coef = 1, n = Inf))
+deTab <- deTab[order(rownames(deTab)), ]
+deTab$DE <- c(efit$DE[order(rownames(efit$DE)), ])
#ORDER deTab TABLE
deTab$t <- NULL
@@ -217,7 +219,7 @@ deTab <- rename(deTab, "FDR" = "adj.P.Val")
deOrder <- c("avgLog2CPM", "avgLog2FC", "P.Value", "FDR", "DE")
if (!is.null(data_annotation)) {
deTab <- deTab[colnames(deTab)
- [c(1, match(deOrder,names(deTab)), 2:(ncol(deTab)-5))]]
+ [c(1, match(deOrder, names(deTab)), 2:(ncol(deTab) - 5))]]
} else {
deTab <- deTab[deOrder]
}
@@ -226,11 +228,11 @@ if (!is.null(data_annotation)) {
```{r changeToSymbol}
-# CHANGE GENE ID TO SYMBOL IF NESSECARY
+# CHANGE GENE ID TO SYMBOL IF NECESSARY
if (setGeneName == "symbol" && !is.null(data_annotation)) {
tempCol <- rownames(deTab)
- rownames(deTab) <- make.names(deTab$geneName, unique=TRUE)
+ rownames(deTab) <- make.names(deTab$geneName, unique = TRUE)
deTab$geneName <- tempCol
colnames(deTab)[1] <- "geneId"
rownames(normDge$counts) <- rownames(deTab)
@@ -255,7 +257,7 @@ Results are saved, so they can be retrieved by the application.
# SAVE ANALYSIS
normDge$counts <- cpm(normDge, log = TRUE)
-save(deTab, normDge, file="analysis.RData")
+save(deTab, normDge, file = "analysis.RData")
```
diff --git a/inst/src/server.R b/inst/src/server.R
index f51d321..8a9ab5c 100644
--- a/inst/src/server.R
+++ b/inst/src/server.R
@@ -2,7 +2,6 @@
options(warn = -1)
server <- function(input, output, session) {
-
## Check if objects need to reload
checkReload <- function() {
is.null(input$app_mode)
@@ -54,34 +53,101 @@ server <- function(input, output, session) {
## Render navigation bar to ui
output[["sidebar_tabs"]] <- renderMenu({
- sidebarMenu(id = "sidebar",
- menuItem("Home", tabName = "home",icon = icon("home")),
- menuItem("Data upload", tabName = "upload", icon = icon("upload")),
- menuItem("Run Analysis", tabName = "run_analysis", icon = icon("calculator")),
- menuItem("Pre-Analysis", icon = icon("clipboard-check"),
- menuItem("Alignment", tabName = "alignment", icon = icon("chart-line")),
- menuItem("Raw Data", tabName = "raw_data", icon = icon("chart-line"))
+ sidebarMenu(
+ id = "sidebar",
+ menuItem("Home", tabName = "home", icon = icon("home")),
+ menuItem(
+ "Data upload",
+ tabName = "upload",
+ icon = icon("upload")
+ ),
+ menuItem(
+ "Run Analysis",
+ tabName = "run_analysis",
+ icon = icon("calculator")
+ ),
+ menuItem(
+ "Pre-Analysis",
+ icon = icon("clipboard-check"),
+ menuItem(
+ "Alignment",
+ tabName = "alignment",
+ icon = icon("chart-line")
+ ),
+ menuItem(
+ "Raw Data",
+ tabName = "raw_data",
+ icon = icon("chart-line")
+ )
+ ),
+ menuItem(
+ "Analysis",
+ icon = icon("binoculars"),
+ menuItem(
+ "Normalization",
+ tabName = "norm_data",
+ icon = icon("chart-line")
+ ),
+ menuItem("PCA", tabName = "pca", icon = icon("chart-line")),
+ menuItem(
+ "Heatmaps",
+ tabName = "heatmaps",
+ icon = icon("chart-line")
+ ),
+ menuItem(
+ "DE analysis",
+ tabName = "analysis",
+ icon = icon("chart-line")
+ ),
+ menuItem(
+ "Bias",
+ tabName = "bias",
+ icon = icon("chart-line")
+ )
+ ),
+ menuItem(
+ "Enrichment",
+ icon = icon("bezier-curve"),
+ menuSubItem(
+ "KEGG",
+ tabName = "enrich_kegg",
+ icon = icon("bezier-curve")
+ ),
+ menuSubItem(
+ "Reactome",
+ tabName = "enrich_reactome",
+ icon = icon("bezier-curve")
+ ),
+ menuSubItem(
+ "Gene Ontology",
+ tabName = "enrich_go",
+ icon = icon("bezier-curve")
+ ),
+ menuSubItem(
+ "Disease Ontology",
+ tabName = "enrich_do",
+ icon = icon("bezier-curve")
+ )
),
- menuItem("Analysis", icon = icon("binoculars"),
- menuItem("Normalization", tabName = "norm_data", icon = icon("chart-line")),
- menuItem("PCA", tabName = "pca", icon = icon("chart-line")),
- menuItem("Heatmaps", tabName = "heatmaps", icon = icon("chart-line")),
- menuItem("DE analysis", tabName = "analysis", icon = icon("chart-line")),
- menuItem("Bias", tabName = "bias", icon = icon("chart-line"))
+ menuItem(
+ "WGCNA",
+ tabName = "wgcna",
+ icon = icon("code-branch")
),
- menuItem("Enrichment", icon = icon("bezier-curve"),
- menuSubItem("KEGG", tabName = "enrich_kegg", icon = icon("bezier-curve")),
- menuSubItem("Reactome", tabName = "enrich_reactome", icon = icon("bezier-curve")),
- menuSubItem("Gene Ontology", tabName = "enrich_go", icon = icon("bezier-curve")),
- menuSubItem("Disease Ontology", tabName = "enrich_do", icon = icon("bezier-curve"))
+ menuItem(
+ "Export",
+ tabName = "export",
+ icon = icon("download")
),
- menuItem("WGCNA", tabName = "wgcna", icon = icon("code-branch")),
- menuItem("Export", tabName = "export", icon = icon("download")),
- menuItem("About", tabName = "about", icon = icon("info-circle")),
- img(src = "lumcLogo.png", width="200px")
+ menuItem(
+ "About",
+ tabName = "about",
+ icon = icon("info-circle")
+ ),
+ img(src = "lumcLogo.png", width = "200px")
)
})
-
+
source("tabs/home/svr_home.R", local = TRUE)
source("tabs/upload/svr_upload.R", local = TRUE)
@@ -100,5 +166,5 @@ server <- function(input, output, session) {
source("tabs/wgcna/svr_wgcna.R", local = TRUE)
source("tabs/export/svr_export.R", local = TRUE)
source("tabs/about/svr_about.R", local = TRUE)
-
+
}
diff --git a/inst/src/tabs/about/ui_about.R b/inst/src/tabs/about/ui_about.R
index aa46f9f..a4ab3ec 100644
--- a/inst/src/tabs/about/ui_about.R
+++ b/inst/src/tabs/about/ui_about.R
@@ -1,7 +1,7 @@
tab_about <- tabItem(
tabName = "about",
- align="center",
+ align = "center",
br(),
HTML('
'),
@@ -14,15 +14,19 @@ tab_about <- tabItem(
h3("Version:", as.character(packageVersion("dgeAnalysis"))),
h2("Developed by LUMC-SASC team"),
h3("Tom Kuipers"),
- h4(
- "Leon Mei", tags$br(),
- "Davy Cats", tags$br()
- ),
+ h4("Leon Mei", tags$br(),
+ "Davy Cats", tags$br()),
br(),
- h3(a(href="https://github.com/LUMC/DGE_analysis", "GitHub page", target="_blank")),
- img(src="lumcLogo.png", width="300px"),
- br(),br(),br(),
+ h3(
+ a(href = "https://github.com/LUMC/DGE_analysis",
+ "GitHub page",
+ target = "_blank")
+ ),
+ img(src = "lumcLogo.png", width = "300px"),
+ br(),
+ br(),
+ br(),
HTML('
'),
h2("Session info"),
diff --git a/inst/src/tabs/alignment/svr_alignment.R b/inst/src/tabs/alignment/svr_alignment.R
index d99f331..f4be44a 100644
--- a/inst/src/tabs/alignment/svr_alignment.R
+++ b/inst/src/tabs/alignment/svr_alignment.R
@@ -10,9 +10,9 @@ output[["group_sum"]] <- renderUI({
tryCatch({
checkReload()
selectInput(
- "group_sum",
- "Group by:",
- c("None"="None", colnames(data_samples()))
+ inputId = "group_sum",
+ label = "Group by:",
+ choices = c("None" = "None", colnames(data_samples()))
)
}, error = function(err) {
return(NULL)
@@ -23,7 +23,7 @@ output[["group_sum"]] <- renderUI({
output[["align_sum"]] <- renderPlotly({
tryCatch({
checkReload()
- if (input$setSummary == "actual"){
+ if (input$setSummary == "actual") {
perc = F
} else {
perc = T
@@ -39,9 +39,9 @@ output[["group_color"]] <- renderUI({
tryCatch({
checkReload()
selectInput(
- "group_color",
- "Group by:",
- c("None"="None", colnames(data_samples()))
+ inputId = "group_color",
+ label = "Group by:",
+ choices = c("None" = "None", colnames(data_samples()))
)
}, error = function(err) {
return(NULL)
@@ -52,7 +52,7 @@ output[["group_color"]] <- renderUI({
output[["complex"]] <- renderPlotly({
tryCatch({
checkReload()
- if (input$setComplexity == "actual"){
+ if (input$setComplexity == "actual") {
perc = F
} else {
perc = T
@@ -66,7 +66,8 @@ output[["complex"]] <- renderPlotly({
## INFORMATION BOXES
output[["align_sum_info"]] <- renderUI({
- infoText <- "In the summary plots, a general overview can be seen of the count data. These plots show a
+ infoText <-
+ "In the summary plots, a general overview can be seen of the count data. These plots show a
bar plot with the alignment results and a complexity plot. The alignment plot is a stacked bar
plot, where every 'row' stands for a sample and the stacked bars per row are the different
tags. These tags indicate the distribution of the read counts, given by a read counter (e.g.
@@ -75,7 +76,8 @@ output[["align_sum_info"]] <- renderUI({
})
output[["complex_info"]] <- renderUI({
- infoText <- "The complexity plots show how many reads cover a certain amount of genes. On the X-axis,
+ infoText <-
+ "The complexity plots show how many reads cover a certain amount of genes. On the X-axis,
there is a ranking from zero to one thousand. This ranking stands for the number of genes.
On the Y-axis the proportion of the reads relative to the total amount of counts is shown.
Normally the expectation is a growing curve. Big deviations between samples of the number
diff --git a/inst/src/tabs/alignment/ui_alignment.R b/inst/src/tabs/alignment/ui_alignment.R
index 0745fe8..92fe000 100644
--- a/inst/src/tabs/alignment/ui_alignment.R
+++ b/inst/src/tabs/alignment/ui_alignment.R
@@ -1,7 +1,7 @@
tab_alignment <- tabItem(
tabName = "alignment",
- align="center",
+ align = "center",
br(),
tabsetPanel(
@@ -21,7 +21,7 @@ tab_alignment <- tabItem(
uiOutput("group_sum"),
br(),
uiOutput("align_sum_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
),
mainPanel(
width = 9,
@@ -45,10 +45,17 @@ tab_alignment <- tabItem(
"Percentage" = "percent")
),
uiOutput("group_color"),
- sliderInput("comp_rank", "Set number of ranks (Genes):", value = 1000, min = 10, max = 10000, step=10),
+ sliderInput(
+ "comp_rank",
+ "Set number of ranks (Genes):",
+ value = 1000,
+ min = 10,
+ max = 10000,
+ step = 10
+ ),
br(),
uiOutput("complex_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
),
mainPanel(
width = 9,
diff --git a/inst/src/tabs/analysis/svr_analysis.R b/inst/src/tabs/analysis/svr_analysis.R
index 9b8c26f..e86c0cc 100644
--- a/inst/src/tabs/analysis/svr_analysis.R
+++ b/inst/src/tabs/analysis/svr_analysis.R
@@ -9,7 +9,9 @@ output[["detab_table"]] <- DT::renderDataTable({
DT::datatable(inUse_deTab[inUse_deTab$DE != 0,], options = list(pageLength = 50, scrollX = TRUE))
}
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -37,10 +39,14 @@ output[["ma_plot"]] <- renderPlotly({
output[["selected_ma"]] <- DT::renderDataTable({
tryCatch({
s <- event_data(event = "plotly_selected", source = "analysis_ma")
- if(is.null(s)){s <- ""}
+ if (is.null(s)) {
+ s <- ""
+ }
DT::datatable(inUse_deTab[s$key,], options = list(pageLength = 15, scrollX = TRUE))
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -48,7 +54,9 @@ output[["selected_ma"]] <- DT::renderDataTable({
output[["volcano_plot"]] <- renderPlotly({
tryCatch({
checkReload()
- volcanoPlot(inUse_deTab, input$vulcanoLogCut, -log10(input$vulcanoPCut))
+ volcanoPlot(inUse_deTab,
+ input$vulcanoLogCut,
+ -log10(input$vulcanoPCut))
}, error = function(err) {
return(NULL)
})
@@ -58,10 +66,14 @@ output[["volcano_plot"]] <- renderPlotly({
output[["selected_volcano"]] <- DT::renderDataTable({
tryCatch({
s <- event_data(event = "plotly_selected", source = "analysis_volcano")
- if(is.null(s)){s <- ""}
+ if (is.null(s)) {
+ s <- ""
+ }
DT::datatable(inUse_deTab[s$key,], options = list(pageLength = 15, scrollX = TRUE))
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -69,7 +81,13 @@ output[["selected_volcano"]] <- DT::renderDataTable({
output[["barcode_plot"]] <- renderPlotly({
tryCatch({
checkReload()
- barcodePlot(inUse_deTab, inUse_normDge, input$group_analysis_bar, input$slider_barcode, input$selected_analysis_bar)
+ barcodePlot(
+ inUse_deTab,
+ inUse_normDge,
+ input$group_analysis_bar,
+ input$slider_barcode,
+ input$selected_analysis_bar
+ )
}, error = function(err) {
return(NULL)
})
@@ -78,9 +96,10 @@ output[["barcode_plot"]] <- renderPlotly({
## Set color of barcode
output[["group_analysis_bar"]] <- renderUI({
tryCatch({
- selectInput(inputId = "group_analysis_bar",
- label = "Color by:",
- choices = colnames(data_samples())
+ selectInput(
+ inputId = "group_analysis_bar",
+ label = "Color by:",
+ choices = colnames(data_samples())
)
}, error = function(err) {
return(NULL)
@@ -88,12 +107,13 @@ output[["group_analysis_bar"]] <- renderUI({
})
## Add specific gene to barplot
-output[["analysis_bar_select_gene"]] <- renderUI({
+observe({
tryCatch({
- selectInput(inputId = "selected_analysis_bar",
- label = "Add specific genes:",
- multiple = TRUE,
- choices = c("Click to add gene" = "", rownames(inUse_deTab))
+ updateSelectizeInput(
+ session = session,
+ inputId = 'selected_analysis_bar',
+ choices = rownames(inUse_deTab),
+ server = TRUE
)
}, error = function(err) {
return(NULL)
@@ -113,15 +133,17 @@ output[["p_val_plot"]] <- renderPlotly({
## INFORMATION BOXES
output[["de_ratio_info"]] <- renderUI({
- infoText <- "The DE ratio plot gives a quick overview of the amount of differentially expressed genes.
+ infoText <-
+ "The DE ratio plot gives a quick overview of the amount of differentially expressed genes.
(down, not and up-regulated) The exact amount of genes are shown inside the plot. The dispersion
- of the Y-axis is based on the percentages. This is calculated based on the total amount of genes
+ of the Y-axis is based on the percentages. This is calculated based on the total amount of genes
after filtering."
informationBox(infoText)
})
output[["ma_plot_info"]] <- renderUI({
- infoText <- "The MA plot (Mean average), plots all genes after filtering. This plot creates a figure with
+ infoText <-
+ "The MA plot (Mean average), plots all genes after filtering. This plot creates a figure with
log-intensity ratios (M-values) and log-intensity averages (A-values). The MA plot can give a
view of all genes and their amount of expression in a comparison of two groups. On the
X-axis the Log2CPM values (A) are plotted against the Log2FC values on the Y-axis (M). In
@@ -131,7 +153,8 @@ output[["ma_plot_info"]] <- renderUI({
})
output[["volcano_plot_info"]] <- renderUI({
- infoText <- "The volcano plot also shows the most expressed genes and can give a good view of the
+ infoText <-
+ "The volcano plot also shows the most expressed genes and can give a good view of the
expression results. The X-axis contains the Log2FC (magnitude of change) and the Y-axis
shows -Log10 p-value (statistical significance). A great benefit of the volcano plot is that it
makes genes with a high fold-change, who are statistically significant, well visible. If genes
@@ -141,7 +164,8 @@ output[["volcano_plot_info"]] <- renderUI({
})
output[["barcode_plot_info"]] <- renderUI({
- infoText <- "The barcode plot shows the most expressed genes. The X-axis shows the Log2CPM
+ infoText <-
+ "The barcode plot shows the most expressed genes. The X-axis shows the Log2CPM
for every sample per gene. The Y-axis shows most expressed genes (from top to
bottom). Every bar stands for a sample. With this plot differences between samples for a
specific gene is visible."
@@ -149,7 +173,8 @@ output[["barcode_plot_info"]] <- renderUI({
})
output[["p_val_plot_info"]] <- renderUI({
- infoText <- "The p-value plot is used as a quality control plot. When all bars, for example, are all the
+ infoText <-
+ "The p-value plot is used as a quality control plot. When all bars, for example, are all the
same height, then the analysis can be described as “noisy”. The ideal pattern would be that
bars around a p-value of zero are high. Next, the bars should get lower in a nice (steep)
curve and should be (almost) zero at the p-value of one."
diff --git a/inst/src/tabs/analysis/ui_analysis.R b/inst/src/tabs/analysis/ui_analysis.R
index 8cb726a..99a424a 100644
--- a/inst/src/tabs/analysis/ui_analysis.R
+++ b/inst/src/tabs/analysis/ui_analysis.R
@@ -1,7 +1,7 @@
tab_analysis <- tabItem(
tabName = "analysis",
- align="center",
+ align = "center",
br(),
tabsetPanel(
@@ -9,12 +9,12 @@ tab_analysis <- tabItem(
title = "DE table",
HTML('
'),
radioButtons(
- "setdeTab",
- "Show selection:",
+ inputId = "setdeTab",
+ label = "Show selection:",
inline = TRUE,
- c("All genes" = "all",
- "DE genes" = "deg")
- ),
+ choices = c("All genes" = "all",
+ "DE genes" = "deg")
+ ),
DT::dataTableOutput("detab_table") %>% withSpinner(),
HTML('
')
),
@@ -27,8 +27,8 @@ tab_analysis <- tabItem(
sidebarPanel(
width = 3,
uiOutput("de_ratio_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("de_ratio", height = "600px") %>% withSpinner()
@@ -45,8 +45,8 @@ tab_analysis <- tabItem(
sidebarPanel(
width = 3,
uiOutput("ma_plot_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("ma_plot", height = "600px") %>% withSpinner()
@@ -64,12 +64,26 @@ tab_analysis <- tabItem(
position = "right",
sidebarPanel(
width = 3,
- sliderInput("vulcanoLogCut", "LogFC Cutoff", 1, min = 0, max = 25, step=0.1),
- sliderInput("vulcanoPCut", "P-Value Cutoff", 0.05, min = 0.01, max = 1, step=0.01),
+ sliderInput(
+ inputId = "vulcanoLogCut",
+ label = "LogFC Cutoff",
+ value = 1,
+ min = 0,
+ max = 25,
+ step = 0.1
+ ),
+ sliderInput(
+ inputId = "vulcanoPCut",
+ label = "P-Value Cutoff",
+ value = 0.05,
+ min = 0.01,
+ max = 1,
+ step = 0.01
+ ),
br(),
uiOutput("volcano_plot_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("volcano_plot", height = "600px") %>% withSpinner()
@@ -88,12 +102,25 @@ tab_analysis <- tabItem(
sidebarPanel(
width = 3,
uiOutput("group_analysis_bar"),
- uiOutput("analysis_bar_select_gene"),
- sliderInput("slider_barcode", "Set the number of genes to show:", value = 10, min = 1, max = 50, step = 1),
+ selectInput(
+ inputId = "selected_analysis_bar",
+ label = "Add specific genes:",
+ multiple = TRUE,
+ choices = c("Click to add gene" = ""),
+ selected = 1
+ ),
+ sliderInput(
+ inputId = "slider_barcode",
+ label = "Set the number of genes to show:",
+ value = 10,
+ min = 1,
+ max = 50,
+ step = 1
+ ),
br(),
uiOutput("barcode_plot_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("barcode_plot", height = "600px") %>% withSpinner()
@@ -110,8 +137,8 @@ tab_analysis <- tabItem(
sidebarPanel(
width = 3,
uiOutput("p_val_plot_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("p_val_plot", height = "600px") %>% withSpinner()
diff --git a/inst/src/tabs/bias/svr_bias.R b/inst/src/tabs/bias/svr_bias.R
index e13cdfb..2e1bf9c 100644
--- a/inst/src/tabs/bias/svr_bias.R
+++ b/inst/src/tabs/bias/svr_bias.R
@@ -13,10 +13,14 @@ output[["gc_bias"]] <- renderPlotly({
output[["selected_biasgc"]] <- DT::renderDataTable({
tryCatch({
s <- event_data(event = "plotly_selected", source = "biasGC")
- if(is.null(s)){s <- ""}
- DT::datatable(inUse_deTab[s$key,], options = list(pageLength = 15, scrollX = TRUE))
+ if (is.null(s)) {
+ s <- ""
+ }
+ DT::datatable(inUse_deTab[s$key, ], options = list(pageLength = 15, scrollX = TRUE))
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -24,8 +28,15 @@ output[["selected_biasgc"]] <- DT::renderDataTable({
output[["selectGC"]] <- renderUI({
tryCatch({
checkReload()
- selectInput("selectGC", "Show bias based on:",
- grep('gc$', colnames(inUse_deTab), value=TRUE, ignore.case=TRUE)
+ selectInput(
+ inputId = "selectGC",
+ label = "Show bias based on:",
+ choices = grep(
+ 'gc$',
+ colnames(inUse_deTab),
+ value = TRUE,
+ ignore.case = TRUE
+ )
)
}, error = function(err) {
return(NULL)
@@ -46,10 +57,14 @@ output[["len_bias"]] <- renderPlotly({
output[["selected_biaslength"]] <- DT::renderDataTable({
tryCatch({
s <- event_data(event = "plotly_selected", source = "biasLength")
- if(is.null(s)){s <- ""}
- DT::datatable(inUse_deTab[s$key,], options = list(pageLength = 15, scrollX = TRUE))
+ if (is.null(s)) {
+ s <- ""
+ }
+ DT::datatable(inUse_deTab[s$key, ], options = list(pageLength = 15, scrollX = TRUE))
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -57,8 +72,15 @@ output[["selected_biaslength"]] <- DT::renderDataTable({
output[["selectLength"]] <- renderUI({
tryCatch({
checkReload()
- selectInput("selectLength", "Show bias based on:",
- grep('length$', colnames(inUse_deTab), value=TRUE, ignore.case=TRUE)
+ selectInput(
+ inputId = "selectLength",
+ label = "Show bias based on:",
+ choices = grep(
+ 'length$',
+ colnames(inUse_deTab),
+ value = TRUE,
+ ignore.case = TRUE
+ )
)
}, error = function(err) {
return(NULL)
@@ -78,7 +100,8 @@ output[["geneStrand_bias"]] <- renderPlotly({
## INFORMATION BOXES
output[["gc_bias_info"]] <- renderUI({
- infoText <- "The GC bias plots are generated based on the average log fold change on the Y-axis. The bias plots
+ infoText <-
+ "The GC bias plots are generated based on the average log fold change on the Y-axis. The bias plots
can only be used if an annotation is used to perform the analysis. If annotation values are
present, a column can be selected with the use of a drop-down button. The columns should
contain the text: 'GC', otherwise they will not be recognized as a column suitable
@@ -87,7 +110,8 @@ output[["gc_bias_info"]] <- renderUI({
})
output[["len_bias_info"]] <- renderUI({
- infoText <- "The feature-length bias plots are generated based on the average log fold change on the Y-axis. The bias plots
+ infoText <-
+ "The feature-length bias plots are generated based on the average log fold change on the Y-axis. The bias plots
can only be used if an annotation is used to perform the analysis. If annotation values are
present, a column can be selected with the use of a drop-down button. The columns should
contain the text: 'length', otherwise they will not be recognized as a column suitable
@@ -96,8 +120,9 @@ output[["len_bias_info"]] <- renderUI({
})
output[["geneStrand_info"]] <- renderUI({
- infoText <- "The gene strand bias plots are generated based on strand info (+ or -) and the number of
- genes (DE or not). It shows the distribution of genes between strands. The gene strand plot can only
+ infoText <-
+ "The gene strand bias plots are generated based on strand info (+ or -) and the number of
+ genes (DE or not). It shows the distribution of genes between strands. The gene strand plot can only
be generated when using an annotation file containing strand information about genes."
informationBox(infoText)
})
diff --git a/inst/src/tabs/bias/ui_bias.R b/inst/src/tabs/bias/ui_bias.R
index 55d4d9d..8ba148e 100644
--- a/inst/src/tabs/bias/ui_bias.R
+++ b/inst/src/tabs/bias/ui_bias.R
@@ -1,7 +1,7 @@
tab_bias <- tabItem(
tabName = "bias",
- align="center",
+ align = "center",
br(),
tabsetPanel(
@@ -15,8 +15,8 @@ tab_bias <- tabItem(
uiOutput("selectGC"),
br(),
uiOutput("gc_bias_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("gc_bias", height = "600px") %>% withSpinner()
@@ -37,8 +37,8 @@ tab_bias <- tabItem(
uiOutput("selectLength"),
br(),
uiOutput("len_bias_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("len_bias", height = "600px") %>% withSpinner()
@@ -58,8 +58,8 @@ tab_bias <- tabItem(
width = 3,
br(),
uiOutput("geneStrand_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("geneStrand_bias", height = "600px") %>% withSpinner()
diff --git a/inst/src/tabs/enrichment/do/svr_do.R b/inst/src/tabs/enrichment/do/svr_do.R
index b963dc8..b45c320 100644
--- a/inst/src/tabs/enrichment/do/svr_do.R
+++ b/inst/src/tabs/enrichment/do/svr_do.R
@@ -7,42 +7,58 @@ get_do <- reactive({
checkReload()
if (input$choose_do == "enrich") {
- showModal(
- modalDialog(
- h1("Enrichment is running..."),
- h4("DO enrichment based on DE genes (with entrezID)"),
- img(src="loading.gif", width = "50%"),
- footer=NULL
- )
- )
- suppressMessages(enrich <- DOSE::enrichDO(inUse_deTab$entrez[inUse_deTab$DE!=0], pvalueCutoff=0.05))
+ showModal(modalDialog(
+ h1("Enrichment is running..."),
+ h4("DO enrichment based on DE genes (with entrezID)"),
+ img(src = "loading.gif", width = "50%"),
+ footer = NULL
+ ))
+ suppressMessages(enrich <- DOSE::enrichDO(inUse_deTab$entrez[inUse_deTab$DE != 0],
+ pvalueCutoff = 0.05))
} else {
- showModal(
- modalDialog(
- h1("Enrichment is running..."),
- h4("DO enrichment based on all genes (with entrezID) and Log2FC"),
- img(src="loading.gif", width = "50%"),
- footer=NULL
- )
- )
+ showModal(modalDialog(
+ h1("Enrichment is running..."),
+ h4("DO enrichment based on all genes (with entrezID) and Log2FC"),
+ img(src = "loading.gif", width = "50%"),
+ footer = NULL
+ ))
set.seed(1234)
geneList <- get_geneList(inUse_deTab)
- suppressMessages(enrich <- DOSE::gseDO(geneList, nPerm=10000, pvalueCutoff=0.05, verbose=FALSE, seed=TRUE))
+ suppressMessages(
+ enrich <-
+ DOSE::gseDO(
+ geneList,
+ nPerm = 10000,
+ pvalueCutoff = 0.05,
+ verbose = FALSE,
+ seed = TRUE
+ )
+ )
enrich@result$Count <- lengths(strsplit(enrich$core_enrichment, "/"))
}
removeModal()
if (nrow(as.data.frame(enrich)) == 0) {
- showNotification(ui = "DO enrichment has not found any enriched terms!", duration = 5, type = "warning")
+ showNotification(ui = "DO enrichment has not found any enriched terms!",
+ duration = 5,
+ type = "warning")
} else {
- showNotification(ui = "DO enrichment has been succesful!", duration = 5, type = "message")
+ showNotification(ui = "DO enrichment has been succesful!",
+ duration = 5,
+ type = "message")
}
enrich
}, error = function(err) {
removeModal()
- showNotification(ui = "DO enrichment failed with an error!", duration = 5, type = "error")
- showNotification(ui = "DO enrichment supports: ENS", duration = 10, type = "error")
- showNotification(ui = as.character(err), duration = 10, type = "error")
+ showNotification(ui = "DO enrichment failed with an error!",
+ duration = 5,
+ type = "error")
+ showNotification(ui = "DO enrichment supports: ENS",
+ duration = 10,
+ type = "error")
+ showNotification(ui = as.character(err),
+ duration = 10,
+ type = "error")
return(NULL)
})
})
@@ -52,10 +68,12 @@ output[["do_data_table"]] <- DT::renderDataTable({
tryCatch({
checkReload()
enrich <- as.data.frame(get_do())
- enrich <- enrich[,!(colnames(enrich) %in% c("ID", "leading_edge", "core_enrichment", "geneID"))]
+ enrich <- enrich[, !(colnames(enrich) %in% c("ID", "leading_edge", "core_enrichment", "geneID"))]
DT::datatable(enrich, options = list(pageLength = 15, scrollX = TRUE))
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -75,7 +93,14 @@ output[["bar_do_slider"]] <- renderUI({
tryCatch({
checkReload()
enrich <- as.data.frame(get_do())
- sliderInput("bar_do_slider", "Amount of shown pathways:", nrow(enrich)/2, min = 1, max = nrow(enrich), step=1)
+ sliderInput(
+ inputId = "bar_do_slider",
+ label = "Amount of shown pathways:",
+ value = nrow(enrich) / 2,
+ min = 1,
+ max = nrow(enrich),
+ step = 1
+ )
}, error = function(err) {
return(NULL)
})
@@ -89,7 +114,14 @@ output[["cnet_do_plot"]] <- renderPlotly({
geneSets <- extract_geneSets(enrich, input$cnet_do_slider, input$do_select_pathway)
graphData <- cnetPlotly(enrich, geneSets, inUse_deTab)
- plotlyGraph(graphData, "Gene-Concept Network", "Log2FC", length(geneSets), input$cnet_do_annoP, input$cnet_do_annoG)
+ plotlyGraph(
+ graphData,
+ "Gene-Concept Network",
+ "Log2FC",
+ length(geneSets),
+ input$cnet_do_annoP,
+ input$cnet_do_annoG
+ )
}, error = function(err) {
return(NULL)
})
@@ -99,10 +131,11 @@ output[["cnet_do_plot"]] <- renderPlotly({
output[["cnet_do_select_pathway"]] <- renderUI({
tryCatch({
enrich <- as.data.frame(get_do())
- selectInput(inputId = "do_select_pathway",
- label = "Add specific pathway:",
- multiple = TRUE,
- choices = c("Click to add pathway" = "", enrich$Description)
+ selectInput(
+ inputId = "do_select_pathway",
+ label = "Add specific pathway:",
+ multiple = TRUE,
+ choices = c("Click to add pathway" = "", enrich$Description)
)
}, error = function(err) {
return(NULL)
@@ -115,15 +148,18 @@ output[["cnet_do_table"]] <- DT::renderDataTable({
checkReload()
enrich <- get_do()
- geneSets <- extract_geneSets(enrich, input$cnet_do_slider, input$do_select_pathway)
+ geneSets <-
+ extract_geneSets(enrich, input$cnet_do_slider, input$do_select_pathway)
graphData <- cnetPlotly(enrich, geneSets, inUse_deTab)
if ("geneName" %in% colnames(inUse_deTab)) {
- DT::datatable(inUse_deTab[inUse_deTab$geneName %in% names(V(graphData)), ], options = list(pageLength = 15, scrollX = TRUE))
+ DT::datatable(inUse_deTab[inUse_deTab$geneName %in% names(V(graphData)),], options = list(pageLength = 15, scrollX = TRUE))
} else {
- DT::datatable(inUse_deTab[rownames(inUse_deTab) %in% names(V(graphData)), ], options = list(pageLength = 15, scrollX = TRUE))
+ DT::datatable(inUse_deTab[rownames(inUse_deTab) %in% names(V(graphData)),], options = list(pageLength = 15, scrollX = TRUE))
}
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -144,10 +180,11 @@ output[["heat_do_plot"]] <- renderPlotly({
output[["heat_do_select_pathway"]] <- renderUI({
tryCatch({
enrich <- as.data.frame(get_do())
- selectInput(inputId = "do_select_heat",
- label = "Add specific pathway:",
- multiple = TRUE,
- choices = c("Click to add pathway" = "", enrich$Description)
+ selectInput(
+ inputId = "do_select_heat",
+ label = "Add specific pathway:",
+ multiple = TRUE,
+ choices = c("Click to add pathway" = "", enrich$Description)
)
}, error = function(err) {
return(NULL)
@@ -163,12 +200,14 @@ output[["heat_do_table"]] <- DT::renderDataTable({
geneSets <- extract_geneSets(enrich, input$heat_do_slider, input$do_select_heat)
graphData <- cnetPlotly(enrich, geneSets, inUse_deTab)
if ("geneName" %in% colnames(inUse_deTab)) {
- DT::datatable(inUse_deTab[inUse_deTab$geneName %in% names(V(graphData)), ], options = list(pageLength = 15, scrollX = TRUE))
+ DT::datatable(inUse_deTab[inUse_deTab$geneName %in% names(V(graphData)),], options = list(pageLength = 15, scrollX = TRUE))
} else {
- DT::datatable(inUse_deTab[rownames(inUse_deTab) %in% names(V(graphData)), ], options = list(pageLength = 15, scrollX = TRUE))
+ DT::datatable(inUse_deTab[rownames(inUse_deTab) %in% names(V(graphData)),], options = list(pageLength = 15, scrollX = TRUE))
}
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -178,7 +217,12 @@ output[["gsea_do_plot"]] <- renderPlotly({
checkReload()
enrich <- get_do()
graphData <- emap_plotly(enrich)
- plotlyGraph(graphData, "Disease ontology", "P-Value", 0, input$do_network_annoP, FALSE)
+ plotlyGraph(graphData,
+ "Disease ontology",
+ "P-Value",
+ 0,
+ input$do_network_annoP,
+ FALSE)
}, error = function(err) {
return(NULL)
})
@@ -189,9 +233,9 @@ output[["select_do_pathway"]] <- renderUI({
tryCatch({
checkReload()
enrich <- as.data.frame(get_do())
- selectInput("do_select", "Select a pathway:",
- enrich$Description
- )
+ selectInput(inputId = "do_select",
+ label = "Select a pathway:",
+ choices = enrich$Description)
}, error = function(err) {
return(NULL)
})
@@ -202,13 +246,29 @@ output[["pathway_from_do"]] <- renderUI({
tryCatch({
checkReload()
enrich <- as.data.frame(get_do())
- getpathway <- rownames(enrich)[enrich$Description %in% input$do_select]
+ getpathway <-
+ rownames(enrich)[enrich$Description %in% input$do_select]
- getFromDo <- includeHTML(paste("https://rgd.mcw.edu/rgdweb/ontology/view.html?acc_id=", getpathway, sep=""))
- getFromDo <- gsub('.*\\s*|\\s*
.*', "", getFromDo)
+ getFromDo <-
+ includeHTML(
+ paste(
+ "https://rgd.mcw.edu/rgdweb/ontology/view.html?acc_id=",
+ getpathway,
+ sep = ""
+ )
+ )
+ getFromDo <-
+ gsub(
+ '.*\\s*|\\s*
.*',
+ "",
+ getFromDo
+ )
if (grepl('% withSpinner()
@@ -53,15 +59,26 @@ tab_enrich_do <- tabItem(
position = "right",
sidebarPanel(
width = 3,
- sliderInput("cnet_do_slider", "Amount of shown pathways:", 5, min = 0, max = 15, step=1),
+ sliderInput(
+ inputId = "cnet_do_slider",
+ label = "Amount of shown pathways:",
+ value = 5,
+ min = 0,
+ max = 15,
+ step = 1
+ ),
uiOutput("cnet_do_select_pathway"),
tags$b("Labels on/off:"),
- checkboxInput("cnet_do_annoP", "Pathway labels", value = TRUE),
- checkboxInput("cnet_do_annoG", "Gene labels", value = FALSE),
+ checkboxInput(inputId = "cnet_do_annoP",
+ label = "Pathway labels",
+ value = TRUE),
+ checkboxInput(inputId = "cnet_do_annoG",
+ label = "Gene labels",
+ value = FALSE),
br(),
uiOutput("cnet_do_plot_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("cnet_do_plot", height = "600px") %>% withSpinner()
@@ -79,12 +96,19 @@ tab_enrich_do <- tabItem(
position = "right",
sidebarPanel(
width = 3,
- sliderInput("heat_do_slider", "Number of shown pathways:", 5, min = 0, max = 15, step=1),
+ sliderInput(
+ inputId = "heat_do_slider",
+ label = "Number of shown pathways:",
+ value = 5,
+ min = 0,
+ max = 15,
+ step = 1
+ ),
uiOutput("heat_do_select_pathway"),
br(),
uiOutput("heat_do_plot_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("heat_do_plot", height = "600px") %>% withSpinner()
@@ -103,11 +127,13 @@ tab_enrich_do <- tabItem(
sidebarPanel(
width = 3,
tags$b("Labels on/off:"),
- checkboxInput("do_network_annoP", "Pathway labels", value = FALSE),
+ checkboxInput(inputId = "do_network_annoP",
+ label = "Pathway labels",
+ value = FALSE),
br(),
uiOutput("do_network_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("gsea_do_plot", height = "600px") %>% withSpinner()
@@ -119,8 +145,8 @@ tab_enrich_do <- tabItem(
tabPanel(
title = "Pathways from RGD",
HTML('
'),
- uiOutput("select_do_pathway", align="center"),
- htmlOutput("pathway_from_do", align="center") %>% withSpinner(),
+ uiOutput("select_do_pathway", align = "center"),
+ htmlOutput("pathway_from_do", align = "center") %>% withSpinner(),
HTML('
')
)
)
diff --git a/inst/src/tabs/enrichment/go/svr_go.R b/inst/src/tabs/enrichment/go/svr_go.R
index 8ee2fb2..1174d0d 100644
--- a/inst/src/tabs/enrichment/go/svr_go.R
+++ b/inst/src/tabs/enrichment/go/svr_go.R
@@ -11,48 +11,72 @@ get_go <- reactive({
checkReload()
organism <- get_organismID(inUse_deTab)
- org <- list(ENS=org.Hs.eg.db,
- ENSMUS=org.Mm.eg.db)
+ org <- list(ENS = org.Hs.eg.db,
+ ENSMUS = org.Mm.eg.db)
#ENSRNO=org.Rn.eg.db)
organism <- org[[organism]]
if (input$choose_go == "enrich") {
- showModal(
- modalDialog(
- h1("Enrichment is running..."),
- h4("GO enrichment based on DE genes (with entrezID)"),
- img(src="loading.gif", width = "50%"),
- footer=NULL
+ showModal(modalDialog(
+ h1("Enrichment is running..."),
+ h4("GO enrichment based on DE genes (with entrezID)"),
+ img(src = "loading.gif", width = "50%"),
+ footer = NULL
+ ))
+ suppressMessages(
+ enrich <- clusterProfiler::enrichGO(
+ inUse_deTab$entrez[inUse_deTab$DE != 0],
+ ont = input$selectOntology,
+ organism,
+ pvalueCutoff = 0.05
)
)
- suppressMessages(enrich <- clusterProfiler::enrichGO(inUse_deTab$entrez[inUse_deTab$DE!=0], ont = input$selectOntology, organism, pvalueCutoff=0.05))
} else {
- showModal(
- modalDialog(
- h1("Enrichment is running..."),
- h4("GO enrichment based on all genes (with entrezID) and Log2FC"),
- img(src="loading.gif", width = "50%"),
- footer=NULL
- )
- )
+ showModal(modalDialog(
+ h1("Enrichment is running..."),
+ h4("GO enrichment based on all genes (with entrezID) and Log2FC"),
+ img(src = "loading.gif", width = "50%"),
+ footer = NULL
+ ))
set.seed(1234)
geneList <- get_geneList(inUse_deTab)
- suppressMessages(enrich <- clusterProfiler::gseGO(geneList, ont = input$selectOntology, organism, nPerm=10000, pvalueCutoff=0.05, verbose=FALSE, seed=TRUE))
+ suppressMessages(
+ enrich <-
+ clusterProfiler::gseGO(
+ geneList,
+ ont = input$selectOntology,
+ organism,
+ nPerm = 10000,
+ pvalueCutoff = 0.05,
+ verbose = FALSE,
+ seed = TRUE
+ )
+ )
enrich@result$Count <- lengths(strsplit(enrich$core_enrichment, "/"))
}
removeModal()
if (nrow(as.data.frame(enrich)) == 0) {
- showNotification(ui = "GO enrichment has not found any enriched terms!", duration = 5, type = "warning")
+ showNotification(ui = "GO enrichment has not found any enriched terms!",
+ duration = 5,
+ type = "warning")
} else {
- showNotification(ui = "GO enrichment has been succesful!", duration = 5, type = "message")
+ showNotification(ui = "GO enrichment has been succesful!",
+ duration = 5,
+ type = "message")
}
enrich
}, error = function(err) {
removeModal()
- showNotification(ui = "GO enrichment failed with an error!", duration = 5, type = "error")
- showNotification(ui = "GO enrichment supports: ENS, ENSMUS and ENSRNO", duration = 10, type = "error")
- showNotification(ui = as.character(err), duration = 10, type = "error")
+ showNotification(ui = "GO enrichment failed with an error!",
+ duration = 5,
+ type = "error")
+ showNotification(ui = "GO enrichment supports: ENS, ENSMUS and ENSRNO",
+ duration = 10,
+ type = "error")
+ showNotification(ui = as.character(err),
+ duration = 10,
+ type = "error")
print(err)
return(NULL)
})
@@ -63,10 +87,12 @@ output[["go_data_table"]] <- DT::renderDataTable({
tryCatch({
checkReload()
enrich <- as.data.frame(get_go())
- enrich <- enrich[,!(colnames(enrich) %in% c("ID", "leading_edge", "core_enrichment", "geneID"))]
+ enrich <- enrich[, !(colnames(enrich) %in% c("ID", "leading_edge", "core_enrichment", "geneID"))]
DT::datatable(enrich, options = list(pageLength = 15, scrollX = TRUE))
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -86,7 +112,14 @@ output[["bar_go_slider"]] <- renderUI({
tryCatch({
checkReload()
enrich <- as.data.frame(get_go())
- sliderInput("bar_go_slider", "Amount of shown pathways:", nrow(enrich)/2, min = 1, max = nrow(enrich), step=1)
+ sliderInput(
+ inputId = "bar_go_slider",
+ label = "Amount of shown pathways:",
+ value = nrow(enrich) / 2,
+ min = 1,
+ max = nrow(enrich),
+ step = 1
+ )
}, error = function(err) {
return(NULL)
})
@@ -100,7 +133,14 @@ output[["cnet_go_plot"]] <- renderPlotly({
geneSets <- extract_geneSets(enrich, input$cnet_go_slider, input$go_select_pathway)
graphData <- cnetPlotly(enrich, geneSets, inUse_deTab)
- plotlyGraph(graphData, "Gene-Concept Network", "Log2FC", length(geneSets), input$cnet_go_annoP, input$cnet_go_annoG)
+ plotlyGraph(
+ graphData,
+ "Gene-Concept Network",
+ "Log2FC",
+ length(geneSets),
+ input$cnet_go_annoP,
+ input$cnet_go_annoG
+ )
}, error = function(err) {
return(NULL)
})
@@ -110,10 +150,11 @@ output[["cnet_go_plot"]] <- renderPlotly({
output[["cnet_go_select_pathway"]] <- renderUI({
tryCatch({
enrich <- as.data.frame(get_go())
- selectInput(inputId = "go_select_pathway",
- label = "Add specific pathway:",
- multiple = TRUE,
- choices = c("Click to add pathway" = "", enrich$Description)
+ selectInput(
+ inputId = "go_select_pathway",
+ label = "Add specific pathway:",
+ multiple = TRUE,
+ choices = c("Click to add pathway" = "", enrich$Description)
)
}, error = function(err) {
return(NULL)
@@ -129,12 +170,14 @@ output[["cnet_go_table"]] <- DT::renderDataTable({
geneSets <- extract_geneSets(enrich, input$cnet_go_slider, input$go_select_pathway)
graphData <- cnetPlotly(enrich, geneSets, inUse_deTab)
if ("geneName" %in% colnames(inUse_deTab)) {
- DT::datatable(inUse_deTab[inUse_deTab$geneName %in% names(V(graphData)), ], options = list(pageLength = 15, scrollX = TRUE))
+ DT::datatable(inUse_deTab[inUse_deTab$geneName %in% names(V(graphData)),], options = list(pageLength = 15, scrollX = TRUE))
} else {
- DT::datatable(inUse_deTab[rownames(inUse_deTab) %in% names(V(graphData)), ], options = list(pageLength = 15, scrollX = TRUE))
+ DT::datatable(inUse_deTab[rownames(inUse_deTab) %in% names(V(graphData)),], options = list(pageLength = 15, scrollX = TRUE))
}
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -155,10 +198,11 @@ output[["heat_go_plot"]] <- renderPlotly({
output[["heat_go_select_pathway"]] <- renderUI({
tryCatch({
enrich <- as.data.frame(get_go())
- selectInput(inputId = "go_select_heat",
- label = "Add specific pathway:",
- multiple = TRUE,
- choices = c("Click to add pathway" = "", enrich$Description)
+ selectInput(
+ inputId = "go_select_heat",
+ label = "Add specific pathway:",
+ multiple = TRUE,
+ choices = c("Click to add pathway" = "", enrich$Description)
)
}, error = function(err) {
return(NULL)
@@ -174,12 +218,14 @@ output[["heat_go_table"]] <- DT::renderDataTable({
geneSets <- extract_geneSets(enrich, input$heat_go_slider, input$go_select_heat)
graphData <- cnetPlotly(enrich, geneSets, inUse_deTab)
if ("geneName" %in% colnames(inUse_deTab)) {
- DT::datatable(inUse_deTab[inUse_deTab$geneName %in% names(V(graphData)), ], options = list(pageLength = 15, scrollX = TRUE))
+ DT::datatable(inUse_deTab[inUse_deTab$geneName %in% names(V(graphData)),], options = list(pageLength = 15, scrollX = TRUE))
} else {
- DT::datatable(inUse_deTab[rownames(inUse_deTab) %in% names(V(graphData)), ], options = list(pageLength = 15, scrollX = TRUE))
+ DT::datatable(inUse_deTab[rownames(inUse_deTab) %in% names(V(graphData)),], options = list(pageLength = 15, scrollX = TRUE))
}
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -189,7 +235,12 @@ output[["gsea_go_plot"]] <- renderPlotly({
checkReload()
enrich <- get_go()
graphData <- emap_plotly(enrich)
- plotlyGraph(graphData, input$selectOntology, "P-Value", 0, input$go_network_annoP, FALSE)
+ plotlyGraph(graphData,
+ input$selectOntology,
+ "P-Value",
+ 0,
+ input$go_network_annoP,
+ FALSE)
}, error = function(err) {
return(NULL)
})
@@ -200,9 +251,9 @@ output[["select_go_pathway"]] <- renderUI({
tryCatch({
checkReload()
enrich <- as.data.frame(get_go())
- selectInput("go_select", "Select a pathway:",
- enrich$Description
- )
+ selectInput(inputId = "go_select",
+ label = "Select a pathway:",
+ choices = enrich$Description)
}, error = function(err) {
return(NULL)
})
@@ -214,8 +265,24 @@ output[["pathway_from_go"]] <- renderUI({
checkReload()
enrich <- as.data.frame(get_go())
getpathway <- rownames(enrich)[enrich$Description %in% input$go_select]
- getFromGo <- paste('', sep="")
- getFromGo <- HTML(paste('\n', getFromGo, '\n', sep=""))
+ getFromGo <-
+ paste(
+ '',
+ sep = ""
+ )
+ getFromGo <-
+ HTML(
+ paste(
+ '\n',
+ getFromGo,
+ '\n',
+ sep = ""
+ )
+ )
getFromGo
}, error = function(err) {
return(NULL)
@@ -225,7 +292,8 @@ output[["pathway_from_go"]] <- renderUI({
## INFORMATION BOXES
output[["go_barplot_info"]] <- renderUI({
- infoText <- "The bar plot shows a sorted list of the most enriched terms. The bar plot is sorted based on
+ infoText <-
+ "The bar plot shows a sorted list of the most enriched terms. The bar plot is sorted based on
the selected value (p-value, q-value or adjusted p-value). The colors of the bars are also
generated based on the earlier selected value. On the X-axis, the amount of genes linked to
the pathway is shown."
@@ -233,7 +301,8 @@ output[["go_barplot_info"]] <- renderUI({
})
output[["cnet_go_plot_info"]] <- renderUI({
- infoText <- "The concept network can show which genes are involved in the most significant terms. The
+ infoText <-
+ "The concept network can show which genes are involved in the most significant terms. The
most enriched terms together with all corresponding genes are collected and shown in a
network plot. Some pathways may contain some matching genes. These genes will also be
connected. The color given to genes is based on the log fold change determined after the
@@ -243,14 +312,16 @@ output[["cnet_go_plot_info"]] <- renderUI({
})
output[["heat_go_plot_info"]] <- renderUI({
- infoText <- "The heatmap visualizes pathways and the corresponding genes. The genes are sorted based on
- Log2FC. The pathways are sorted on number of gene mathes between other pathways, listing pathways with
- the most gene matches on the left. With this plot genes present in pathways can be compared on sight."
+ infoText <-
+ "The heatmap visualizes pathways and the corresponding genes. The genes are sorted based on
+ Log2FC. The pathways are sorted on number of gene mathes between other pathways, listing pathways with
+ the most gene matches on the left. With this plot genes present in pathways can be compared on sight."
informationBox(infoText)
})
output[["go_network_info"]] <- renderUI({
- infoText <- "The pathway network shows connections between all found pathways. Every dot that the
+ infoText <-
+ "The pathway network shows connections between all found pathways. Every dot that the
plot shows represents a pathway. The color given to the pathways is based on the adjusted
p-value."
informationBox(infoText)
diff --git a/inst/src/tabs/enrichment/go/ui_go.R b/inst/src/tabs/enrichment/go/ui_go.R
index b597080..9e69a9b 100644
--- a/inst/src/tabs/enrichment/go/ui_go.R
+++ b/inst/src/tabs/enrichment/go/ui_go.R
@@ -4,10 +4,14 @@ tab_enrich_go <- tabItem(
align = "center",
br(),
- radioButtons("choose_go", "Select enrichment type:",
- inline = TRUE,
- c("Gene set enrichment" = "gse",
- "Over represented enrichment" = "enrich")
+ radioButtons(
+ inputId = "choose_go",
+ label = "Select enrichment type:",
+ inline = TRUE,
+ choices = c(
+ "Gene set enrichment" = "gse",
+ "Over represented enrichment" = "enrich"
+ )
),
radioButtons(
@@ -15,12 +19,12 @@ tab_enrich_go <- tabItem(
label = "Selected a sub-ontology:",
inline = TRUE,
selected = "CC",
- c(
+ choices = c(
"Biological Process (BP)" = "BP",
"Cellular Component (CC)" = "CC",
"Molecular Function (MF)" = "MF"
)
- ),
+ ),
tabsetPanel(
tabPanel(
@@ -42,13 +46,15 @@ tab_enrich_go <- tabItem(
inputId = "bar_go_value",
label = "Color plot with:",
selected = "pvalue",
- c("P-Value" = "pvalue",
+ choices = c(
+ "P-Value" = "pvalue",
"Adjusted P-Value" = "p.adjust",
- "Q-Value" = "qvalues")
- ),
+ "Q-Value" = "qvalues"
+ )
+ ),
br(),
uiOutput("go_barplot_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
),
mainPanel(
width = 9,
@@ -65,14 +71,25 @@ tab_enrich_go <- tabItem(
position = "right",
sidebarPanel(
width = 3,
- sliderInput("cnet_go_slider", "Amount of shown pathways:", 5, min = 0, max = 15, step = 1),
+ sliderInput(
+ inputId = "cnet_go_slider",
+ label = "Amount of shown pathways:",
+ value = 5,
+ min = 0,
+ max = 15,
+ step = 1
+ ),
uiOutput("cnet_go_select_pathway"),
tags$b("Labels on/off:"),
- checkboxInput("cnet_go_annoP", "Pathway labels", value = TRUE),
- checkboxInput("cnet_go_annoG", "Gene labels", value = FALSE),
+ checkboxInput(inputId = "cnet_go_annoP",
+ label = "Pathway labels",
+ value = TRUE),
+ checkboxInput(inputId = "cnet_go_annoG",
+ label = "Gene labels",
+ value = FALSE),
br(),
uiOutput("cnet_go_plot_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
),
mainPanel(
width = 9,
@@ -91,12 +108,19 @@ tab_enrich_go <- tabItem(
position = "right",
sidebarPanel(
width = 3,
- sliderInput("heat_go_slider", "Number of shown pathways:", 5, min = 0, max = 15, step=1),
+ sliderInput(
+ inputId = "heat_go_slider",
+ label = "Number of shown pathways:",
+ value = 5,
+ min = 0,
+ max = 15,
+ step = 1
+ ),
uiOutput("heat_go_select_pathway"),
br(),
uiOutput("heat_go_plot_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("heat_go_plot", height = "600px") %>% withSpinner()
@@ -115,11 +139,13 @@ tab_enrich_go <- tabItem(
sidebarPanel(
width = 3,
tags$b("Labels on/off:"),
- checkboxInput("go_network_annoP", "Pathway labels", value = FALSE),
+ checkboxInput(inputId = "go_network_annoP",
+ label = "Pathway labels",
+ value = FALSE),
br(),
uiOutput("go_network_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("gsea_go_plot", height = "600px") %>% withSpinner()
diff --git a/inst/src/tabs/enrichment/kegg/svr_kegg.R b/inst/src/tabs/enrichment/kegg/svr_kegg.R
index 6e0159b..4ce00df 100644
--- a/inst/src/tabs/enrichment/kegg/svr_kegg.R
+++ b/inst/src/tabs/enrichment/kegg/svr_kegg.R
@@ -5,51 +5,74 @@ get_kegg <- reactive({
checkReload()
organism <- get_organismID(inUse_deTab)
- org <- list(ENSCEL="cel",
- ENSCAF="cfa",
- ENSDAR="dre",
- ENS="hsa",
- ENSMUS="mmu",
- ENSRNO="rno")
+ org <- list(
+ ENSCEL = "cel",
+ ENSCAF = "cfa",
+ ENSDAR = "dre",
+ ENS = "hsa",
+ ENSMUS = "mmu",
+ ENSRNO = "rno"
+ )
organism <- org[[organism]]
if (input$choose_kegg == "enrich") {
- showModal(
- modalDialog(
- h1("Enrichment is running..."),
- h4("KEGG enrichment based on DE genes (with entrezID)"),
- img(src="loading.gif", width = "50%"),
- footer=NULL
+ showModal(modalDialog(
+ h1("Enrichment is running..."),
+ h4("KEGG enrichment based on DE genes (with entrezID)"),
+ img(src = "loading.gif", width = "50%"),
+ footer = NULL
+ ))
+ suppressMessages(
+ enrich <- clusterProfiler::enrichKEGG(
+ inUse_deTab$entrez[inUse_deTab$DE != 0],
+ organism = organism,
+ pvalueCutoff = 0.05
)
)
- suppressMessages(enrich <- clusterProfiler::enrichKEGG(inUse_deTab$entrez[inUse_deTab$DE!=0], organism=organism, pvalueCutoff=0.05))
} else {
- showModal(
- modalDialog(
- h1("Enrichment is running..."),
- h4("KEGG enrichment based on all genes (with entrezID) and Log2FC"),
- img(src="loading.gif", width = "50%"),
- footer=NULL
- )
- )
+ showModal(modalDialog(
+ h1("Enrichment is running..."),
+ h4("KEGG enrichment based on all genes (with entrezID) and Log2FC"),
+ img(src = "loading.gif", width = "50%"),
+ footer = NULL
+ ))
set.seed(1234)
geneList <- get_geneList(inUse_deTab)
- suppressMessages(enrich <- clusterProfiler::gseKEGG(geneList, organism=organism, nPerm=10000, pvalueCutoff=0.05, verbose=FALSE, seed=TRUE))
+ suppressMessages(
+ enrich <- clusterProfiler::gseKEGG(
+ geneList,
+ organism = organism,
+ nPerm = 10000,
+ pvalueCutoff = 0.05,
+ verbose = FALSE,
+ seed = TRUE
+ )
+ )
enrich@result$Count <- lengths(strsplit(enrich$core_enrichment, "/"))
}
removeModal()
if (nrow(as.data.frame(enrich)) == 0) {
- showNotification(ui = "KEGG enrichment has not found any enriched terms!", duration = 5, type = "warning")
+ showNotification(ui = "KEGG enrichment has not found any enriched terms!",
+ duration = 5,
+ type = "warning")
} else {
- showNotification(ui = "KEGG enrichment has been succesful!", duration = 5, type = "message")
+ showNotification(ui = "KEGG enrichment has been succesful!",
+ duration = 5,
+ type = "message")
}
enrich
}, error = function(err) {
removeModal()
- showNotification(ui = "KEGG enrichment failed with an error!", duration = 5, type = "error")
- showNotification(ui = "KEGG enrichment supports: ENSCEL, ENSCAF, ENSDAR, ENS, ENSMUS and ENSRNO", duration = 10, type = "error")
- showNotification(ui = as.character(err), duration = 10, type = "error")
+ showNotification(ui = "KEGG enrichment failed with an error!",
+ duration = 5,
+ type = "error")
+ showNotification(ui = "KEGG enrichment supports: ENSCEL, ENSCAF, ENSDAR, ENS, ENSMUS and ENSRNO",
+ duration = 10,
+ type = "error")
+ showNotification(ui = as.character(err),
+ duration = 10,
+ type = "error")
print(err)
return(NULL)
})
@@ -60,10 +83,12 @@ output[["kegg_data_table"]] <- DT::renderDataTable({
tryCatch({
checkReload()
enrich <- as.data.frame(get_kegg())
- enrich <- enrich[,!(colnames(enrich) %in% c("ID", "leading_edge", "core_enrichment", "geneID"))]
+ enrich <- enrich[, !(colnames(enrich) %in% c("ID", "leading_edge", "core_enrichment", "geneID"))]
DT::datatable(enrich, options = list(pageLength = 15, scrollX = TRUE))
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -83,7 +108,14 @@ output[["bar_kegg_slider"]] <- renderUI({
tryCatch({
checkReload()
enrich <- as.data.frame(get_kegg())
- sliderInput("bar_kegg_slider", "Amount of shown pathways:", nrow(enrich)/2, min = 1, max = nrow(enrich), step=1)
+ sliderInput(
+ inputId = "bar_kegg_slider",
+ label = "Amount of shown pathways:",
+ value = nrow(enrich) / 2,
+ min = 1,
+ max = nrow(enrich),
+ step = 1
+ )
}, error = function(err) {
return(NULL)
})
@@ -95,9 +127,18 @@ output[["cnet_kegg_plot"]] <- renderPlotly({
checkReload()
enrich <- get_kegg()
- geneSets <- extract_geneSets(enrich, input$cnet_kegg_slider, input$kegg_select_pathway)
+ geneSets <- extract_geneSets(enrich,
+ input$cnet_kegg_slider,
+ input$kegg_select_pathway)
graphData <- cnetPlotly(enrich, geneSets, inUse_deTab)
- plotlyGraph(graphData, "Gene-Concept Network", "Log2FC", length(geneSets), input$cnet_kegg_annoP, input$cnet_kegg_annoG)
+ plotlyGraph(
+ graphData,
+ "Gene-Concept Network",
+ "Log2FC",
+ length(geneSets),
+ input$cnet_kegg_annoP,
+ input$cnet_kegg_annoG
+ )
}, error = function(err) {
return(NULL)
})
@@ -107,10 +148,11 @@ output[["cnet_kegg_plot"]] <- renderPlotly({
output[["cnet_kegg_select_pathway"]] <- renderUI({
tryCatch({
enrich <- as.data.frame(get_kegg())
- selectInput(inputId = "kegg_select_pathway",
- label = "Add specific pathway:",
- multiple = TRUE,
- choices = c("Click to add pathway" = "", enrich$Description)
+ selectInput(
+ inputId = "kegg_select_pathway",
+ label = "Add specific pathway:",
+ multiple = TRUE,
+ choices = c("Click to add pathway" = "", enrich$Description)
)
}, error = function(err) {
return(NULL)
@@ -123,15 +165,19 @@ output[["cnet_kegg_table"]] <- DT::renderDataTable({
checkReload()
enrich <- get_kegg()
- geneSets <- extract_geneSets(enrich, input$cnet_kegg_slider, input$kegg_select_pathway)
+ geneSets <- extract_geneSets(enrich,
+ input$cnet_kegg_slider,
+ input$kegg_select_pathway)
graphData <- cnetPlotly(enrich, geneSets, inUse_deTab)
if ("geneName" %in% colnames(inUse_deTab)) {
- DT::datatable(inUse_deTab[inUse_deTab$geneName %in% names(V(graphData)), ], options = list(pageLength = 15, scrollX = TRUE))
+ DT::datatable(inUse_deTab[inUse_deTab$geneName %in% names(V(graphData)),], options = list(pageLength = 15, scrollX = TRUE))
} else {
- DT::datatable(inUse_deTab[rownames(inUse_deTab) %in% names(V(graphData)), ], options = list(pageLength = 15, scrollX = TRUE))
+ DT::datatable(inUse_deTab[rownames(inUse_deTab) %in% names(V(graphData)),], options = list(pageLength = 15, scrollX = TRUE))
}
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -152,10 +198,11 @@ output[["heat_kegg_plot"]] <- renderPlotly({
output[["heat_kegg_select_pathway"]] <- renderUI({
tryCatch({
enrich <- as.data.frame(get_kegg())
- selectInput(inputId = "kegg_select_heat",
- label = "Add specific pathway:",
- multiple = TRUE,
- choices = c("Click to add pathway" = "", enrich$Description)
+ selectInput(
+ inputId = "kegg_select_heat",
+ label = "Add specific pathway:",
+ multiple = TRUE,
+ choices = c("Click to add pathway" = "", enrich$Description)
)
}, error = function(err) {
return(NULL)
@@ -171,12 +218,14 @@ output[["heat_kegg_table"]] <- DT::renderDataTable({
geneSets <- extract_geneSets(enrich, input$heat_kegg_slider, input$kegg_select_heat)
graphData <- cnetPlotly(enrich, geneSets, inUse_deTab)
if ("geneName" %in% colnames(inUse_deTab)) {
- DT::datatable(inUse_deTab[inUse_deTab$geneName %in% names(V(graphData)), ], options = list(pageLength = 15, scrollX = TRUE))
+ DT::datatable(inUse_deTab[inUse_deTab$geneName %in% names(V(graphData)),], options = list(pageLength = 15, scrollX = TRUE))
} else {
- DT::datatable(inUse_deTab[rownames(inUse_deTab) %in% names(V(graphData)), ], options = list(pageLength = 15, scrollX = TRUE))
+ DT::datatable(inUse_deTab[rownames(inUse_deTab) %in% names(V(graphData)),], options = list(pageLength = 15, scrollX = TRUE))
}
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -186,7 +235,12 @@ output[["gsea_kegg_plot"]] <- renderPlotly({
checkReload()
enrich <- get_kegg()
graphData <- emap_plotly(enrich)
- plotlyGraph(graphData, "KEGG", "P-Value", 0, input$kegg_network_annoP, FALSE)
+ plotlyGraph(graphData,
+ "KEGG",
+ "P-Value",
+ 0,
+ input$kegg_network_annoP,
+ FALSE)
}, error = function(err) {
return(NULL)
})
@@ -197,9 +251,9 @@ output[["select_kegg_pathway"]] <- renderUI({
tryCatch({
checkReload()
enrich <- as.data.frame(get_kegg())
- selectInput("kegg_select", "Select a pathway:",
- enrich$Description
- )
+ selectInput(inputId = "kegg_select",
+ label = "Select a pathway:",
+ choices = enrich$Description)
}, error = function(err) {
return(NULL)
})
@@ -212,8 +266,18 @@ output[["pathway_from_kegg"]] <- renderUI({
enrich <- as.data.frame(get_kegg())
getpathway <- rownames(enrich)[enrich$Description %in% input$kegg_select]
getpathway <- "hsa05152"
- getFromKegg <- a(href=paste0("https://www.genome.jp/kegg-bin/show_pathway?", getpathway), target="_blank",
- img(src=paste0("https://www.genome.jp/kegg/pathway/", substr(getpathway, 1, 3), "/", getpathway, ".png"))
+ getFromKegg <- a(
+ href = paste0("https://www.genome.jp/kegg-bin/show_pathway?", getpathway),
+ target = "_blank",
+ img(
+ src = paste0(
+ "https://www.genome.jp/kegg/pathway/",
+ substr(getpathway, 1, 3),
+ "/",
+ getpathway,
+ ".png"
+ )
+ )
)
getFromKegg
}, error = function(err) {
@@ -224,7 +288,8 @@ output[["pathway_from_kegg"]] <- renderUI({
## INFORMATION BOXES
output[["kegg_barplot_info"]] <- renderUI({
- infoText <- "The bar plot shows a sorted list of the most enriched terms. The bar plot is sorted based on
+ infoText <-
+ "The bar plot shows a sorted list of the most enriched terms. The bar plot is sorted based on
the selected value (p-value, q-value or adjusted p-value). The colors of the bars are also
generated based on the earlier selected value. On the X-axis, the amount of genes linked to
the pathway is shown."
@@ -232,7 +297,8 @@ output[["kegg_barplot_info"]] <- renderUI({
})
output[["cnet_kegg_plot_info"]] <- renderUI({
- infoText <- "The concept network can show which genes are involved in the most significant terms. The
+ infoText <-
+ "The concept network can show which genes are involved in the most significant terms. The
most enriched terms together with all corresponding genes are collected and shown in a
network plot. Some pathways may contain some matching genes. These genes will also be
connected. The color given to genes is based on the log fold change determined after the
@@ -242,14 +308,16 @@ output[["cnet_kegg_plot_info"]] <- renderUI({
})
output[["heat_kegg_plot_info"]] <- renderUI({
- infoText <- "The heatmap visualizes pathways and the corresponding genes. The genes are sorted based on
+ infoText <-
+ "The heatmap visualizes pathways and the corresponding genes. The genes are sorted based on
Log2FC. The pathways are sorted on number of gene mathes between other pathways, listing pathways with
the most gene matches on the left. With this plot genes present in pathways can be compared on sight."
informationBox(infoText)
})
output[["kegg_network_info"]] <- renderUI({
- infoText <- "The pathway network shows connections between all found pathways. Every dot that the
+ infoText <-
+ "The pathway network shows connections between all found pathways. Every dot that the
plot shows represents a pathway. The color given to the pathways is based on the adjusted
p-value."
informationBox(infoText)
diff --git a/inst/src/tabs/enrichment/kegg/ui_kegg.R b/inst/src/tabs/enrichment/kegg/ui_kegg.R
index 934b8a4..b801ca1 100644
--- a/inst/src/tabs/enrichment/kegg/ui_kegg.R
+++ b/inst/src/tabs/enrichment/kegg/ui_kegg.R
@@ -1,14 +1,18 @@
tab_enrich_kegg <- tabItem(
tabName = "enrich_kegg",
- align="center",
+ align = "center",
br(),
- radioButtons("choose_kegg", "Select enrichment type:",
- inline = TRUE,
- c("Gene set enrichment" = "gse",
- "Over represented enrichment" = "enrich")
- ),
+ radioButtons(
+ inputId = "choose_kegg",
+ label = "Select enrichment type:",
+ inline = TRUE,
+ choices = c(
+ "Gene set enrichment" = "gse",
+ "Over represented enrichment" = "enrich"
+ )
+ ),
tabsetPanel(
tabPanel(
@@ -30,14 +34,16 @@ tab_enrich_kegg <- tabItem(
inputId = "bar_kegg_value",
label = "Color plot with:",
selected = "pvalue",
- c("P-Value" = "pvalue",
+ choices = c(
+ "P-Value" = "pvalue",
"Adjusted P-Value" = "p.adjust",
- "Q-Value" = "qvalues")
+ "Q-Value" = "qvalues"
+ )
),
br(),
uiOutput("kegg_barplot_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("kegg_barplot", height = "600px") %>% withSpinner()
@@ -53,15 +59,26 @@ tab_enrich_kegg <- tabItem(
position = "right",
sidebarPanel(
width = 3,
- sliderInput("cnet_kegg_slider", "Number of shown pathways:", 5, min = 0, max = 15, step=1),
+ sliderInput(
+ "cnet_kegg_slider",
+ "Number of shown pathways:",
+ 5,
+ min = 0,
+ max = 15,
+ step = 1
+ ),
uiOutput("cnet_kegg_select_pathway"),
tags$b("Labels on/off:"),
- checkboxInput("cnet_kegg_annoP", "Pathway labels", value = TRUE),
- checkboxInput("cnet_kegg_annoG", "Gene labels", value = FALSE),
+ checkboxInput(inputId = "cnet_kegg_annoP",
+ label = "Pathway labels",
+ value = TRUE),
+ checkboxInput(inputId = "cnet_kegg_annoG",
+ label = "Gene labels",
+ value = FALSE),
br(),
uiOutput("cnet_kegg_plot_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("cnet_kegg_plot", height = "600px") %>% withSpinner()
@@ -79,12 +96,19 @@ tab_enrich_kegg <- tabItem(
position = "right",
sidebarPanel(
width = 3,
- sliderInput("heat_kegg_slider", "Number of shown pathways:", 5, min = 0, max = 15, step=1),
+ sliderInput(
+ inputId = "heat_kegg_slider",
+ label = "Number of shown pathways:",
+ value = 5,
+ min = 0,
+ max = 15,
+ step = 1
+ ),
uiOutput("heat_kegg_select_pathway"),
br(),
uiOutput("heat_kegg_plot_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("heat_kegg_plot", height = "600px") %>% withSpinner()
@@ -103,11 +127,13 @@ tab_enrich_kegg <- tabItem(
sidebarPanel(
width = 3,
tags$b("Labels on/off:"),
- checkboxInput("kegg_network_annoP", "Pathway labels", value = FALSE),
+ checkboxInput(inputId = "kegg_network_annoP",
+ label = "Pathway labels",
+ value = FALSE),
br(),
uiOutput("kegg_network_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("gsea_kegg_plot", height = "600px") %>% withSpinner()
diff --git a/inst/src/tabs/enrichment/reactome/svr_reactome.R b/inst/src/tabs/enrichment/reactome/svr_reactome.R
index 4d24755..db80564 100644
--- a/inst/src/tabs/enrichment/reactome/svr_reactome.R
+++ b/inst/src/tabs/enrichment/reactome/svr_reactome.R
@@ -5,49 +5,72 @@ get_reactome <- reactive({
checkReload()
organism <- get_organismID(inUse_deTab)
- org <- list(ENSCEL="celegans",
- ENS="human",
- ENSMUS="mouse",
- ENSRNO="rat")
+ org <- list(
+ ENSCEL = "celegans",
+ ENS = "human",
+ ENSMUS = "mouse",
+ ENSRNO = "rat"
+ )
organism <- org[[organism]]
if (input$choose_reactome == "enrich") {
- showModal(
- modalDialog(
- h1("Enrichment is running..."),
- h4("Reactome enrichment based on DE genes (with entrezID)"),
- img(src="loading.gif", width = "50%"),
- footer=NULL
+ showModal(modalDialog(
+ h1("Enrichment is running..."),
+ h4("Reactome enrichment based on DE genes (with entrezID)"),
+ img(src = "loading.gif", width = "50%"),
+ footer = NULL
+ ))
+ suppressMessages(
+ enrich <- ReactomePA::enrichPathway(
+ inUse_deTab$entrez[inUse_deTab$DE != 0],
+ organism = organism,
+ pvalueCutoff = 0.05
)
)
- suppressMessages(enrich <- ReactomePA::enrichPathway(inUse_deTab$entrez[inUse_deTab$DE!=0], organism=organism, pvalueCutoff=0.05))
} else {
- showModal(
- modalDialog(
- h1("Enrichment is running..."),
- h4("Reactome enrichment based on all genes (with entrezID) and Log2FC"),
- img(src="loading.gif", width = "50%"),
- footer=NULL
- )
- )
+ showModal(modalDialog(
+ h1("Enrichment is running..."),
+ h4("Reactome enrichment based on all genes (with entrezID) and Log2FC"),
+ img(src = "loading.gif", width = "50%"),
+ footer = NULL
+ ))
set.seed(1234)
geneList <- get_geneList(inUse_deTab)
- suppressMessages(enrich <- ReactomePA::gsePathway(geneList, organism=organism, nPerm=10000, pvalueCutoff=0.05, verbose=FALSE, seed=TRUE))
+ suppressMessages(
+ enrich <- ReactomePA::gsePathway(
+ geneList,
+ organism = organism,
+ nPerm = 10000,
+ pvalueCutoff = 0.05,
+ verbose = FALSE,
+ seed = TRUE
+ )
+ )
enrich@result$Count <- lengths(strsplit(enrich$core_enrichment, "/"))
}
removeModal()
if (nrow(as.data.frame(enrich)) == 0) {
- showNotification(ui = "Reactome enrichment has not found any enriched terms!", duration = 5, type = "warning")
+ showNotification(ui = "Reactome enrichment has not found any enriched terms!",
+ duration = 5,
+ type = "warning")
} else {
- showNotification(ui = "Reactome enrichment has been succesful!", duration = 5, type = "message")
+ showNotification(ui = "Reactome enrichment has been succesful!",
+ duration = 5,
+ type = "message")
}
enrich
}, error = function(err) {
removeModal()
- showNotification(ui = "Reactome enrichment failed with an error!", duration = 5, type = "error")
- showNotification(ui = "Reactome enrichment supports: ENSCEL, ENS, ENSMUS and ENSRNO", duration = 10, type = "error")
- showNotification(ui = as.character(err), duration = 10, type = "error")
+ showNotification(ui = "Reactome enrichment failed with an error!",
+ duration = 5,
+ type = "error")
+ showNotification(ui = "Reactome enrichment supports: ENSCEL, ENS, ENSMUS and ENSRNO",
+ duration = 10,
+ type = "error")
+ showNotification(ui = as.character(err),
+ duration = 10,
+ type = "error")
print(err)
return(NULL)
})
@@ -58,10 +81,12 @@ output[["reactome_data_table"]] <- DT::renderDataTable({
tryCatch({
checkReload()
enrich <- as.data.frame(get_reactome())
- enrich <- enrich[,!(colnames(enrich) %in% c("ID", "leading_edge", "core_enrichment", "geneID"))]
+ enrich <- enrich[, !(colnames(enrich) %in% c("ID", "leading_edge", "core_enrichment", "geneID"))]
DT::datatable(enrich, options = list(pageLength = 15, scrollX = TRUE))
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -70,7 +95,9 @@ output[["reactome_barplot"]] <- renderPlotly({
tryCatch({
checkReload()
enrich <- as.data.frame(get_reactome())
- enrichBarplot(enrich, input$bar_reactome_slider, input$bar_reactome_value)
+ enrichBarplot(enrich,
+ input$bar_reactome_slider,
+ input$bar_reactome_value)
}, error = function(err) {
return(NULL)
})
@@ -81,7 +108,14 @@ output[["bar_reactome_slider"]] <- renderUI({
tryCatch({
checkReload()
enrich <- as.data.frame(get_reactome())
- sliderInput("bar_reactome_slider", "Amount of shown pathways:", nrow(enrich)/2, min = 1, max = nrow(enrich), step=1)
+ sliderInput(
+ inputId = "bar_reactome_slider",
+ label = "Amount of shown pathways:",
+ value = nrow(enrich) / 2,
+ min = 1,
+ max = nrow(enrich),
+ step = 1
+ )
}, error = function(err) {
return(NULL)
})
@@ -93,9 +127,18 @@ output[["cnet_reactome_plot"]] <- renderPlotly({
checkReload()
enrich <- get_reactome()
- geneSets <- extract_geneSets(enrich, input$cnet_reactome_slider, input$reactome_select_pathway)
+ geneSets <- extract_geneSets(enrich,
+ input$cnet_reactome_slider,
+ input$reactome_select_pathway)
graphData <- cnetPlotly(enrich, geneSets, inUse_deTab)
- plotlyGraph(graphData, "Gene-Concept Network", "Log2FC", length(geneSets), input$cnet_reactome_annoP, input$cnet_reactome_annoG)
+ plotlyGraph(
+ graphData,
+ "Gene-Concept Network",
+ "Log2FC",
+ length(geneSets),
+ input$cnet_reactome_annoP,
+ input$cnet_reactome_annoG
+ )
}, error = function(err) {
return(NULL)
})
@@ -105,10 +148,11 @@ output[["cnet_reactome_plot"]] <- renderPlotly({
output[["cnet_reactome_select_pathway"]] <- renderUI({
tryCatch({
enrich <- as.data.frame(get_reactome())
- selectInput(inputId = "reactome_select_pathway",
- label = "Add specific pathway:",
- multiple = TRUE,
- choices = c("Click to add pathway" = "", enrich$Description)
+ selectInput(
+ inputId = "reactome_select_pathway",
+ label = "Add specific pathway:",
+ multiple = TRUE,
+ choices = c("Click to add pathway" = "", enrich$Description)
)
}, error = function(err) {
return(NULL)
@@ -121,15 +165,19 @@ output[["cnet_reactome_table"]] <- DT::renderDataTable({
checkReload()
enrich <- get_reactome()
- geneSets <- extract_geneSets(enrich, input$cnet_reactome_slider, input$reactome_select_pathway)
+ geneSets <- extract_geneSets(enrich,
+ input$cnet_reactome_slider,
+ input$reactome_select_pathway)
graphData <- cnetPlotly(enrich, geneSets, inUse_deTab)
if ("geneName" %in% colnames(inUse_deTab)) {
- DT::datatable(inUse_deTab[inUse_deTab$geneName %in% names(V(graphData)), ], options = list(pageLength = 15, scrollX = TRUE))
+ DT::datatable(inUse_deTab[inUse_deTab$geneName %in% names(V(graphData)),], options = list(pageLength = 15, scrollX = TRUE))
} else {
- DT::datatable(inUse_deTab[rownames(inUse_deTab) %in% names(V(graphData)), ], options = list(pageLength = 15, scrollX = TRUE))
+ DT::datatable(inUse_deTab[rownames(inUse_deTab) %in% names(V(graphData)),], options = list(pageLength = 15, scrollX = TRUE))
}
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -139,7 +187,9 @@ output[["heat_reactome_plot"]] <- renderPlotly({
checkReload()
enrich <- get_reactome()
- geneSets <- extract_geneSets(enrich, input$heat_reactome_slider, input$reactome_select_heat)
+ geneSets <- extract_geneSets(enrich,
+ input$heat_reactome_slider,
+ input$reactome_select_heat)
heatplotly(geneSets, inUse_deTab)
}, error = function(err) {
return(NULL)
@@ -150,10 +200,11 @@ output[["heat_reactome_plot"]] <- renderPlotly({
output[["heat_reactome_select_pathway"]] <- renderUI({
tryCatch({
enrich <- as.data.frame(get_reactome())
- selectInput(inputId = "reactome_select_heat",
- label = "Add specific pathway:",
- multiple = TRUE,
- choices = c("Click to add pathway" = "", enrich$Description)
+ selectInput(
+ inputId = "reactome_select_heat",
+ label = "Add specific pathway:",
+ multiple = TRUE,
+ choices = c("Click to add pathway" = "", enrich$Description)
)
}, error = function(err) {
return(NULL)
@@ -166,15 +217,19 @@ output[["heat_reactome_table"]] <- DT::renderDataTable({
checkReload()
enrich <- get_reactome()
- geneSets <- extract_geneSets(enrich, input$heat_reactome_slider, input$reactome_select_heat)
+ geneSets <- extract_geneSets(enrich,
+ input$heat_reactome_slider,
+ input$reactome_select_heat)
graphData <- cnetPlotly(enrich, geneSets, inUse_deTab)
if ("geneName" %in% colnames(inUse_deTab)) {
- DT::datatable(inUse_deTab[inUse_deTab$geneName %in% names(V(graphData)), ], options = list(pageLength = 15, scrollX = TRUE))
+ DT::datatable(inUse_deTab[inUse_deTab$geneName %in% names(V(graphData)),], options = list(pageLength = 15, scrollX = TRUE))
} else {
- DT::datatable(inUse_deTab[rownames(inUse_deTab) %in% names(V(graphData)), ], options = list(pageLength = 15, scrollX = TRUE))
+ DT::datatable(inUse_deTab[rownames(inUse_deTab) %in% names(V(graphData)),], options = list(pageLength = 15, scrollX = TRUE))
}
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -184,7 +239,12 @@ output[["gsea_reactome_plot"]] <- renderPlotly({
checkReload()
enrich <- get_reactome()
graphData <- emap_plotly(enrich)
- plotlyGraph(graphData, "Reactome", "P-Value", 0, input$reactome_network_annoP, FALSE)
+ plotlyGraph(graphData,
+ "Reactome",
+ "P-Value",
+ 0,
+ input$reactome_network_annoP,
+ FALSE)
}, error = function(err) {
return(NULL)
})
@@ -196,8 +256,7 @@ output[["select_reactome_pathway"]] <- renderUI({
checkReload()
enrich <- as.data.frame(get_reactome())
selectInput("reactome_select", "Select a pathway:",
- enrich$Description
- )
+ enrich$Description)
}, error = function(err) {
return(NULL)
})
@@ -209,8 +268,26 @@ output[["pathway_from_reactome"]] <- renderUI({
checkReload()
enrich <- as.data.frame(get_reactome())
getpathway <- rownames(enrich)[enrich$Description %in% input$reactome_select]
- getFromReactome <- includeHTML(paste("https://reactome.org/ContentService/exporter/diagram/", getpathway, ".svg?title=false", sep=""))
- getFromReactome <- HTML(paste('\n', getFromReactome, '\n', sep=""))
+ getFromReactome <-
+ includeHTML(
+ paste(
+ "https://reactome.org/ContentService/exporter/diagram/",
+ getpathway,
+ ".svg?title=false",
+ sep = ""
+ )
+ )
+ getFromReactome <-
+ HTML(
+ paste(
+ '\n',
+ getFromReactome,
+ '\n',
+ sep = ""
+ )
+ )
getFromReactome
}, error = function(err) {
return(NULL)
@@ -218,7 +295,8 @@ output[["pathway_from_reactome"]] <- renderUI({
})
output[["reactome_barplot_info"]] <- renderUI({
- infoText <- "The bar plot shows a sorted list of the most enriched terms. The bar plot is sorted based on
+ infoText <-
+ "The bar plot shows a sorted list of the most enriched terms. The bar plot is sorted based on
the selected value (p-value, q-value or adjusted p-value). The colors of the bars are also
generated based on the earlier selected value. On the X-axis, the amount of genes linked to
the pathway is shown."
@@ -226,7 +304,8 @@ output[["reactome_barplot_info"]] <- renderUI({
})
output[["cnet_reactome_plot_info"]] <- renderUI({
- infoText <- "The concept network can show which genes are involved in the most significant terms. The
+ infoText <-
+ "The concept network can show which genes are involved in the most significant terms. The
most enriched terms together with all corresponding genes are collected and shown in a
network plot. Some pathways may contain some matching genes. These genes will also be
connected. The color given to genes is based on the log fold change determined after the
@@ -236,14 +315,16 @@ output[["cnet_reactome_plot_info"]] <- renderUI({
})
output[["heat_reactome_plot_info"]] <- renderUI({
- infoText <- "The heatmap visualizes pathways and the corresponding genes. The genes are sorted based on
+ infoText <-
+ "The heatmap visualizes pathways and the corresponding genes. The genes are sorted based on
Log2FC. The pathways are sorted on number of gene mathes between other pathways, listing pathways with
the most gene matches on the left. With this plot genes present in pathways can be compared on sight."
informationBox(infoText)
})
output[["reactome_network_info"]] <- renderUI({
- infoText <- "The pathway network shows connections between all found pathways. Every dot that the
+ infoText <-
+ "The pathway network shows connections between all found pathways. Every dot that the
plot shows represents a pathway. The color given to the pathways is based on the adjusted
p-value."
informationBox(infoText)
diff --git a/inst/src/tabs/enrichment/reactome/ui_reactome.R b/inst/src/tabs/enrichment/reactome/ui_reactome.R
index ec26860..4eeaa10 100644
--- a/inst/src/tabs/enrichment/reactome/ui_reactome.R
+++ b/inst/src/tabs/enrichment/reactome/ui_reactome.R
@@ -1,13 +1,17 @@
tab_enrich_reactome <- tabItem(
tabName = "enrich_reactome",
- align="center",
+ align = "center",
br(),
- radioButtons("choose_reactome", "Select enrichment type:",
- inline = TRUE,
- c("Gene set enrichment" = "gse",
- "Over represented enrichment" = "enrich")
+ radioButtons(
+ "choose_reactome",
+ "Select enrichment type:",
+ inline = TRUE,
+ c(
+ "Gene set enrichment" = "gse",
+ "Over represented enrichment" = "enrich"
+ )
),
tabsetPanel(
@@ -30,14 +34,16 @@ tab_enrich_reactome <- tabItem(
inputId = "bar_reactome_value",
label = "Color plot with:",
selected = "pvalue",
- c("P-Value" = "pvalue",
+ c(
+ "P-Value" = "pvalue",
"Adjusted P-Value" = "p.adjust",
- "Q-Value" = "qvalues")
+ "Q-Value" = "qvalues"
+ )
),
br(),
uiOutput("reactome_barplot_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("reactome_barplot", height = "600px") %>% withSpinner()
@@ -53,15 +59,22 @@ tab_enrich_reactome <- tabItem(
position = "right",
sidebarPanel(
width = 3,
- sliderInput("cnet_reactome_slider", "Amount of shown pathways:", 5, min = 0, max = 15, step=1),
+ sliderInput(
+ "cnet_reactome_slider",
+ "Amount of shown pathways:",
+ 5,
+ min = 0,
+ max = 15,
+ step = 1
+ ),
uiOutput("cnet_reactome_select_pathway"),
tags$b("Labels on/off:"),
checkboxInput("cnet_reactome_annoP", "Pathway labels", value = TRUE),
checkboxInput("cnet_reactome_annoG", "Gene labels", value = FALSE),
br(),
uiOutput("cnet_reactome_plot_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("cnet_reactome_plot", height = "600px") %>% withSpinner()
@@ -79,12 +92,19 @@ tab_enrich_reactome <- tabItem(
position = "right",
sidebarPanel(
width = 3,
- sliderInput("heat_reactome_slider", "Number of shown pathways:", 5, min = 0, max = 15, step=1),
+ sliderInput(
+ "heat_reactome_slider",
+ "Number of shown pathways:",
+ 5,
+ min = 0,
+ max = 15,
+ step = 1
+ ),
uiOutput("heat_reactome_select_pathway"),
br(),
uiOutput("heat_reactome_plot_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("heat_reactome_plot", height = "600px") %>% withSpinner()
@@ -106,8 +126,8 @@ tab_enrich_reactome <- tabItem(
checkboxInput("reactome_network_annoP", "Pathway labels", value = FALSE),
br(),
uiOutput("reactome_network_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("gsea_reactome_plot", height = "600px") %>% withSpinner()
diff --git a/inst/src/tabs/export/svr_export.R b/inst/src/tabs/export/svr_export.R
index 721423f..2402e5b 100644
--- a/inst/src/tabs/export/svr_export.R
+++ b/inst/src/tabs/export/svr_export.R
@@ -2,16 +2,26 @@
## get the right dataset for download
datasetInput <- reactive({
checkReload()
- switch(input$dataset_select,
- "normCounts" = 2^(inUse_normDge$counts),
- "normCountslog2" = inUse_normDge$counts,
- "deTab" = inUse_deTab,
- "deg" = inUse_deTab[inUse_deTab$DE != 0,],
- "pcGene" = pc_gene_table(),
- "kegg" = as.data.frame(get_kegg())[,!(colnames(as.data.frame(get_kegg())) %in% c("ID", "leading_edge", "core_enrichment", "geneID"))],
- "reactome" = as.data.frame(get_reactome())[,!(colnames(as.data.frame(get_reactome())) %in% c("ID", "leading_edge", "core_enrichment", "geneID"))],
- "go" = as.data.frame(get_go())[,!(colnames(as.data.frame(get_go())) %in% c("ID", "leading_edge", "core_enrichment", "geneID"))],
- "do" = as.data.frame(get_do())[,!(colnames(as.data.frame(get_do())) %in% c("ID", "leading_edge", "core_enrichment", "geneID"))])
+ switch(
+ input$dataset_select,
+ "normCounts" = 2 ^ (inUse_normDge$counts),
+ "normCountslog2" = inUse_normDge$counts,
+ "deTab" = inUse_deTab,
+ "deg" = inUse_deTab[inUse_deTab$DE != 0, ],
+ "pcGene" = pc_gene_table(),
+ "kegg" = as.data.frame(get_kegg())[, !(
+ colnames(as.data.frame(get_kegg())) %in% c("ID", "leading_edge", "core_enrichment", "geneID")
+ )],
+ "reactome" = as.data.frame(get_reactome())[, !(
+ colnames(as.data.frame(get_reactome())) %in% c("ID", "leading_edge", "core_enrichment", "geneID")
+ )],
+ "go" = as.data.frame(get_go())[, !(
+ colnames(as.data.frame(get_go())) %in% c("ID", "leading_edge", "core_enrichment", "geneID")
+ )],
+ "do" = as.data.frame(get_do())[, !(
+ colnames(as.data.frame(get_do())) %in% c("ID", "leading_edge", "core_enrichment", "geneID")
+ )]
+ )
})
## create filename and save data as CSV
@@ -20,7 +30,13 @@ output$downloadCSV <- downloadHandler(
paste("shiny_analysis_", gsub(" ", "_", tolower(input$dataset_select)), ".csv", sep = "")
},
content = function(file) {
- write.table(datasetInput(), file, row.names = TRUE, col.names=NA, sep = ",")
+ write.table(
+ datasetInput(),
+ file,
+ row.names = TRUE,
+ col.names = NA,
+ sep = ","
+ )
}
)
@@ -30,14 +46,24 @@ output$downloadTSV <- downloadHandler(
paste("shiny_analysis_", gsub(" ", "_", tolower(input$dataset_select)), ".tsv", sep = "")
},
content = function(file) {
- write.table(datasetInput(), file, row.names = TRUE, col.names=NA, sep = "\t")
+ write.table(
+ datasetInput(),
+ file,
+ row.names = TRUE,
+ col.names = NA,
+ sep = "\t"
+ )
}
)
## Download markdown HTML report
-output[["downloadMHTML"]] <- downloadHandler(
- filename = paste(input$analysis_method, '_', gsub('-', '', Sys.Date()), '.html', sep=''),
- content <- function(file) {
- file.copy(paste0("markdown/", input$analysis_method, '.html'), file)
- }
-)
+output[["downloadMHTML"]] <- downloadHandler(filename = paste(
+ input$analysis_method,
+ '_',
+ gsub('-', '', Sys.Date()),
+ '.html',
+ sep = ''
+),
+content <- function(file) {
+ file.copy(paste0("markdown/", input$analysis_method, '.html'), file)
+})
diff --git a/inst/src/tabs/export/ui_export.R b/inst/src/tabs/export/ui_export.R
index 2f2a114..c1de38c 100644
--- a/inst/src/tabs/export/ui_export.R
+++ b/inst/src/tabs/export/ui_export.R
@@ -1,22 +1,26 @@
tab_export <- tabItem(
tabName = "export",
- align="center",
+ align = "center",
HTML('
'),
br(),
br(),
h2("Download tables"),
- selectInput("dataset_select", "",
- c("Normalized counts" = "normCounts",
- "Log2 Normalized counts" = "normCountslog2",
- "Full DE table" = "deTab",
- "DE genes only" = "deg",
- "PC values per gene (PCA)" = "pcGene",
- "KEGG pathways" = "kegg",
- "Reactome pathways" = "reactome",
- "GO pathways" = "go",
- "DO pathways" = "do")
- ),
+ selectInput(
+ inputId = "dataset_select",
+ label = "",
+ choices = c(
+ "Normalized counts" = "normCounts",
+ "Log2 Normalized counts" = "normCountslog2",
+ "Full DE table" = "deTab",
+ "DE genes only" = "deg",
+ "PC values per gene (PCA)" = "pcGene",
+ "KEGG pathways" = "kegg",
+ "Reactome pathways" = "reactome",
+ "GO pathways" = "go",
+ "DO pathways" = "do"
+ )
+ ),
downloadButton("downloadCSV", label = "Download as CSV"),
downloadButton("downloadTSV", label = "Download as TSV"),
br(),
diff --git a/inst/src/tabs/heatmaps/svr_heatmaps.R b/inst/src/tabs/heatmaps/svr_heatmaps.R
index d1a47e1..80cd397 100644
--- a/inst/src/tabs/heatmaps/svr_heatmaps.R
+++ b/inst/src/tabs/heatmaps/svr_heatmaps.R
@@ -12,7 +12,14 @@ output[["var_heat"]] <- renderPlotly({
## Set amount of variable genes to show
output[["heatmap_var_ngenes"]] <- renderUI({
tryCatch({
- sliderInput("slider_heatmap_var", "Set the number of genes to show:", value = 100, min = 2, max = nrow(inUse_normDge), step=1)
+ sliderInput(
+ inputId = "slider_heatmap_var",
+ label = "Set the number of genes to show:",
+ value = 100,
+ min = 2,
+ max = nrow(inUse_normDge),
+ step = 1
+ )
}, error = function(err) {
return(NULL)
})
@@ -23,9 +30,9 @@ output[["group_var"]] <- renderUI({
tryCatch({
checkReload()
selectInput(
- "group_var",
- "Group by:",
- c("None"="None", colnames(data_samples()))
+ inputId = "group_var",
+ label = "Group by:",
+ choices = c("None" = "None", colnames(data_samples()))
)
}, error = function(err) {
return(NULL)
@@ -36,8 +43,13 @@ output[["group_var"]] <- renderUI({
output[["dge_heat"]] <- renderPlotly({
tryCatch({
checkReload()
- if (is.null(inUse_deTab)){return(NULL)}
- topDgeHeatmapPlot(inUse_deTab, inUse_normDge, input$group_dge, input$slider_heatmap_dge)
+ if (is.null(inUse_deTab)) {
+ return(NULL)
+ }
+ topDgeHeatmapPlot(inUse_deTab,
+ inUse_normDge,
+ input$group_dge,
+ input$slider_heatmap_dge)
}, error = function(err) {
return(NULL)
})
@@ -48,9 +60,9 @@ output[["group_dge"]] <- renderUI({
tryCatch({
checkReload()
selectInput(
- "group_dge",
- "Group by:",
- c("None"="None", colnames(data_samples()))
+ inputId = "group_dge",
+ label = "Group by:",
+ choices = c("None" = "None", colnames(data_samples()))
)
}, error = function(err) {
return(NULL)
@@ -60,7 +72,14 @@ output[["group_dge"]] <- renderUI({
## Set amount of DGE genes to show
output[["heatmap_dge_ngenes"]] <- renderUI({
tryCatch({
- sliderInput("slider_heatmap_dge", "Set the number of genes to show:", value = 100, min = 2, max = nrow(inUse_normDge), step=1)
+ sliderInput(
+ inputId = "slider_heatmap_dge",
+ label = "Set the number of genes to show:",
+ value = 100,
+ min = 2,
+ max = nrow(inUse_normDge),
+ step = 1
+ )
}, error = function(err) {
return(NULL)
})
@@ -69,7 +88,8 @@ output[["heatmap_dge_ngenes"]] <- renderUI({
## INFORMATION BOXES
output[["var_heat_info"]] <- renderUI({
- infoText <- "This heatmap is based on the most variable genes. This is calculated
+ infoText <-
+ "This heatmap is based on the most variable genes. This is calculated
by getting the average Log2CPM difference of a gene between all samples. The
genes are then sorted based on the calculated difference. The genes with the
biggest difference between Log2CPM values between all samples are listed as
@@ -78,7 +98,8 @@ output[["var_heat_info"]] <- renderUI({
})
output[["dge_heat_info"]] <- renderUI({
- infoText <- "This heatmap is based on the most differentially expressed genes. This
+ infoText <-
+ "This heatmap is based on the most differentially expressed genes. This
is defined by sorting all genes based on the adjusted p-value. The genes with
the lowest adjusted p-values are considered 'most expressed'."
informationBox(infoText)
diff --git a/inst/src/tabs/heatmaps/ui_heatmaps.R b/inst/src/tabs/heatmaps/ui_heatmaps.R
index 8b56aaa..fe1a98d 100644
--- a/inst/src/tabs/heatmaps/ui_heatmaps.R
+++ b/inst/src/tabs/heatmaps/ui_heatmaps.R
@@ -1,7 +1,7 @@
tab_heatmaps <- tabItem(
tabName = "heatmaps",
- align="center",
+ align = "center",
br(),
tabsetPanel(
@@ -16,8 +16,8 @@ tab_heatmaps <- tabItem(
uiOutput("group_var"),
br(),
uiOutput("var_heat_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("var_heat", height = "600px") %>% withSpinner()
@@ -37,8 +37,8 @@ tab_heatmaps <- tabItem(
uiOutput("group_dge"),
br(),
uiOutput("dge_heat_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("dge_heat", height = "600px") %>% withSpinner()
diff --git a/inst/src/tabs/home/svr_home.R b/inst/src/tabs/home/svr_home.R
index a7c1aef..ab28519 100644
--- a/inst/src/tabs/home/svr_home.R
+++ b/inst/src/tabs/home/svr_home.R
@@ -27,46 +27,67 @@ output[["welcome"]] <- renderUI({
## Basic explanation of New and View analysis
output[["get_started"]] <- renderUI({
- fluidRow(
- column(
- width = 6,
- h2("New analysis"),
- div(
- br(),
- span(
- "1. Go to the 'Data upload' page and select 'New analysis'.", tags$br(),
- "2. Upload files (both CSV and TSV is accepted):", tags$br(),
- HTML(" "), "- Samplesheet (metadata), Contains information about each sample.", tags$br(),
- HTML(" "), "- Count data, Contains the read alignment results (read counts per feature).", tags$br(),
- HTML(" "), "- Annotation, Contains more information about genes (location, length, etc.).", tags$br(),
- "3. Go to the 'Run analysis' page.", tags$br(),
- "4. Adjust the settings for to the desired analysis.", tags$br(),
- "5. Run the analysis.", tags$br(),
- "6. View the results.",
- style = "text-align: justify; display: flex; justify-content: center; width: 90%"
- ),
- br(),
- style = "background-color: #f5f5f5; border: 1px solid #e3e3e3; width: 90%"
- )
- ),
- column(
- width = 6,
- h2("View analysis"),
- div(
- br(),
- span(
- "1. Go to the 'Data upload' page and select 'View analysis'.", tags$br(),
- "2. Upload files (both CSV and TSV is accepted):", tags$br(),
- HTML(" "), "- Samplesheet (metadata), Contains information about each sample.", tags$br(),
- HTML(" "), "- Count data, Contains the read alignment results (read counts per feature).", tags$br(),
- HTML(" "), "- Normalized data, Contains the normalization results (read counts per feature).", tags$br(),
- HTML(" "), "- DE table, Contains all analysis results.", tags$br(),
- "3. View the results.",
- style = "text-align: justify; display: flex; justify-content: center; width: 90%"
- ),
- br(), br(), br(),
- style = "background-color: #f5f5f5; border: 1px solid #e3e3e3; width: 90%"
- )
+ fluidRow(column(
+ width = 6,
+ h2("New analysis"),
+ div(
+ br(),
+ span(
+ "1. Go to the 'Data upload' page and select 'New analysis'.",
+ tags$br(),
+ "2. Upload files (both CSV and TSV is accepted):",
+ tags$br(),
+ HTML(" "),
+ "- Samplesheet (metadata), Contains information about each sample.",
+ tags$br(),
+ HTML(" "),
+ "- Count data, Contains the read alignment results (read counts per feature).",
+ tags$br(),
+ HTML(" "),
+ "- Annotation, Contains more information about genes (location, length, etc.).",
+ tags$br(),
+ "3. Go to the 'Run analysis' page.",
+ tags$br(),
+ "4. Adjust the settings for to the desired analysis.",
+ tags$br(),
+ "5. Run the analysis.",
+ tags$br(),
+ "6. View the results.",
+ style = "text-align: justify; display: flex; justify-content: center; width: 90%"
+ ),
+ br(),
+ style = "background-color: #f5f5f5; border: 1px solid #e3e3e3; width: 90%"
)
- )
+ ),
+ column(
+ width = 6,
+ h2("View analysis"),
+ div(
+ br(),
+ span(
+ "1. Go to the 'Data upload' page and select 'View analysis'.",
+ tags$br(),
+ "2. Upload files (both CSV and TSV is accepted):",
+ tags$br(),
+ HTML(" "),
+ "- Samplesheet (metadata), Contains information about each sample.",
+ tags$br(),
+ HTML(" "),
+ "- Count data, Contains the read alignment results (read counts per feature).",
+ tags$br(),
+ HTML(" "),
+ "- Normalized data, Contains the normalization results (read counts per feature).",
+ tags$br(),
+ HTML(" "),
+ "- DE table, Contains all analysis results.",
+ tags$br(),
+ "3. View the results.",
+ style = "text-align: justify; display: flex; justify-content: center; width: 90%"
+ ),
+ br(),
+ br(),
+ br(),
+ style = "background-color: #f5f5f5; border: 1px solid #e3e3e3; width: 90%"
+ )
+ ))
})
diff --git a/inst/src/tabs/home/ui_home.R b/inst/src/tabs/home/ui_home.R
index 772bd47..f419562 100644
--- a/inst/src/tabs/home/ui_home.R
+++ b/inst/src/tabs/home/ui_home.R
@@ -1,7 +1,7 @@
tab_home <- tabItem(
tabName = "home",
- align="center",
+ align = "center",
br(),
h1("Welcome"),
@@ -17,8 +17,9 @@ tab_home <- tabItem(
h1("Flowchart of the application"),
div(
br(),
- img(src="programFlow.png", width="90%"),
- br(), br(),
+ img(src = "programFlow.png", width = "90%"),
+ br(),
+ br(),
style = "background-color: #f5f5f5; border: 1px solid #e3e3e3; width: 90%"
)
)
diff --git a/inst/src/tabs/norm_data/svr_norm.R b/inst/src/tabs/norm_data/svr_norm.R
index 46ea45c..eb9479f 100644
--- a/inst/src/tabs/norm_data/svr_norm.R
+++ b/inst/src/tabs/norm_data/svr_norm.R
@@ -3,9 +3,12 @@
output[["normalized_counts"]] <- DT::renderDataTable({
tryCatch({
checkReload()
- DT::datatable(inUse_normDge$counts, options = list(pageLength = 50, scrollX = TRUE))
+ DT::datatable(inUse_normDge$counts,
+ options = list(pageLength = 50, scrollX = TRUE))
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -54,9 +57,12 @@ output[["selected_norm_voom"]] <- DT::renderDataTable({
tryCatch({
checkReload()
s <- event_data(event = "plotly_selected", source = "norm_voom")
- DT::datatable(data.frame(inUse_normDge$counts)[unlist(s$key),], options = list(pageLength = 15, scrollX = TRUE))
+ DT::datatable(data.frame(inUse_normDge$counts)[unlist(s$key), ],
+ options = list(pageLength = 15, scrollX = TRUE))
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -73,8 +79,10 @@ output[["norm_un_cluster_2d"]] <- renderPlotly({
## Set color of mds 2d
output[["group_norm_mds2d"]] <- renderUI({
tryCatch({
- selectInput("group_norm_mds2d", "Color by:",
- colnames(data_samples())
+ selectInput(
+ inputId = "group_norm_mds2d",
+ label = "Color by:",
+ choices = colnames(data_samples())
)
}, error = function(err) {
return(NULL)
@@ -86,7 +94,7 @@ output[["selected_norm_mds2d"]] <- DT::renderDataTable({
tryCatch({
checkReload()
s <- event_data(event = "plotly_selected", source = "norm_mds2d")
- DT::datatable(data_samples()[unlist(s$key),, drop = FALSE], options = list(pageLength = 15, scrollX = TRUE))
+ DT::datatable(data_samples()[unlist(s$key), , drop = FALSE], options = list(pageLength = 15, scrollX = TRUE))
}, error = function(err) {
return(NULL)
})
@@ -105,8 +113,10 @@ output[["norm_un_cluster_3d"]] <- renderPlotly({
## Set color of mds 3d
output[["group_norm_mds3d"]] <- renderUI({
tryCatch({
- selectInput("group_norm_mds3d", "Color by:",
- colnames(data_samples())
+ selectInput(
+ inputId = "group_norm_mds3d",
+ label = "Color by:",
+ choices = colnames(data_samples())
)
}, error = function(err) {
return(NULL)
@@ -116,21 +126,24 @@ output[["group_norm_mds3d"]] <- renderUI({
## INFORMATION BOXES
output[["norm_dist_line_info"]] <- renderUI({
- infoText <- "The line plot shows the density of the log2CPM values per sample. The density shows the
+ infoText <-
+ "The line plot shows the density of the log2CPM values per sample. The density shows the
distribution of count values per sample and is used to determine big differences between
samples."
informationBox(infoText)
})
output[["norm_dist_boxplot_info"]] <- renderUI({
- infoText <- "The box plot has a similar purpose, but the data can be viewed in a different
+ infoText <-
+ "The box plot has a similar purpose, but the data can be viewed in a different
format. The distribution can be seen between the Log2CPM at the corresponding
samples."
informationBox(infoText)
})
output[["norm_voom_plot_info"]] <- renderUI({
- infoText <- "The voom plot provides a check on the filtering, which is performed at the beginning of the
+ infoText <-
+ "The voom plot provides a check on the filtering, which is performed at the beginning of the
analysis. The method used to calculate this is 'voom'. Voom is an acronym for
mean-variance modeling at the observational level. This means that the mean-variance in
the data is calculated and gives each observation a certain weight. Problems during the
@@ -139,15 +152,17 @@ output[["norm_voom_plot_info"]] <- renderUI({
})
output[["norm_un_cluster_2d_info"]] <- renderUI({
- infoText <- "This MDS plot (multidimensional scaling plot) can be viewed as a 2D plot with
- calculations of two dimensions. With the MDS plot distances between samples is
+ infoText <-
+ "This MDS plot (multidimensional scaling plot) can be viewed as a 2D plot with
+ calculations of two dimensions. With the MDS plot distances between samples is
shown, based on similarities and differences."
informationBox(infoText)
})
output[["norm_un_cluster_3d_info"]] <- renderUI({
- infoText <- "This MDS plot (multidimensional scaling plot) can be viewed as a 3D plot with
- calculations of three dimensions. With the MDS plot distances between samples is
+ infoText <-
+ "This MDS plot (multidimensional scaling plot) can be viewed as a 3D plot with
+ calculations of three dimensions. With the MDS plot distances between samples is
shown, based on similarities and differences."
informationBox(infoText)
})
diff --git a/inst/src/tabs/norm_data/ui_norm.R b/inst/src/tabs/norm_data/ui_norm.R
index f07d056..008a8d5 100644
--- a/inst/src/tabs/norm_data/ui_norm.R
+++ b/inst/src/tabs/norm_data/ui_norm.R
@@ -1,18 +1,17 @@
tab_norm_data <- tabItem(
tabName = "norm_data",
- align="center",
+ align = "center",
br(),
tabsetPanel(
tabPanel(
title = "Normalized Counts",
HTML('
'),
- fluidRow(
- column(
- 12,
- DT::dataTableOutput("normalized_counts") %>% withSpinner())
- ),
+ fluidRow(column(
+ 12,
+ DT::dataTableOutput("normalized_counts") %>% withSpinner()
+ )),
HTML('
')
),
@@ -24,8 +23,8 @@ tab_norm_data <- tabItem(
sidebarPanel(
width = 3,
uiOutput("norm_dist_line_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("norm_dist_line", height = "600px") %>% withSpinner()
@@ -42,8 +41,8 @@ tab_norm_data <- tabItem(
sidebarPanel(
width = 3,
uiOutput("norm_dist_boxplot_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("norm_dist_boxplot", height = "600px") %>% withSpinner()
@@ -62,8 +61,8 @@ tab_norm_data <- tabItem(
uiOutput("norm_voom_ngenes"),
br(),
uiOutput("norm_voom_plot_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("norm_voom_plot", height = "600px") %>% withSpinner()
@@ -84,8 +83,8 @@ tab_norm_data <- tabItem(
uiOutput("group_norm_mds2d"),
br(),
uiOutput("norm_un_cluster_2d_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("norm_un_cluster_2d", height = "600px") %>% withSpinner()
@@ -106,8 +105,8 @@ tab_norm_data <- tabItem(
uiOutput("group_norm_mds3d"),
br(),
uiOutput("norm_un_cluster_3d_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("norm_un_cluster_3d", height = "600px") %>% withSpinner()
diff --git a/inst/src/tabs/pca/svr_pca.R b/inst/src/tabs/pca/svr_pca.R
index 57bc0f6..6b1f7bf 100644
--- a/inst/src/tabs/pca/svr_pca.R
+++ b/inst/src/tabs/pca/svr_pca.R
@@ -13,7 +13,10 @@ output[["variance_pca"]] <- renderPlotly({
output[["samples_pca_2d"]] <- renderPlotly({
tryCatch({
checkReload()
- samplePca2dPlot(inUse_normDge, input$group_pca2d, input$set_pca2d_pc1, input$set_pca2d_pc2)
+ samplePca2dPlot(inUse_normDge,
+ input$group_pca2d,
+ input$set_pca2d_pc1,
+ input$set_pca2d_pc2)
}, error = function(err) {
return(NULL)
})
@@ -22,8 +25,10 @@ output[["samples_pca_2d"]] <- renderPlotly({
## Set color of PCA 2d
output[["group_pca2d"]] <- renderUI({
tryCatch({
- selectInput("group_pca2d", "Color by:",
- colnames(data_samples())
+ selectInput(
+ inputId = "group_pca2d",
+ label = "Color by:",
+ choices = colnames(data_samples())
)
}, error = function(err) {
return(NULL)
@@ -33,8 +38,10 @@ output[["group_pca2d"]] <- renderUI({
## Set color of PCA 2d
output[["group_pca2d"]] <- renderUI({
tryCatch({
- selectInput("group_pca2d", "Color by:",
- colnames(data_samples())
+ selectInput(
+ inputId = "group_pca2d",
+ label = "Color by:",
+ choices = colnames(data_samples())
)
}, error = function(err) {
return(NULL)
@@ -44,14 +51,18 @@ output[["group_pca2d"]] <- renderUI({
## Set PCs for PCA 2d
output[["setpc_pca2d"]] <- renderUI({
tryCatch({
- all_pc <- sprintf("PC%s",seq(1:ncol(inUse_normDge$counts)))
+ all_pc <- sprintf("PC%s", seq(1:ncol(inUse_normDge$counts)))
tagList(
- selectInput("set_pca2d_pc1", "Select X-axis PC:",
- all_pc
+ selectInput(
+ inputId = "set_pca2d_pc1",
+ label = "Select X-axis PC:",
+ choices = all_pc
),
- selectInput("set_pca2d_pc2", "Select Y-axis PC:",
- all_pc,
- selected = "PC2"
+ selectInput(
+ inputId = "set_pca2d_pc2",
+ label = "Select Y-axis PC:",
+ choices = all_pc,
+ selected = "PC2"
)
)
}, error = function(err) {
@@ -64,10 +75,14 @@ output[["selected_pca"]] <- DT::renderDataTable({
tryCatch({
checkReload()
s <- event_data(event = "plotly_selected", source = "pca_pca2d")
- if(is.null(s)){s <- ""}
- DT::datatable(data_samples()[unlist(s$key),, drop = FALSE], options = list(pageLength = 15, scrollX = TRUE))
+ if (is.null(s)) {
+ s <- ""
+ }
+ DT::datatable(data_samples()[unlist(s$key), , drop = FALSE], options = list(pageLength = 15, scrollX = TRUE))
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -75,7 +90,13 @@ output[["selected_pca"]] <- DT::renderDataTable({
output[["samples_pca_3d"]] <- renderPlotly({
tryCatch({
checkReload()
- samplePca3dPlot(inUse_normDge, input$group_pca3d, input$set_pca3d_pc1, input$set_pca3d_pc2, input$set_pca3d_pc3)
+ samplePca3dPlot(
+ inUse_normDge,
+ input$group_pca3d,
+ input$set_pca3d_pc1,
+ input$set_pca3d_pc2,
+ input$set_pca3d_pc3
+ )
}, error = function(err) {
return(NULL)
})
@@ -84,8 +105,10 @@ output[["samples_pca_3d"]] <- renderPlotly({
## Set color of PCA 3d
output[["group_pca3d"]] <- renderUI({
tryCatch({
- selectInput("group_pca3d", "Color by:",
- colnames(data_samples())
+ selectInput(
+ inputId = "group_pca3d",
+ label = "Color by:",
+ choices = colnames(data_samples())
)
}, error = function(err) {
return(NULL)
@@ -95,18 +118,24 @@ output[["group_pca3d"]] <- renderUI({
## Set PCs for PCA 3d
output[["setpc_pca3d"]] <- renderUI({
tryCatch({
- all_pc <- sprintf("PC%s",seq(1:ncol(inUse_normDge$counts)))
+ all_pc <- sprintf("PC%s", seq(1:ncol(inUse_normDge$counts)))
tagList(
- selectInput("set_pca3d_pc1", "Select X-axis PC:",
- all_pc
+ selectInput(
+ inputId = "set_pca3d_pc1",
+ label = "Select X-axis PC:",
+ choices = all_pc
),
- selectInput("set_pca3d_pc2", "Select Y-axis PC:",
- all_pc,
- selected = "PC2"
+ selectInput(
+ inputId = "set_pca3d_pc2",
+ label = "Select Y-axis PC:",
+ choices = all_pc,
+ selected = "PC2"
),
- selectInput("set_pca3d_pc3", "Select Z-axis PC:",
- all_pc,
- selected = "PC3"
+ selectInput(
+ inputId = "set_pca3d_pc3",
+ label = "Select Z-axis PC:",
+ choices = all_pc,
+ selected = "PC3"
)
)
}, error = function(err) {
@@ -119,7 +148,7 @@ pc_gene_table <- reactive({
tryCatch({
tdge <- t(inUse_normDge$counts)
tdge[!is.finite(tdge)] <- 0
- pca <- prcomp(tdge, center=TRUE)
+ pca <- prcomp(tdge, center = TRUE)
pca <- pca$rotation
pca
}, error = function(err) {
@@ -130,20 +159,23 @@ pc_gene_table <- reactive({
## INFORMATION BOXES
output[["variance_pca_info"]] <- renderUI({
- infoText <- "This plot shows the variances of the PCA (Principal Components Analysis) components.
+ infoText <-
+ "This plot shows the variances of the PCA (Principal Components Analysis) components.
A scree plot shows the 'eigenvalues' from the PCA and can be used to decide how many components
can be kept for the PCA analysis."
informationBox(infoText)
})
output[["samples_pca_2d_info"]] <- renderUI({
- infoText <- "The 2D PCA plot shows the samples based on the two components. A PCA plot shows important
+ infoText <-
+ "The 2D PCA plot shows the samples based on the two components. A PCA plot shows important
information from a multivariate data table and shows the result as new variables (Principal Components)."
informationBox(infoText)
})
output[["samples_pca_3d_info"]] <- renderUI({
- infoText <- "The 3D PCA plot shows the samples based on the three components. A PCA plot shows important
+ infoText <-
+ "The 3D PCA plot shows the samples based on the three components. A PCA plot shows important
information from a multivariate data table and shows the result as new variables (Principal Components)."
informationBox(infoText)
})
diff --git a/inst/src/tabs/pca/ui_pca.R b/inst/src/tabs/pca/ui_pca.R
index 282c1b8..6511f25 100644
--- a/inst/src/tabs/pca/ui_pca.R
+++ b/inst/src/tabs/pca/ui_pca.R
@@ -1,7 +1,7 @@
tab_pca <- tabItem(
tabName = "pca",
- align="center",
+ align = "center",
br(),
tabsetPanel(
@@ -13,8 +13,8 @@ tab_pca <- tabItem(
sidebarPanel(
width = 3,
uiOutput("variance_pca_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("variance_pca", height = "600px") %>% withSpinner()
@@ -34,8 +34,8 @@ tab_pca <- tabItem(
uiOutput("setpc_pca2d"),
br(),
uiOutput("samples_pca_2d_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("samples_pca_2d", height = "600px") %>% withSpinner()
@@ -57,8 +57,8 @@ tab_pca <- tabItem(
uiOutput("setpc_pca3d"),
br(),
uiOutput("samples_pca_3d_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("samples_pca_3d", height = "600px") %>% withSpinner()
diff --git a/inst/src/tabs/raw_data/svr_raw.R b/inst/src/tabs/raw_data/svr_raw.R
index 0fcda37..288609f 100644
--- a/inst/src/tabs/raw_data/svr_raw.R
+++ b/inst/src/tabs/raw_data/svr_raw.R
@@ -22,9 +22,11 @@ output[["dist_boxplot"]] <- renderPlotly({
## Make dge voom ready
get_pre_voom <- reactive({
dge <- get_raw_dge()
- dge$counts <- dge$counts[!grepl('^__', rownames(dge$counts)),]
- selectedFeatures <- rownames( dge$counts )[ apply( dge$counts, 1, function( v ) sum( v >= input$slider_raw_voom ) ) >= 1/4 * ncol( dge$counts ) ]
- highExprDge <- dge[ selectedFeatures,, keep.lib.sizes = FALSE ]
+ dge$counts <- dge$counts[!grepl('^__', rownames(dge$counts)), ]
+ selectedFeatures <-
+ rownames(dge$counts)[apply(dge$counts, 1, function(v)
+ sum(v >= input$slider_raw_voom)) >= 1 / 4 * ncol(dge$counts)]
+ highExprDge <- dge[selectedFeatures, , keep.lib.sizes = FALSE]
highExprDge
})
@@ -33,9 +35,11 @@ output[["raw_voom_plot"]] <- renderPlotly({
tryCatch({
checkReload()
dge <- get_raw_dge()
- dge$counts <- dge$counts[!grepl('^__', rownames(dge$counts)),]
- selectedFeatures <- rownames( dge$counts )[ apply( dge$counts, 1, function( v ) sum( v >= input$slider_raw_voom ) ) >= 1/4 * ncol( dge$counts ) ]
- highExprDge <- dge[ selectedFeatures,, keep.lib.sizes = FALSE ]
+ dge$counts <- dge$counts[!grepl('^__', rownames(dge$counts)), ]
+ selectedFeatures <-
+ rownames(dge$counts)[apply(dge$counts, 1, function(v)
+ sum(v >= input$slider_raw_voom)) >= 1 / 4 * ncol(dge$counts)]
+ highExprDge <- dge[selectedFeatures, , keep.lib.sizes = FALSE]
voomPlot(highExprDge, "raw_voom")
}, error = function(err) {
@@ -46,7 +50,10 @@ output[["raw_voom_plot"]] <- renderPlotly({
## Show amount of genes left after filtering
output[["raw_voom_ngenes"]] <- renderUI({
tryCatch({
- h2("Predicted after filtering:", br(), nrow(get_pre_voom()), "Genes")
+ h2("Predicted after filtering:",
+ br(),
+ nrow(get_pre_voom()),
+ "Genes")
}, error = function(err) {
return(NULL)
})
@@ -57,10 +64,12 @@ output[["selected_raw_voom"]] <- DT::renderDataTable({
tryCatch({
checkReload()
s <- event_data(event = "plotly_selected", source = "raw_voom")
- counts <- data.frame(get_raw_dge()$counts[!grepl('^__', rownames(get_raw_dge()$counts)),])
- DT::datatable(counts[unlist(s$key),], options = list(pageLength = 15, scrollX = TRUE))
+ counts <- data.frame(get_raw_dge()$counts[!grepl('^__', rownames(get_raw_dge()$counts)), ])
+ DT::datatable(counts[unlist(s$key), ], options = list(pageLength = 15, scrollX = TRUE))
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -77,8 +86,10 @@ output[["un_cluster_2d"]] <- renderPlotly({
## Set color of mds 2d
output[["group_raw_mds2d"]] <- renderUI({
tryCatch({
- selectInput("group_raw_mds2d", "Color by:",
- colnames(data_samples())
+ selectInput(
+ inputId = "group_raw_mds2d",
+ label = "Color by:",
+ choices = colnames(data_samples())
)
}, error = function(err) {
return(NULL)
@@ -90,10 +101,14 @@ output[["selected_raw_mds2d"]] <- DT::renderDataTable({
tryCatch({
checkReload()
s <- event_data(event = "plotly_selected", source = "raw_mds2d")
- if(is.null(s)){s <- ""}
- DT::datatable(data_samples()[unlist(s$key),, drop = FALSE], options = list(pageLength = 15, scrollX = TRUE))
+ if (is.null(s)) {
+ s <- ""
+ }
+ DT::datatable(data_samples()[unlist(s$key), , drop = FALSE], options = list(pageLength = 15, scrollX = TRUE))
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -111,8 +126,7 @@ output[["un_cluster_3d"]] <- renderPlotly({
output[["group_raw_mds3d"]] <- renderUI({
tryCatch({
selectInput("group_raw_mds3d", "Color by:",
- colnames(data_samples())
- )
+ colnames(data_samples()))
}, error = function(err) {
return(NULL)
})
@@ -121,21 +135,24 @@ output[["group_raw_mds3d"]] <- renderUI({
## INFORMATION BOXES
output[["dist_line_info"]] <- renderUI({
- infoText <- "The line plot shows the density of the log2CPM values per sample. The density shows the
+ infoText <-
+ "The line plot shows the density of the log2CPM values per sample. The density shows the
distribution of count values per sample and is used to determine big differences between
samples."
informationBox(infoText)
})
output[["dist_boxplot_info"]] <- renderUI({
- infoText <- "The box plot has a similar purpose, but the data can be viewed in a different
+ infoText <-
+ "The box plot has a similar purpose, but the data can be viewed in a different
format. The distribution can be seen between the Log2CPM at the corresponding
samples."
informationBox(infoText)
})
output[["raw_voom_plot_info"]] <- renderUI({
- infoText <- "The voom plot provides a check on the filtering, which is performed at the beginning of the
+ infoText <-
+ "The voom plot provides a check on the filtering, which is performed at the beginning of the
analysis. The method used to calculate this is 'voom'. Voom is an acronym for
mean-variance modeling at the observational level. This means that the mean-variance in
the data is calculated and gives each observation a certain weight. Problems during the
@@ -144,15 +161,17 @@ output[["raw_voom_plot_info"]] <- renderUI({
})
output[["un_cluster_2d_info"]] <- renderUI({
- infoText <- "This MDS plot (multidimensional scaling plot) can be viewed as a 2D plot with
- calculations of two dimensions. With the MDS plot distances between samples is
+ infoText <-
+ "This MDS plot (multidimensional scaling plot) can be viewed as a 2D plot with
+ calculations of two dimensions. With the MDS plot distances between samples is
shown, based on similarities and differences."
informationBox(infoText)
})
output[["un_cluster_3d_info"]] <- renderUI({
- infoText <- "This MDS plot (multidimensional scaling plot) can be viewed as a 3D plot with
- calculations of three dimensions. With the MDS plot distances between samples is
+ infoText <-
+ "This MDS plot (multidimensional scaling plot) can be viewed as a 3D plot with
+ calculations of three dimensions. With the MDS plot distances between samples is
shown, based on similarities and differences."
informationBox(infoText)
})
diff --git a/inst/src/tabs/raw_data/ui_raw.R b/inst/src/tabs/raw_data/ui_raw.R
index 5772bff..1f7980e 100644
--- a/inst/src/tabs/raw_data/ui_raw.R
+++ b/inst/src/tabs/raw_data/ui_raw.R
@@ -1,7 +1,7 @@
tab_raw_data <- tabItem(
tabName = "raw_data",
- align="center",
+ align = "center",
br(),
tabsetPanel(
@@ -13,8 +13,8 @@ tab_raw_data <- tabItem(
sidebarPanel(
width = 3,
uiOutput("dist_line_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("dist_line", height = "600px") %>% withSpinner()
@@ -31,8 +31,8 @@ tab_raw_data <- tabItem(
sidebarPanel(
width = 3,
uiOutput("dist_boxplot_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("dist_boxplot", height = "600px") %>% withSpinner()
@@ -48,12 +48,19 @@ tab_raw_data <- tabItem(
position = "right",
sidebarPanel(
width = 3,
- sliderInput("slider_raw_voom", "Set Log2CPM cutoff:", value = 1, min = 0, max = 10, step=0.1),
+ sliderInput(
+ inputId = "slider_raw_voom",
+ label = "Set Log2CPM cutoff:",
+ value = 1,
+ min = 0,
+ max = 10,
+ step = 0.1
+ ),
uiOutput("raw_voom_ngenes"),
br(),
uiOutput("raw_voom_plot_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("raw_voom_plot", height = "600px") %>% withSpinner()
@@ -74,8 +81,8 @@ tab_raw_data <- tabItem(
uiOutput("group_raw_mds2d"),
br(),
uiOutput("un_cluster_2d_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("un_cluster_2d", height = "600px") %>% withSpinner()
@@ -96,8 +103,8 @@ tab_raw_data <- tabItem(
uiOutput("group_raw_mds3d"),
br(),
uiOutput("un_cluster_3d_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("un_cluster_3d", height = "600px") %>% withSpinner()
diff --git a/inst/src/tabs/run_analysis/svr_run.R b/inst/src/tabs/run_analysis/svr_run.R
index 4a5770e..359fb8f 100644
--- a/inst/src/tabs/run_analysis/svr_run.R
+++ b/inst/src/tabs/run_analysis/svr_run.R
@@ -2,17 +2,17 @@
## Start an analysis
observeEvent(input$run_button, {
if (!is.null(preMarkdownChecks())) {
- showNotification(ui = preMarkdownChecks(), duration = 5, type = "error")
+ showNotification(ui = preMarkdownChecks(),
+ duration = 5,
+ type = "error")
return(NULL)
}
- showModal(
- modalDialog(
- h1("Analysis is running..."),
- img(src="loading.gif", width = "50%"),
- footer=NULL
- )
- )
+ showModal(modalDialog(
+ h1("Analysis is running..."),
+ img(src = "loading.gif", width = "50%"),
+ footer = NULL
+ ))
results <- tryCatch({
rmarkdown::render(
@@ -28,20 +28,26 @@ observeEvent(input$run_button, {
design_value = input$design_value,
matrix_v1 = input$matrix_val1,
matrix_v2 = input$matrix_val2,
- alpha = input$alpha_value),
+ alpha = input$alpha_value
+ ),
output_file = paste0(input$analysis_method, '.html')
)
- load("markdown/analysis.RData", envir=.GlobalEnv)
+ load("markdown/analysis.RData", envir = .GlobalEnv)
inUse_deTab <<- deTab
inUse_normDge <<- normDge
- showNotification(ui = "Analysis has been succesful!", duration = 5, type = "message")
+ showNotification(ui = "Analysis has been succesful!",
+ duration = 5,
+ type = "message")
}, error = function(err) {
- showNotification(ui = "The analysis failed with an error!", duration = 5, type = "error")
- showNotification(ui = as.character(err), duration = 10, type = "error")
+ showNotification(ui = "The analysis failed with an error!",
+ duration = 5,
+ type = "error")
+ showNotification(ui = as.character(err),
+ duration = 10,
+ type = "error")
print(err)
return(NULL)
- }
- )
+ })
removeModal()
}, ignoreInit = TRUE)
@@ -51,7 +57,7 @@ preMarkdownChecks <- reactive ({
return("Wrong analysis mode!")
} else if (is.null(input$matrix_val1) | is.null(input$matrix_val2)) {
return("One of the contrast is empty!")
- } else if (paste(input$matrix_val1, collapse="") == paste(input$matrix_val2, collapse="")) {
+ } else if (paste0(input$matrix_val1) == paste0(input$matrix_val2)) {
return("Contrasts cant be the same!")
} else if (!is.null(input$setGeneName)) {
if (input$setGeneName == "symbol" & !("geneName" %in% colnames(data_annotation()))) {
@@ -64,10 +70,14 @@ preMarkdownChecks <- reactive ({
## Render base column for design
output[["design_base"]] <- renderUI({
tryCatch({
- if (is.null(input$file_samples)){return(NULL)}
+ if (is.null(input$file_samples)) {
+ return(NULL)
+ }
- selectInput("design_base", "Select base column for comparison:",
- colnames(data_samples())
+ selectInput(
+ inputId = "design_base",
+ label = "Select base column for comparison:",
+ choices = colnames(data_samples())
)
}, error = function(err) {
return(NULL)
@@ -77,19 +87,25 @@ output[["design_base"]] <- renderUI({
## Render nested design values
output[["design_value"]] <- renderUI({
tryCatch({
- if (is.null(input$design_base)){return(NULL)}
- if (input$design_type == "basic"){
- checkboxGroupInput("design_value",
- "",
- choices = character(0),
- inline = TRUE
+ if (is.null(input$design_base)) {
+ return(NULL)
+ }
+ if (input$design_type == "basic") {
+ checkboxGroupInput(
+ inputId = "design_value",
+ label = "",
+ choices = character(0),
+ inline = TRUE
)
} else {
- showNotification(ui = "WARNING: This type of analysis is 'more advanced'! Make sure you know what you are doing!", duration = 5, type = "warning")
- checkboxGroupInput("design_value",
- "Select nested columns, relative to base column:",
- choices = colnames(data_samples())[!colnames(data_samples()) %in% input$design_base],
- inline = TRUE
+ showNotification(ui = "WARNING: This type of analysis is 'more advanced'! Make sure you know what you are doing!",
+ duration = 5,
+ type = "warning")
+ checkboxGroupInput(
+ inputId = "design_value",
+ label = "Select nested columns, relative to base column:",
+ choices = colnames(data_samples())[!colnames(data_samples()) %in% input$design_base],
+ inline = TRUE
)
}
}, error = function(err) {
@@ -104,20 +120,12 @@ AllInputs <- reactive({
## Show matrix selectizes in current mode
output[["matrix"]] <- renderUI({
- fluidRow(
- column(
- width = 5,
- uiOutput("matrix_value1")
- ),
- column(
- width = 2,
- h2("VS")
- ),
- column(
- width = 5,
- uiOutput("matrix_value2")
- )
- )
+ fluidRow(column(width = 5,
+ uiOutput("matrix_value1")),
+ column(width = 2,
+ h2("VS")),
+ column(width = 5,
+ uiOutput("matrix_value2")))
})
## Select items for left matrix
@@ -125,11 +133,12 @@ output[["matrix_value1"]] <- renderUI({
tryCatch({
columns <- c(input$design_base, input$design_value)
- selectInput(inputId = "matrix_val1",
- label = "Select values for comparison:",
- multiple = TRUE,
- selected = AllInputs()[["matrix_val1"]],
- choices = c("(Treatment)" = "", unique(data_samples()[columns]))
+ selectInput(
+ inputId = "matrix_val1",
+ label = "Select values for comparison:",
+ multiple = TRUE,
+ selected = AllInputs()[["matrix_val1"]],
+ choices = c("(Treatment)" = "", unique(data_samples()[columns]))
)
}, error = function(err) {
return(NULL)
@@ -141,11 +150,12 @@ output[["matrix_value2"]] <- renderUI({
tryCatch({
columns <- c(input$design_base, input$design_value)
- selectInput(inputId = "matrix_val2",
- label = "Select values for comparison:",
- multiple = TRUE,
- selected = AllInputs()[["matrix_val2"]],
- choices = c("(Control)" = "", unique(data_samples()[columns]))
+ selectInput(
+ inputId = "matrix_val2",
+ label = "Select values for comparison:",
+ multiple = TRUE,
+ selected = AllInputs()[["matrix_val2"]],
+ choices = c("(Control)" = "", unique(data_samples()[columns]))
)
}, error = function(err) {
return(NULL)
@@ -155,7 +165,14 @@ output[["matrix_value2"]] <- renderUI({
## Show the current design in use
output[["show_design"]] <- renderUI({
tryCatch({
- design <- createDesign(data_samples(), input$design_base, input$design_value, input$matrix_val1, input$matrix_val2)
+ design <-
+ createDesign(
+ data_samples(),
+ input$design_base,
+ input$design_value,
+ input$matrix_val1,
+ input$matrix_val2
+ )
design <- gsub("\\+", " + ", design)
if (design == "~" | design == "~0 + ") {
design <- "No values selected"
@@ -204,7 +221,8 @@ output[["show_matrix"]] <- renderUI({
total_matrix2 <- "No values selected"
}
- total_matrix <- paste(total_matrix1, total_matrix2, sep = " VS ")
+ total_matrix <-
+ paste(total_matrix1, total_matrix2, sep = " VS ")
}, error = function(err) {
return("No values selected VS No values selected")
})
@@ -239,10 +257,12 @@ output[["setGeneName"]] <- renderUI({
return(NULL)
}
- radioButtons("setGeneName", "Use gene ID or gene symbols:",
- inline = TRUE,
- c("Gene ID" = "id",
- "Gene Symbol" = "symbol")
+ radioButtons(
+ inputId = "setGeneName",
+ label = "Use gene ID or gene symbols:",
+ inline = TRUE,
+ choices = c("Gene ID" = "id",
+ "Gene Symbol" = "symbol")
)
}, error = function(err) {
return(NULL)
diff --git a/inst/src/tabs/run_analysis/ui_run.R b/inst/src/tabs/run_analysis/ui_run.R
index 37e6964..d615ad5 100644
--- a/inst/src/tabs/run_analysis/ui_run.R
+++ b/inst/src/tabs/run_analysis/ui_run.R
@@ -1,7 +1,7 @@
tab_run_analysis <- tabItem(
tabName = "run_analysis",
- align="center",
+ align = "center",
br(),
h2("Settings"),
@@ -11,55 +11,65 @@ tab_run_analysis <- tabItem(
column(
width = 6,
radioButtons(
- "analysis_method",
- "Choose analysis method:",
+ inputId = "analysis_method",
+ label = "Choose analysis method:",
inline = TRUE,
selected = "analysisEdgeR",
- c("Limma/Voom" = "analysisLimma",
+ choices = c(
+ "Limma/Voom" = "analysisLimma",
"EdgeR" = "analysisEdgeR",
- "DESeq2" = "analysisDESeq2")
- ),
+ "DESeq2" = "analysisDESeq2"
+ )
+ ),
br(),
- sliderInput("alpha_value", "Set FDR cutoff (adjusted P-Value):", value = 0.05, min = 0.01, max = 1, step=0.01),
- sliderInput("cpm_value", "Set Log2CPM cutoff:", value = 1, min = 0, max = 10, step=0.1)
+ sliderInput(
+ inputId = "alpha_value",
+ label = "Set FDR cutoff (adjusted P-Value):",
+ value = 0.05,
+ min = 0.01,
+ max = 1,
+ step = 0.01
+ ),
+ sliderInput(
+ inputId = "cpm_value",
+ label = "Set Log2CPM cutoff:",
+ value = 1,
+ min = 0,
+ max = 10,
+ step = 0.1
+ )
),
column(
width = 6,
uiOutput("design_base"),
radioButtons(
- "design_type",
- "",
+ inputId = "design_type",
+ label = "",
inline = TRUE,
- c("Basic design" = "basic",
- "Advanced design" = "advanced")
- ),
+ choices = c("Basic design" = "basic",
+ "Advanced design" = "advanced")
+ ),
uiOutput("design_value"),
uiOutput("matrix")
)
),
br(),
- fluidRow(
- column(
- width = 6,
- h4("Current design in use:"),
- div(
- br(),
+ fluidRow(column(
+ width = 6,
+ h4("Current design in use:"),
+ div(br(),
uiOutput("show_design"),
br(),
- style = "background-color: #f5f5f5; border: 1px solid #e3e3e3; width: 90%"
- )
- ),
- column(
- width = 6,
- h4("Find genes that respond to:"),
- div(
- br(),
+ style = "background-color: #f5f5f5; border: 1px solid #e3e3e3; width: 90%")
+ ),
+ column(
+ width = 6,
+ h4("Find genes that respond to:"),
+ div(br(),
uiOutput("show_matrix"),
br(),
- style = "background-color: #f5f5f5; border: 1px solid #e3e3e3; width: 90%"
- )
- )
- ),
+ style = "background-color: #f5f5f5; border: 1px solid #e3e3e3; width: 90%")
+ )),
HTML('
'),
uiOutput("excludeSamples"),
@@ -67,10 +77,8 @@ tab_run_analysis <- tabItem(
HTML('
'),
- actionButton(
- "run_button",
- "Run Analysis"
- ),
+ actionButton(inputId = "run_button",
+ label = "Run Analysis"),
br()
)
diff --git a/inst/src/tabs/upload/svr_upload.R b/inst/src/tabs/upload/svr_upload.R
index 5b7291f..cb1481b 100644
--- a/inst/src/tabs/upload/svr_upload.R
+++ b/inst/src/tabs/upload/svr_upload.R
@@ -2,9 +2,15 @@
## Change application mode New <-> View
observeEvent(input$app_mode, {
if (input$app_mode == "new") {
- showNotification(ui = "New analysis mode selected!", duration = 3, type = "message")
- runjs('$("#show_view_analysis").css({"border-radius": "25px","border": "3px solid rgba(0,0,0,0)"});')
- runjs('$("#show_new_analysis").css({"border-radius": "25px", "border": "3px solid #0088cc"});')
+ showNotification(ui = "New analysis mode selected!",
+ duration = 3,
+ type = "message")
+ runjs(
+ '$("#show_view_analysis").css({"border-radius": "25px","border": "3px solid rgba(0,0,0,0)"});'
+ )
+ runjs(
+ '$("#show_new_analysis").css({"border-radius": "25px", "border": "3px solid #0088cc"});'
+ )
tryCatch({
if (exists("normDge")) {
inUse_normDge <<- normDge
@@ -20,9 +26,15 @@ observeEvent(input$app_mode, {
return(NULL)
})
} else {
- showNotification(ui = "View analysis mode selected!", duration = 3, type = "message")
- runjs('$("#show_new_analysis").css({"border-radius": "25px", "border": "3px solid rgba(0,0,0,0)"});')
- runjs('$("#show_view_analysis").css({"border-radius": "25px", "border": "3px solid #0088cc"});')
+ showNotification(ui = "View analysis mode selected!",
+ duration = 3,
+ type = "message")
+ runjs(
+ '$("#show_new_analysis").css({"border-radius": "25px", "border": "3px solid rgba(0,0,0,0)"});'
+ )
+ runjs(
+ '$("#show_view_analysis").css({"border-radius": "25px", "border": "3px solid #0088cc"});'
+ )
inUse_normDge <<- get_normDge()
inUse_deTab <<- data_detab()
}
@@ -39,17 +51,43 @@ observeEvent(input$app_mode, {
## Read sample data file
data_samples <- reactive({
if (input$app_mode == "new") {
- if (is.null(input$file_samples$datapath)){return(NULL)}
- data_samples <- read.csv(input$file_samples$datapath, row.names=1, header = TRUE, sep = "\t", check.names = FALSE)
+ if (is.null(input$file_samples$datapath)) {
+ return(NULL)
+ }
+ data_samples <- read.csv(
+ input$file_samples$datapath,
+ row.names = 1,
+ header = TRUE,
+ sep = "\t",
+ check.names = FALSE
+ )
if (ncol(data_samples) < 1) {
- data_samples <- read.csv(input$file_samples$datapath, row.names=1, header = TRUE, check.names = FALSE)
+ data_samples <- read.csv(
+ input$file_samples$datapath,
+ row.names = 1,
+ header = TRUE,
+ check.names = FALSE
+ )
}
}
if (input$app_mode == "view") {
- if (is.null(input$file_samples_view$datapath)){return(NULL)}
- data_samples <- read.csv(input$file_samples_view$datapath, row.names=1, header = TRUE, sep = "\t", check.names = FALSE)
+ if (is.null(input$file_samples_view$datapath)) {
+ return(NULL)
+ }
+ data_samples <- read.csv(
+ input$file_samples_view$datapath,
+ row.names = 1,
+ header = TRUE,
+ sep = "\t",
+ check.names = FALSE
+ )
if (ncol(data_samples) < 1) {
- data_samples <- read.csv(input$file_samples_view$datapath, row.names=1, header = TRUE, check.names = FALSE)
+ data_samples <- read.csv(
+ input$file_samples_view$datapath,
+ row.names = 1,
+ header = TRUE,
+ check.names = FALSE
+ )
}
}
data_samples
@@ -58,17 +96,43 @@ data_samples <- reactive({
## Read count data file
data_counts <- reactive({
if (input$app_mode == "new") {
- if (is.null(input$file_counts$datapath)){return(NULL)}
- data_counts <- read.csv(input$file_counts$datapath, row.names=1, header = TRUE, sep = "\t", check.names = FALSE)
+ if (is.null(input$file_counts$datapath)) {
+ return(NULL)
+ }
+ data_counts <- read.csv(
+ input$file_counts$datapath,
+ row.names = 1,
+ header = TRUE,
+ sep = "\t",
+ check.names = FALSE
+ )
if (ncol(data_counts) < 1) {
- data_counts <- read.csv(input$file_counts$datapath, row.names=1, header = TRUE, check.names = FALSE)
+ data_counts <- read.csv(
+ input$file_counts$datapath,
+ row.names = 1,
+ header = TRUE,
+ check.names = FALSE
+ )
}
}
if (input$app_mode == "view") {
- if (is.null(input$file_counts_view$datapath)){return(NULL)}
- data_counts <- read.csv(input$file_counts_view$datapath, row.names=1, header = TRUE, sep = "\t", check.names = FALSE)
+ if (is.null(input$file_counts_view$datapath)) {
+ return(NULL)
+ }
+ data_counts <- read.csv(
+ input$file_counts_view$datapath,
+ row.names = 1,
+ header = TRUE,
+ sep = "\t",
+ check.names = FALSE
+ )
if (ncol(data_counts) < 1) {
- data_counts <- read.csv(input$file_counts_view$datapath, row.names=1, header = TRUE, check.names = FALSE)
+ data_counts <- read.csv(
+ input$file_counts_view$datapath,
+ row.names = 1,
+ header = TRUE,
+ check.names = FALSE
+ )
}
}
data_counts
@@ -76,30 +140,69 @@ data_counts <- reactive({
## Read annotation data file
data_annotation <- reactive({
- if (is.null(input$file_annotation$datapath)){return(NULL)}
- data_annotation <- read.csv(input$file_annotation$datapath, row.names=1, header = TRUE, sep = "\t", check.names = FALSE)
+ if (is.null(input$file_annotation$datapath)) {
+ return(NULL)
+ }
+ data_annotation <- read.csv(
+ input$file_annotation$datapath,
+ row.names = 1,
+ header = TRUE,
+ sep = "\t",
+ check.names = FALSE
+ )
if (ncol(data_annotation) < 1) {
- data_annotation <- read.csv(input$file_annotation$datapath, row.names=1, header = TRUE, check.names = FALSE)
+ data_annotation <- read.csv(
+ input$file_annotation$datapath,
+ row.names = 1,
+ header = TRUE,
+ check.names = FALSE
+ )
}
data_annotation
})
## Read normalized data file
data_norm <- reactive({
- if (is.null(input$file_norm_view$datapath)){return(NULL)}
- data_norm <- read.csv(input$file_norm_view$datapath, row.names=1, header = TRUE, sep = "\t", check.names = FALSE)
+ if (is.null(input$file_norm_view$datapath)) {
+ return(NULL)
+ }
+ data_norm <- read.csv(
+ input$file_norm_view$datapath,
+ row.names = 1,
+ header = TRUE,
+ sep = "\t",
+ check.names = FALSE
+ )
if (ncol(data_norm) < 1) {
- data_norm <- read.csv(input$file_norm_view$datapath, row.names=1, header = TRUE, check.names = FALSE)
+ data_norm <- read.csv(
+ input$file_norm_view$datapath,
+ row.names = 1,
+ header = TRUE,
+ check.names = FALSE
+ )
}
data_norm
})
## Read detab data file
data_detab <- reactive({
- if (is.null(input$file_detab_view$datapath)){return(NULL)}
- data_detab <- read.csv(input$file_detab_view$datapath, row.names=1, header = TRUE, sep = "\t", check.names = FALSE)
+ if (is.null(input$file_detab_view$datapath)) {
+ return(NULL)
+ }
+ data_detab <- read.csv(
+ input$file_detab_view$datapath,
+ row.names = 1,
+ header = TRUE,
+ sep = "\t",
+ check.names = FALSE
+ )
if (ncol(data_detab) < 1) {
- data_detab <- read.csv(input$file_detab_view$datapath, row.names=1, header = TRUE, check.names = FALSE)
+ data_detab <- read.csv(
+ input$file_detab_view$datapath,
+ row.names = 1,
+ header = TRUE,
+ check.names = FALSE
+ )
}
data_detab
})
@@ -119,11 +222,10 @@ get_normDge <- reactive({
temp$counts <- log2(temp$counts)
return(temp)
}, error = function(err) {
- temp <- DGEList(counts = 2^(assay(se)), samples = colData(se))
+ temp <- DGEList(counts = 2 ^ (assay(se)), samples = colData(se))
temp$counts <- log2(temp$counts)
return(temp)
- }
- )
+ })
normDge
}, error = function(err) {
return(NULL)
@@ -133,15 +235,17 @@ get_normDge <- reactive({
## Create raw dge from raw count table
get_raw_dge <- reactive({
data_counts <- data_counts()
- data_counts <- data_counts[!grepl('^__', rownames(data_counts)),]
+ data_counts <- data_counts[!grepl('^__', rownames(data_counts)), ]
se <- readCountsFromTable(data_counts,
data_samples())
se <- addSamplesFromTableToSE(se, data_samples())
if (!is.null(data_annotation())) {
se <- addAnnotationsFromTableToSE(se, data_annotation())
}
- dge <- DGEList(counts = assay(se), samples = colData(se), genes = rowData(se))
- dge <- dge[ rowSums( abs( dge$counts ) ) > 1, ]
+ dge <- DGEList(counts = assay(se),
+ samples = colData(se),
+ genes = rowData(se))
+ dge <- dge[rowSums(abs(dge$counts)) > 1,]
dge$counts <- cpm(dge, log = TRUE)
dge
})
@@ -155,7 +259,9 @@ output[["sample_data"]] <- DT::renderDataTable({
tryCatch({
DT::datatable(data_samples(), options = list(pageLength = 50, scrollX = TRUE))
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -164,7 +270,9 @@ output[["count_data"]] <- DT::renderDataTable({
tryCatch({
DT::datatable(data_counts(), options = list(pageLength = 50, scrollX = TRUE))
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -173,7 +281,9 @@ output[["annotation_data"]] <- DT::renderDataTable({
tryCatch({
DT::datatable(data_annotation(), options = list(pageLength = 50, scrollX = TRUE))
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -186,7 +296,9 @@ output[["sample_data_view"]] <- DT::renderDataTable({
tryCatch({
DT::datatable(data_samples(), options = list(pageLength = 50, scrollX = TRUE))
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -195,7 +307,9 @@ output[["count_data_view"]] <- DT::renderDataTable({
tryCatch({
DT::datatable(data_counts(), options = list(pageLength = 50, scrollX = TRUE))
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -204,7 +318,9 @@ output[["norm_data_view"]] <- DT::renderDataTable({
tryCatch({
DT::datatable(data_norm(), options = list(pageLength = 50, scrollX = TRUE))
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
@@ -213,6 +329,8 @@ output[["detab_data_view"]] <- DT::renderDataTable({
tryCatch({
DT::datatable(data_detab(), options = list(pageLength = 50, scrollX = TRUE))
}, error = function(err) {
- return(DT::datatable(data.frame(c("No data available in table")), rownames = FALSE, colnames = ""))
+ return(DT::datatable(data.frame(c(
+ "No data available in table"
+ )), rownames = FALSE, colnames = ""))
})
})
diff --git a/inst/src/tabs/upload/ui_upload.R b/inst/src/tabs/upload/ui_upload.R
index e194fe4..90d2fcc 100644
--- a/inst/src/tabs/upload/ui_upload.R
+++ b/inst/src/tabs/upload/ui_upload.R
@@ -1,120 +1,219 @@
tab_upload <- tabItem(
tabName = "upload",
- align="center",
+ align = "center",
br(),
radioButtons(
inputId = "app_mode",
label = "Set analysis mode",
inline = TRUE,
- c("New analysis" = "new",
- "View analysis" = "view")
- ),
+ choices = c("New analysis" = "new",
+ "View analysis" = "view")
+ ),
- fluidRow(
- column(
- width = 6,
- div(
- id = "show_new_analysis",
- br(),br(),br(),
- fileInput("file_samples", "Choose your samples (metadata) file:",
- multiple = FALSE,
- accept = c("CSV", ".csv", "TSV", ".tsv", "TXT", ".txt", "ZIP", ".zip", "GZ", ".gz")),
- fileInput("file_counts", "Choose your raw counts file:",
- multiple = FALSE,
- accept = c("CSV", ".csv", "TSV", ".tsv", "TXT", ".txt", "ZIP", ".zip", "GZ", ".gz")),
- fileInput("file_annotation", "Choose your annotation file:",
- multiple = FALSE,
- accept = c("CSV", ".csv", "TSV", ".tsv", "TXT", ".txt", "ZIP", ".zip", "GZ", ".gz")),
- br(),br(),br(),
- style="position: relative; border-radius: 25px; border: 3px solid #0088cc;",
- hidden(
- div(
- id = "hide_new_analysis",
- style="background-color: rgba(0,0,0,0.5); border-radius: 25px; position: absolute; width: 100%; height: 100%; top: 0; z-index: 10;"
- )
+ fluidRow(column(
+ width = 6,
+ div(
+ id = "show_new_analysis",
+ br(),
+ br(),
+ br(),
+ fileInput(
+ inputId = "file_samples",
+ label = "Choose your samples (metadata) file:",
+ multiple = FALSE,
+ accept = c(
+ "CSV",
+ ".csv",
+ "TSV",
+ ".tsv",
+ "TXT",
+ ".txt",
+ "ZIP",
+ ".zip",
+ "GZ",
+ ".gz"
)
- )
- ),
- column(
- width = 6,
- div(
- id = "show_view_analysis",
- br(),
- fileInput("file_samples_view", "Choose your samples (metadata) file:",
- multiple = FALSE,
- accept = c("CSV", ".csv", "TSV", ".tsv", "TXT", ".txt", "ZIP", ".zip", "GZ", ".gz")),
- fileInput("file_counts_view", "Choose your raw counts file:",
- multiple = FALSE,
- accept = c("CSV", ".csv", "TSV", ".tsv", "TXT", ".txt", "ZIP", ".zip", "GZ", ".gz")),
- fileInput("file_norm_view", "Choose your normalized counts file:",
- multiple = FALSE,
- accept = c("CSV", ".csv", "TSV", ".tsv", "TXT", ".txt", "ZIP", ".zip", "GZ", ".gz")),
- fileInput("file_detab_view", "Choose your DE file:",
- multiple = FALSE,
- accept = c("CSV", ".csv", "TSV", ".tsv", "TXT", ".txt", "ZIP", ".zip", "GZ", ".gz")),
- style="position: relative; border: 3px solid rgba(0,0,0,0)",
- div(
- id = "hide_view_analysis",
- style="background-color: rgba(0,0,0,0.5); border-radius: 25px; position: absolute; width: 100%; height: 100%; top: 0; z-index: 10;"
+ ),
+ fileInput(
+ inputId = "file_counts",
+ label = "Choose your raw counts file:",
+ multiple = FALSE,
+ accept = c(
+ "CSV",
+ ".csv",
+ "TSV",
+ ".tsv",
+ "TXT",
+ ".txt",
+ "ZIP",
+ ".zip",
+ "GZ",
+ ".gz"
+ )
+ ),
+ fileInput(
+ inputId = "file_annotation",
+ label = "Choose your annotation file:",
+ multiple = FALSE,
+ accept = c(
+ "CSV",
+ ".csv",
+ "TSV",
+ ".tsv",
+ "TXT",
+ ".txt",
+ "ZIP",
+ ".zip",
+ "GZ",
+ ".gz"
)
+ ),
+ br(),
+ br(),
+ br(),
+ style = "position: relative; border-radius: 25px; border: 3px solid #0088cc;",
+ hidden(
+ div(id = "hide_new_analysis",
+ style = "background-color: rgba(0,0,0,0.5); border-radius: 25px; position: absolute; width: 100%; height: 100%; top: 0; z-index: 10;")
)
)
),
-
- br(),
- div(
- id="new_tabs",
- tabsetPanel(
- tabPanel("Samples",
- HTML('
'),
- DT::dataTableOutput("sample_data") %>% withSpinner(),
- HTML('
')
+ column(
+ width = 6,
+ div(
+ id = "show_view_analysis",
+ br(),
+ fileInput(
+ inputId = "file_samples_view",
+ label = "Choose your samples (metadata) file:",
+ multiple = FALSE,
+ accept = c(
+ "CSV",
+ ".csv",
+ "TSV",
+ ".tsv",
+ "TXT",
+ ".txt",
+ "ZIP",
+ ".zip",
+ "GZ",
+ ".gz"
+ )
),
-
- tabPanel("Counts",
- HTML('
'),
- DT::dataTableOutput("count_data") %>% withSpinner(),
- HTML('
')
+ fileInput(
+ inputId = "file_counts_view",
+ label = "Choose your raw counts file:",
+ multiple = FALSE,
+ accept = c(
+ "CSV",
+ ".csv",
+ "TSV",
+ ".tsv",
+ "TXT",
+ ".txt",
+ "ZIP",
+ ".zip",
+ "GZ",
+ ".gz"
+ )
),
-
- tabPanel("Annotation",
- HTML('
'),
- DT::dataTableOutput("annotation_data") %>% withSpinner(),
- HTML('
')
- )
+ fileInput(
+ inputId = "file_norm_view",
+ label = "Choose your normalized counts file:",
+ multiple = FALSE,
+ accept = c(
+ "CSV",
+ ".csv",
+ "TSV",
+ ".tsv",
+ "TXT",
+ ".txt",
+ "ZIP",
+ ".zip",
+ "GZ",
+ ".gz"
+ )
+ ),
+ fileInput(
+ inputId = "file_detab_view",
+ label = "Choose your DE file:",
+ multiple = FALSE,
+ accept = c(
+ "CSV",
+ ".csv",
+ "TSV",
+ ".tsv",
+ "TXT",
+ ".txt",
+ "ZIP",
+ ".zip",
+ "GZ",
+ ".gz"
+ )
+ ),
+ style = "position: relative; border: 3px solid rgba(0,0,0,0)",
+ div(id = "hide_view_analysis",
+ style = "background-color: rgba(0,0,0,0.5); border-radius: 25px; position: absolute; width: 100%; height: 100%; top: 0; z-index: 10;")
)
- ),
+ )),
- hidden(
- div(
- id="view_tabs",
+ br(),
+ div(id = "new_tabs",
tabsetPanel(
- tabPanel("Samples",
- HTML('
'),
- DT::dataTableOutput("sample_data_view") %>% withSpinner(),
- HTML('
')
- ),
-
- tabPanel("Counts",
- HTML('
'),
- DT::dataTableOutput("count_data_view") %>% withSpinner(),
- HTML('
')
+ tabPanel(
+ "Samples",
+ HTML('
'),
+ DT::dataTableOutput("sample_data") %>% withSpinner(),
+ HTML('
')
),
- tabPanel("Normalized Counts",
- HTML('
'),
- DT::dataTableOutput("norm_data_view") %>% withSpinner(),
- HTML('
')
+ tabPanel(
+ "Counts",
+ HTML('
'),
+ DT::dataTableOutput("count_data") %>% withSpinner(),
+ HTML('
')
),
- tabPanel("DE table",
- HTML('
'),
- DT::dataTableOutput("detab_data_view") %>% withSpinner(),
- HTML('
')
+ tabPanel(
+ "Annotation",
+ HTML('
'),
+ DT::dataTableOutput("annotation_data") %>% withSpinner(),
+ HTML('
')
)
+ )),
+
+ hidden(div(
+ id = "view_tabs",
+ tabsetPanel(
+ tabPanel(
+ "Samples",
+ HTML('
'),
+ DT::dataTableOutput("sample_data_view") %>% withSpinner(),
+ HTML('
')
+ ),
+
+ tabPanel(
+ "Counts",
+ HTML('
'),
+ DT::dataTableOutput("count_data_view") %>% withSpinner(),
+ HTML('
')
+ ),
+
+ tabPanel(
+ "Normalized Counts",
+ HTML('
'),
+ DT::dataTableOutput("norm_data_view") %>% withSpinner(),
+ HTML('
')
+ ),
+
+ tabPanel(
+ "DE table",
+ HTML('
'),
+ DT::dataTableOutput("detab_data_view") %>% withSpinner(),
+ HTML('
')
)
)
- )
+ ))
)
diff --git a/inst/src/tabs/wgcna/svr_wgcna.R b/inst/src/tabs/wgcna/svr_wgcna.R
index b5038e4..561109d 100644
--- a/inst/src/tabs/wgcna/svr_wgcna.R
+++ b/inst/src/tabs/wgcna/svr_wgcna.R
@@ -14,8 +14,10 @@ output[["wgcna_sample_tree"]] <- renderPlotly({
## Set color of sample dendrogram
output[["color_wgcna_tree"]] <- renderUI({
tryCatch({
- selectInput("color_wgcna_tree", "Color by:",
- colnames(data_samples())
+ selectInput(
+ inputId = "color_wgcna_tree",
+ label = "Color by:",
+ choices = colnames(data_samples())
)
}, error = function(err) {
return(NULL)
@@ -51,25 +53,31 @@ output[["wgcna_power_plot"]] <- renderPlotly({
## Calculate power values with soft threshold
get_power <- reactive({
- showModal(
- modalDialog(
- h1("Running soft threshold calculations..."),
- h4("This can take a while..."),
- img(src="loading.gif", width = "50%"),
- footer=NULL
- )
- )
+ showModal(modalDialog(
+ h1("Running soft threshold calculations..."),
+ h4("This can take a while..."),
+ img(src = "loading.gif", width = "50%"),
+ footer = NULL
+ ))
tryCatch({
powers <- c(c(1:input$power_numberOf))
- soft <- pickSoftThreshold(t(inUse_normDge$counts), powerVector = powers, verbose = 2)
+ soft <- pickSoftThreshold(t(inUse_normDge$counts),
+ powerVector = powers,
+ verbose = 2)
removeModal()
- showNotification(ui = "Power calculations has been succesful!", duration = 5, type = "message")
+ showNotification(ui = "Power calculations has been succesful!",
+ duration = 5,
+ type = "message")
soft
}, error = function(err) {
removeModal()
- showNotification(ui = "Power calculations failed with an error!", duration = 5, type = "error")
- showNotification(ui = as.character(err), duration = 10, type = "error")
+ showNotification(ui = "Power calculations failed with an error!",
+ duration = 5,
+ type = "error")
+ showNotification(ui = as.character(err),
+ duration = 10,
+ type = "error")
print(err)
return(NULL)
})
@@ -86,11 +94,9 @@ output[["wgcna_dendro_gene_module"]] <- renderPlotly({
p1 <- plotly_dendrogram(geneTree, NULL, dynamicColors)
p2 <- plot_modules(dynamicColors)
- subplot(
- list(p1, p2),
- nrows = 2,
- heights = c(0.9, 0.1)
- ) %>%
+ subplot(list(p1, p2),
+ nrows = 2,
+ heights = c(0.9, 0.1)) %>%
config(
toImageButtonOptions = list(
format = "png",
@@ -113,7 +119,14 @@ output[["wgcna_number_genes"]] <- renderUI({
if (max_genes > 5000) {
max_genes <- 5000
}
- sliderInput("wgcna_number_genes", "Number of genes", 1000, min = 10, max = max_genes, step = 10)
+ sliderInput(
+ inputId = "wgcna_number_genes",
+ label = "Number of genes",
+ value = 1000,
+ min = 10,
+ max = max_genes,
+ step = 10
+ )
}, error = function(err) {
return(NULL)
})
@@ -121,14 +134,12 @@ output[["wgcna_number_genes"]] <- renderUI({
## Calculate TOMsimilarityFromExpr most variable MANUALLY
get_TOM_manual <- reactive({
- showModal(
- modalDialog(
- h1("Running TOM calculations..."),
- h4("This can take a while..."),
- img(src="loading.gif", width = "50%"),
- footer=NULL
- )
- )
+ showModal(modalDialog(
+ h1("Running TOM calculations..."),
+ h4("This can take a while..."),
+ img(src = "loading.gif", width = "50%"),
+ footer = NULL
+ ))
tryCatch({
if (is.null(input$wgcna_number_genes)) {
@@ -139,22 +150,35 @@ get_TOM_manual <- reactive({
lcpm <- inUse_normDge$counts
var_genes <- apply(lcpm, 1, var)
- select_var <- names(sort(var_genes, decreasing=TRUE))[1:amount]
- high_var_cpm <- as.data.frame(lcpm[select_var,])
+ select_var <- names(sort(var_genes, decreasing = TRUE))[1:amount]
+ high_var_cpm <- as.data.frame(lcpm[select_var, ])
SubGeneNames <- rownames(high_var_cpm)
- adjacency <- adjacency(t(high_var_cpm), type = "signed", power = input$module_power)
- TOM <- TOMsimilarityFromExpr(adjacency, networkType = "signed", TOMType = "signed", power = input$module_power)
+ adjacency <- adjacency(t(high_var_cpm),
+ type = "signed",
+ power = input$module_power)
+ TOM <- TOMsimilarityFromExpr(
+ adjacency,
+ networkType = "signed",
+ TOMType = "signed",
+ power = input$module_power
+ )
colnames(TOM) <- rownames(TOM) <- SubGeneNames
- dissTOM <- 1-TOM
+ dissTOM <- 1 - TOM
removeModal()
- showNotification(ui = "TOM calculations has been succesful!", duration = 5, type = "message")
+ showNotification(ui = "TOM calculations has been succesful!",
+ duration = 5,
+ type = "message")
dissTOM
}, error = function(err) {
removeModal()
- showNotification(ui = "TOM calculations failed with an error!", duration = 5, type = "error")
- showNotification(ui = as.character(err), duration = 10, type = "error")
+ showNotification(ui = "TOM calculations failed with an error!",
+ duration = 5,
+ type = "error")
+ showNotification(ui = as.character(err),
+ duration = 10,
+ type = "error")
print(err)
return(NULL)
})
@@ -162,29 +186,39 @@ get_TOM_manual <- reactive({
## Calculate TOMsimilarityFromExpr in blocks AUTOMATIC (Not available atm)
get_TOM_auto <- reactive({
- showModal(
- modalDialog(
- h1("Running TOM calculations..."),
- h4("This can take a while..."),
- img(src="loading.gif", width = "50%"),
- footer=NULL
- )
- )
+ showModal(modalDialog(
+ h1("Running TOM calculations..."),
+ h4("This can take a while..."),
+ img(src = "loading.gif", width = "50%"),
+ footer = NULL
+ ))
tryCatch({
- net <- blockwiseModules(t(inUse_normDge$counts), power = input$module_power,
- TOMType = "unsigned", minModuleSize = 20,
- reassignThreshold = 0, mergeCutHeight = 0.25,
- numericLabels = TRUE, pamRespectsDendro = FALSE,
- verbose = 3)
+ net <- blockwiseModules(
+ t(inUse_normDge$counts),
+ power = input$module_power,
+ TOMType = "unsigned",
+ minModuleSize = 20,
+ reassignThreshold = 0,
+ mergeCutHeight = 0.25,
+ numericLabels = TRUE,
+ pamRespectsDendro = FALSE,
+ verbose = 3
+ )
removeModal()
- showNotification(ui = "TOM calculations has been succesful!", duration = 5, type = "message")
+ showNotification(ui = "TOM calculations has been succesful!",
+ duration = 5,
+ type = "message")
net
}, error = function(err) {
removeModal()
- showNotification(ui = "TOM calculations failed with an error!", duration = 5, type = "error")
- showNotification(ui = as.character(err), duration = 10, type = "error")
+ showNotification(ui = "TOM calculations failed with an error!",
+ duration = 5,
+ type = "error")
+ showNotification(ui = as.character(err),
+ duration = 10,
+ type = "error")
print(err)
return(NULL)
})
@@ -195,7 +229,9 @@ get_modules <- reactive({
dissTOM <- get_TOM_manual()
geneTree <- hclust(as.dist(dissTOM), method = "average")
- dynamicMods <- cutreeDynamic(dendro = geneTree, method="tree", minClusterSize = 20)
+ dynamicMods <- cutreeDynamic(dendro = geneTree,
+ method = "tree",
+ minClusterSize = 20)
dynamicColors <- labels2colors(dynamicMods, colorSeq = setdiff(standardColors(), "black"))
dynamicColors <- dynamicColors[geneTree$order]
dynamicColors
@@ -227,12 +263,12 @@ get_eigengenes <- reactive({
lcpm <- inUse_normDge$counts
var_genes <- apply(lcpm, 1, var)
- select_var <- names(sort(var_genes, decreasing=TRUE))[1:amount]
- high_var_cpm <- as.data.frame(lcpm[select_var,])
+ select_var <- names(sort(var_genes, decreasing = TRUE))[1:amount]
+ high_var_cpm <- as.data.frame(lcpm[select_var, ])
MEList <- moduleEigengenes(t(high_var_cpm), colors = dynamicColors)
MEs <- MEList$eigengenes
- MEDiss <- 1-cor(MEs)
+ MEDiss <- 1 - cor(MEs)
METree <- hclust(as.dist(MEDiss), method = "average")
METree
})
@@ -266,8 +302,8 @@ get_relation <- reactive({
lcpm <- inUse_normDge$counts
var_genes <- apply(lcpm, 1, var)
- select_var <- names(sort(var_genes, decreasing=TRUE))[1:amount]
- high_var_cpm <- as.data.frame(lcpm[select_var,])
+ select_var <- names(sort(var_genes, decreasing = TRUE))[1:amount]
+ high_var_cpm <- as.data.frame(lcpm[select_var, ])
MEs0 <- moduleEigengenes(t(high_var_cpm), dynamicColors)$eigengenes
MEs <- orderMEs(MEs0)
@@ -291,10 +327,10 @@ get_dendro_network_heatmap <- reactive({
dissTOM <- get_TOM_manual()
geneTree <- hclust(as.dist(dissTOM), method = "average")
- data_TOM <- dissTOM^7
+ data_TOM <- dissTOM ^ 7
diag(data_TOM) <- NA
data_TOM <- data_TOM[, geneTree$order]
- data_TOM <- data_TOM[rev(geneTree$order),]
+ data_TOM <- data_TOM[rev(geneTree$order), ]
data_TOM
})
@@ -307,7 +343,8 @@ output[["wgcna_tree_info"]] <- renderUI({
})
output[["wgcna_trait_info"]] <- renderUI({
- infoText <- "Trait is retrieved from sample sheet (only numeric columns)"
+ infoText <-
+ "Trait is retrieved from sample sheet (only numeric columns)"
informationBox(infoText)
})
diff --git a/inst/src/tabs/wgcna/ui_wgcna.R b/inst/src/tabs/wgcna/ui_wgcna.R
index 901b892..dfc7c3d 100644
--- a/inst/src/tabs/wgcna/ui_wgcna.R
+++ b/inst/src/tabs/wgcna/ui_wgcna.R
@@ -14,8 +14,8 @@ tab_wgcna <- tabItem(
uiOutput("color_wgcna_tree"),
br(),
uiOutput("wgcna_tree_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("wgcna_sample_tree", height = "600px") %>% withSpinner()
@@ -32,8 +32,8 @@ tab_wgcna <- tabItem(
width = 3,
br(),
uiOutput("wgcna_trait_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("wgcna_trait_heat", height = "600px") %>% withSpinner()
@@ -48,18 +48,32 @@ tab_wgcna <- tabItem(
position = "right",
sidebarPanel(
width = 3,
- sliderInput("power_cutoff", "R^2 cutoff", 0.8, min = 0, max = 1, step = 0.01),
- sliderInput("power_numberOf", "Number of powers", 25, min = 1, max = 50, step = 1),
- radioButtons(
- "setPowerTab",
- "Choose plot:",
- c("SFT index" = "power",
- "Connectivity" = "soft")
+ sliderInput(
+ inputId = "power_cutoff",
+ label = "R^2 cutoff",
+ value = 0.8,
+ min = 0,
+ max = 1,
+ step = 0.01
+ ),
+ sliderInput(
+ inputId = "power_numberOf",
+ label = "Number of powers",
+ value = 25,
+ min = 1,
+ max = 50,
+ step = 1
),
+ radioButtons(
+ inputId = "setPowerTab",
+ label = "Choose plot:",
+ choices = c("SFT index" = "power",
+ "Connectivity" = "soft")
+ ),
br(),
uiOutput("wgcna_power_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("wgcna_power_plot", height = "600px") %>% withSpinner()
@@ -75,12 +89,19 @@ tab_wgcna <- tabItem(
position = "right",
sidebarPanel(
width = 3,
- sliderInput("module_power", "Number of powers", 6, min = 1, max = 50, step = 1),
+ sliderInput(
+ inputId = "module_power",
+ label = "Number of powers",
+ value = 6,
+ min = 1,
+ max = 50,
+ step = 1
+ ),
uiOutput("wgcna_number_genes"),
br(),
uiOutput("wgcna_module_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("wgcna_dendro_gene_module", height = "600px") %>% withSpinner(),
@@ -98,8 +119,8 @@ tab_wgcna <- tabItem(
width = 3,
br(),
uiOutput("wgcna_module_trait_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("wgcna_module_trait", height = "600px") %>% withSpinner()
@@ -116,8 +137,8 @@ tab_wgcna <- tabItem(
width = 3,
br(),
uiOutput("wgcna_network_heat_info"),
- span(icon("copyright"), "LUMC - SASC", style="color: #e3e3e3;")
- ),
+ span(icon("copyright"), "LUMC - SASC", style = "color: #e3e3e3;")
+ ),
mainPanel(
width = 9,
plotlyOutput("wgcna_network_heat", height = "600px") %>% withSpinner()
diff --git a/inst/src/ui.R b/inst/src/ui.R
index b95416e..f2b5182 100644
--- a/inst/src/ui.R
+++ b/inst/src/ui.R
@@ -31,14 +31,12 @@ ui <- dashboardPage(
collapsed = FALSE,
width = 350,
- sidebarMenu(
- sidebarMenuOutput("sidebar_tabs")
- )
+ sidebarMenu(sidebarMenuOutput("sidebar_tabs"))
),
dashboardBody(
useShinyjs(),
includeCSS("css/styles.css", local = TRUE),
- tags$head(tags$link(rel="shortcut icon", href = "lumcFavicon.png")),
+ tags$head(tags$link(rel = "shortcut icon", href = "lumcFavicon.png")),
tabItems(
tab_home,
diff --git a/man/complexityPlot.Rd b/man/complexityPlot.Rd
index dfd5e3b..7be329a 100644
--- a/man/complexityPlot.Rd
+++ b/man/complexityPlot.Rd
@@ -6,7 +6,7 @@
If percentages == TRUE percentages are calculated.
A dot line plot is created based on the number of reads at rank.}
\usage{
-complexityPlot(se, group_color = "None", perc, rank)
+complexityPlot(se, group_color = "None", perc = T, rank = 1000)
}
\arguments{
\item{se}{SummerizedExperiment object, containing samples and counts}