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.
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...