I have the following DESeq2 code and the corresponding results
suppressMessages(library(DESeq2))
suppressMessages(library(airway))
data(airway)
airway_se <- airway
airway_dds <- DESeqDataSet(airway_se, design = ~cell + dex)
deseq <- DESeq(airway_dds)
#> estimating size factors
#> estimating dispersions
#> gene-wise dispersion estimates
#> mean-dispersion relationship
#> final dispersion estimates
#> fitting model and testing
results <- results(deseq)
results
#> log2 fold change (MAP): dex untrt vs trt
#> Wald test p-value: dex untrt vs trt
#> DataFrame with 64102 rows and 6 columns
#> baseMean log2FoldChange lfcSE stat
#> <numeric> <numeric> <numeric> <numeric>
#> ENSG00000000003 708.60217 0.37415246 0.09884435 3.7852692
#> ENSG00000000005 0.00000 NA NA NA
#> ENSG00000000419 520.29790 -0.20206175 0.10974241 -1.8412367
#> ENSG00000000457 237.16304 -0.03616686 0.13834540 -0.2614244
#> ENSG00000000460 57.93263 0.08445399 0.24990709 0.3379415
#> ... ... ... ... ...
#> LRG_94 0 NA NA NA
#> LRG_96 0 NA NA NA
#> LRG_97 0 NA NA NA
#> LRG_98 0 NA NA NA
#> LRG_99 0 NA NA NA
#> pvalue padj
#> <numeric> <numeric>
#> ENSG00000000003 0.0001535423 0.001289269
#> ENSG00000000005 NA NA
#> ENSG00000000419 0.0655868795 0.197066711
#> ENSG00000000457 0.7937652416 0.913856017
#> ENSG00000000460 0.7354072415 0.884141575
#> ... ... ...
#> LRG_94 NA NA
#> LRG_96 NA NA
#> LRG_97 NA NA
#> LRG_98 NA NA
#> LRG_99 NA NA
My question is how can I recover the treated and control count for each gene to calculate the fold change in log2FoldChange
output above?
Thanks.
airway@assays$data$counts
is that normalized or not? If not how can I get the normalized one from S4?This answer A: How to recover treated/control count from DESeq2 output tells you how to get the counts object (normalized) from a deseq/S4 object