## Example 1: simple two-group comparison
example("DESeq")
results(dds)
results(dds, format="GRanges")
resultsNames(dds)
dds <- removeResults(dds)
## Example 2: two conditions, two groups, with interaction term
dds <- makeExampleDESeqDataSet(n=100,m=12)
dds$group <- factor(rep(rep(c("X","Y"),each=3),2))
design(dds) <- ~ group + condition + group:condition
dds <- DESeq(dds)
resultsNames(dds)
# the condition effect
results(dds, contrast=c("condition","B","A"))
# the group effect
results(dds, contrast=c("group","Y","X"))
# the interaction term
results(dds, name="groupY.conditionB")
# the condition effect in group B
results(dds, contrast=c(0,0,1,1))
# or, equivalently using list to add these two effects
results(dds, contrast=list(c("condition_B_vs_A","groupY.conditionB")))
## Example 3: two conditions, three groups, with interaction terms
dds <- makeExampleDESeqDataSet(n=100,m=18)
dds$group <- factor(rep(rep(c("X","Y","Z"),each=3),2))
design(dds) <- ~ group + condition + group:condition
dds <- DESeq(dds)
resultsNames(dds)
# the main effect for condition
results(dds, contrast=c("condition","B","A"))
# which is equivalent to
results(dds, contrast=list("conditionB","conditionA"))
# the interaction term for condition in group Z.
# if this term is non-zero, then group Z has a
# different condition effect than the main effect for condition
results(dds, contrast=list("groupZ.conditionB","groupZ.conditionA"))
# the condition effect in group Z.
# this is the sum of the main effect for condition
# and the interaction effect for condition in group Z
results(dds, contrast=list(
c("conditionB","groupZ.conditionB"),
c("conditionA","groupZ.conditionA")))
# the group Z effect compared to the average of group X and Y.
# here we use 'listValues' to multiply the effect sizes for
# group X and group Y by -1/2
results(dds, contrast=list("groupZ",c("groupX","groupY")), listValues=c(1,-1/2))
# the individual effect for group Z, compared to the intercept
results(dds, name="groupZ")
Run the code above in your browser using DataLab