xyplot {SNPchip} | R Documentation |
Plot copy number and physical position given by a
CNSet
object for a set of genomic intervals stored in a
RangedDataCVN
object.
xyplot2(x, data, range, frame=50e3L, ...)
x |
A |
data |
A |
... |
A |
range |
A |
frame |
The genomic distance (basepairs) to the left and right of the start and stop
coordinates in the |
These functions plot copy number estimates versus physical
position. The function is particularly useful for multi-panel displays
in which the copy number estimates for a single range of a
GRanges
object appears in one panel. The size of the
multi-panel display depends on the number of ranges (rows) in the
GRanges
object.
An object of class trellis
.
R. Scharpf
To modify the plot appearance from the default, additional arguments
can be passed to panel.xyplot
, lpoints
, and
lrect
.
## simulated data library(oligoClasses) library(IRanges) library(VanillaICE) data(oligoSetExample, package="oligoClasses") ## The oligoSnpSet class will likely be deprecated and made defunct ## in a future release. Instead, we favor ## RangedSummarizedExperiment-derived classes defined in VanillaICE oligoSet <- oligoSet[chromosome(oligoSet) == 1, ] cn <- copyNumber(oligoSet)/100 cn <- log2((2^cn)/2) gt <- calls(oligoSet)[,] ## simulate BAFs bf <- rep(NA, length(gt)) u <- runif(length(gt)) bf[gt==1 & u > 0.5] <- runif(sum(gt==1 & u > 0.5), 0, 0.05) bf[gt==1 & u <= 0.5] <- runif(sum(gt==1 & u <= 0.5), 0.95, 1) bf[gt==2] <- runif(sum(gt==2), 0.45, 0.55) bf[900:1200] <- runif(length(900:1200), 0, 0.03) gr <- GRanges(paste0("chr", chromosome(featureData(oligoSet))), IRanges(position(oligoSet), width=1)) cn <- as.matrix(cn) bf <- as.matrix(bf) dimnames(cn) <- dimnames(bf) <- list(featureNames(oligoSet), sampleNames(oligoSet)) se <- SnpArrayExperiment(cn=cn, baf=bf, rowRanges=gr, isSnp=rep(TRUE, length(gr))) fit <- hmm2(se) g <- as(segs(fit), "GRanges") ## To visualize each range in it's own panel surrounded by a ## frame of 2,000,000 bases: ## (here the frames are overlapping, but the method could be ## applied more generally to a collection of ranges from ## different chromsomes and samples) xyplot2(cn~x | range, data=oligoSet, range=g, frame=2e6, panel=xypanel, cex=2, pch=".", col.het="salmon", fill.het="salmon", col.hom="royalblue", fill.hom="royalblue", state.cex=0.5, border="orange", scales=list(x="free"), par.strip.text=list(cex=0.5), xlab="Mb", ylab=expression(log[2]("copy number")))