Skip to content

Commit

Permalink
Merge pull request #12 from LUMC/develop
Browse files Browse the repository at this point in the history
Develop -> v1.3.1
  • Loading branch information
tomkuipers1402 authored Oct 13, 2020
2 parents a13dd2c + 3d2a819 commit 23af176
Show file tree
Hide file tree
Showing 87 changed files with 2,975 additions and 574 deletions.
53 changes: 27 additions & 26 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,43 +1,44 @@
Package: dgeAnalysis
Type: Package
Title: dgeAnalysis
Version: 1.1.0
Version: 1.3.1
Author@R:
person("Tom", "Kuipers", email = "t.b.kuipers@outlook.com", 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.0.2
RoxygenNote: 7.1.1
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Imports:
shiny (>= 1.4.0),
shiny (>= 1.5.0),
shinydashboard (>= 0.7.1),
shinyWidgets (>= 0.5.0),
shinycssloaders (>= 0.3),
shinyjs (>= 1.1),
shinyWidgets (>= 0.5.3),
shinycssloaders (>= 1.0.0),
shinyjs (>= 2.0.0),
BiocManager (>= 1.30.10),
knitr (>= 1.27),
tidyr (>= 1.0.2),
scales (>= 1.1.0),
broom (>= 0.5.4),
plotly (>= 4.9.1),
igraph (>= 1.2.4.2),
reshape2 (>= 1.4.3),
SummarizedExperiment (>= 1.16.1),
edgeR (>= 3.28.0),
limma (>= 3.42.1),
DESeq2 (>= 1.26.0),
clusterProfiler (>= 3.14),
DOSE (>= 3.12.0),
graphite (>= 1.32.0),
ReactomePA (>= 1.30.0),
org.Hs.eg.db (>= 3.10),
org.Mm.eg.db (>= 3.10),
rmarkdown (>= 2.1)
knitr (>= 1.30),
tidyr (>= 1.1.2),
scales (>= 1.1.1),
broom (>= 0.7.1),
plotly (>= 4.9.2),
igraph (>= 1.2.5),
reshape2 (>= 1.4.4),
SummarizedExperiment (>= 1.18.2),
edgeR (>= 3.30.3),
limma (>= 3.44.3),
DESeq2 (>= 1.28.1),
clusterProfiler (>= 3.16.1),
DOSE (>= 3.14.0),
graphite (>= 1.34.0),
ReactomePA (>= 1.32.0),
org.Hs.eg.db (>= 3.11.4),
org.Mm.eg.db (>= 3.11.4),
rmarkdown (>= 2.4),
WGCNA (>= 1.69)
biocViews: Annotation, Clustering, GeneSetEnrichment, GO, KEGG,
MultipleComparison, Pathways, Reactome, Visualization,
Sequencing, RNASeq, ChIPSeq, GeneExpression, Transcription,
Sequencing, RNASeq, GeneExpression, Transcription,
Normalization, DifferentialExpression, Bayesian, Regression,
PrincipalComponent
PrincipalComponent, WGCNA
Binary file modified MANUAL.pdf
Binary file not shown.
56 changes: 55 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1 +1,55 @@
exportPattern("^[[:alpha:]]+")
# Generated by roxygen2: do not edit by hand

export(addAnnotationsFromTableToSE)
export(addSamplesFromTableToSE)
export(alignmentSummary)
export(alignmentSummaryPlot)
export(barcodePlot)
export(biasPlot)
export(cnetPlotly)
export(complexityData)
export(complexityPlot)
export(countDistributionBoxPlot)
export(countDistributionLinePlot)
export(createContrast)
export(createDesign)
export(createMatrix)
export(deRatioPlot)
export(emap_plotly)
export(enrichBarplot)
export(extract_geneSets)
export(gamConfidenceFit)
export(geneStrandBar)
export(getCount)
export(get_dendrogram_data)
export(get_geneList)
export(get_organismID)
export(heatplotly)
export(informationBox)
export(list2df)
export(list2graph)
export(ma_plot)
export(multidimensionalScaling2dPlot)
export(multidimensionalScaling3dPlot)
export(overlap_ratio)
export(pValuePlot)
export(plot_module_trait_relation_heat)
export(plot_modules)
export(plot_power)
export(plot_soft)
export(plot_trait_heat)
export(plotlyGraph)
export(plotly_dendro_heat)
export(plotly_dendrogram)
export(readCountsFromTable)
export(relevelSamples)
export(samplePca2dPlot)
export(samplePca3dPlot)
export(stackDge)
export(startApp)
export(topDgeHeatmapPlot)
export(update_n)
export(variableHeatmapPlot)
export(variancePcaPlot)
export(volcanoPlot)
export(voomPlot)
126 changes: 68 additions & 58 deletions R/de.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
## ----- Read files -----


## readCountsFromTable()
## Add all counts that are in samples in SummerizedExperiment
## Parameters:
## data_counts = Dataframe, Containing all raw count data
## data_samples = Dataframe, Containing all sample data
## Returns:
## se = SummerizedExperiment, With counts
#' Add all counts that are in samples in SummerizedExperiment.
#'
#' @param data_counts Dataframe, Containing all raw count data
#' @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)])
Expand All @@ -17,31 +18,32 @@ readCountsFromTable <- function(data_counts, data_samples) {
}


## addSamplesFromTableToSE()
## Add samples to the SummerizedExperiment
## Parameters:
## se = SummerizedExperiment, With counts
## data_samples = Dataframe, Containing all sample data
## Returns:
## se = SummerizedExperiment, With samples and counts
#' Add samples to the SummerizedExperiment.
#'
#' @param se SummerizedExperiment, With counts
#' @param data_samples Dataframe, Containing all sample data
#'
#' @return se, (SummerizedExperiment) With samples and counts
#'
#' @export

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,])
names(colData(se)) <- colnames(data_samples)
colData(se) <- DataFrame(data_samples[samples,, drop = FALSE])
se
}


## addAnnotationsFromTableToSE()
## Add annotation to the SummerizedExperiment
## Parameters:
## se = SummerizedExperiment, With samples and counts
## data_annotation = Dataframe, Containing all annotation data
## Returns:
## se = SummerizedExperiment, With samples, counts and annotation
#' Add annotation to the SummerizedExperiment.
#'
#' @param se SummerizedExperiment, With counts
#' @param data_annotation Dataframe, Containing all annotation data
#'
#' @return se, (SummerizedExperiment) With samples, counts and annotation
#'
#' @export

addAnnotationsFromTableToSE <- function(se, data_annotation){
features <- intersect(rownames(se), rownames(data_annotation))
Expand All @@ -55,13 +57,14 @@ addAnnotationsFromTableToSE <- function(se, data_annotation){
## ----- Analysis utility -----


## getCount()
## Count the read counts per feature to find number of reads that are aligned, not aligned, etc.
## Parameters:
## x = String, Containing the value on which to count reads
## raw = Dataframe, Containing count data
## Returns:
## Integer, With total counted reads
#' Count the read counts per feature to find number of reads that are aligned, not aligned, etc.
#'
#' @param x Containing the value/label on which to count reads
#' @param raw Dataframe, Containing count data
#'
#' @return Integer, With total counted reads
#'
#' @export

getCount <- function(x, raw){
if (x["feature"] %in% rownames(raw)) {
Expand All @@ -73,12 +76,13 @@ getCount <- function(x, raw){
}


## alignmentSummary()
## Creates dataframe with counts per mapping feature (aligned, not aligned, etc.)
## Parameters:
## se = SummerizedExperiment, With samples, counts (and annotation)
## Returns:
## out = Dataframe, With total counts per available mapping feature
#' 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) ) ]
Expand All @@ -88,13 +92,14 @@ alignmentSummary <- function(se){
}


## complexityData()
## Creates dataframe with number of reads per gene, ordered on genes with the most reads assigned.
## Parameters:
## se = SummerizedExperiment, With samples, counts (and annotation)
## max = Integer, The maximum rank that is used
## Returns:
## out = Dataframe, With total read counts per gene
#' Creates dataframe with number of reads per gene, ordered on genes with the most reads assigned.
#'
#' @param se SummerizedExperiment, With samples, counts (and annotation)
#' @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) ) ]
Expand All @@ -111,12 +116,14 @@ complexityData <- function(se, max){
}


## stackDge()
## Stacks total DGE counts based on: mapping feature (aligned, not aligned, etc.), sample and LogCPM
## Parameters:
## dge = DGE list object, containing samples and counts
## Returns:
## count = Dataframe, With mapping feature, sample and LogCPM
#' Stacks total DGE counts based on: mapping feature (aligned, not aligned, etc.), sample and LogCPM.
#'
#' @param dge DGE list object, containing samples and counts
#' @param max Integer, The maximum rank that is used
#'
#' @return count, (Dataframe) With mapping feature, sample and LogCPM
#'
#' @export

stackDge <- function(dge){
count <- stack(dge$counts)
Expand All @@ -125,14 +132,15 @@ stackDge <- function(dge){
}


## gamConfidenceFit()
## Calculates a confidence fit for various plots.
## Model used is GAM to calculate predictions
## Parameters:
## deTab = Dataframe, with all analysis results
## biasColumn = String, Value on which to calculate confidence
## Returns:
## prediction = Vector, With coordinates of prediction locations (line plot)
#' Calculates a confidence fit for various plots.
#' Model used is GAM to calculate predictions.
#'
#' @param deTab Dataframe, with all analysis results
#' @param biasColumn String, Value on which to calculate confidence
#'
#' @return prediction, (Vector) With coordinates of prediction locations (line plot)
#'
#' @export

gamConfidenceFit <- function(deTab, biasColumn) {
method.args = list()
Expand All @@ -144,7 +152,9 @@ gamConfidenceFit <- function(deTab, biasColumn) {

base.args <- list(quote(formula), data = quote(deTab))
gamModel <- do.call(mgcv::gam, c(base.args, method.args))
prediction <- augment(gamModel)

prediction <- deTab[, c(biasColumn, "avgLog2FC")]
prediction <- cbind(prediction, predict(gamModel, se.fit=TRUE))
prediction <- prediction[order(prediction[[biasColumn]]), ]

setRange <- range(1, nrow(prediction))
Expand Down
Loading

0 comments on commit 23af176

Please sign in to comment.