::: {.cell layout-align="center" hash='03-dge-pretty_cache/commonmark/heatmap_d932d28e43d4f625388121593005a89a'}

```{.r .cell-code}
# Select top 50 differentially expressed genes
res <- results(deseq2.dds)
res_ordered <- res[order(res$padj), ]
top_genes <- row.names(res_ordered)[1:50]
# Extract counts and normalize
counts <- counts(deseq2.dds, normalized = TRUE)
counts_top <- counts[top_genes, ]
# Log-transform counts
log_counts_top <- log2(counts_top + 1)
# Generate heatmap
pheatmap(log_counts_top, scale = "row")
```

::: {.cell-output-display}
![](03-dge-pretty_files/figure-commonmark/heatmap-1.png){fig-align='center'}
:::
:::