lgeistlinger / EnrichmentBrowser

Seamless navigation through combined results of set-based and network-based enrichment analysis
20 stars 11 forks source link

How can I make use of DESeq2's normalization factors during import? #27

Closed lgeistlinger closed 4 years ago

lgeistlinger commented 4 years ago

Thank you so much, @lgeistlinger ! Here are the updates:

  1. design = ~ batch + condition worked! (Results were not very different with or without age, thanks to you, age is no more covariate of interest in my analysis.)

  2. I could not proceed without normalization:

    res <- sbea(method = "gsea", se = se, gs = go.bp.gs, browse = T)
    Error in .reorderAssays(se, assay) : 
    Expression dataset (se) does not contain an assay named "norm"

    Normalization worked but excluded ~91 % of genes:

    se <- normalize(se, norm.method = "vst")
    Excluding 8118 genes not satisfying min.cpm threshold

    The results were from DESeq2 and not from raw read counts. Considering the vignette, I am not sure if normalization is needed. Also, DESeq2 output already has normalization factors:

image

How can I make use of DESeq2's normalization factors to normalize the count slot and create "norm" slot in an SE? (I think, it's an important consideration for the import() function.)

Originally posted by @vivek-verma202 in https://github.com/lgeistlinger/EnrichmentBrowser/issues/23#issuecomment-685080240

lgeistlinger commented 4 years ago

This is now possible in EnrichmentBrowser v2.19.5.

You can install this version of the package directly from github via:

BiocManager::install("lgeistlinger/EnrichmentBrowser")

Now, importing from DESeq2

> se <- import(dds, res)
> se
class: RangedSummarizedExperiment 
dim: 64102 8 
metadata(4): '' version design dataType
**assays(2): raw norm**
rownames(64102): ENSG00000000003 ENSG00000000005 ... LRG_98 LRG_99
rowData names(27): baseMean FC ... deviance maxCooks
colnames(8): SRR1039508 SRR1039509 ... SRR1039520 SRR1039521
colData names(11): SampleName cell ... sizeFactor GROUP

will automatically attach an additionally assay norm that contains the variance-stabilized expression values that are normalized for differences in library size between samples.

The resulting se can then be used to carry out enrichment methods such as gsea:

> res <- sbea("gsea", se, kegg.gs)
Permutations: 1 -- 100
Processing ...