I have a question on averaging biological replicates together. the code below plots data for each sample. When and how do I combine my biological replicates for plotting? I would like to combine over the CONDITION column and have tried a man ways. Thought you might have an answer.
colData(rld)
DataFrame with 6 rows and 10 columns
          sampleName  fileName     LINE EXPOSURE CONDITION   TISSUE       REP
            <factor>  <factor> <factor> <factor>  <factor> <factor> <integer>
A1H_Acute  A1H_Acute A1H_Acute      CSB    Acute   Cocaine        H         1
A2H_Acute  A2H_Acute A2H_Acute      CSB    Acute   Cocaine        H         2
A3H_Acute  A3H_Acute A3H_Acute      CSB    Acute   Cocaine        H         3
B1H_Acute  B1H_Acute B1H_Acute      CSB    Acute Sucrose_C        H         1
B2H_Acute  B2H_Acute B2H_Acute      CSB    Acute Sucrose_C        H         2
B3H_Acute  B3H_Acute B3H_Acute      CSB    Acute Sucrose_C        H         3
               SEX individual        sizeFactor
          <factor>   <factor>         <numeric>
A1H_Acute        M         AM  1.23895646591537
A2H_Acute        M         AM 0.709636373005609
A3H_Acute        M         AM  1.39159832544129
B1H_Acute        M         BM 0.738832280319489
B2H_Acute        M         BM 0.908432365721923
B3H_Acute        M         BM  1.24898796150053
dds <- DESeqDataSetFromMatrix(countData = AcuteCountsMheadCO, colData = AcuteSampleTable1MheadCO, design = ~ CONDITION )
myTest<-DESeq(dds)
rld <- rlog(myTest, blind=F)
select <- order(rowMeans(counts(myTest,normalized=TRUE)),
                decreasing=TRUE)[1:20]
df <- as.data.frame(colData(myTest)[,c("CONDITION","TISSUE")])
pheatmap(assay(rld)[select,], cluster_rows=FALSE, show_rownames=FALSE,
         cluster_cols=FALSE, annotation_col=df)

Hi James,
I realize my code is not correct in the aspect of plotting the most significant DEGenes. I am very new to DEseq2 and making heat maps. In the end I want to generate a heat map for the "pulled" samples on only the most significant genes. In this case it was 104 genes.