0
2.6 years ago by
TFony10
TFony10 wrote:

Hi, everyone.

In my experiment, I have 5 objects (A,B,C,D,E) with drug treatment (Pre and Post). Therefore total samples include A-pre, A-post, B-pre, B-post, C-pre, C-post, D-pre, D-post, E-pre, E-post

Fist aim is comparing pre-treatment and post-treament, it should be 5 samples vs 5 samples

Second aim is comparing pre-treatment and post-treament in each indidual object, it should be A-pre vs A-post; B-pre vs B-post, C-pre vs C-post, D-pre vs D-post, E-pre vs E-post

I am confused about how to make design matrix and contrast matrix.

Design <- model.matrix(~0+treat_status+object) ??

Contrast <- make.contrast() ???

Thanks

Bests,

Shawn

modified 2.6 years ago • written 2.6 years ago by TFony10
1
2.6 years ago by
Gavin Kelly560
United Kingdom / London / Francis Crick Institute
Gavin Kelly560 wrote:

To get the overall pre vs post, taking account of the pairing, you'll need ~treat_status + object and the second coefficient will give you the log fold-change estimate of the pre vs post (it'll be relative to 'post' if you've kept the default alphabetic factor order). So topTable(..., coef=2), or topTable(..., coef="treat_statusPost")

If you don't include an intercept (with your inclusion of '0' on the RHS of the model formula), then you'll get an esimate for both pre and post, so you'd need to have a make.contrast that subtracted these two; with an intercept, everythings relative to the baseline condition, so that subtraction is already done for you.

To get individual objects' changes, you'll need  ~ object + object:treat_status - 1 and you'll get the first five coefficients being the per-object baseline, and the next five being the per-object post-to-pre log fold change.  So topTable(..., coef=6)  or topTable(..., coef="objectA:treat_statusPost")  etc

1

Just to add to Gavin's answer; it seems that you only have one sample per object/treatment combination. In that case, there will not be any residual degrees of freedom in your design matrix if you include a log-fold change term for each object. This precludes a DE analysis with limma, because there is no way to estimate the sample variance. It is not possible to get significance statistics for individual objects, only the log-fold changes. Thus, you might as well just compute the pre/post differences in log-expression values directly for each object, which is the best you can do for your second aim.

0
2.6 years ago by
TFony10
TFony10 wrote:

Bests,

Shawn