Skip to content
Snippets Groups Projects
Commit b5c62ff0 authored by Holger Brandl's avatar Holger Brandl
Browse files

moved up qc section

parent 9cf14439
No related branches found
No related tags found
No related merge requests found
......@@ -69,7 +69,7 @@ genesAfter <- nrow(countMatrix)
########################################################################################################################
#' ## Perform Differential Expression Analysis
#' ## Data Preparation
#' DESeq is an R package to analyse count data from high-throughput sequencing assays such as RNA-Seq and test for differential expression. The latest version, DESeq2, is used.
......@@ -120,31 +120,6 @@ dds <- DESeqDataSetFromMatrix(countMatrix, colData, formula(~ condition))
dds <- estimateSizeFactors(dds)
#' For details about size factor normalziation and calculation see https://www.biostars.org/p/79978/
##' Size Factors estimated by DESeq
sizeFactors(dds) %>%
set_names(colnames(countMatrix)) %>% melt() %>%
rownames2column("sample") %>%
ggplot(aes(sample, value)) + geom_bar(stat="identity") + ggtitle("deseq size factors") + coord_flip()
##' From the DESeq docs about how size factors are used: The sizeFactors vector assigns to each column of the count matrix a value, the size factor, such that count values in the columns can be brought to a common scale by dividing by the corresponding size factor.
##' This means that counts are divied by size factors. So let's now load the lambda libraies and replace the predefined size factors with our custom ones
#' From DESeq manual: The regularized log transformation is preferable to the variance stabilizing transformation if the size factors vary widely.
#' Run Deseq Test
#dds <- DESeq(dds, fitType='local', betaPrior=FALSE)
#dds <- DESeq(dds, fitType='local')
dds <- DESeq(dds)
#res <- results(dds)
#resultsNames(dds)
#' Model Overview:
summary(results(dds))
########################################################################################################################
#' ## Quality Control
......@@ -193,7 +168,34 @@ heatmap.2(distMatrix, labRow=colnames(labelcntData), labCol=colnames(labelcntDat
#key=F, col=colorpanel(100, "black", "white"),
margin=c(8, 8), main="Sample Distance Matrix")
########################################################################################################################
#' # Perform Differential Expression Analysis
#' For details about size factor normalziation and calculation see https://www.biostars.org/p/79978/
##' Size Factors estimated by DESeq
sizeFactors(dds) %>%
set_names(colnames(countMatrix)) %>% melt() %>%
rownames2column("sample") %>%
ggplot(aes(sample, value)) + geom_bar(stat="identity") + ggtitle("deseq size factors") + coord_flip()
##' From the DESeq docs about how size factors are used: The sizeFactors vector assigns to each column of the count matrix a value, the size factor, such that count values in the columns can be brought to a common scale by dividing by the corresponding size factor.
##' This means that counts are divied by size factors. So let's now load the lambda libraies and replace the predefined size factors with our custom ones
#' From DESeq manual: The regularized log transformation is preferable to the variance stabilizing transformation if the size factors vary widely.
#' Run Deseq Test
#dds <- DESeq(dds, fitType='local', betaPrior=FALSE)
#dds <- DESeq(dds, fitType='local')
dds <- DESeq(dds)
#res <- results(dds)
#resultsNames(dds)
#' Model Overview:
summary(results(dds))
## extract all de-sets according to our contrasts model
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment