First post, so apologies for any flaws with post structure.
I am attempting to make a basic heatmap that shows the log fold change of differentially expressed genes, as identified by DESeq2. See below the code I am using for DESeq2:
##Load DESeq2 source("https://bioconductor.org/biocLite.R") biocLite("DESeq2") biocLite("stringi") biocLite("MASS") install.packages("survival") biocLite("bit") library("DESeq2") setwd("C:/Users/megan/Desktop/Computational/WizKO-RNAseq") install.packages("rlang") biocLite("DESeqDataFromMatrix") ##Read in your data Counts_bbmap <- read.table("RNAseqResults.txt", header = TRUE, row.names=1) sampleInfo <- read.csv("ValuesFile.txt") sampleInfo <- data.frame(sampleInfo) dds <- DESeqDataSetFromMatrix(countData = Counts_bbmap, colData = sampleInfo, design = ~Genotype) dds <- DESeq(dds) resultsNames(dds)
To make my heatmap, I am attempting to use pheatmap using the following code:
##Heatmap biocLite("pheatmap") library("pheatmap") ntd <- normTransform(dds) select <- order(rowMeans(counts(dds, normalized=TRUE)), decreasing =TRUE)[1:50] df <- as.data.frame(colData(dds)[,c("Genotype","Sample")]) pheatmap(assay(ntd)[select,], cluster_rows=FALSE, showrownames=TRUE, cluster_cols=FALSE, annotation_col=df)
However, I want to only post Log Fold Changes, and the above code produces a heatmap plotting something else (although I'm not sure what). I've tried a few different things myself, such as subsetting the data into just genes with adjusted p values over a certain number, sorting the data, etc. But I cannot figure out how to just plot the log fold changes that have already been calculated. The error may be in the assay(ntd) but I do not know how to resolve this.
Thanks for any and all help.