A panel function for plotting copy number versus physical position

Share:

Description

A panel function for xyplot for plotting copy number versus physical position.

Usage

1
2
3
xypanel(x, y, gt, is.snp, range, col.hom = "grey20", fill.hom =
"lightblue", col.het = "grey20", fill.het = "salmon", col.np = "grey20",
fill.np = "grey60", show.state=TRUE, state.cex=1,  col.state="blue", ..., subscripts)

Arguments

x

Physical position in megabases.

y

Copy number estimates.

gt

Genotype calls.

is.snp

Logical. Whether the marker is polymorphic.

range

A RangedData or IRanges object. Note that we expect the units returned by start and end to be basepairs.

col.hom

A specification for the color of plotting symbols for homozygous genotypes.

fill.hom

A specification for the fill color of plotting symbols for homozygous genotypes.

col.het

A specification for the color of plotting symbols for heterozygous genotypes.

fill.het

A specification for the fill color of plotting symbols for heterozygous genotypes.

col.np

A specification for the color of plotting symbols for nonpolymorphic markers.

fill.np

A specification for the fill color of plotting symbols for nonpolymorphic genotypes.

show.state

Logical. Whether to display the predicted state in each panel.

state.cex

Numeric. cex for state label. Ignored if show.state is FALSE.

col.state

Character. color for state label. Ignored if show.state is FALSE.

...

Additional arguments passed to lattice functions xyplot, lpoints, and lrect.

subscripts

See the panel functions in lattice for more information.

Details

The order of plotting is (1) nonpolymorphic markers, (2), homozygous SNPs, and (3) heterozygous SNPs. Stretches of homozygosity should appear as blue using the default color scheme.

Note

To make the drawing of the range object border invisible, one can use border="white".

Author(s)

R. Scharpf

See Also

xyplot

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
## Not run: 
	if(require("crlmm") && require("VanillaICE") && require("IRanges")){
    library(lattice)
		library(oligoClasses)
    data(oligoSetExample, package="oligoClasses")
    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")
		xyplot(cn ~ x | range, data=oligoSet, range=g[2], ##range=fit2[1:10, ],
		       frame=2e6,
		       panel=xypanel, cex=0.3, pch=21, border="blue",
		       scales=list(x="free"),
		       col.hom="lightblue", col.het="salmon", col.np="grey60",
		       fill.np="grey60",
		       xlab="Mb")
		## if xyplot method is masked by lattice, do
		##xyplot <- VanillaICE:::xyplot
	}

## End(Not run)