DESeq2 extracting results: resultsNames does not show the expected output
3
0
Entering edit mode
@zeynepnenseth-12928
Last seen 7.6 years ago

Hi,

My data set is similar to the described "two conditions, two genotypes with an interaction term" situation. I think I do follow the example (2) correctly. However, when extracting results for the condition (e.g. treatment) effect for genotype II (e.g. X-KD), resultsNames function does not show the expected output. I know there are similar posts around but I could not figure it out myself.

Here is my code:

> library(DESeq2)
> coldata
                transfection      treatment ID
Ctr_untreated_1-1      siCtr      untreated  A
Ctr_untreated_1-2      siCtr      untreated  A
Ctr_untreated_2-1      siCtr      untreated  B
Ctr_untreated_2-2      siCtr      untreated  B
Ctr_untreated_3-1      siCtr      untreated  C
Ctr_untreated_3-2      siCtr      untreated  C
Ctr_untreated_4-1      siCtr      untreated  D
Ctr_untreated_4-2      siCtr      untreated  D
X-KD_untreated_1-1       siX      untreated  E
X-KD_untreated_1-2       siX      untreated  E
X-KD_untreated_2-1       siX      untreated  F
X-KD_untreated_2-2       siX      untreated  F
X-KD_untreated_3-1       siX      untreated  G
X-KD_untreated_3-2       siX      untreated  G
X-KD_untreated_4-1       siX      untreated  H
X-KD_untreated_4-2       siX      untreated  H
Ctr_treated_1-1        siCtr        hormone  I
Ctr_treated_1-2        siCtr        hormone  I
Ctr_treated_2-1        siCtr        hormone  J
Ctr_treated_2-2        siCtr        hormone  J
Ctr_treated_3-1        siCtr        hormone  K
Ctr_treated_3-2        siCtr        hormone  K
Ctr_treated_4-1        siCtr        hormone  L
Ctr_treated_4-2        siCtr        hormone  L
X-KD_treated_1-1         siX        hormone  N
X-KD_treated_1-2         siX        hormone  N
X-KD_treated_2-1         siX        hormone  O
X-KD_treated_2-2         siX        hormone  O
X-KD_treated_3-1         siX        hormone  P
X-KD_treated_3-2         siX        hormone  P
X-KD_treated_4-1         siX        hormone  Q
X-KD_treated_4-2         siX        hormone  Q

> raw_matrix <- read.table("Sequencing/HTSeq-count_allgenes_mod_order.txt", row.names=1, header=T)
> colnames(raw_matrix)<-NULL
> dds = DESeqDataSetFromMatrix(countData = raw_matrix, colData = coldata, design = ~ transfection + treatment + transfection:treatment)
> ddsColl <- collapseReplicates(dds, dds$ID)
> dds.test = DESeq(ddsColl)
> resultsNames(dds.test)
[1] "Intercept"                             "transfection_siX_vs_siCtr"        
[3] "treatment_untreated_vs_hormone" "transfectionsiX.treatmentuntreated"

I was expecting to get the output "transfectionsiX.treatmenthormone" instead of "transfectionsiX.treatmentuntreated".

. Where do I miss something?

Thanks,

Zeynep

deseq2 rnaseq resultsnames • 3.7k views
ADD COMMENT
0
Entering edit mode
@mikelove
Last seen 2 days ago
United States

See the DESeq2 vignette section on setting factor levels.

ADD COMMENT
0
Entering edit mode
@zeynepnenseth-12928
Last seen 7.6 years ago

Hi,

Thank you for the feedback. As I understood correctly, I can use relevel function in order to set the reference.

I did try this indeed before running the DESeq function (after collapsing replicates):

> ddsColl$transfection <- relevel (ddsColl$transfection, "siCtr")
> ddsColl$treatment <- relevel (ddsColl$treatment, "untreated")
> dds.test = DESeq(ddsColl)
> resultsNames(dds.test)
[1] "Intercept"                                  "transfection_siPLZF_vs_siCtr"             
[3] "treatment_hormonetreated_vs_untreated"      "transfectionsiPLZF.treatmenthormonetreated"

Here, I got the expected output from resultsNames.

Then in order to extract results for the treatment effect for X-KD, I wrote a similar code to the example (2):

> res <- results(dds.test, contrast=list(c("treatment_hormone_vs_untreated", "transfectionsiX.treatmenthormone"), alpha=0.05)

It gives this error:

Error in checkContrast(contrast, resNames) :
  'contrast', as a list of length 2, should have character vectors as elements,
see the manual page of ?results for more information

I don`t know where I miss something. Did I use relevel function wrong?

Thanks,

Zeynep

ADD COMMENT
0
Entering edit mode

hi Zeynep,

it's just a small coding bug. You didn't close the list() with a final ")". The code should be:

res <- results(dds.test, contrast=list(c("treatment_hormone_vs_untreated", "transfectionsiX.treatmenthormone")), alpha=0.05)
ADD REPLY
0
Entering edit mode
@zeynepnenseth-12928
Last seen 7.6 years ago

Thank you very much! It did solve the problem.

ADD COMMENT

Login before adding your answer.

Traffic: 532 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

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

Powered by the version 2.3.6