DESeq2 contrasts within group only comparing against one level
1
0
Entering edit mode
Nmabe • 0
@nmabe-14642
Last seen 5.8 years ago

 

Hi all-

I would like to be able to contrast the condition within a cell type (e.g. R1Vehicle vs. R1 Treated), but when I run DESeq with my group levels, it appears that the results from DESeq2 are already contrasting levels against a single level (P1Treated). Am I inputting the groupings wrong for my type and condition? Thanks in advance.

a <- read.csv("~/Desktop/BIX/SampleSheetBIX.csv", header=T)

   sampleName fileName type condition
1  42929veh_1   R1.txt   R1   Vehicle
2  42929veh_2   R2.txt   R1   Vehicle
3   42929tx_1   R3.txt   R1   Treated
4   42929tx_2   R4.txt   R1   Treated
5  20342veh_1   R5.txt   R2   Vehicle
6  20342veh_2   R6.txt   R2   Vehicle
7   20342tx_1   R7.txt   R2   Treated
8   20342tx_2   R8.txt   R2   Treated
9  40977veh_1   R9.txt   R3   Vehicle
10 40977veh_2  R10.txt   R3   Vehicle
11  40977tx_1  R11.txt   R3   Treated
12  40977tx_2  R12.txt   R3   Treated
13 54074veh_1  R13.txt   P1   Vehicle
14 54074veh_2  R14.txt   P1   Vehicle
15  54074tx_1  R15.txt   P1   Treated
16  54074tx_2  R16.txt   P1   Treated
17 99142veh_1  R17.txt   P2   Vehicle
18 99142veh_2  R18.txt   P2   Vehicle
19  99142tx_1  R19.txt   P2   Treated
20  99142tx_2  R20.txt   P2   Treated

dds <- DESeqDataSetFromHTSeqCount(sampleTable=a, design= ~type+condition)

dds$group <- factor(paste0(dds$type, dds$condition))

design(dds) <- ~ group

> dds$group
[1] R1Vehicle R1Vehicle R1Treated R1Treated R2Vehicle R2Vehicle R2Treated R2Treated R3Vehicle R3Vehicle R3Treated R3Treated P1Vehicle P1Vehicle P1Treated P1Treated
[17] P2Vehicle P2Vehicle P2Treated P2Treated
Levels: P1Treated P1Vehicle P2Treated P2Vehicle R1Treated R1Vehicle R2Treated R2Vehicle R3Treated R3Vehicle

dds2 <- DESeq(dds)

> resultsNames(dds2)
[1] "Intercept"                    "group_P1Vehicle_vs_P1Treated" "group_P2Treated_vs_P1Treated" "group_P2Vehicle_vs_P1Treated" "group_R1Treated_vs_P1Treated"
[6] "group_R1Vehicle_vs_P1Treated" "group_R2Treated_vs_P1Treated" "group_R2Vehicle_vs_P1Treated" "group_R3Treated_vs_P1Treated" "group_R3Vehicle_vs_P1Treated"

 

deseq2 • 986 views
ADD COMMENT
1
Entering edit mode
@mikelove
Last seen 9 hours ago
United States

You can compare any two levels of group using the 'contrast' argument:

res <- results(dds, contrast=c("group", "...", "..."))

resultsNames(dds) just prints the coefficients that were fit, but you can use 'contrast' to make comparisons of interest.

ADD COMMENT

Login before adding your answer.

Traffic: 849 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