DESeq2 - alternative script

#set the working directory setwd("/path/to/the/folder/with/counts/at_counts") #install the following packages if not yet installed library("ggrepel") library("DESeq2") library("ggplot2") library("EnhancedVolcano") library("reshape2") library("plyr") require(reshape2)

IMPORT AND PREPROCESS GENE COUNTS DATA

geneCountData <- read.csv('salmon.merged.gene_counts_length_scaled.tsv', header = TRUE, sep = "\t") print(head(geneCountData))

get rid of the gene_name column

geneCountData = geneCountData[, colnames(geneCountData)[colnames(geneCountData) != 'gene_name']] print(head(geneCountData))

create a new table with only numbers

counts need to be rounded to integers

prepare to re-add the 'gene_id' column to the numbers table

create names of the new columns

merge the "gene_id" column with the numbers table

rename the columns

IMPORT AND PREPROCESS META DATA

make sure that the condition in the metadata is factorised to keep order for DESeq2

first group (Ax) is the baseline, DESeq2 will compare the second group against the first group

CREATE DESEQ2 OBJECT AND RUN THE ANALYSIS

Take a look at the results table

Summary of differential gene expression

Sort summary list by p-value

Save DEGs to file

Print the results for the genes of interest