Plot copy number and physical position for a set of genomic intervals.

Share:

Description

Plot copy number and physical position given by a CNSet object for a set of genomic intervals stored in a RangedDataCVN object.

Usage

1
xyplot2(x, data, range, frame=50e3L, ...)

Arguments

x

A formula. Currently, the formula must be one of cn~x, cn ~ x | id or cn ~ x | range when data is a CNSet. If data is a BeadStudioSet, the formula has the form lrr ~ x| range or baf ~ x | range.

data

A CNSet, BeadStudioSet, or SnpSet object.

...

A RangedDataCNV object must be passed by the name 'range'. Arguments for xyplot are passed to xyplot2. Additional arguments are passed to xypanel and panel.xyplot.

range

A RangedDataCNV object.

frame

The genomic distance (basepairs) to the left and right of the start and stop coordinates in the range object.

Details

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.

Value

An object of class trellis.

Author(s)

R. Scharpf

See Also

xyplot, xypanel

To modify the plot appearance from the default, additional arguments can be passed to panel.xyplot, lpoints, and lrect.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
  ## 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")))