decideTests() does what you want, and it does provide BH as an adjustment option. Note that "fdr" and "BH" are the same thing.
You could also consider using an F-test for the three contrasts, i.e., topTable(fit2,, coef=1:3).
Another option is to use write.fit(). You pass it your MArrayLM object (fit2
above), and optionally a TestResults object that has the -1,0,1 designations from decideTests (could use groups
above if you want a separate adjustment), and specify the adjustment type ("BH" or "fdr" are the same as Gordon said), and whether you want to apply the method separately for each contrast or put all 3 together in one global adjustment. Two possible downsides to this method: 1) It writes out for all genes, so you'd have to subset to what you want later and 2) it writes it out to a text file, which you'd have to read back into R if you want to do more manipulations.
If you're fine with the separate test adjustment, then you could use topTable this way:
topTable_T1_Control <- topTable(fit2, coef=1, adjust='BH', num = Inf, sort.by = "none") topTable_T2_Control <- topTable(fit2, coef=2, adjust='BH', num = Inf, sort.by = "none") topTable_T1_T2 <- topTable(fit2, coef=3, adjust='BH', num = Inf, sort.by = "none")
The objects will have the genes in all the same order, so you can easily cbind() them together into one object along with the output from decideTests and then filter down to genes that are significant in just one contrast. You'll need to do some column selection and renaming, and subsetting of the object using logical conditions (e.g., rowSums(groups !=0) > 0
).
Jenny
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.