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.
<--------------------------------------------------------------------------------------------------------------------------------------------------->
library(DESeq2)
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
summary(res27)
order the results by p-value
resOrdered27 <- res27[order(res27$pvalue),] resOrdered27
summary of ordered results
summary(resOrdered27)
sum(res27$padj < 0.05, na.rm=T)
save results in csv file
write.csv(as.data.frame(resOrdered27), file = "MyCaseControlResults27.csv")