SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
DEXSeq - more than two different conditions yylilly RNA Sequencing 22 04-25-2019 08:00 PM
Looking for replicated conditions IsBeth Bioinformatics 3 03-26-2014 04:44 AM
DESeq2: Difference between condition+type vs. 3 conditions mevers Bioinformatics 3 09-02-2013 01:17 AM
Is more than two conditions possible in DESEQ? greener RNA Sequencing 5 05-09-2011 03:10 PM
Sensitivity of Mutant Detection srr8623 Illumina/Solexa 0 07-14-2010 03:05 PM

Reply
 
Thread Tools
Old 04-17-2014, 01:06 PM   #1
TheSeqGeek
Member
 
Location: USA

Join Date: Feb 2014
Posts: 40
Default DESeq2 (Mutant/WT + Two Conditions)

1. ) I would like to know whether the level of gene expression is caused by the mutation or by the condition or perhaps there is some mixture. I have three replicates for each experiment.

Condition1 = Exponential Phase
|
|---------> Mutant
|---------------------WT

Condition2 = Stationary Phase
|
|---------> Mutant
|---------------------WT



WT has three replicates in the Exponential phase AND three replicates in the Stationary phase

Mutant has three replicates in the Exponential phase and three replicates in the Stationary phase.


2. ) I already looked over DESeq2 vignette/manual so please don't refer me to that. I would like to know how to setup the factors and levels to make this comparison possible and meaningful to interpret.

Help is greatly appreciated. I know there a few other people who would like to know how to do this.

Last edited by TheSeqGeek; 04-17-2014 at 01:10 PM.
TheSeqGeek is offline   Reply With Quote
Old 04-18-2014, 01:26 AM   #2
dpryan
Devon Ryan
 
Location: Freiburg, Germany

Join Date: Jul 2011
Posts: 3,480
Default

Your design is simply:
Code:
design <- ~genotype*phase
Depending on how you construct the DESeqDataSet, you would also need to associate your samples to these factors in either the "coldata" (rows are samples and the columns would be "genotype" and "phase") of the 3rd and 4th columns of sampleTable if you're using DESeqDataSetFromHTSeqCount.
dpryan is offline   Reply With Quote
Old 04-22-2014, 06:39 AM   #3
Michael Love
Senior Member
 
Location: Boston

Join Date: Jul 2013
Posts: 333
Default

Yes, Devon has the correct design for you, which is equivalent to

Code:
~ genotype + phase + genotype:phase
Quote:
I would like to know whether the level of gene expression is caused by the mutation or by the condition or perhaps there is some mixture.
In (generalized) linear modeling, this is referred to as an interaction.

If you run DESeq() with the design that Devon provided, you can use the example code below in order to build a results table, where the p-values and adjusted p-values specifies tests of whether the coefficient is zero, and the coefficients available for testing are genotype, phase, and genotype X phase. If there is an effect of the combination which is not explained by simply multiplying the genotype and phase effect, then the interaction term will have a low p-value and adjusted p-value.

you can follow the example in ?results, which is in the 1.4 release version of DESeq2:

Code:
# 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)
results(dds, contrast=c("condition","B","A"))
results(dds, contrast=c("group","Y","X"))
# extract the interaction term simply with name
results(dds, name="groupY.conditionB")
Michael Love is offline   Reply With Quote
Old 04-22-2014, 08:52 AM   #4
TheSeqGeek
Member
 
Location: USA

Join Date: Feb 2014
Posts: 40
Default

I got this far

Code:
library(DESeq2)

#import the data
directory<-"/Users/Kumka/Documents/R/analysis/"
sampleFiles <- list.files(path="/Users/Name/Documents/R/fnr_analysis/",pattern="*.txt")
sampleFiles


#Give names to experimental conditions
sampleGroup <- factor(rep(rep(c("Mutant","WT"),each=3),2))
sampleCondition <- factor(rep(rep(c("Exponential","Stationary"),each=6),1))
sampleTable<-data.frame(sampleName=sampleFiles, fileName=sampleFiles, group=sampleGroup, condition=sampleCondition)
sampleTable


ddsHTSeq<-DESeqDataSetFromHTSeqCount(sampleTable=sampleTable, directory=directory, design=~group*condition)
dds<-DESeq(ddsHTSeq)
res<-results(dds)
I'm not quite sure how to interpret the log2FC though.... Any thoughts help on this? It's not comparing mutant/wt in one condition but on both is it not?
Here is the code
Code:
resultsNames(dds)
group.results <- results(dds, contrast=c("group","WT","Mutant"))
group.results <- group.results[order(group.results$padj),]
head(group.results)
write.csv(group.results, "WT_vs_Mutant_results.csv")
The code
Code:
results(ddd)
Is the same as the interaction term same as in the code
Code:
results(ddd, name = "groupY.conditonB")

Last edited by TheSeqGeek; 04-22-2014 at 10:36 AM.
TheSeqGeek is offline   Reply With Quote
Old 04-23-2014, 11:28 AM   #5
Michael Love
Senior Member
 
Location: Boston

Join Date: Jul 2013
Posts: 333
Default

When you run a 2x2 analysis with an interaction term, the main effects comparisons, e.g.,

results(dds, contrast=c("group","WT","Mutant"))

generates a results table of log2 WT vs Mutant fold change for the base level of phase.

The log2 WT vs Mutant fold change for the other level of the phase is:

log2 WT vs Mutant + interaction

If the interaction term for a gene is 0, then the WT / Mutant effect is the same for both phases.
Michael Love is offline   Reply With Quote
Old 05-06-2014, 02:21 PM   #6
lbragg
Member
 
Location: Brisbane

Join Date: Sep 2009
Posts: 14
Default

Quote:
Originally Posted by Michael Love View Post
When you run a 2x2 analysis with an interaction term, the main effects comparisons, e.g.,

results(dds, contrast=c("group","WT","Mutant"))

generates a results table of log2 WT vs Mutant fold change for the base level of phase.

The log2 WT vs Mutant fold change for the other level of the phase is:

log2 WT vs Mutant + interaction

If the interaction term for a gene is 0, then the WT / Mutant effect is the same for both phases.
I am using DESeq2 for a similar study design (treatment and time, each with two levels), and need a little help with the above explanation.

Does this code
Code:
results(ddd, name = "groupY.conditonB")
give the log2 WT vs Mutant + interaction results?

Also, in this example, how would you get the DE genes between the two levels of phase for the mutant type?

Thanks!
lbragg is offline   Reply With Quote
Old 05-06-2014, 05:04 PM   #7
Michael Love
Senior Member
 
Location: Boston

Join Date: Jul 2013
Posts: 333
Default

hi lbragg,

name = "groupY.conditonB" gives just the interaction effect.

If you want to add the condition B vs A and the interaction effect, you can either provide a numeric contrast (where the numbers correspond to elements of resultsNames(dds)):

Code:
results(dds, contrast=c(0,0,1,1))
or if you are using v1.4, you can provide a list to 'contrast':

Code:
results(dds, contrast=list(c("condition_B_vs_A","groupY.conditionB"),character()))
See the ?results help for the 'contrast' argument for more details.

Either of these gives the same results table, which is the condition effect for group Y. See here for a primer on how interactions work in linear models: http://en.wikipedia.org/wiki/Interaction_(statistics)
Michael Love is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 10:45 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO