Skip to content

Commit

Permalink
Merge pull request #22 from LUMC/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
tomkuipers1402 authored Aug 9, 2022
2 parents 1e6c7ac + 0edc6c9 commit b32963a
Show file tree
Hide file tree
Showing 101 changed files with 3,135 additions and 2,923 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ Changelog
<!--
Newest changes should be on top.
-->
version 1.5.1
---------------------------
+ Remove heatmap plot in enrichment
+ Fix empty table not shown
+ Update hover info
+ Apply icon name change in updated package (fontawesome)
+ Update markdowns to use non-interactive ggplot2 plots
+ Reorder chunks in markdown
+ Remove voom plot from raw data
+ Rewrite plots to be based on ggplot2 -> ggplotly
+ Change filtering for enrichment
+ Bug fix for tSNE: Missing break in loop

version 1.4.4
---------------------------
+ Add file names and md5 to markdown
Expand Down
42 changes: 21 additions & 21 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
Package: dgeAnalysis
Type: Package
Title: dgeAnalysis
Version: 1.4.4
Version: 1.5.1
Author@R:
person("Tom", "Kuipers", email = "t.b.kuipers@lumc.nl", role = c("aut", "cre"))
Description:
R shiny tool to perform differential gene expression and view the results interactively.
Depends: R (>= 3.6.1)
RoxygenNote: 7.1.1
Depends: R (>= 4.1)
RoxygenNote: 7.2.1
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Imports:
shiny (>= 1.5.0),
shinydashboard (>= 0.7.1),
shinyWidgets (>= 0.5.3),
shiny (>= 1.7.2),
shinydashboard (>= 0.7.2),
shinyWidgets (>= 0.7.2),
shinycssloaders (>= 1.0.0),
shinyjs (>= 2.0.0),
BiocManager (>= 1.30.10),
knitr (>= 1.30),
SummarizedExperiment (>= 1.18.2),
edgeR (>= 3.30.3),
limma (>= 3.44.3),
DESeq2 (>= 1.28.1),
tidyr (>= 1.1.2),
scales (>= 1.1.1),
broom (>= 0.7.1),
plotly (>= 4.9.2),
Rtsne (>= 0.15),
rmarkdown (>= 2.4),
gprofiler2 (>= 0.2.0),
igraph (>= 1.2.5)
shinyjs (>= 2.1.0),
BiocManager (>= 1.30.18),
knitr (>= 1.39),
SummarizedExperiment (>= 1.24.0),
edgeR (>= 3.36.0),
limma (>= 3.50.3),
DESeq2 (>= 1.34.0),
tidyr (>= 1.3.2),
scales (>= 1.2.0),
broom (>= 1.0.0),
plotly (>= 4.10.0),
Rtsne (>= 0.16),
rmarkdown (>= 2.14),
gprofiler2 (>= 0.2.1),
igraph (>= 1.3.4),
biocViews: Annotation, Clustering, GeneSetEnrichment, GO, KEGG,
MultipleComparison, Pathways, Reactome, Visualization,
Sequencing, RNASeq, GeneExpression, Transcription,
Expand Down
Binary file modified MANUAL.pdf
Binary file not shown.
55 changes: 30 additions & 25 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,49 @@

export(addAnnotationsFromTableToSE)
export(addSamplesFromTableToSE)
export(alignmentSummary)
export(alignmentSummaryPlot)
export(barcodePlot)
export(biasPlot)
export(alignment_summary)
export(bar_plot)
export(barcode)
export(barcode_plot)
export(bias_gc)
export(cnetPlotly)
export(cnet_data)
export(complexity)
export(complexityData)
export(complexityPlot)
export(countDistributionBoxPlot)
export(countDistributionLinePlot)
export(count_dist)
export(createContrast)
export(createDesign)
export(createMatrix)
export(deRatioPlot)
export(enrichBarplot)
export(enrichDE)
export(de_ratio)
export(dendro_data)
export(dendro_plot)
export(enrich_bar)
export(enrich_barDE)
export(extract_geneSets)
export(gamConfidenceFit)
export(geneStrandBar)
export(fix_violin_hover)
export(gene_strand)
export(getCount)
export(get_dendrogram_data)
export(get_organismID)
export(heatplotly)
export(heat_de)
export(heat_var)
export(heatmap_plot)
export(informationBox)
export(line_plot)
export(list2df)
export(list2graph)
export(ma_plot)
export(multidimensionalScalingPlot)
export(pValuePlot)
export(pcaPlot)
export(plotlyGraph)
export(plotly_dendrogram)
export(ma)
export(mds_clust)
export(network_plot)
export(pca_data)
export(pvalue)
export(readCountsFromTable)
export(relevelSamples)
export(scatter_plot)
export(stackDge)
export(startApp)
export(topDgeHeatmapPlot)
export(tsnePlot)
export(variableHeatmapPlot)
export(variancePcaPlot)
export(volcanoPlot)
export(voomPlot)
export(tsne_data)
export(violin_dist)
export(violin_plot)
export(volcano)
export(voom_data)
68 changes: 12 additions & 56 deletions R/de.R → R/de_functions.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@

## ----- Read files -----


#' Add all counts that are in samples in SummerizedExperiment.
#'
#' @param data_counts Dataframe, Containing all raw count data
Expand Down Expand Up @@ -52,10 +49,6 @@ addAnnotationsFromTableToSE <- function(se, data_annotation) {
se
}

## --------------------------------------------------------------------------

## ----- Analysis utility -----


#' Count the read counts per feature to find number of reads that are aligned, not aligned, etc.
#'
Expand All @@ -76,23 +69,6 @@ getCount <- function(x, raw) {
}


#' Creates dataframe with counts per mapping feature (aligned, not aligned, etc.).
#'
#' @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))
out$count <- apply(out, 1, getCount, assays(se)$counts)
out
}


#' Creates dataframe with number of reads per gene, ordered on genes with the most reads assigned.
#'
#' @param se SummerizedExperiment, With samples, counts (and annotation)
Expand All @@ -111,8 +87,7 @@ complexityData <- function(se, max) {
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 * 100
}
out
}
Expand All @@ -134,42 +109,25 @@ stackDge <- function(dge) {
}


#' Calculates a confidence fit for various plots.
#' Model used is GAM to calculate predictions.
#' Fix hover info for violin plot, as it cant find CPM values
#'
#' @param deTab Dataframe, with all analysis results
#' @param biasColumn String, Value on which to calculate confidence
#' @param plot List object, List with plot object from ggplotly
#'
#' @return prediction, (Vector) With coordinates of prediction locations (line plot)
#' @return plot, List object with fixed hover
#'
#' @export

gamConfidenceFit <- function(deTab, biasColumn) {
method.args = list()
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
)))

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]]),]
fix_violin_hover <- function(plot) {
for (x in 1:length(plot[["x"]][["data"]])) {
layer <- plot[["x"]][["data"]][[x]]
logcpm <- round(layer[["x"]], 2)
temp <- sub("(<br />).*", "", layer[["text"]])
plot[["x"]][["data"]][[x]][["text"]] <- paste(temp, "\nLog2CPM:", logcpm)
}

setRange <- range(1, nrow(prediction))
result <- round(seq(setRange[1], setRange[2], length.out = 500))
prediction <- prediction[c(result), ]
plot
}

## --------------------------------------------------------------------------

## ----- TREE PLOTS -----


#' Get heigth information from tree object.
#' Get labels/names from tree ends.
Expand Down Expand Up @@ -277,5 +235,3 @@ get_dendrogram_data <- function(tree,
new <- new[order(new$x), ]
return(new)
}

## --------------------------------------------------------------------------
Loading

0 comments on commit b32963a

Please sign in to comment.