How can I use edgeR for comparing a lot of treatments with control with fewer lines of code to avoid error during contrasting?
0
0
Entering edit mode
6.2 years ago
biplab ▴ 110

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 • 1.4k views
ADD COMMENT
1
Entering edit mode

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 REPLY

Login before adding your answer.

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