The R package contains some sample code. These examples are also given in a supplementary vignette. For the package vignette, visit the SNPchip page, or type
>library(SNPchip)
>openVignette()
To learn more about vignettes, visit the Bioconductor vignette page.
Below is the R code to reconstruct the material in the supplementary vignette. The code is also downloadable here.
###################################################
### chunk number 1: library
###################################################
library(SNPchip)
###################################################
### chunk number 2: loadTriosURL
###################################################
load(url("http://biostat.jhsph.edu/~iruczins/publications/sm/2006.scharpf.bioinfo/vignette/trios.rda"))
###################################################
### chunk number 3: normal1
###################################################
plotSnp(object=trios, chromosomes=1:23, samples=1:2, ylim=c(0.5, 4),
cexAA=1, cexAB=1, cexNC=1, summaryPanel=TRUE,
width.right=16, legend.bty="n", cex.chr=0.9,
cex.legend=1, cex.axis=0.8)
###################################################
### chunk number 4: normal3
###################################################
plotSnp(trios, 19:23, 1:2,
cexAA=2, cexAB=2,
ylim=c(0.5, 4), legend.bty="n", legend.pch="topright",
cex.legend=1.5,
probs=seq(0, 1, by=0.25), xTicks=4, oma=c(5, 3, 4, 1))
###################################################
### chunk number 5: loadCancerDataFromUrl
###################################################
load(url("http://biostat.jhsph.edu/~iruczins/publications/sm/2006.scharpf.bioinfo/vignette/affyCancer.rda"))
###################################################
### chunk number 6: deletion
###################################################
plotSnp(affyCancer, 11:12, 3, ylim=c(0, 5), summaryPanel=TRUE, cex.axis=0.8,
cexAA=2, cexAB=3, cexNC=2, cex.legend=1, alternate.xaxis=FALSE,
width.right=0.6, xTicks=5, bty="n")
###################################################
### chunk number 7: amplification
###################################################
plotSnp(affyCancer, 6:7, 2, ylim=c(0, 5), summaryPanel=TRUE, cex.axis=0.8,
cexAA=2, cexAB=2, cexNC=2, cex.legend=1, alternate.xaxis=FALSE,
width.rigth=0.6, xTicks=5, bty="n")
###################################################
### chunk number 8: cancer1
###################################################
plotSnp(affyCancer, 1:23, 1:3, ylim=c(0, 6), yTicks=4, width.right=16,
summaryPanel=TRUE, cex.axis=0.7,
cex.legend=0.9, cex.chr=0.7)
###################################################
### chunk number 9: upd
###################################################
i <- grep("NA12874", sampleNames(trios))
plotSnp(trios, 1:2, i, ylim=c(0.5, 4.5), summaryPanel=TRUE, cexAA=2, cexAB=2,
width.right=0.6, xTicks=6, alternate.xaxis=FALSE)
###################################################
### chunk number 10: mosaicChr2
###################################################
i <- grep("NA07055", sampleNames(trios))
chr2 <- trios[chromosome(trios) == "chr2", i]
layout(matrix(1:2, nr=2, nc=1), heights=c(1, .05))
par(oma=c(6, 4, 0, 3))
plotChromosome(chr2, ylim=c(0, 5), mar=c(3, 0, 1, 0),
colCentromere="bisque", cexAA=1, cexAB=1, cexNC=1,
cex.main=0.8,
panel.xaxis=TRUE, bty="n",
xlab="Mb", cex.axis=0.7, cex.legend=0.7, main="chr2")
par(las=3)
mtext("copy number", 2, line=2, outer=TRUE, cex=0.7)
par(las=1)
data(cytoband)
plotCytoband(chr2, cytoband, cex.axis=0.5)
###################################################
### chunk number 11: mislabel-merged
###################################################
i1 <- grep("11839", sampleNames(trios))
i2 <- grep("11840", sampleNames(trios))
mislabel <- trios[, c(i1, i2)]
enzyme <- pData(featureData(mislabel))$enzyme
plotSnp(mislabel, 19:23, 1:2, ylim=c(0.75, 3.5), summaryPanel=TRUE,
cexAA=2, cexAB=2, width.right=2, cex.legend=0.9, cex.axis=1, bty="n",
mar=rep(0,4), xTicks=4)
###################################################
### chunk number 12: mislabel-xba
###################################################
plotSnp(mislabel[enzyme == "Xba", ], 19:23, 1:2, ylim=c(0.75, 3.5), summaryPanel=TRUE,
cexAA=2, cexAB=2, width.right=2, cex.legend=0.9, cex.axis=1, bty="n",
mar=rep(0,4), xTicks=4)
###################################################
### chunk number 13: mislabel-hind
###################################################
plotSnp(mislabel[enzyme == "Hind", ], 19:23, 1:2, ylim=c(0.75, 3.5), summaryPanel=TRUE,
cexAA=2, cexAB=2, width.right=2, cex.legend=0.9, cex.axis=1, bty="n",
mar=rep(0,4), xTicks=4)