Question: Script for fold change in DESeq for count data with 2 groups
gravatar for marc.osullivan
4 months ago by
marc.osullivan0 wrote:

I'm new to both R and DESeq2 and I have a script to work off but this will only generate Log2 fold change? Does anyone know what script to add to calculate untransformed fold change to my read counts?

I've attached the script below.



First format data into columns and counts, see attached example files

cts27 <- read.csv("~/MyCounts27.csv",header=T,row.names=1) coldata27 <- read.csv("~/MyColdata27_23Signif.csv")

These two lines create the deseq object, second line not 100% needed but best to include

dds27 <- DESeqDataSetFromMatrix(countData=cts27,colData=coldata27,design= ~ Obese.Normal) dds27$Obese.Normal <- relevel(dds27$Obese.Normal, ref="Normal")

here we run the analysis on the object dds27

dds27 <- DESeq(dds27)

here results are generated and saved as res27, can change p-value cut off by changing alpha value

res27 <- results(dds27, alpha = 0.05) res27

summary of results


order the results by p-value

resOrdered27 <- res27[order(res27$pvalue),] resOrdered27

summary of ordered results


sum(res27$padj < 0.05, na.rm=T)

save results in csv file

write.csv(, file = "MyCaseControlResults27.csv")

rnaseq deseq2 • 151 views
ADD COMMENTlink modified 4 months ago by Michael Love24k • written 4 months ago by marc.osullivan0
Answer: Script for fold change in DESeq for count data with 2 groups
gravatar for Michael Love
4 months ago by
Michael Love24k
United States
Michael Love24k wrote:

I'd recommend to take a look at the workflow here for an example analysis script:

To convert the log2 fold changes to fold changes, you can use 2^LFC (this is described in the workflow link above, in the section about the results table).

ADD COMMENTlink written 4 months ago by Michael Love24k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 199 users visited in the last hour