Hello,
I am using edgeR to calculate differential gene expression among individuals from two populations (BR and SD) exposed to three salinity treatments (15, 35, 60 ppt), with three biological replicates each (a, b, c) for 18 samples total. When I create my design matrix, my six treatments are named with numbers, but in the edgeR documentation, the treatments are named with letters, for example see section 3.2.3 on page 24. Because of the way my treatments are named, I am unsure about how to use the 'lrt <- glmLRT(fit, contrast=c(-1,1,0))' command. If someone could suggest how to change my treatment names from numbers to letters (preferred since this will allow me to keep following the manual) OR give an example of how to use the contrast argument with numbers, I would appreciate it. Thank you! The design and my code are below.
DESIGN:
> design
1 2 3 4 5 6
X1_BR15a 1 0 0 0 0 0
X2_BR15b 1 0 0 0 0 0
X3_BR15c 1 0 0 0 0 0
X4_BR35a 0 1 0 0 0 0
X5_BR35b 0 1 0 0 0 0
X6_BR35c 0 1 0 0 0 0
X7_BR60a 0 0 1 0 0 0
X8_BR60b 0 0 1 0 0 0
X9_BR60c 0 0 1 0 0 0
X10_SD15a 0 0 0 1 0 0
X11_SD15b 0 0 0 1 0 0
X12_SD15c 0 0 0 1 0 0
X13_SD35a 0 0 0 0 1 0
X14_SD35b 0 0 0 0 1 0
X15_SD35c 0 0 0 0 1 0
X16_SD60a 0 0 0 0 0 1
X17_SD60b 0 0 0 0 0 1
X18_SD60c 0 0 0 0 0 1
attr(,"assign")
[1] 1 1 1 1 1 1
attr(,"contrasts")
attr(,"contrasts")$group
[1] "contr.treatment"
MY CODE:
source("http://bioconductor.org/biocLite.R")
biocLite("edgeR")
library("edgeR")
x <- read.delim("path_to_file", header=TRUE, row.names="Symbols")
z <-x[ ,c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18)]
keep <- rowSums(cpm(z)) >=18
z<- z[keep,]
group <- c(1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6)
y <- DGEList(counts=z, group=group)
design <- model.matrix(~0+group, data=y$samples)
colnames(design) <- levels(y$samples$group)
y <- estimateGLMCommonDisp(y, design)
y <- estimateGLMTrendedDisp(y, design)
y <- estimateGLMTagwiseDisp(y, design)
fit <-glmFit(y, design)
lrt <- glmLRT(fit, contrast=c(-1,1,0)) ## What to put for contrast?
Not sure if it's a Safari thing, but I had a hell of a time with the simple formatting of the code in this comment -- hopefully we'll get a markdown editor back in here someday!
What was the issue? Was it that the code all looked like it was formatted as inline code? If so, are you using RStudio?
I was entering the answer all at once in the textbox itself (not copy/pasting from elsewhere). After that I'd highlight the relevant bits and change the formatting (ie. change "this" to inline code, change "that" to Code <blockstyle>, but it just wasn't behaving well. The insertion point was even jumping up to the top of the text box if I tried to delete whitespace in the middle of that endeavor.
Also: using RStudio? Puh-leeze ... emacs/ess or bust ... and I'd thank you if you refrain from repeating such an attempt to assassinate my character again in the future!
(j/k, for one reason or another I've been flirting with RStudio on occasion recently, and it's actually quite nice for some things)
Hmmm. A Mac guy who also uses emacs/ess? I didn't know you could do that - sort of like adding matter and antimatter together without the resulting annihilation. Do you also have a fusion reactor in your back yard?
Anyway, it seems to me that Safari is neck and neck with IE for 'most busted browser'. Does Chrome or Firefox work better?
The issue I see with RStudio (which I don't really use either - no need to change all the hard won keybinding muscle memory I have for using emacs/ess) is that a copy/paste results in everything being highlighted with what looks like inline code:
> really <- function(x) "why is this all greyed out?"
> really() [1] "why is this all greyed out?"
Which annoys me to no end...