Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/xyplot-methods.R
For each genomic interval in the ranged data, a plot of the log R ratios and B allele frequencies stored in the oligoSnpSet are plotted.
1 | xyplotLrrBaf(rd, object, frame, ...)
|
rd |
An instance of |
object |
A |
frame |
The genomic distance in basepairs to plot on either side
of the genomic interval in the |
... |
Additional arguments passed to the panel function. See details. |
The xypanelBaf
function is a panel function that does
the actual plotting of the genomic data.
A trellis
object.
R. Scharpf
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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | ## Not run:
library(crlmm)
library(SummarizedExperiment)
library(VanillaICE)
data(cnSetExample, package="crlmm")
oligoSetList <- BafLrrSetList(cnSetExample[, 1])
oligoSet <- oligoSetList[[1]]
cn <- copyNumber(oligoSet)/100
cn <- log2((2^cn)/2)
gt <- calls(oligoSet)[,]
## simulate BAFs
bf <- baf(oligoSet)[, ]/1000
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)
##rd <- fit[sampleNames(fit)=="NA19007", ]
rd <- as(segs(fit), "GRanges")
## We're interested in this range
range <- GRanges("chr8", IRanges(3.7e6, 5.9e6), sample="NA19007")
index <- subjectHits(findOverlaps(range, rd))
xyplotLrrBaf(rd[index, ], oligoSetList[[1]], frame=1e6,
panel=xypanelBaf, cex=0.2,
scales=list(x=list(relation="free"),
y=list(alternating=1,
at=c(-1, 0, log2(3/2), log2(4/2)),
labels=expression(-1, 0, log[2](3/2), log[2](4/2)))),
par.strip.text=list(cex=0.7),
ylim=c(-3,1),
col.hom="grey50",
col.het="grey50",
col.np="grey20",
xlab="physical position (Mb)",
ylab=expression(log[2]("R ratios")),
key=list(text=list(c(expression(log[2]("R ratios")), expression("B allele freqencies")),
col=c("grey", "blue")), columns=2))
## Or, plot each range of the GRanges instance in a separate panel
xyplotLrrBaf(rd, oligoSetList[[1]], frame=1e6,
panel=xypanelBaf, cex=0.2,
scales=list(x=list(relation="free"),
y=list(alternating=1,
at=c(-1, 0, log2(3/2), log2(4/2)),
labels=expression(-1, 0, log[2](3/2), log[2](4/2)))),
par.strip.text=list(cex=0.7),
ylim=c(-3,1),
col.hom="grey50",
col.het="grey50",
col.np="grey20",
xlab="physical position (Mb)",
ylab=expression(log[2]("R ratios")),
key=list(text=list(c(expression(log[2]("R ratios")), expression("B allele freqencies")),
col=c("grey", "blue")), columns=2))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.