Question: Could not shrink after adjusting factor level reference in DESeq2
0
gravatar for jfo
4 months ago by
jfo20
jfo20 wrote:

my two conditions are Keme and Latik, so I have condition_keme_vs_latik (based on dds). I want Latik to be the reference so:

res <- results(dds, lfcThreshold = lfc_cutoff, alpha = padj_cutoff, contrast = c("condition", "latik", "keme")

Now, to shrink the LFC:

resLFC <- lfcShrink(dds_out, coef="condition_keme_vs_latik", type="apeglm", res = res)

Error ensues:

Error in lfcShrink(dds, coef = "condition_keme_vs_latik", type = "apeglm", : 'coef' should specify same coefficient as in results 'res'

Of course, reversing the contrast to the original would allow me to proceed since the resultName shows "condition_keme_vs_latik", which coef expects. How do I run lfcShrink using my preferred factor levels?

lfcshrink rna-seq deseq2 • 185 views
ADD COMMENTlink written 4 months ago by jfo20

Okay. Sorry. I found a link to "Note on factor levels". Silly me.

ADD REPLYlink written 4 months ago by jfo20

It would be great if you can add a short explanation of the error and the solution to the answer field since this is a fairly common error and others might benefit from it in the future.

ADD REPLYlink written 4 months ago by ATpoint36k
1
gravatar for jfo
4 months ago by
jfo20
jfo20 wrote:

Sorry about that.

The error shows up because of the factor levels (changed reference to latik from keme) and the lfcShrink needs the right value for the coef (which can be determined using resultsName). The correct value would be the original keme as reference, i.e., condition_keme_vs_latik.

To run lfcShrink using my preferred reference condition, change the reference before running DESeq() using

dds$condition <- relevel(dds$condition, ref = "latik")
ADD COMMENTlink modified 4 months ago by ATpoint36k • written 4 months ago by jfo20
Please log in to add an answer.

Help
Access

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