Question: How can I use edgeR for comparing a lot of treatments with control with fewer lines of code to avoid error during contrasting?
gravatar for biplab
2.9 years ago by
University of California, Davis
biplab110 wrote:

I am relatively new to R programming. I am using edgeR for differential expression analysis of my RNA-seq data. I have one control and around 25 treatments. I would like to compare contrast control with each treatment pair-wise. Currently I am doing it following way:

c_vs_t1 <- glmLRT(fit, contrast=c(-1,1,0,0,0,0,0,0,0,0,0,0..))

c_vs_t2 <- glmLRT(fit, contrast=c(-1,0,1,0,0,0,0,0,0,0,0,0..))

c_vs_t3 <- glmLRT(fit, contrast=c(-1,0,0,1,0,0,0,0,0,0,0,0..))

c_vs_t4 <- glmLRT(fit, contrast=c(-1,0,0,0,1,0,0,0,0,0,0,0..))

c_vs_t5 <- glmLRT(fit, contrast=c(-1,0,0,0,0,1,0,0,0,0,0,0..))

c_vs_t6 <- glmLRT(fit, contrast=c(-1,0,0,0,0,0,1,0,0,0,0,0..))

Similarly, in order to get get a table with logFC, I need to write around 25 line of similar code again as follow:

t1_logfc <- c_vs_t1$table

t2_logfc <- c_vs_t2$table

so on

How can I do this with few line of code? This might be a coding questions, I am not sure the question is appropriate or not for this site. If it seems inappropriate, I am really sorry for that. I will be really happy if someone can help me with this.

rna-seq R • 826 views
ADD COMMENTlink modified 2.9 years ago • written 2.9 years ago by biplab110

You can use for loops. More generally if you want to learn R, there are really nice cheatsheets about data transformation & import, apply functions and so on...

ADD REPLYlink modified 2.9 years ago • written 2.9 years ago by arta620
Please log in to add an answer.


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