Learn R Programming

aroma.core (version 1.2.0)

segmentByCBS.RawGenomicSignals: Segment copy numbers using the CBS method

Description

Segment copy numbers using the CBS method of the DNAcopy package.

Usage

## S3 method for class 'RawGenomicSignals':
segmentByCBS(this, ..., cache=FALSE, force=FALSE, verbose=FALSE)

Arguments

...
Additional arguments passed to the segmentation function.
verbose
See Verbose.

Value

  • Returns the fit object.

Details

Internally segment is used to segment the signals. This segmentation method support weighted segmentation.

See Also

For more information see RawGenomicSignals.

Examples

Run this code
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Simulating copy-number data
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Number of loci
J <- 1000

mu <- double(J)
mu[200:300] <- mu[200:300] + 1
mu[650:800] <- mu[650:800] - 1
eps <- rnorm(J, sd=1/2)
y <- mu + eps
x <- sort(runif(length(y), max=length(y)))
w <- runif(J)
w[650:800] <- 0.001


cn <- RawCopyNumbers(y, x)
print(cn)

plot(cn, col="#aaaaaa")

cnS <- binnedSmoothing(cn, by=10)
print(cnS)
lines(cnS, col="black", lwd=3)


# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Segment
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
legend <- c()

fit <- segmentByCBS(cn)
cnr <- extractCopyNumberRegions(fit)
print(cnr)
drawLevels(cnr, col="red", lwd=3)
legend <- c(legend, red="CBS")

fit <- segmentByGLAD(cn)
cnr <- extractCopyNumberRegions(fit)
print(cnr)
drawLevels(cnr, col="blue", lwd=3)
legend <- c(legend, blue="GLAD")

if (require("HaarSeg")) {
  fit <- segmentByHaarSeg(cn)
  cnr <- extractCopyNumberRegions(fit)
  print(cnr)
  drawLevels(cnr, col="orange", lwd=3)
  legend <- c(legend, orange="HaarSeg")
}

legend("topleft", pch=19, col=names(legend), legend, bty="n", horiz=TRUE)

Run the code above in your browser using DataLab