DESeq2: Extract mean normalized log2 counts by level
Entering edit mode
agdif ▴ 10
Last seen 4.7 years ago


I currently am using a dataset with 5 timepoints and 4 replicates per timepoint. While the results file exports the L2FC, I am also interested in extracting the numerator log2 values for each time point. I have already extracted the log2 normalized counts for each individual sample with the code below, but am unable to find a way to extract the log2 mean normalized counts for each level/ timepoint.

For example:

  1 hr 1 hr 1 hr 1 hr 2 hr 2 hr 2 hr 2 hr  
Gene A norm cts 100 110 100 150 300 350 400 320  

1 hr average= 115 

2 hr average = 342.5

log2 normalized counts per level/ timepoint 

1 hr: log2(115+1)

2 hr: log2(342.5+1)

Is there a simple way to do this in the R package? Otherwise, would I have to manually calculate like outlined above? 

# Define DE design
dds = DESeqDataSetFromMatrix(countData=countdata, colData=coldata, design=~timepoint)
dds$timepoint=relevel(dds$timepoint, ref="0 hrs")

# Run the DESeq pipeline
dds = DESeq(dds, test="LRT", full=~timepoint, reduced=~1)
res=results(dds, alpha=0.05)
resSig=subset(res, padj<0.05)

# Extract log2 shifted normalized counts per sample
l2normcts=counts(dds, normTransform=TRUE)



normalized counts log2 • 1.2k views

Login before adding your answer.

Traffic: 418 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6