SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
DESeq2 multiple levels id0 Bioinformatics 3 05-30-2014 12:31 PM
Replacing aspects of the DESeqDataSet Rivalyn Bioinformatics 2 05-26-2014 01:59 PM
DEXSeq with experimental variables adumitri Bioinformatics 2 06-27-2013 07:37 AM
does bayseq struggle with highly expressed outliers? unknown_unknowns Bioinformatics 0 03-25-2013 09:04 AM
Add Readgroups to Tophat multiple sample input? Pamela Mukhopadhyay Bioinformatics 0 12-14-2011 09:55 PM

Reply
 
Thread Tools
Old 06-08-2014, 03:01 PM   #1
JonB
Member
 
Location: Norway

Join Date: Jan 2010
Posts: 83
Default DESeq2: struggle to add multiple variables to DESeqDataSet

Hi,

I want to add the two variables condition and treatment to my DESeqDataSet, and I thought I had succeeded:

> ddsHTSeq
class: DESeqDataSet
dim: 21680 11
exptData(0):
assays(1): counts
rownames(21680): scign000001 scign000002 ... scign021679 scign021680
rowData metadata column names(0):
colnames(11): R1D0B1 R1D2B1 ... R3DxB1 R3DzB1
colData names(2): condition treatment

I added four levels to condition and two levels to treatment and I am able to pull out DESeq results from the different levels of condition, but I can't pull out the results from treatment:

> resTreatment = results(ddsHTSeq, contrast=c("treatment", "cut", "uncut"))

Any ideas what I am doing wrong?
JonB is offline   Reply With Quote
Old 06-09-2014, 05:59 AM   #2
Michael Love
Senior Member
 
Location: Boston

Join Date: Jul 2013
Posts: 333
Default

hi Jon,

Can you include the code you used to create ddsHTSeq?
Michael Love is offline   Reply With Quote
Old 06-09-2014, 01:38 PM   #3
JonB
Member
 
Location: Norway

Join Date: Jan 2010
Posts: 83
Default

Here's the code I used:

Code:
library("DESeq2")

#Set the directory where the HTSeq count files are located
directory = "/Users/jonbra/Desktop/Gene_count_files/"

#Catch the files with the pattern "GFF"
sampleFiles = grep("GFF", list.files(directory), value=TRUE)
sampleFiles

#Setup sample conditions in the same order of the files in sampleFiles
sampleCondition = c("D0", "D2", "Dx", "Dz", "D0", "D2", "Dx", "Dz", "D0", "Dx", "Dz")
sampleName = c("R1D0B1", "R1D2B1", "R1DxB1", "R1DzB1", "R2D0B1", "R2D2B1", "R2DxB1", "R2DzB1", "R3D0B1", "R3DxB1", "R3DzB1")
sampleTreatment = c("uncut", "cut", "cut", "cut", "uncut", "cut", "cut", "cut", "uncut", "cut", "cut")
sampleTable = data.frame(sampleName=sampleName, fileName=sampleFiles, condition=sampleCondition, treatment=sampleTreatment)
sampleTable

#Creates the DESeqDataSet which stores the count data for DESeq2
ddsHTSeq = DESeqDataSetFromHTSeqCount(sampleTable=sampleTable, directory=directory, design= ~ condition)
ddsHTSeq

colData(ddsHTSeq)$condition=factor(colData(ddsHTSeq)$condition, levels=c("D0", "D2", "Dx", "Dz"))
colData(ddsHTSeq)$treatment=factor(colData(ddsHTSeq)$treatment, levels=c("uncut", "cut"))
I tried to use this design formula instead:

Code:
ddsHTSeq = DESeqDataSetFromHTSeqCount(sampleTable=sampleTable, directory=directory, design= ~ treatment + condition)
But got this error message:

Error in DESeqDataSet(se, design = design, ignoreRank) :
the model matrix is not full rank, i.e. one or more variables in the design formula are linear combinations of the others
JonB is offline   Reply With Quote
Old 06-09-2014, 01:54 PM   #4
Michael Love
Senior Member
 
Location: Boston

Join Date: Jul 2013
Posts: 333
Default

The problem you will have with modeling ~ treatment + condition is that D0 is indistinguishable from uncut, i.e. all samples which are D0 are also uncut and vice versa. That makes the model impossible to fit as specified.

If you leave out the treatment variable, you can make comparisons of each level against the other. And you can also make the comparison of D2,Dx,Dz vs D0 (so the treatment contrast you are interested) using the list argument to the contrast argument:

Code:
results(dds, 
  contrast=list(c("conditionD2","conditionDx","conditionDz"),"conditionD0"), 
  listValues=c(1/3,-1))
Michael Love is offline   Reply With Quote
Old 06-09-2014, 02:00 PM   #5
JonB
Member
 
Location: Norway

Join Date: Jan 2010
Posts: 83
Default

Ah, I see. That makes sense. Thanks!
JonB is offline   Reply With Quote
Reply

Tags
deseq, deseq2

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 06:10 PM.


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