Group membersGroup members
Florian DelbartFlorian Delbart
Jens RummensJens Rummens
Alexander SneyersAlexander Sneyers
The DESeq tool was used to analyze the count data of RNAseq and identify upregulated and downregulated genes.The DESeq tool was used to analyze the count data of RNAseq and identify upregulated and downregulated genes.
library("DESeq2")library(scales)options(repr.plot.width=4, repr.plot.height=3)setwd(path.expand("~/data/Assignment/DeSEQ"))#set working directoryTo be able to perform the DESeq analysis a matrix of the gene count data was constructedTo be able to perform the DESeq analysis a matrix of the gene count data was constructed
matrixFile = path.expand("~/data/Assignment/DeSEQ/allgene.gene.counts.tsv")#define matrix filecountData <- as.matrix(read.csv(matrixFile, sep="\t", row.names="Geneid"))head(countData)#making matrix of gene count dataChanging the layout of the matrixChanging the layout of the matrix
colnames(countData) <- c("shNS1", "shNS2", "shNS3", "shRUNX1.1", "shRUNX1.2", "shRUNX1.3")head(countData)#Change column names to experimental conditions rather than file nameDefining which samples correspond to control or knockdown conditions Defining which samples correspond to control or knockdown conditions
#Name of experimental conditions must be the same as data, very important.condition <- factor(c("shNS", "shNS", "shNS", "shRUNX1", "shRUNX1", "shRUNX1"))print(condition)#Make table with sample names and corresponding conditionscolData <- data.frame(sampleName = colnames(countData), condition = condition)colData#Reformatting the generated dataset to a DESeq dataset to be able to use the DESeq tooldds <- DESeqDataSetFromMatrix(countData = countData, colData = colData, design = ~ condition)#Make sure the column names are correct.colnames(dds) <- colnames(countData)#Summary of the DESeq datasetdds#Check if conditions contain all samplesdds$conditionAnalysis of differentially expressed genesAnalysis of differentially expressed genes
dds <- DESeq(dds)Quality control for library size.Quality control for library size.
#Plot of relative library sizes of the different samplesoptions(repr.plot.width=8, repr.plot.height=5)barplot(sizeFactors(dds))Large variation in library size was observed between the shNS conditions. Much less variation in library size in shRUNX1 samples.DeSEQ corrects for variations in library size.Large variation in library size was observed between the shNS conditions. Much less variation in library size in shRUNX1 samples. DeSEQ corrects for variations in library size.
#Plot of absolute library sizes of the different samplesbarplot(colSums(countData))Checking for correlation in gene expression between different samplesChecking for correlation in gene expression between different samples
Gene expression varies less in samples from the same experimental conditionGene expression varies less in samples from the same experimental condition
options(repr.plot.width=8, repr.plot.height=8)plot(data.frame(log10(counts(dds))), cex=0.1, col=alpha("black", 0.4))To reduce the large variability at low expression levels a log transformation was performed.To reduce the large variability at low expression levels a log transformation was performed.
rld <- rlogTransformation(dds, blind=TRUE)options(repr.plot.width=8, repr.plot.height=8)plot(data.frame(assay(rld)), cex=0.1, col=alpha("green", 0.4))plotPCA(rld, intgroup=c("condition")) Making a MA plot to visualize significantly differentialy expressed genesMaking a MA plot to visualize significantly differentialy expressed genes
options(repr.plot.width=8, repr.plot.height=6)plotMA(dds,ylim=c(-3,3))Plots log2fold change vs mean expression. Significant differentially expressed genes are shown in red. Plots log2fold change vs mean expression. Significant differentially expressed genes are shown in red.
Exporting the results of DESeq analysisExporting the results of DESeq analysis
res <- results(dds)res <- res[order(res$log2FoldChange),]head(res)#Ordering the results according to log2foldchangeres.sign <- res[(!is.na(res$padj)) & (res$padj < 0.05),]dim(res.sign)#Counting the number of significantly expressed genes, not including NA write.table(res, "DeSEQRUNX1logfc.results.tsv", sep="\t", col.names=NA, quote=FALSE)#Exporting the results as .tsv filebarplot(assay(rld)["GLA",])#Visualizing the expression levels of a specific gene within the different samples