Question: How can I use edgeR for comparing a lot of treatments with control with fewer lines of code to avoid error during contrasting?
0
gravatar for biplab
2.7 years ago by
biplab100
University of California, Davis
biplab100 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 • 759 views
ADD COMMENTlink modified 2.7 years ago • written 2.7 years ago by biplab100
1

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.7 years ago • written 2.7 years ago by arta590
Please log in to add an answer.

Help
Access

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