Comparisons both between and within subjects using DESeq2
1
0
Entering edit mode
asaferali • 0
@asaferali-6904
Last seen 8.4 years ago
Canada

Hello,

I have RNAseq data from 5 patients before and after treatment, and 5 controls before and after treatment.  I would like to identify genes that respond differently to treatment in patients compared to controls.  Because  we have data from the same individuals before and after treatment, we would like the model to include a term for subjects, ie. design=~Disease+Disease:Subject+Disease:Treatment.

While this comparison is possible using EdgeR, I cannot get it to work using DESeq2.  I keep receiving the message "Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels".  Is there any way to make this comparison using DESeq2?

My script and the error I receive is below:

> countData<-counts
> coldata = with(samples, data.frame(LibraryName = I(LibraryName),Disease = Disease,Treatment = Treatment,Subject = Subject))
> dds<-DESeqDataSetFromMatrix(countData=countData, colData=coldata, design=~Disease+Disease:Subject+Disease:Treatment)
> dds$Disease<-relevel(dds$Disease, "HAP")
> dds$Treatment<-relevel(dds$Treatment, "Control")
> dds<-DESeq(dds)
estimating size factors
estimating dispersions
gene-wise dispersion estimates
mean-dispersion relationship
final dispersion estimates
fitting model and testing
Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) :
  contrasts can be applied only to factors with 2 or more levels

Thank you in advance for your suggestions!

 

 

 

deseq2 edger differentialexpression • 2.9k views
ADD COMMENT
0
Entering edit mode

Can you show the colData(dds) (you can replace subject ids if necessary using levels(dds$Subject) <- ... ) and also print the sessionInfo()?

ADD REPLY
0
Entering edit mode

Actually I figured out the problem. Subject was not stored as a factor, but as an integer.  By changing it to a factor I can get DESeq to run.

Thanks!

ADD REPLY
0
Entering edit mode
asaferali • 0
@asaferali-6904
Last seen 8.4 years ago
Canada

Actually I figured out the problem. Subject was not stored as a factor, but as an integer.  By changing it to a factor I can get DESeq to run.

Thanks!

 

ADD COMMENT

Login before adding your answer.

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