Last data update: 2014.03.03

R: Prune the CBS profile by dropping change points that are too...
pruneBySdUndo.CBSR Documentation

Prune the CBS profile by dropping change points that are too small

Description

Prune the CBS profile by dropping change points that are too small, where "too small" means that the amplitude of the change points is less than a multiple of the overall standard deviation of the copy-number signals.

Usage

## S3 method for class 'CBS'
pruneBySdUndo(fit, rho=3, sigma="DNAcopy", ..., verbose=FALSE)

Arguments

fit

A CBS object.

rho

A positive double scalar specifying the number of standard deviations (rho*sigma) required in order to keep a change point. More change points are dropped the greater this value is.

sigma

The whole-genome standard deviation of the locus-level copy number signals. The default is to calculate it from the data and as done in the DNAcopy package.

...

(Optional) Additional arguments passed to the standard deviation estimator function.

verbose

See Verbose.

Details

This method corresponds to using the undo argument when calling segmentByCBS(), which in turn corresponds to using the undo.splits="sdundo" and undo.SD of the underlying segment method.

Value

Returns a CBS object (of the same class as fit).

Author(s)

Henrik Bengtsson, Pierre Neuvial

Examples


# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Simulating copy-number data
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
set.seed(0xBEEF)

# Number of loci
J <- 1000

mu <- double(J)
mu[1:100] <- mu[1:100] + 0.3
mu[200:300] <- mu[200:300] + 1
mu[350:400] <- NA # centromere
mu[650:800] <- mu[650:800] - 1
eps <- rnorm(J, sd=1/2)
y <- mu + eps
x <- sort(runif(length(y), max=length(y))) * 1e5
w <- runif(J)
w[650:800] <- 0.001


# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Segmentation
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
fit <- segmentByCBS(y, x=x)
print(fit)
plotTracks(fit)

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Post-segmentation pruning
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
fitP <- pruneBySdUndo(fit, rho=1)
drawLevels(fitP, col="red")

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(PSCBS)
PSCBS v0.61.0 (2016-02-03) successfully loaded. See ?PSCBS for help.

Attaching package: 'PSCBS'

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

    append, load

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/PSCBS/pruneBySdUndo.CBS.Rd_%03d_medium.png", width=480, height=480)
> ### Name: pruneBySdUndo.CBS
> ### Title: Prune the CBS profile by dropping change points that are too
> ###   small
> ### Aliases: pruneBySdUndo.CBS CBS.pruneBySdUndo pruneBySdUndo,CBS-method
> ### Keywords: internal methods
> 
> ### ** Examples
> 
> 
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> # Simulating copy-number data
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> set.seed(0xBEEF)
> 
> # Number of loci
> J <- 1000
> 
> mu <- double(J)
> mu[1:100] <- mu[1:100] + 0.3
> mu[200:300] <- mu[200:300] + 1
> mu[350:400] <- NA # centromere
> mu[650:800] <- mu[650:800] - 1
> eps <- rnorm(J, sd=1/2)
> y <- mu + eps
> x <- sort(runif(length(y), max=length(y))) * 1e5
> w <- runif(J)
> w[650:800] <- 0.001
> 
> 
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> # Segmentation
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> fit <- segmentByCBS(y, x=x)
> print(fit)
  sampleName chromosome       start      end nbrOfLoci    mean
1       <NA>          0    55167.82 11153525       103  0.3101
2       <NA>          0 11153524.74 20774251        98  0.0139
3       <NA>          0 20774250.85 29320105        99  1.0474
4       <NA>          0 29320104.86 65874675       298 -0.0203
5       <NA>          0 65874675.06 81348129       151 -1.0813
6       <NA>          0 81348129.20 99910827       200 -0.0612
> plotTracks(fit)
> 
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> # Post-segmentation pruning
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> fitP <- pruneBySdUndo(fit, rho=1)
> drawLevels(fitP, col="red")
NULL
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>