Using Bioconductor To Analyse Beadarray Data: Difference between revisions
mNo edit summary |
mNo edit summary |
||
| Line 41: | Line 41: | ||
d = dist(t(exprs(BSData.quantile))) | d = dist(t(exprs(BSData.quantile))) | ||
plot(hclust(d) | plot(hclust(d) | ||
</pre> | |||
==Differential Expression Analysis== | |||
*Normalised data can be analysed using the limma package for statistical differences | |||
*First define groups for each treatment. If a samplesheet was provided correctly and had this information: | |||
<pre>samples = pData(BSData)$Sample_Group</pre> | |||
*Otherwise define these groups manually in the order that they were entered (check by looking at pData(BSData) | |||
<pre>samples = c("Control", "Control", "Treatment1", "Treatment1, "Treatment2"...) | |||
*Next the groups are used to set up a statistical design: | |||
<pre> | |||
library(limma) | |||
samples = as.factor(samples) | |||
design = model.matrix(~0 + samples) | |||
colnames(design) = levels(samples) | |||
fit = lmFit(exprs(BSData.quantile), design) | |||
</pre> | |||
*Now set up contrast matrices to define how you want the data analyses. For example you may want to compare some treatments to a control, as well as between some treaments. See the limma user guide for more information about specific analyses. When defining the contrast matrix use the sample group names as defined above. | |||
<pre> | |||
cont.matrix = makeContrasts(Treatment1vsControl = Treatment1 - Control, Treatment2vsControl = Treatment2 - Control, Treatment1vsTreatment2 = Treatment1 - Treatment2, levels = design) | |||
fit.cont = contrasts.fit(fit, cont.matrix) | |||
ebFit = eBayes(fit.cont) | |||
</pre> | </pre> | ||