TreatDGE function usage
2
1
Entering edit mode
candida.vaz ▴ 50
@candidavaz-6923
Last seen 5.2 years ago
Singapore

Dear EDGER support team,

I have a single factor experiment with the 5 different samples having three replicates each.

group <- factor(c("a","a","a","b","b","b","c","c","c","d","d","d","e","e","e"))

Using a GLM based approach, and using TreatDGE function, I am trying to obtain the Differentially expressed genes. The following two kinds of comparisons are of interest to me:

1. (b vs a), (c vs a), (d vs a), (e vs a)

2. (c vs b), (e vs d)

For the 1st type of comparison, I was using this:

tr <- treatDGE(fit, coef=2, lfc=1) (b vs a)

tr <- treatDGE(fit, coef=3, lfc=1) (c vs a)

tr <- treatDGE(fit, coef=4, lfc=1) (d vs a)

tr <- treatDGE(fit, coef=5, lfc=1) (e vs a)

Is this correct?

How can I make use of the "contrast" argument of the TreatDGE function for these comparisons.

And how to do the second kind of comparisons? I read the TreatDGE function information provided, but not able to decide on how to use it correctly.

Thanks in advance for the help!

Candida

edger • 1.7k views
ADD COMMENT
3
Entering edit mode
@gordon-smyth
Last seen 1 hour ago
WEHI, Melbourne, Australia

I'm assuming that your fit used the design matrix:

design <- model.matrix(~group)

To test (c vs b) you can use:

treatDGE(fit, contrast=c(0,-1,1,0,0), lfc=1)

To test (e vs d):

treatDGE(fit, contrast=c(0,0,0,-1,1), lfc=1)

Note that

treatDGE(fit, coef=2, lfc=1)

is just shorthand for:

treatDGE(fit, contrast=c(0,1,0,0,0), lfc=1)

In general, the contrast argument behaves the same for treatDGE() as it does for the glmLRT() function.

ADD COMMENT
0
Entering edit mode
candida.vaz ▴ 50
@candidavaz-6923
Last seen 5.2 years ago
Singapore

Dear Gordon,

Thanks a lot for your prompt reply,

I read in the edge R tutorial that "0+ in the model formula is an instruction not to include an intercept column and
instead to include a column for each group".

so I decided to fit my design matrix as: "design <- model.matrix(~0+group)"

x <- read.delim("known-miR-expression-profiling-max-read-counts.txt",row.names="Symbol")
group <- factor(c("a","a","a","b","b","b","c","c","c","d","d","d","e","e"))
y <- DGEList(counts=x,group=group)
data.frame(Sample=colnames(y),group)
y <- calcNormFactors(y)
norm.vals <- cpm(y)
design <- model.matrix(~0+group)
y <- estimateGLMCommonDisp(y, design, verbose=TRUE)
y <- estimateGLMTrendedDisp(y, design)
y <- estimateGLMTagwiseDisp(y, design)
fit <- glmFit(y, design)

for b vs a :

groupbvsgroupa <- makeContrasts(groupb-groupa, levels=design)
tr <- treatDGE(fit, contrast=groupbvsgroupa, lfc=1)

for c vs b :

groupcvsgroupb <- makeContrasts(groupc-groupb, levels=design)
tr <- treatDGE(fit, contrast=groupcvsgroupb, lfc=1)

Is this a correct way too?

Another doubt I had is that is one of the sample replicate is not good and I decide to remove it, so for 4 samples  (a-d)

I have 3 replicates and the 5th one (e) has two, can I still proceed as:

group <- factor(c("a","a","a","b","b","b","c","c","c","d","d","d","e","e"))

 

Thank you very much for your kind help!

Candida

 

ADD COMMENT
1
Entering edit mode

The specification of the contrasts looks good to me. Your code will still work without the problematic replicate from group E (though, whether or not it makes sense to remove that replicate is another matter). Make sure that you have also removed the corresponding column in the count matrix.

ADD REPLY
0
Entering edit mode

Thanks Aaron,

Yes I have removed the corresponding column in the count matrix.

Thanks for the help!

Candida

ADD REPLY

Login before adding your answer.

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