Biostar Beta. Not for public use.
Question: why DEseq2 does not care about the condition?
0
Entering edit mode

I just came across a very serious problem with very known package. Either I am mistake or there is something going on with this package.

You can test it on any sample you have . I tested it on a count value of two of my transcriptome data

First

condition <- factor(c(rep("Normal", 10),rep("Tumor", 11)))​​
dds <- DESeqDataSetFromMatrix(dfm, DataFrame(condition), ~ condition)​
keep <- rowSums(counts(dds)) >= 1
dds <- dds[keep,]
dds <- DESeq(dds)​

Second way to do

condition <- factor(c(rep("Tumor", 11),rep("Normal", 10)))​​
dds <- DESeqDataSetFromMatrix(dfm, DataFrame(condition), ~ condition)​
keep <- rowSums(counts(dds)) >= 1
dds <- dds[keep,]
dds <- DESeq(dds)​

Both will give you the same LogFold change, This is not correct , am I mistaken in any way?

ensembl_gene_id           baseMean log2FoldChange      lfcSE
1 ENSG00000000003              3796.1249    -0.53555500 0.08317700
2 ENSG00000000005              488.0348    -4.05982089 0.24879251
3 ENSG00000000419              1955.4115     0.38420490 0.05960030
4 ENSG00000000457              1714.8072     0.46568839 0.06396953
5 ENSG00000000460             561.7435     1.34575314 0.07998034
6 ENSG00000000938             737.0033    -0.07637925 0.13679817
         stat       pvalue         padj
1  -6.4387389 1.204703e-10 4.953873e-10
2 -16.3180992 7.338521e-60 4.064709e-58
3   6.4463581 1.145698e-10 4.721174e-10
4   7.2798468 3.341996e-13 1.659606e-12
5  16.8260485 1.572530e-63 1.044359e-61
6  -0.5583353 5.766154e-01 6.495767e-01
ADD COMMENTlink 20 months ago Learner • 160 • updated 19 months ago RamRS 21k
Entering edit mode
0

Is there a factor of -1?

ADD REPLYlink 20 months ago
russhh
♦ 4.4k
Entering edit mode
0

@russhh can you explian what you mean with -1?

ADD REPLYlink 20 months ago
Learner
• 160
Entering edit mode
0

Surely you see that the simplest explanation is that you have something wrong, but you need to show us the first few lines of your input and output for us to see what it is.

ADD REPLYlink 20 months ago
swbarnes2
5.7k
Entering edit mode
0

@swbarnes2 look at above please

ADD REPLYlink 20 months ago
Learner
• 160
Entering edit mode
0

I don't think you've made the colData part right, so I think both of your scripts are really running with design ~ 1

ADD REPLYlink 20 months ago
swbarnes2
5.7k
Entering edit mode
0

@swbarnes2 can you please tell me how to make that then?

ADD REPLYlink 20 months ago
Learner
• 160
Entering edit mode
0

In general, you need to figure that people will spend about 1/10th the time answering your question as you demonstrate you have put into trying to solve it. How much time do you think your responses here make it look like you've spent?

ADD REPLYlink 20 months ago
swbarnes2
5.7k
Entering edit mode
0

@swbarnes2 can you please be specific? I cannot understand your point? do you mean that I don't spend enough time on solving the issue myself? if so and if I knew how to solve it why then should I bother and post it here ?

ADD REPLYlink 20 months ago
Learner
• 160
Entering edit mode
0
Entering edit mode
0

This is not an answer - should be a comment as it is asking for clarification and not answering the question.

ADD REPLYlink 19 months ago
RamRS
21k
3
Entering edit mode
condition  <- factor(c(rep("Normal", 10),rep("Tumor", 11)))
condition2 <- factor(c(rep("Tumor", 11),rep("Normal", 10)))
levels(condition)
[1] "Normal" "Tumor" 
levels(condition2)
[1] "Normal" "Tumor"

The levels of your factor variable are the same (alphabetical unless absolutely specified), therefore when you're testing your model, it'll create the same contrast by default.

ADD COMMENTlink 20 months ago andrew.j.skelton73 5.7k
Entering edit mode
0

@andrew.j.skelton73 how would you do it differently ?

ADD REPLYlink 20 months ago
Learner
• 160
Entering edit mode
0

relevel? @learner

ADD REPLYlink 20 months ago
cpad0112
11k
Entering edit mode
0

@cpad0112 got it , thanks , I am testing to see if the problem solve and I will accept your answer . Thanks

ADD REPLYlink 20 months ago
Learner
• 160
Entering edit mode
1

you can set reference levels before hand:

> condition  <- factor(c(rep("Normal", 10),rep("Tumor", 11)),levels=c("Tumor","Normal"))
> levels(condition)
[1] "Tumor"  "Normal"
> condition1  <- factor(c(rep("Normal", 10),rep("Tumor", 11)),levels=c("Normal","Tumor"))
> levels(condition1)
[1] "Normal" "Tumor" 
> condition
 [1] Normal Normal Normal Normal Normal Normal Normal Normal Normal Normal Tumor  Tumor  Tumor 
[14] Tumor  Tumor  Tumor  Tumor  Tumor  Tumor  Tumor  Tumor 
Levels: Tumor Normal
> condition1
 [1] Normal Normal Normal Normal Normal Normal Normal Normal Normal Normal Tumor  Tumor  Tumor 
[14] Tumor  Tumor  Tumor  Tumor  Tumor  Tumor  Tumor  Tumor 
Levels: Normal Tumor
ADD REPLYlink 20 months ago
cpad0112
11k
Entering edit mode
0

You could keep everything as is, and just specify the contrast you're interested in. Check out ?results

> results1 <- results(dds, contrast=c("condition","Tumor","Normal"))
> results2 <- results(dds, contrast=c("condition","Normal","Tumor"))
ADD REPLYlink 20 months ago
andrew.j.skelton73
5.7k
• updated 19 months ago
RamRS
21k
Entering edit mode
0

@andrew.j.skelton73 Thanks Andrew, I like the way you answer my question, it helped me alot THANKS

ADD REPLYlink 20 months ago
Learner
• 160

Login before adding your answer.

Similar Posts
Loading Similar Posts
Powered by the version 2.0