Skip to content

Instantly share code, notes, and snippets.

@dBenedek
Created June 27, 2022 09:14
Show Gist options
  • Save dBenedek/ce94653f21cb581c9acbe17032da8ec3 to your computer and use it in GitHub Desktop.
Save dBenedek/ce94653f21cb581c9acbe17032da8ec3 to your computer and use it in GitHub Desktop.
[DE DESeq2] Basic differential expression with DESeq2 #DE #DESeq2 #R
library("tidyverse")
library("DESeq2")
# Create DESeq2 object:
dds <- DESeqDataSetFromMatrix(count_data,
colData = col_data,
design = ~ group)
# Run DE:
dds <- DESeq(dds)
res <- results(dds, contrast=c("group","1","2")) # group 1 compared to group 2
# Reformat:
res <- res %>%
as.data.frame() %>%
rownames_to_column("gene") %>%
arrange(padj) %>%
column_to_rownames("gene")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment