# NOT RUN {
# load data
data(NanoString);
# specifiy housekeeping genes in annotation
NanoString.mRNA[NanoString.mRNA$Name %in%
c('Eef1a1','Gapdh','Hprt1','Ppia','Sdha'),'Code.Class'] <- 'Housekeeping';
# setup the traits
sample.names <- names(NanoString.mRNA)[-c(1:3)];
strain1 <- rep(1, times = (ncol(NanoString.mRNA)-3));
strain1[grepl('HW',sample.names)] <- 2;
strain2 <- rep(1, times = (ncol(NanoString.mRNA)-3));
strain2[grepl('WW',sample.names)] <- 2;
strain3 <- rep(1, times = (ncol(NanoString.mRNA)-3));
strain3[grepl('LE',sample.names)] <- 2;
trait.strain <- data.frame(
row.names = sample.names,
strain1 = strain1,
strain2 = strain2,
strain3 = strain3
);
# normalize
NanoString.mRNA.norm <- NanoStringNorm(
x = NanoString.mRNA,
anno = NA,
CodeCount = 'geo.mean',
Background = 'mean.2sd',
SampleContent = 'housekeeping.geo.mean',
round.values = TRUE,
take.log = TRUE,
traits = trait.strain,
return.matrix.of.endogenous.probes = FALSE
);
# plot all the plots as PDF report
pdf('NanoStringNorm_Example_Plots_All.pdf')
Plot.NanoStringNorm(
x = NanoString.mRNA.norm,
label.best.guess = TRUE,
plot.type = 'all'
);
dev.off()
# publication quality tiff volcano plot
tiff('NanoStringNorm_Example_Plots_Volcano.tiff', units = 'in', height = 6,
width = 6, compression = 'lzw', res = 1200, pointsize = 10);
Plot.NanoStringNorm(
x = NanoString.mRNA.norm,
label.best.guess = TRUE,
plot.type = c('volcano'),
title = FALSE
);
dev.off()
# all plots as seperate files output for a presentation
png('NanoStringNorm_Example_Plots_%03d.png', units = 'in', height = 6,
width = 6, res = 250, pointsize = 10);
Plot.NanoStringNorm(
x = NanoString.mRNA.norm,
label.best.guess = TRUE,
plot.type = c('cv','mean.sd','RNA.estimates','volcano','missing','norm.factors',
'positive.controls','batch.effects')
);
dev.off()
# user specified labelling with optimal resolution for most digital displays
png('NanoStringNorm_Example_Plots_Normalization_Factors.png', units = 'in', height = 6,
width = 6, res = 250, pointsize = 10);
Plot.NanoStringNorm(
x = NanoString.mRNA.norm,
label.best.guess = FALSE,
label.ids = list(genes = rownames(NanoString.mRNA.norm$gene.summary.stats.norm),
samples = rownames(NanoString.mRNA.norm$sample.summary.stats)),
plot.type = c('norm.factors')
);
dev.off()
# }
Run the code above in your browser using DataLab