Search
Question: Comparisons both between and within subjects using DESeq2
0
gravatar for asaferali
2.4 years ago by
asaferali0
Canada
asaferali0 wrote:

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!

 

 

 

ADD COMMENTlink modified 2.4 years ago • written 2.4 years ago by asaferali0

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

ADD REPLYlink written 2.4 years ago by Michael Love11k

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 REPLYlink written 2.4 years ago by asaferali0
0
gravatar for asaferali
2.4 years ago by
asaferali0
Canada
asaferali0 wrote:

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 COMMENTlink modified 2.4 years ago • written 2.4 years ago by asaferali0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 122 users visited in the last hour