Last data update: 2014.03.03

R: Plot function for exomeCopy
plot.ExomeCopyR Documentation

Plot function for exomeCopy

Description

Plots the predicted copy count segments of an ExomeCopy object

Usage

## S3 method for class 'ExomeCopy'
plot(x, points = TRUE, cols = NULL, show.legend = TRUE,
main = "exomeCopy predicted segments", xlab = "genomic position",
ylab = "normalized read count", xlim = NULL, ylim = NULL, cex = 1, lwd = 4, ...)

Arguments

x

The ExomeCopy object.

points

Logical, whether normalized read counts should be drawn.

cols

A vector of the same length as b, specifying a color for each of the states of the HMM.

show.legend

Logical, whether a default legend should be shown.

main

main title

xlab

x axis label

ylab

y axis label

xlim

x limits

ylim

y limits

cex

size of the points (if plotted)

lwd

line width

...

Other arguments passed to plot()

See Also

exomeCopy ExomeCopy-class copyCountSegments

Examples


example(exomeCopy)
plot(fit)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(exomeCopy)
Loading required package: IRanges
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Loading required package: S4Vectors
Loading required package: stats4

Attaching package: 'S4Vectors'

The following objects are masked from 'package:base':

    colMeans, colSums, expand.grid, rowMeans, rowSums

Loading required package: GenomicRanges
Loading required package: GenomeInfoDb
Loading required package: Rsamtools
Loading required package: Biostrings
Loading required package: XVector
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/exomeCopy/plot.exomeCopyObject.Rd_%03d_medium.png", width=480, height=480)
> ### Name: plot.ExomeCopy
> ### Title: Plot function for exomeCopy
> ### Aliases: plot.ExomeCopy
> 
> ### ** Examples
> 
> 
> example(exomeCopy)

exmCpy> ## The following is an example of running exomeCopy on simulated
exmCpy> ## read counts using the model parameters defined above.  For an example
exmCpy> ## using real exome sequencing read counts (with simulated CNV) please
exmCpy> ## see the vignette.
exmCpy> 
exmCpy> ## create RangedData for storing genomic ranges and covariate data
exmCpy> ## (background, background stdev, GC-content)
exmCpy> 
exmCpy> m <- 5000

exmCpy> rdata <- RangedData(IRanges(start=0:(m-1)*100+1,width=100),
exmCpy+ space=rep("chr1",m), universe="hg19", log.bg=rnorm(m), log.bg.var=rnorm(m),
exmCpy+ gc=runif(m,30,50))  

exmCpy> ## create read depth distributional parameters mu and phi
exmCpy> rdata$gc.sq <- rdata$gc^2

exmCpy> X <- cbind(bg=rdata$log.bg,gc=rdata$gc,gc.sq=rdata$gc.sq)

exmCpy> Y <- cbind(bg.sd=rdata$log.bg.var)

exmCpy> beta <- c(5,1,.01,-.01)

exmCpy> gamma <- c(-3,.1)

exmCpy> rdata$mu <- exp(beta[1] + scale(X) %*% beta[2:4])

exmCpy> rdata$phi <- exp(gamma[1] + scale(Y) %*% gamma[2])

exmCpy> ## create observed counts with simulated heterozygous duplication
exmCpy> cnv.nranges <- 200

exmCpy> bounds <- (round(m/2)+1):(round(m/2)+cnv.nranges)

exmCpy> O <- rnbinom(nrow(rdata),mu=rdata$mu,size=1/rdata$phi)

exmCpy> O[bounds] <- O[bounds] + rbinom(cnv.nranges,prob=0.5,size=O[bounds])

exmCpy> rdata[["sample1"]] <- O

exmCpy> ## run exomeCopy() and list segments
exmCpy> fit <- exomeCopy(rdata,"sample1",X.names=c("log.bg","gc","gc.sq"))

exmCpy> # an example call with variance fitting.
exmCpy> # see paper: this does not necessarily improve the fit
exmCpy> fit <- exomeCopy(rdata,"sample1",X.names=c("log.bg","gc","gc.sq"),
exmCpy+                  Y.names="log.bg",fit.var=TRUE)

exmCpy> ## see man page for copyCountSegments() for summary of
exmCpy> ## the predicted segments of constant copy count, and
exmCpy> ## for plot.ExomeCopy() for plotting fitted objects
exmCpy> 
exmCpy> 
exmCpy> 
exmCpy> 
> plot(fit)
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>