Last data update: 2014.03.03

R: Coerces a CBS object to a DNAcopy object
as.DNAcopy.CBSR Documentation

Coerces a CBS object to a DNAcopy object

Description

Coerces a CBS object to a DNAcopy object.

Usage

## S3 method for class 'CBS'
as.DNAcopy(fit, ...)

Arguments

fit

A CBS object."

...

Not used.

Value

Returns a DNAcopy object (of the DNAcopy package).

Author(s)

Henrik Bengtsson

See Also

as.CBS(). For more information see CBS.

Examples

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

# Number of loci
J <- 1000

mu <- double(J)
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)


 
# Coerce an CBS object to a DNAcopy object
fitD <- as.DNAcopy(fit)

# Coerce an DNAcopy object to a CBS object
fitC <- as.CBS(fitD)

# Sanity check
fitD2 <- as.DNAcopy(fit)
stopifnot(all.equal(fitD2, fitD))

fitC2 <- as.CBS(fitD2)
stopifnot(all.equal(fitC2, fitC))

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/as.DNAcopy.CBS.Rd_%03d_medium.png", width=480, height=480)
> ### Name: as.DNAcopy.CBS
> ### Title: Coerces a CBS object to a DNAcopy object
> ### Aliases: as.DNAcopy.CBS CBS.as.DNAcopy as.DNAcopy,CBS-method
> ### Keywords: internal methods
> 
> ### ** Examples
> 
>  
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> # Simulating copy-number data
> # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> set.seed(0xBEEF)
> 
> # Number of loci
> J <- 1000
> 
> mu <- double(J)
> 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 20774251       201  0.0164
2       <NA>          0 20774250.85 29320105        99  1.0474
3       <NA>          0 29320104.86 65874675       298 -0.0203
4       <NA>          0 65874675.06 81348129       151 -1.0813
5       <NA>          0 81348129.20 99910827       200 -0.0612
> plotTracks(fit)
> 
> 
>  
> # Coerce an CBS object to a DNAcopy object
> fitD <- as.DNAcopy(fit)
> 
> # Coerce an DNAcopy object to a CBS object
> fitC <- as.CBS(fitD)
> 
> # Sanity check
> fitD2 <- as.DNAcopy(fit)
> stopifnot(all.equal(fitD2, fitD))
> 
> fitC2 <- as.CBS(fitD2)
> stopifnot(all.equal(fitC2, fitC))
 list()
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>