Movatterモバイル変換


[0]ホーム

URL:


Version:0.68.0
Depends:R (≥ 3.2.0)
Imports:R.methodsS3 (≥ 1.8.2), R.oo (≥ 1.25.0), R.utils (≥ 2.12.0),R.cache (≥ 0.16.0), matrixStats (≥ 0.62.0), aroma.light (≥2.4.0), DNAcopy (≥ 1.42.0), future (≥ 1.28.0), parallel,graphics, grDevices, stats, utils
Suggests:R.rsp (≥ 0.45.0), R.devices (≥ 2.17.1), ggplot2 (≥ 3.2.1)
SuggestsNote:BioC (>= 3.1)
VignetteBuilder:R.rsp
Title:Analysis of Parent-Specific DNA Copy Numbers
Description:Segmentation of allele-specific DNA copy number data and detection of regions with abnormal copy number within each parental chromosome. Both tumor-normal paired and tumor-only analyses are supported.
License:GPL-2 |GPL-3 [expanded from: GPL (≥ 2)]
LazyLoad:TRUE
ByteCompile:TRUE
biocViews:aCGH, CopyNumberVariants, SNP, Microarray, OneChannel,TwoChannel, Genetics
URL:https://github.com/HenrikBengtsson/PSCBS
BugReports:https://github.com/HenrikBengtsson/PSCBS/issues
NeedsCompilation:no
Packaged:2025-04-18 18:47:19 UTC; henrik
Author:Henrik Bengtsson [aut, cre, cph], Pierre Neuvial [aut], Venkatraman E. Seshan [aut], Adam B. Olshen [aut], Paul T. Spellman [aut], Richard A. Olshen [aut], Frank E Harrell Jr [ctb] (Weighted quantile estimator adopted from Hmisc::wtd.quantile())
Maintainer:Henrik Bengtsson <henrikb@braju.com>
Repository:CRAN
Date/Publication:2025-04-18 19:40:02 UTC

Package PSCBS

Description

Segmentation of allele-specific DNA copy number data and detection of regions with abnormal copy number within each parental chromosome. Both tumor-normal paired and tumor-only analyses are supported..

This package should be considered to be in an alpha or beta phase.You should expect the API to be changing over time.

Installation and updates

To install this package, useinstall.packages("PSCBS").

To get started

To get started, see:

  1. Vignettes 'Parent-specific copy-number segmentation using Paired PSCBS' and 'Total copy-number segmentation using CBS'.

  2. segmentByCBS() - segments total copy-numbers, or anyother unimodal genomic signals, using the CBS method [3,4].

  3. segmentByPairedPSCBS() - segments allele-specifictumor signal from a tumorwith a matched normalusing the Paired PSCBS method [1,2].

  4. segmentByNonPairedPSCBS() - segments allele-specifictumor signal from a tumorwithout a matched normalusing the Non-Paired PSCBS method adopted from [1,2].

How to cite

Please use [1] and [2] to cite when using Paired PSCBS,and [3] and [4] when using CBS.When using Non-Paired PSCBS, please cite [1] and [2] as well.

License

GPL (>= 2).

Author(s)

Henrik Bengtsson

References

[1] A.B. Olshen, H. Bengtsson, P. Neuvial, P.T. Spellman, R.A. Olshen, V.E. Seshan,Parent-specific copy number in paired tumor-normal studies using circular binary segmentation, Bioinformatics, 2011
[2] H. Bengtsson, P. Neuvial and T.P. Speed,TumorBoost: Normalization of allele-specific tumor copy numbers from a single pair of tumor-normal genotyping microarrays, BMC Bioinformatics, 2010
[3] A.B. Olshen, E.S. Venkatraman (aka Venkatraman E. Seshan), R. Lucito and M. Wigler,Circular binary segmentation for the analysis of array-based DNA copy number data, Biostatistics, 2004
[4] E.S. Venkatraman and A.B. Olshen,A faster circular binary segmentation algorithm for the analysis of array CGH data, Bioinformatics, 2007


The AbstractCBS class

Description

Package: PSCBS
Class AbstractCBS

list
~~|
~~+--AbstractCBS

Directly known subclasses:
CBS,NonPairedPSCBS,PSCBS,PairedPSCBS

public abstract classAbstractCBS
extends list

All CBS-style segmentation results extend this class, e.g.CBS andPairedPSCBS.

Usage

AbstractCBS(fit=list(), sampleName=fit$sampleName, ...)

Arguments

fit

Alist structure containing the segmentation results.

sampleName

Acharacter string.

...

Not used.

Fields and Methods

Methods:

adjustPloidyScale -
extractCNs -
getChangePoints -
getChromosomes Gets the set of chromosomes.
getLocusData Gets the locus-level data.
getSegmentSizes -
getSegments Gets the segments.
mergeThreeSegments Merge a segment and its two flanking segments.
nbrOfChangePoints Gets the number of change points.
nbrOfChromosomes Gets the number of chromosomes.
nbrOfLoci Gets the number of loci.
nbrOfSegments Gets the number of segments.
normalizeTotalCNs Normalizes copy numbers such that the whole-genome average total copy number is two.
ploidy Gets and sets ploidy.
ploidy<- -
plotTracks Plots the segmentation result along the genome.
sampleCNs -
writeWIG -

Methods inherited from list:
Ops,nonStructure,vector-method, Ops,structure,vector-method, Ops,vector,nonStructure-method, Ops,vector,structure-method, all.equal, as.data.frame, attachLocally, averageQuantile, callHooks, coerce,ANY,list-method, normalizeAverage, normalizeDifferencesToAverage, normalizeQuantileRank, normalizeQuantileSpline, plotDensity, relist, reset, type.convert, within

Author(s)

Henrik Bengtsson


The CBS class

Description

A CBS object holds results from theCircular Binary Segmentation (CBS) methodforone sample for one or more chromosomes.

Package: PSCBS
Class CBS

list
~~|
~~+--AbstractCBS
~~~~~~~|
~~~~~~~+--CBS

Directly known subclasses:

public abstract classCBS
extendsAbstractCBS

Usage

CBS(...)

Arguments

...

Arguments passed to the constructor ofAbstractCBS.

Fields and Methods

Methods:

as -
c Concatenates segmentation results.
estimateStandardDeviation Estimates the whole-genome standard deviation of the signals.
plotTracks Plots copy numbers along the genome.
pruneBySdUndo Prune the CBS profile by dropping change points that are too small.
segmentByCBS -
seqOfSegmentsByDP -
writeSegments Writes the table of segments to file.

Methods inherited from AbstractCBS:
adjustPloidyScale, all.equal, as.data.frame, clearCalls, drawChangePoints, drawKnownSegments, dropChangePoint, dropChangePoints, dropRegion, dropRegions, extractCNs, extractChromosome, extractChromosomes, extractRegions, extractSegments, extractWIG, getChangePoints, getChromosomeOffsets, getChromosomeRanges, getChromosomes, getLocusData, getLocusSignalNames, getMeanEstimators, getSampleName, getSegmentSizes, getSegmentTrackPrefixes, getSegments, mergeThreeSegments, mergeTwoSegments, nbrOfChangePoints, nbrOfChromosomes, nbrOfLoci, nbrOfSegments, normalizeTotalCNs, ploidy, ploidy<-, plotTracks, print, pruneByDP, pruneByHClust, renameChromosomes, report, resegment, resetSegments, sampleCNs, sampleName, sampleName<-, seqOfSegmentsByDP, setLocusData, setMeanEstimators, setPloidy, setSampleName, setSegments, shiftTCN, tileChromosomes, updateMeans, writeWIG

Methods inherited from list:
Ops,nonStructure,vector-method, Ops,structure,vector-method, Ops,vector,nonStructure-method, Ops,vector,structure-method, all.equal, as.data.frame, attachLocally, averageQuantile, callHooks, coerce,ANY,list-method, normalizeAverage, normalizeDifferencesToAverage, normalizeQuantileRank, normalizeQuantileSpline, plotDensity, relist, reset, type.convert, within

Difference to DNAcopy object

A CBS object is similar to DNAcopy objects with the majordifference that a CBS object holds only one sample, whereasa DNAcopy object can hold more than one sample.

See also

ThesegmentByCBS() method returns an object of this class.

Author(s)

Henrik Bengtsson


Non-documented objects

Description

This page contains aliases for all "non-documented" objects thatR CMD check detects in this package.

Almost all of them aregeneric functions that have specificdocument for the corresponding method coupled to a specific class.Other functions are re-defined bysetMethodS3() todefault methods. Neither of these two classes are non-documentedin reality.The rest are deprecated methods.

Author(s)

Henrik Bengtsson


The NonPairedPSCBS class

Description

Package: PSCBS
Class NonPairedPSCBS

list
~~|
~~+--AbstractCBS
~~~~~~~|
~~~~~~~+--PSCBS
~~~~~~~~~~~~|
~~~~~~~~~~~~+--NonPairedPSCBS

Directly known subclasses:

public abstract classNonPairedPSCBS
extendsPSCBS

A NonPairedPSCBS is an object containing the results from theNon-paired PSCBS method.

Usage

NonPairedPSCBS(fit=list(), ...)

Arguments

fit

Alist structure containing the Non-paired PSCBS results.

...

Not used.

Fields and Methods

Methods:
No methods defined.

Methods inherited from PSCBS:
as.data.frame, c, drawChangePoints, extractChromosomes, extractWIG, getLocusData, getLocusSignalNames, getSegmentTrackPrefixes, isLocallyPhased, isSegmentSplitter, normalizeTotalCNs, writeSegments

Methods inherited from AbstractCBS:
adjustPloidyScale, all.equal, as.data.frame, clearCalls, drawChangePoints, drawKnownSegments, dropChangePoint, dropChangePoints, dropRegion, dropRegions, extractCNs, extractChromosome, extractChromosomes, extractRegions, extractSegments, extractWIG, getChangePoints, getChromosomeOffsets, getChromosomeRanges, getChromosomes, getLocusData, getLocusSignalNames, getMeanEstimators, getSampleName, getSegmentSizes, getSegmentTrackPrefixes, getSegments, mergeThreeSegments, mergeTwoSegments, nbrOfChangePoints, nbrOfChromosomes, nbrOfLoci, nbrOfSegments, normalizeTotalCNs, ploidy, ploidy<-, plotTracks, print, pruneByDP, pruneByHClust, renameChromosomes, report, resegment, resetSegments, sampleCNs, sampleName, sampleName<-, seqOfSegmentsByDP, setLocusData, setMeanEstimators, setPloidy, setSampleName, setSegments, shiftTCN, tileChromosomes, updateMeans, writeWIG

Methods inherited from list:
Ops,nonStructure,vector-method, Ops,structure,vector-method, Ops,vector,nonStructure-method, Ops,vector,structure-method, all.equal, as.data.frame, attachLocally, averageQuantile, callHooks, coerce,ANY,list-method, normalizeAverage, normalizeDifferencesToAverage, normalizeQuantileRank, normalizeQuantileSpline, plotDensity, relist, reset, type.convert, within

Author(s)

Henrik Bengtsson

See Also

ThesegmentByNonPairedPSCBS() method returns an object of this class.


The PSCBS class

Description

Package: PSCBS
Class PSCBS

list
~~|
~~+--AbstractCBS
~~~~~~~|
~~~~~~~+--PSCBS

Directly known subclasses:
NonPairedPSCBS,PairedPSCBS

public abstract classPSCBS
extendsAbstractCBS

A PSCBS is an object containing results from parent-specific copy-number(PSCN) segmentation.

Usage

PSCBS(fit=list(), ...)

Arguments

fit

Alist structure containing the PSCN segmentation results.

...

Not used.

Fields and Methods

Methods:

c -
isLocallyPhased -
normalizeTotalCNs -
writeSegments Writes the table of segments to file.

Methods inherited from AbstractCBS:
adjustPloidyScale, all.equal, as.data.frame, clearCalls, drawChangePoints, drawKnownSegments, dropChangePoint, dropChangePoints, dropRegion, dropRegions, extractCNs, extractChromosome, extractChromosomes, extractRegions, extractSegments, extractWIG, getChangePoints, getChromosomeOffsets, getChromosomeRanges, getChromosomes, getLocusData, getLocusSignalNames, getMeanEstimators, getSampleName, getSegmentSizes, getSegmentTrackPrefixes, getSegments, mergeThreeSegments, mergeTwoSegments, nbrOfChangePoints, nbrOfChromosomes, nbrOfLoci, nbrOfSegments, normalizeTotalCNs, ploidy, ploidy<-, plotTracks, print, pruneByDP, pruneByHClust, renameChromosomes, report, resegment, resetSegments, sampleCNs, sampleName, sampleName<-, seqOfSegmentsByDP, setLocusData, setMeanEstimators, setPloidy, setSampleName, setSegments, shiftTCN, tileChromosomes, updateMeans, writeWIG

Methods inherited from list:
Ops,nonStructure,vector-method, Ops,structure,vector-method, Ops,vector,nonStructure-method, Ops,vector,structure-method, all.equal, as.data.frame, attachLocally, averageQuantile, callHooks, coerce,ANY,list-method, normalizeAverage, normalizeDifferencesToAverage, normalizeQuantileRank, normalizeQuantileSpline, plotDensity, relist, reset, type.convert, within

Author(s)

Henrik Bengtsson

See Also

PairedPSCBS.


The PairedPSCBS class

Description

Package: PSCBS
Class PairedPSCBS

list
~~|
~~+--AbstractCBS
~~~~~~~|
~~~~~~~+--PSCBS
~~~~~~~~~~~~|
~~~~~~~~~~~~+--PairedPSCBS

Directly known subclasses:

public abstract classPairedPSCBS
extendsPSCBS

A PairedPSCBS is an object containing the results from thePaired PSCBS method.

Usage

PairedPSCBS(fit=list(), ...)

Arguments

fit

Alist structure containing the Paired PSCBS results.

...

Not used.

Fields and Methods

Methods:

callAB Calls segments that are in allelic balance.
callCopyNeutral Calls segments that have a neutral total copy number.
callGNL Calls segments that are gained, copy neutral, or lost.
callGNLByTCNofAB -
callGainNeutralLoss -
callLOH Calls segments that are in LOH.
callNTCN -
callROH Calls segments that are in ROH.
estimateDeltaAB Estimate a threshold for calling allelic balance from DH.
estimateDeltaLOH Estimate a threshold for calling LOH from DH.
estimateKappa Estimate global background in segmented copy numbers.
extractCNs -
hasBootstrapSummaries -
plotTracks -
segmentByNonPairedPSCBS -
segmentByPairedPSCBS -
seqOfSegmentsByDP -

Methods inherited from PSCBS:
as.data.frame, c, drawChangePoints, extractChromosomes, extractWIG, getLocusData, getLocusSignalNames, getSegmentTrackPrefixes, isLocallyPhased, isSegmentSplitter, normalizeTotalCNs, writeSegments

Methods inherited from AbstractCBS:
adjustPloidyScale, all.equal, as.data.frame, clearCalls, drawChangePoints, drawKnownSegments, dropChangePoint, dropChangePoints, dropRegion, dropRegions, extractCNs, extractChromosome, extractChromosomes, extractRegions, extractSegments, extractWIG, getChangePoints, getChromosomeOffsets, getChromosomeRanges, getChromosomes, getLocusData, getLocusSignalNames, getMeanEstimators, getSampleName, getSegmentSizes, getSegmentTrackPrefixes, getSegments, mergeThreeSegments, mergeTwoSegments, nbrOfChangePoints, nbrOfChromosomes, nbrOfLoci, nbrOfSegments, normalizeTotalCNs, ploidy, ploidy<-, plotTracks, print, pruneByDP, pruneByHClust, renameChromosomes, report, resegment, resetSegments, sampleCNs, sampleName, sampleName<-, seqOfSegmentsByDP, setLocusData, setMeanEstimators, setPloidy, setSampleName, setSegments, shiftTCN, tileChromosomes, updateMeans, writeWIG

Methods inherited from list:
Ops,nonStructure,vector-method, Ops,structure,vector-method, Ops,vector,nonStructure-method, Ops,vector,structure-method, all.equal, as.data.frame, attachLocally, averageQuantile, callHooks, coerce,ANY,list-method, normalizeAverage, normalizeDifferencesToAverage, normalizeQuantileRank, normalizeQuantileSpline, plotDensity, relist, reset, type.convert, within

Author(s)

Henrik Bengtsson

See Also

ThesegmentByPairedPSCBS() method returns an object of this class.


Restructuring AbstractCBS objects

Description

This page describes available methods for restructuring anAbstractCBS object.

All of the above methods are implemented forCBS andPairedPSCBS objects.

Author(s)

Henrik Bengtsson

See Also

For more information seeAbstractCBS.


Coerces a DNAcopy object to a CBS object

Description

Coerces a DNAcopy object to a CBS object.

Usage

## S3 method for class 'DNAcopy'as.CBS(fit, sample=1L, ...)

Arguments

fit

ADNAcopy. object(of theDNAcopy package.)

sample

An index specifying which sample to extract,if more than one exists.

...

Not used.

Value

Returns aCBS object.

Author(s)

Henrik Bengtsson

See Also

as.DNAcopy().For more information seeDNAcopy.


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

ACBS object."

...

Not used.

Value

Returns aDNAcopy object(of theDNAcopy package).

Author(s)

Henrik Bengtsson

See Also

as.CBS().For more information seeCBS.

Examples

 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Simulating copy-number data# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -set.seed(0xBEEF)# Number of lociJ <- 1000mu <- double(J)mu[200:300] <- mu[200:300] + 1mu[350:400] <- NA # centromeremu[650:800] <- mu[650:800] - 1eps <- rnorm(J, sd=1/2)y <- mu + epsx <- sort(runif(length(y), max=length(y))) * 1e5w <- runif(J)w[650:800] <- 0.001# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Segmentation# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -fit <- segmentByCBS(y, x=x)print(fit)plotTracks(fit) # Coerce an CBS object to a DNAcopy objectfitD <- as.DNAcopy(fit)# Coerce an DNAcopy object to a CBS objectfitC <- as.CBS(fitD)# Sanity checkfitD2 <- as.DNAcopy(fit)stopifnot(all.equal(fitD2, fitD))fitC2 <- as.CBS(fitD2)stopifnot(all.equal(fitC2, fitC))

Gets the table of segments

Description

Gets the table of segments.

Usage

## S3 method for class 'AbstractCBS'as.data.frame(x, ...)

Arguments

...

Not used.

Value

Returns adata.frame, where each row corresponds toa unique segment.

Author(s)

Henrik Bengtsson

See Also

Utilizes*getSegments().For more information seeAbstractCBS..


Gets the table of segments

Description

Gets the table of segments.

Usage

## S3 method for class 'CBS'as.data.frame(x, ...)

Arguments

...

Not used.

Value

Returns adata.frame, where each row corresponds toa unique segment.

Author(s)

Henrik Bengtsson

See Also

Utilizes*getSegments().For more information seeCBS..


Estimate confidence intervals of TCN and DH segment levels

Description

Estimate confidence intervals of TCN and DH segment levels using bootstrap.

Usage

## S3 method for class 'PairedPSCBS'bootstrapTCNandDHByRegion(fit, B=1000L, boot=NULL, ..., probs=c(0.025, 0.05, 0.95,  0.975), statsFcn=NULL, what=c("segment", "changepoint"), force=FALSE, verbose=FALSE,  .debug=FALSE)

Arguments

B

A positiveinteger specifying the number of bootstrap samples.

boot

Alternatively, to generatingB bootstrap samples,this specifies a pre-generated set of bootstrap samples asreturned bybootstrapSegmentsAndChangepoints().

...

Additional arguments passed tobootstrapSegmentsAndChangepoints().

probs

The default quantiles to be estimated.

statsFcn

A (optional)function that estimates confidenceintervals given locus-level data.IfNULL, thequantile function is used.

what

Acharactervector specifying what to bootstrap.

force

IfTRUE, already existing estimates are ignored,otherwise not.

verbose

SeeVerbose.

.debug

(internal) IfTRUE, additional sanity checks areperformed internally.

Value

Returns aPairedPSCBS object.

Author(s)

Henrik Bengtsson


Concatenates segmentation results

Description

Concatenates segmentation results.

Usage

## S3 method for class 'CBS'c(..., addSplit=TRUE)

Arguments

...

One or moreAbstractCBS objects to be combined.

addSplit

IfTRUE, a "divider" is added between chromosomes.

Value

Returns anAbstractCBS object of the same class in ....

Author(s)

Henrik Bengtsson

See Also

For more information seeCBS.


Calls segments that are in allelic balance

Description

Calls segments that are in allelic balance, i.e. that have equal minor and major copy numbers.

Usage

## S3 method for class 'PairedPSCBS'callAB(fit, flavor=c("DeltaAB*"), ..., minSize=1, xorCalls=TRUE, force=FALSE)

Arguments

flavor

Acharacter string specifying which type ofcall to use.

...

Additional arguments passed to the caller.

minSize

An optionalinteger specifying the minimum numberof data points in order to call a segments. If fewer data points,then the call is set toNA regardless.

xorCalls

IfTRUE, a region already called LOH, willfor consistency never be called AB, resulting in either an ABcall set toFALSE orNA (as explained below).

force

IfFALSE, and allelic-balance calls already exits,then nothing is done, otherwise the calls are done.

Value

Returns aPairedPSCBS object with allelic-balance calls.

AB and LOH consistency

Biologically, a segment can not be both in allelic balance (AB) andin loss-of-heterozygosity (LOH) at the same time.To avoid reporting such inconsistencies, the LOH caller will,if argumentxorCalls=TRUE, never report a segment to be inLOH if it is already called to be in AB.However, regardless of of the AB call, a segment is still alwaystested for LOH, to check weather the LOH caller is consistent with theAB caller or not. Thus, in order to distinguish the case wherethe AB caller and LOH caller agree from when they disagree,we report either (AB,LOH)=(TRUE,FALSE) or (TRUE,NA). The former isreported when they are consistent, and the latter when they are not,or when the AB caller could not call it.

Author(s)

Henrik Bengtsson

See Also

Internally, one of the following methods are used:*callAllelicBalanceByDH().


Calls segments that are in allelic balance

Description

Calls segments that are in allelic balance by thresholding on DH using a predetermined threshold.The variability of the DH mean levels is taken into account via abootstrap estimator.

Usage

## S3 method for class 'PairedPSCBS'callAllelicBalanceByDH(fit, delta=estimateDeltaAB(fit, flavor = "qq(DH)"), alpha=0.05,  ..., verbose=FALSE)

Arguments

flavor

Acharacter string specifying which type ofcall to use.

delta

(Tuning parameter) A non-negativenumeric threshold.

alpha

Anumeric in [0,1] specifying the upper and lowerquantiles calculated by the bootstrap estimator.

...

Additional arguments passed to the bootstrap estimator*bootstrapTCNandDHByRegion().

Value

Returns aPairedPSCBS object with allelic-balance calls.

Algorithm

Author(s)

Henrik Bengtsson

See Also

Instead of calling this method explicitly, it is recommendedto use the*callAllelicBalance() method.


Calls (focal) amplifications

Description

Calls (focal) amplifications.

Usage

## S3 method for class 'CBS'callAmplifications(fit, adjust=1, maxLength=2e+07, method=c("ucsf-exp"), ...,  verbose=FALSE)

Arguments

adjust

A positive scale factor adjusting the sensitivity of thecaller, where a value less (greater) than 1.0 makes the callerless (more) sensitive.

maxLength

Adouble scalar specifying the maximum length of a segmentin order for it to be considered a focal amplification.

method

Acharacter string specifying the calling algorithm to use.

...

Additional/optional arguments used to override the defaultparameters used by the caller.

verbose

Verbose.

Value

Returns aCBS object wherelogical column'amplificationCall' has been appended to the segmentation table.

The UCSF caller

Ifmethod == "ucsf-exp", then segments are called using [1], i.e.a segment is called an amplification if ...

Author(s)

Henrik Bengtsson

References

[1] Fridlyand et al.Breast tumor copy number aberrationphenotypes and genomic instability, BMC Cancer, 2006.

See Also

*callGainsAndLosses().*callOutliers().For more information seeCBS.


Calls segments that have a neutral total copy number

Description

Calls segments that have a neutral total copy number (NTCN),i.e. that have a TCN that corresponds to the ploidy of the genome.

Usage

## S3 method for class 'PairedPSCBS'callCopyNeutral(fit, flavor=c("TCN|AB"), ..., minSize=1, force=FALSE)

Arguments

flavor

Acharacter string specifying which type ofcall to use.

...

Additional arguments passed to the caller.

minSize

An optionalinteger specifying the minimum numberof data points in order to call a segments. If fewer data points,then the call is set toNA regardless.

force

IfFALSE, and copy-neutral calls already exits,then nothing is done, otherwise the calls are done.

Value

Returns aPairedPSCBS object with copy-neutral calls.

Author(s)

Henrik Bengtsson

See Also

Internally, one of the following methods are used:*callCopyNeutralByTCNofAB().


Calls regions that are copy neutral

Description

Calls regions that are copy neutral from the total copy numbers (TCNs) of segmentsin allelic balance (AB).

Usage

## S3 method for class 'PairedPSCBS'callCopyNeutralByTCNofAB(fit, delta=estimateDeltaCN(fit), alpha=0.05, ..., force=FALSE,  verbose=FALSE)

Arguments

fit

A PairedPSCBS fit object as returned bysegmentByPairedPSCBS.

delta

A non-negativedouble specifying the width of the"acceptance" region.Defaults to half of the distance between two integer TCN states,i.e. 1/2. This argument should be shrunken as a function ofthe amount of the normal contamination and other background signals.

alpha

Adouble in [0,0.5] specifying the significance levelof the confidence intervals used.

...

Additional arguments passed to*calcStatsForCopyNeutralABs().

force

IfTRUE, an already called object is skipped, otherwise not.

verbose

SeeVerbose.

Details

...

Value

Returns aPairedPSCBS fit object where a columnwith the copy-neutral call.

Author(s)

Henrik Bengtsson


Calls segments that are gained, copy neutral, or lost

Description

Calls segments that are gained, copy neutral, or lost, where copy neutral means having a total copy numberthat corresponds to the ploidy of the genome.

Usage

## S3 method for class 'PairedPSCBS'callGNL(fit, flavor=c("TCN|AB"), ..., minSize=1, force=FALSE)

Arguments

flavor

Acharacter string specifying which type ofcall to use.

...

Additional arguments passed to the caller.

minSize

An optionalinteger specifying the minimum numberof data points in order to call a segments. If fewer data points,then the call is set toNA regardless.

force

IfFALSE, and copy-neutral calls already exits,then nothing is done, otherwise the calls are done.

Value

Returns aPairedPSCBS object with added calls.

Author(s)

Henrik Bengtsson

See Also

Internally, one of the following methods are used:callGNLByTCNofAB().


Calls gains and losses

Description

Calls gains and losses.

Usage

## S3 method for class 'CBS'callGainsAndLosses(fit, adjust=1, method=c("ucsf-mad", "ucsf-dmad"), ..., verbose=FALSE)

Arguments

adjust

A positive scale factor adjusting the sensitivity of thecaller, where a value less (greater) than 1.0 makes the callerless (more) sensitive.

method

Acharacter string specifying the calling algorithm to use.

...

Additional/optional arguments used to override the defaultparameters used by the caller.

Value

Returns aCBS object wherelogical columns'lossCall' and 'gainCall' have been appended to the segmentation table.

The UCSF caller

Ifmethod == "ucsf-mad", then segments are called using [1], i.e.a segment is called gained or lost if its segment level isat least two standard deviations away from the median segment levelon Chr1-22, where standard deviation is estimated using MAD.Then same is done formethod == "ucsf-dmad" with the differencethat the standard deviation is estimated using a robust first ordervariance estimator.

Author(s)

Henrik Bengtsson

References

[1] Fridlyand et al.Breast tumor copy number aberrationphenotypes and genomic instability, BMC Cancer, 2006.

See Also

*callAmplifications().*callOutliers().For more information seeCBS.

Examples

 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Simulating copy-number data# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -set.seed(0xBEEF)# Number of lociJ <- 1000mu <- double(J)mu[200:300] <- mu[200:300] + 1mu[350:400] <- NA # centromeremu[650:800] <- mu[650:800] - 1eps <- rnorm(J, sd=1/2)y <- mu + epsx <- sort(runif(length(y), max=length(y))) * 1e5w <- runif(J)w[650:800] <- 0.001# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Segmentation# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -fit <- segmentByCBS(y, x=x)print(fit)plotTracks(fit) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# CALLS# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Call gains and losses by segmentsfitC <- callGainsAndLosses(fit)# Call amplifications by segmentsfitC <- callAmplifications(fitC)# Call outliers by locifitC <- callOutliers(fitC)

Calls segments that are in LOH

Description

Calls segments that are in LOH, i.e. that have "zero" minor copy number.

Usage

## S3 method for class 'PairedPSCBS'callLOH(fit, flavor=c("SmallC1", "LargeDH"), ..., minSize=1, xorCalls=TRUE, force=FALSE)

Arguments

flavor

Acharacter string specifying which type ofcall to use.

...

Additional arguments passed to the caller.

minSize

An optionalinteger specifying the minimum numberof data points in order to call a segments. If fewer data points,then the call is set toNA regardless.

xorCalls

IfTRUE, a region already called AB, willfor consistency never be called LOH, resulting in either an LOHcall set toFALSE orNA (as explained below).

force

IfFALSE, and allelic-balance calls already exits,then nothing is done, otherwise the calls are done.

Value

Returns aPairedPSCBS object with LOH calls.

AB and LOH consistency

Biologically, a segment can not be both in allelic balance (AB) andin loss-of-heterozygosity (LOH) at the same time.To avoid reporting such inconsistencies, the LOH caller will,if argumentxorCalls=TRUE, never report a segment to be inLOH if it is already called to be in AB.However, regardless of of the AB call, a segment is still alwaystested for LOH, to check weather the LOH caller is consistent with theAB caller or not. Thus, in order to distinguish the case wherethe AB caller and LOH caller agree from when they disagree,we report either (AB,LOH)=(TRUE,FALSE) or (TRUE,NA). The former isreported when they are consistent, and the latter when they are not,or when the LOH caller could not call it.

Author(s)

Henrik Bengtsson

See Also

Internally, one of the following methods are used:*callLowC1ByC1(),*callExtremeAllelicImbalanceByDH().


Calls outliers

Description

Calls outliers.

Usage

## S3 method for class 'CBS'callOutliers(fit, adjust=1, method=c("ucsf-mad"), ...)

Arguments

adjust

A positive scale factor adjusting the sensitivity of thecaller, where a value less (greater) than 1.0 makes the callerless (more) sensitive.

method

Acharacter string specifying the calling algorithm to use.

...

Additional/optional arguments used to override the defaultparameters used by the caller.

Value

Returns aCBS object wherelogical columns'negOutlierCall' and 'posOutlierCall' have been appendedto the segmentation table.

The UCSF caller

Ifmethod == "ucsf-mad", then loci are called using [1]"Finally, to identify single technical or biological outliers suchas high level amplifications, the presence of the outliers withina segment was allowed by assigning the original observed log2ratioto the clones for which the observed values were more than fourtumor-specific MAD away from the smoothed values." [1; Suppl. Mat.]

Author(s)

Henrik Bengtsson

References

[1] Fridlyand et al.Breast tumor copy number aberrationphenotypes and genomic instability, BMC Cancer, 2006.

See Also

*callGainsAndLosses().*callAmplifications().For more information seeCBS.


Calls segments that are in ROH

Description

Calls segments that are in ROH, i.e. that have no (true) heterozygous genotypes.Run of homozygosity (ROH) is a property of the normal (germline) sample.

Usage

## S3 method for class 'PairedPSCBS'callROH(fit, ..., updateMeans=TRUE, force=FALSE, verbose=FALSE)

Arguments

...

Additional arguments passed totestROH().

updateMeans

IfTRUE, DH and (C1,C2) mean levels are settoNA for segments called ROH, otherwise not.

force

IfFALSE, and ROH calls already exits,then nothing is done, otherwise the calls are done.

verbose

SeeVerbose.

Value

Returns aPairedPSCBS object with ROH calls.

Author(s)

Pierre Neuvial, Henrik Bengtsson

See Also

Internally,testROH() is used.To call allelic balance (AB) see*callAB().To call loss of heterozygosity (LOH) see*callLOH().


Calls/drops single-locus outliers along the genome

Description

Calls/drops single-locus outliers along the genome that have a signal that differ significantly from theneighboring loci.

Usage

 ## Default S3 method:callSegmentationOutliers(y, chromosome=0, x=NULL, method="DNAcopy::smooth.CNA", ...,  verbose=FALSE) ## S3 method for class 'data.frame'callSegmentationOutliers(y, ...) ## Default S3 method:dropSegmentationOutliers(y, ...) ## S3 method for class 'data.frame'dropSegmentationOutliers(y, ...)

Arguments

y

Anumericvector of J genomic signals to be segmented.

chromosome

(Optional) Aninteger scalar(or avector of length J contain a unique value).Only used for annotation purposes.

x

Optionalnumericvector of J genomic locations.IfNULL, index locations1:J are used.

method

Acharacter string specifying the methodused for calling outliers.

...

Additional arguments passed to internal outlierdetection method.

verbose

SeeVerbose.

Value

callSegmentationOutliers() returns alogicalvector of length J.dropSegmentationOutliers() returns an object of the same typeas argumenty, where the signals for which outliers were calledhave been set toNA.

Missing and non-finite values

Signals as well as genomic positions may contain missingvalues, i.e.NAs orNaNs. By definition, these cannotbe outliers.

Author(s)

Henrik Bengtsson

See Also

Internallysmooth.CNA is utilized to identifythe outliers.


Drops zero or more change points

Description

Drops zero or more change points, which is done by dropping one change point at thetime using*dropChangePoint()and recalculating the segment statistics at the end.

NOTE: This method only works if there is only one chromosome.

Usage

## S3 method for class 'AbstractCBS'dropChangePoints(fit, idxs, update=TRUE, ...)

Arguments

idxs

Anintegervector specifying the change points to be dropped.

update

IfTRUE, segment statistics are updated.

...

Other arguments passed to*dropChangePoint()and*updateMeans().

Value

Returns anAbstractCBS of the same class withlength(idxs) segments.

Author(s)

Henrik Bengtsson

See Also

For more information seeAbstractCBS.


Drops chromosomal regions (a connected set of segments)

Description

Drops chromosomal regions (a connected set of segments) each of a certain size (number of segments).None of the statistics are recalculated.

Usage

## S3 method for class 'AbstractCBS'dropRegions(this, regions, H=1, ..., asMissing=FALSE, verbose=FALSE)

Arguments

regions

Anintegervector of length R specifying the indicesof the left most segment in each of the R regions to be dropped.

H

A non-negativeinteger specifying the size of each region,i.e. the number of segments per region.

...

Additional arguments passed to*extractRegions().

asMissing

IfTRUE, dropped segments are replaced by missing values,otherwise they are truly dropped.

verbose

Alogical or aVerbose object.

Value

Returns anAbstractCBS object of the same class with (at most)R*H segments dropped.If some regions overlap (share segments), then fewer than R*H segmentsare dropped.

Author(s)

Henrik Bengtsson

See Also

Internally*extractRegions() is used.See also*dropChangePoint() and*mergeTwoSegments().For more information seeAbstractCBS.


Estimate a threshold for calling allelic balance from DH

Description

Estimate a threshold for calling allelic balance from DH to be used by the*callAB() method.

Usage

## S3 method for class 'PairedPSCBS'estimateDeltaAB(this, scale=NULL, flavor=c("qq(DH)", "q(DH)", "mad(hBAF)", "median(DH)"),  ..., max=Inf, verbose=FALSE)

Arguments

scale

An optionalnumeric scale factor.

flavor

Acharacter string specifying which type ofestimator to use.

...

Additional arguments passed to the estimator.

max

(Optional) The maximum estimate allowed. If greater thanthis value, the estimate will be truncated.

verbose

SeeVerbose.

Value

Returns the threshold estimate as anumeric scalar.

Author(s)

Henrik Bengtsson

See Also

Internally, one of the following methods are used:*estimateDeltaABBySmallDH(),*estimateStdDevForHeterozygousBAF(),*estimateMeanForDH(), and*estimateHighDHQuantileAtAB().


Estimate a threshold for calling allelic balance from DH

Description

Estimate a threshold for calling allelic balance from DH.

Usage

## S3 method for class 'PairedPSCBS'estimateDeltaABBySmallDH(fit, q1=0.05, q2=0.9, ..., verbose=FALSE)

Arguments

q1

Anumeric value specifying the weighted quantile of thesegment-level DHs used to identify segments with small DH means.

q2

Anumeric value specifying the quantile of the locus-levelDH signals for those segments with small DH mean levels.

...

Not used.

verbose

SeeVerbose.

Value

Returns the threshold estimate as anumeric scalar.

Algorithm

Author(s)

Henrik Bengtsson

See Also

Instead of calling this method explicitly, it is recommendedto use the*estimateDeltaAB() method.


Estimates the length of one total copy-number (TCN) unit

Description

Estimates the length of one total copy-number (TCN) unit

Usage

## S3 method for class 'PairedPSCBS'estimateDeltaCN(fit, scale=1, flavor=c("1-kappa", "delta(mode)"),  kappa=estimateKappa(fit), adjust=0.2, quantile=0.95, ...)

Arguments

scale

Anumeric scale factor in (0,Inf) used for rescaling(multiplying) the final estimate with.

flavor

Specifies which type of estimator should be used.

kappa

Estimate of background signal (used by the"1-kappa" method).

adjust,quantile

Tuning parameters (used by the"delta(mode)" method).

...

Not used.

Details

For parent-specific copy-number (PSCN) data, the TCN unit length isestimated as(1-kappa)/2, wherekappa is estimated fromdata (byestimateKappa).

For total copy-number (TCN) data (only),

Value

Returns a positive scalarnumeric.

Author(s)

Henrik Bengtsson

See Also

For more information seePairedPSCBS.


Estimate a threshold for calling LOH from DH

Description

Estimate a threshold for calling LOH from DH to be used by the*callLOH() method.

Usage

## S3 method for class 'PairedPSCBS'estimateDeltaLOH(this, flavor=c("minC1|nonAB"), ..., max=Inf, verbose=FALSE)

Arguments

flavor

Acharacter string specifying which type ofestimator to use.

...

Additional arguments passed to the estimator.

max

(Optional) The maximum estimate allowed. If greater thanthis value, the estimate will be truncated.

verbose

SeeVerbose.

Value

Returns the threshold estimate as anumeric scalar or -Inf.In case it is not possible to estimate the LOH threshold, then-Inf is returned.

Author(s)

Henrik Bengtsson

See Also

Internally, one of the following methods are used:*estimateDeltaLOHByMinC1ForNonAB().


Estimate a threshold for calling LOH from DH

Description

Estimate a threshold for calling LOH from DH based on the location of guessed C1=0 and C1=1 peaks.

Usage

## S3 method for class 'PairedPSCBS'estimateDeltaLOHByMinC1ForNonAB(this, midpoint=1/2, maxC=3 * (ploidy(this)/2), ...,  verbose=FALSE)

Arguments

midpoint

Anumeric scalar in [0,1] specifying the relativeposition of the midpoint between the estimated locations ofC1=0 and C1=1 mean parameters.

maxC

Maximum total copy number of a segment in order tobe included in the initial set of segments.

...

Not used.

verbose

SeeVerbose.

Details

This method requires that calls for allelic balances already havebeen me made, cf.*callAllelicBalance().

Value

Returns the estimated LOH threshold as anumeric scalar or -Inf.In case it is not possible to estimate the LOH threshold, then-Inf is returned.

Algorithm

Author(s)

Henrik Bengtsson

See Also

Instead of calling this method explicitly, it is recommendedto use the*estimateDeltaLOH() method.


Estimate global background in segmented copy numbers

Description

Estimate global background in segmented copy numbers.The global background, here called\kappa,may have multiple origins where normal contamination is one,but not necessarily the only one.

Usage

## S3 method for class 'PairedPSCBS'estimateKappa(this, flavor=c("density(C1)"), ...)

Arguments

flavor

Acharacter string specifying which type ofestimator to use.

...

Additional arguments passed to the estimator.

Value

Returns the background estimate as anumeric scalar.

Author(s)

Henrik Bengtsson

See Also

Internally, one of the following methods are used:*estimateKappaByC1Density().


Estimate global background in segmented copy numbers

Description

Estimate global background in segmented copy numbers based on the location of peaks in a weighteddensity estimator of the minor copy number mean levels.

The global background, here called\kappa,may have multiple origins where normal contamination is one,but not necessarily the only one.

Assumptions: This estimator assumes that there are segmentswith C1=0 and C1=1, i.e. some deletions and, typically, some normalsegements.

Usage

## S3 method for class 'PairedPSCBS'estimateKappaByC1Density(this, typeOfWeights=c("dhNbrOfLoci", "sqrt(dhNbrOfLoci)"),  adjust=1, from=0, minDensity=0.2, ..., verbose=FALSE)

Arguments

typeOfWeights

Acharacter string specifying how weightsare calculated.

adjust

Anumeric scale factor specifying the size ofthe bandwidth parameter used by the density estimator.

from

Anumeric scalar specifying the lower bound for thesupport of the estimated density.

minDensity

A non-negativenumeric threshold specifyingthe minimum density a peak should have in order to considerit a peak.

...

Not used.

verbose

SeeVerbose.

Value

Returns the background estimate as anumeric scalar.

Algorithm

Author(s)

Henrik Bengtsson

See Also

Instead of calling this method explicitly, it is recommendedto use the*estimateKappa() method.


Estimates the whole-genome standard deviation of the signals

Description

Estimates the whole-genome standard deviation of the signals.

Usage

## S3 method for class 'CBS'estimateStandardDeviation(fit, chromosomes=NULL, method=c("diff", "res", "abs",  "DNAcopy"), estimator=c("mad", "sd"), na.rm=TRUE, weights=NULL, ...)

Arguments

chromosomes

An optionalvector specifying the subset ofchromosomes used for the estimate. IfNULL, all chromosomes are used.

method

Acharacter string specifying the method used.

estimator

Acharacter string or afunction specifying theinternal estimator.

na.rm

IfTRUE, missing values are dropped, otherwise not.

weights

An optionaldoublevector ofnbrOfLoci()non-negative weights.

...

Not used.

Value

Returns a non-negativenumeric scale.

Author(s)

Henrik Bengtsson

See Also

For more information seeCBS.


Gets an example data set

Description

Gets an example data set.

Usage

## Default S3 method:exampleData(name=c("paired.chr01"), ...)

Arguments

name

Acharacter string specifying the name of the data set.

...

Not used.

Value

Returnsdata.frame.

Author(s)

Henrik Bengtsson


Extract minor and major copy-number mean levels per segment

Description

Extract minor and major copy-number mean levels per segment.

Usage

## S3 method for class 'PairedPSCBS'extractMinorMajorCNs(fit, ...)

Arguments

...

Not used.

Value

Returns adata.frame.

Author(s)

Henrik Bengtsson

See Also

*extractTCNAndDHs()For more information seePairedPSCBS.


Extracts segments means at each locus

Description

Extracts segments means at each locus.

Usage

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

Arguments

...

Arguments passed to*getLocusData().

Value

Returns anumericvector of lengthnbrOfLoci().

Author(s)

Henrik Bengtsson

See Also

For more information seeCBS.


Extract TCN and DH mean levels per segment

Description

Extract TCN and DH mean levels per segment.

Usage

## S3 method for class 'PairedPSCBS'extractTCNAndDHs(fit, ...)

Arguments

...

Arguments passed togetSegments().

Value

Returns adata.frame.

Author(s)

Henrik Bengtsson

See Also

*extractMinorMajorCNs().For more information seePairedPSCBS.


Identifies gaps of a genome where there exist no observations

Description

Identifies gaps of a genome where there exist no observations.

Usage

## Default S3 method:findLargeGaps(chromosome=NULL, x, minLength, resolution=1L, ...)

Arguments

chromosome

(Optional) Anintegervector of length J ofchromosome indices.

x

Anumericvector of J of genomic locations.

minLength

A positivenumeric scalar specifying the minimumlength of a gap.

resolution

A non-negativenumeric specifying the minimumlength unit, which by default equals one nucleotide/base pair.

...

Not used.

Value

Returnsdata.frame zero or more rows and with columnschromosome (if given),start,stop,andlength.

Author(s)

Henrik Bengtsson

See Also

UsegapsToSegments() to turn the set of identified gaps intothe complementary set of segments such that they can be passedtosegmentByCBS(),segmentByPairedPSCBS() andsegmentByNonPairedPSCBS() via argumentknownSegments.


Call segments to be copy neutral based on allelic imbalance calls and total copy number estimates

Description

Call segments to be copy neutral based on allelic imbalance calls and total copy number estimates.

Usage

## Default S3 method:findNeutralCopyNumberState(C, isAI, weights=NULL, ..., minDensity=1e-10,  flavor=c("firstPeak", "maxPeak"), verbose=FALSE)

Arguments

C

Anumericvector of region-level total copy number estimates.

isAI

Alogicalvector of "allelic imbalance" calls.

weights

An optionalnumericvector of non-negative weights.

...

Further arguments to be passed to the density estimationfunction.

minDensity

Anumeric value, below which density peaks arediscarded.

flavor

Acharacter string specifying how to identify themode of the AB segments.

verbose

IfTRUE, extra information is output.

Value

Alogicalvector of "neutral copy number state" calls.

Author(s)

Pierre Neuvial, Henrik Bengtsson


Gets the genomic segments that are complementary to the gaps

Description

Gets the genomic segments that are complementary to the gaps, with default chromosome boundaries being-Infand+Inf.

Usage

## S3 method for class 'data.frame'gapsToSegments(gaps, resolution=1L, minLength=0L, dropGaps=FALSE, ...)

Arguments

gaps

Adata.frame with columnschromosome,start,andstop. Any overlapping gaps will throw an error.

resolution

A non-negativenumeric specifying the minimumlength unit, which by default equals one nucleotide/base pair.

minLength

Minimum length of segments to be kept.

dropGaps

IfTRUE, the gaps themselves are not part of the output.

...

Not used.

Value

Returnsdata.frame of least one row with columnschromosomeif that argument is given),start,stop andlength.The segments are ordered along the genome.

Author(s)

Henrik Bengtsson

See Also

findLargeGaps().


Generates original and bootstrapped segment-specific index sets

Description

Generates original and bootstrapped segment-specific index sets, which can be used to calculate various bootstrap summaries,e.g. segment mean levels.

Usage

## S3 method for class 'PairedPSCBS'getBootstrapLocusSets(fit, B=1000L, by=c("betaTN", "betaT"), seed=NULL, verbose=FALSE,  .validate=FALSE, ...)

Arguments

B

A non-negativeinteger specifying the number of bootstrap samples.

by

ShouldbetaTN orbetaT be used?

seed

An (optional)integer specifying the random seed to beset before sampling indices. The random seed is set to its originalstate when exiting. IfNULL, it is not set.

verbose

SeeVerbose.

.validate

IfTRUE, additional sanity checks are performedto validate the correctness. This is only needed for troubleshootingif it is suspected there is a bug.

...

Not used.

Value

Returns alist.

Author(s)

Henrik Bengtsson

See Also

This is used internally by various bootstrap methods.


Calculates various call statistics per chromosome

Description

Calculates various call statistics per chromosome.

Usage

## S3 method for class 'CBS'getCallStatistics(fit, regions=NULL, shrinkRegions=TRUE, ..., verbose=FALSE)

Arguments

regions

An optionaldata.frame with columns "chromosome","start", and "end" specifying the regions of interest to calculatestatistics for. IfNULL, all of the genome is used.

shrinkRegions

IfTRUE, regions are shrunk to the support ofthe data.

...

Not used.

verbose

Verbose.

Details

The estimators implemented here are based solely on thesegmentation results, which is very fast.In the original proposal by Fridlyand et al. [1], the authorsestimates the parameters by converting segment-level calls backto locus-level calls and there do the calculations.The difference between the two approaches should be minor,particularly for large density arrays.

Value

Returns a CxKdata.frame, where C is the number of regions thatmeet the criteria setup by argumentregionsand (K-4)/2 is the number of call types.The first column is the chromosome index, the second and the thirdare the first and last position, and the fourth the length(=last-first+1) of the chromosome.The following columns contains call summaries per chromosome.For each chromosome and call type, the total length of such callson that chromosome is reported together how large of a fractionof the chromosome such calls occupy.

Author(s)

Henrik Bengtsson

References

[1] Fridlyand et al.Breast tumor copy number aberrationphenotypes and genomic instability, BMC Cancer, 2006.

See Also

For more information seeCBS.


Gets the set of chromosomes

Description

Gets the set of chromosomes in the segmentation result.

Usage

## S3 method for class 'AbstractCBS'getChromosomes(this, ...)

Arguments

...

Arguments passed to*getSegments().

Value

Returns a unique and sortedvector of chromosomes segmented.

Author(s)

Henrik Bengtsson

See Also

*nbrOfChromosomes().For more information seeAbstractCBS.


Calculates the fraction of the genome lost, gained, or aberrant either way

Description

Calculates the fraction of the genome lost, gained, or aberrant either way (in sense of total copy numbers),using definitions closely related to those presented in [1].

Usage

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

Arguments

...

Not used.

Value

Returns adouble in [0,1].

Author(s)

Henrik Bengtsson

References

[1] Fridlyand et al.Breast tumor copy number aberrationphenotypes and genomic instability, BMC Cancer, 2006.

See Also

Internally,*getCallStatistics() is used.For more information seeCBS.


Gets the locus-level data

Description

Gets the locus-level data.

Usage

## S3 method for class 'AbstractCBS'getLocusData(...)

Arguments

...

Not used.

Value

Returns a JxLdata.frame, where J in the number of loci,and L is the number of locus-specific fields.

Author(s)

Henrik Bengtsson

See Also

For more information seeAbstractCBS.


Gets the name of the sample segmented

Description

Gets the name of the sample segmented.

Usage

## S3 method for class 'AbstractCBS'getSampleName(fit, ...)

Arguments

...

Not used.

Value

Returns acharacter string.

Author(s)

Henrik Bengtsson

See Also

*setSampleName().For more information seeAbstractCBS..


Gets the segments

Description

Gets the segments.

Usage

## S3 method for class 'AbstractCBS'getSegments(...)

Arguments

...

Not used.

Value

Returns a SxKdata.frame, where S in the number of segments,and K is the number of segment-specific fields.

Author(s)

Henrik Bengtsson

See Also

For more information seeAbstractCBS.


Gets the segments

Description

Gets the segments.

Usage

## S3 method for class 'PSCBS'getSegments(fit, simplify=FALSE, splitters=TRUE, addGaps=FALSE, ...)

Arguments

simplify

IfTRUE, redundant and intermediate information is dropped.

#

splitters

IfTRUE, "splitters" between chromosomes arepreserved, otherwise dropped.

...

Not used.

Value

Returns a SxKdata.frame, where S in the number of segments,and K is the number of segment-specific fields.

Author(s)

Henrik Bengtsson

See Also

For more information seePSCBS.


Gets smoothed locus-level data

Description

Gets smoothed locus-level data.

Usage

## S3 method for class 'CBS'getSmoothLocusData(fit, by, ...)

Arguments

fit

AnCBS object.

by

Anumeric scalar specifying the bin size.

...

Not used.

Value

Returns adata.frame where thefirst three columns are 'chromosome', 'x' (position),and 'count' (number of loci average over for the given bin),and the remaining ones are the smoothed locus-level data.

Author(s)

Henrik Bengtsson

See Also

For more information seeCBS.


Performs a hierarchical clustering of the CN mean levels

Description

Performs a hierarchical clustering of the CN mean levels.

Usage

## S3 method for class 'AbstractCBS'hclustCNs(fit, size=NULL, distMethod="euclidean", hclustMethod="ward.D", ...,  verbose=FALSE)

Arguments

size

Argument passed to*sampleCNs().

distMethod,hclustMethod

Argumentmethod fordist and "stats::hclust", respectively.

...

Not used.

verbose

SeeVerbose.

Value

Returns ahclust object as returned byhclust.

Author(s)

Henrik Bengtsson

See Also

This method is utilized by*pruneByHClust().


Install the DNAcopy package

Description

Install the DNAcopy package, if missing.

Usage

## Default S3 method:installDNAcopy(..., force=FALSE)

Arguments

...

Arguments passed to the install function.

force

IfFALSE and theDNAcopy package is alreadyinstalled, then it will not be re-install.IfTRUE, it will be installed.

Details

This function is will download and call thebiocLite()installation function from the Bioconductor Project website.This function will also make sure thatDNAcopy is loaded sothat it is reported bysessionInfo.

Value

Returns nothing.

Author(s)

Henrik Bengtsson


Joins neighboring segments such that there is no gap in between them

Description

Joins neighboring segments such that there is no gap in between them.For instance, consider two neighboring segments [x1,x2] and [x3,x4]with x1 < x2 < x3 < x4. After join the segments, they are[x1,x23] and [x23,x4] where x23 = (x2 + x3)/2.

Usage

## S3 method for class 'CBS'joinSegments(fit, range=NULL, verbose=FALSE, ...)

Arguments

range

(optional) Anumericvector of length two.

verbose

SeeVerbose.

...

Not used.

Details

This function assumes only chromosome exists.If more, an error will be thrown.

Value

Returns an updatedCBS object.

Author(s)

Henrik Bengtsson


Merge neighboring segments that are not called

Description

Merge neighboring segments that are not called

Usage

## S3 method for class 'CBS'mergeNonCalledSegments(fit, ..., verbose=FALSE)

Arguments

...

Not used.

verbose

Verbose.

Value

Returns an object of the same classwith the same of fewer number of segments.

Author(s)

Henrik Bengtsson

See Also

For more information seeCBS.


Merge a segment and its two flanking segments

Description

Merge a segment and its two flanking segments into one segment, and recalculating the segment statistics.

Usage

## S3 method for class 'AbstractCBS'mergeThreeSegments(fit, middle, ...)

Arguments

middle

Aninteger specifying the three segments(middle-1, middle, middle+1) to be merged.

...

Additional arguments passed to*mergeTwoSegments().

Value

Returns anAbstractCBS of the same class with two less segment.

Author(s)

Henrik Bengtsson

See Also

Internally*mergeTwoSegments() is used.For more information seeAbstractCBS.


Merge two neighboring segments

Description

Merge two neighboring segments into one segment, which is done by dropping theircommon change point and recalculating the segment statistics.

Usage

## S3 method for class 'AbstractCBS'mergeTwoSegments(...)

Arguments

...

Not used.

Value

Returns anAbstractCBS of the same class with one less segment.

Author(s)

Henrik Bengtsson

See Also

To merge a segment and its two flanking segments, see*mergeThreeSegments().To drop regions (a connected set of segments)see*dropRegions().For more information seeAbstractCBS.


Merge two neighboring segments

Description

Merge two neighboring segments by recalculating segment statistics.

Usage

## S3 method for class 'PairedPSCBS'mergeTwoSegments(this, left, update=TRUE, verbose=FALSE, ...)

Arguments

left

Aninteger specifying the segments (left, left+1)to be merged.

update

IfTRUE, segment statistics are updated.

verbose

Alogical or aVerbose object.

...

Not used.

Value

Returns aPairedPSCBS with one less segment.

Author(s)

Henrik Bengtsson

See Also

To drop regions (a connected set of segments) seedropRegions().For more information seePairedPSCBS.


Gets the number of change points

Description

Gets the number of change points, which is defined as the number of segments minusthe number of chromosomes.

Usage

## S3 method for class 'AbstractCBS'nbrOfChangePoints(fit, ignoreGaps=FALSE, dropEmptySegments=TRUE, ...)

Arguments

...

Not used.

Value

Returns aninteger.

Author(s)

Henrik Bengtsson

See Also

*nbrOfSegments()*nbrOfChromosomes()For more information seeAbstractCBS.


Gets the number of chromosomes

Description

Gets the number of chromosomes.

Usage

## S3 method for class 'AbstractCBS'nbrOfChromosomes(this, ...)

Arguments

...

Arguments passed to*getChromosomes().

Value

Returns aninteger.

Author(s)

Henrik Bengtsson

See Also

*getChromosomes().For more information seeAbstractCBS.


Gets the number of loci

Description

Gets the number of loci.

Usage

## S3 method for class 'AbstractCBS'nbrOfLoci(fit, splitters=FALSE, ...)

Arguments

splitters,...

Arguments passed to*getLocusData().

Value

Returns aninteger.

Author(s)

Henrik Bengtsson

See Also

For more information seeAbstractCBS.


Gets the number of segments

Description

Gets the number of segments.

Usage

## S3 method for class 'AbstractCBS'nbrOfSegments(this, splitters=FALSE, ...)

Arguments

splitters,...

Arguments passed to*getSegments().

Value

Returns aninteger.

Author(s)

Henrik Bengtsson

See Also

*nbrOfChangePoints()*nbrOfChromosomes()For more information seeAbstractCBS.


Normalizes copy numbers such that the whole-genome average total copy number is two

Description

Normalizes copy numbers such that the whole-genome average total copy number is two.

Usage

## S3 method for class 'AbstractCBS'normalizeTotalCNs(...)

Arguments

...

Additional arguments passed to the normalization method.

Value

Returns a normalized AbstractCBS object of the same class asfit.

Author(s)

Henrik Bengtsson

See Also

For more information seeAbstractCBS..


Gets and sets ploidy

Description

Gets and sets ploidy.

Usage

  ## S3 method for class 'AbstractCBS'ploidy(fit, ...)  ## S3 replacement method for class 'AbstractCBS'ploidy(fit) <- value

Arguments

fit

AnAbstractCBS object.

value

Aninteger (in1,2,\ldots) specifying the genome ploidy .

...

Not used.

Value

Returns (invisibly) an updated object.

Author(s)

Henrik Bengtsson

See Also

For more information seeAbstractCBS..


Plots the segmentation result along the genome

Description

Plots the segmentation result along the genome.

Usage

## S3 method for class 'AbstractCBS'plotTracks(...)

Arguments

...

...

Value

Returns nothing.

Author(s)

Henrik Bengtsson

See Also

For more information seeAbstractCBS.


Plots copy numbers along the genome

Description

Plots copy numbers along the genome for one or more chromosomes.Each type of track is plotted in its own panel.

Usage

## S3 method for class 'CBS'plotTracks(x, scatter=TRUE, pch=20, col="gray", meanCol="purple", cex=1, grid=FALSE,  Clim="auto", xScale=1e-06, Clab="auto", ..., byIndex=FALSE, mar=NULL, add=FALSE)

Arguments

x

A result object returned bysegmentByCBS().

pch

The type of points to use.

Clim

The range of copy numbers.

xScale

The scale factor used for genomic positions.

...

Not used.

add

IfTRUE, the panels plotted are added to the existing plot,otherwise a new plot is created.

Value

Returns nothing.

Author(s)

Henrik Bengtsson


Plots parental specific copy numbers along the genome

Description

Plots parental specific copy numbers along the genome for one or more chromosomes.It is possible to specify what type of tracks to plot.Each type of track is plotted in its own panel.

Usage

## S3 method for class 'PairedPSCBS'plotTracks1(x, tracks=c("tcn", "dh", "tcn,c1,c2", "tcn,c1", "tcn,c2", "c1,c2", "betaN",  "betaT", "betaTN")[1:3], scatter="*", calls=".*", pch=".", col=NULL, cex=1,  changepoints=FALSE, grid=FALSE, quantiles=c(0.05, 0.95), xlim=NULL,  Clim=c(0, 3 * ploidy(x)), Blim=c(0, 1), xScale=1e-06, ..., add=FALSE,  subplots=!add && (length(tracks) > 1), verbose=FALSE)

Arguments

x

A result object returned bysegmentByPairedPSCBS().

tracks

Acharactervector specifying what types of tracks to plot.

scatter

Acharactervector specifying which of the tracks shouldhave scatter plot.

calls

Acharactervector of regular expression identifyingcall labels to be highlighted in the panels.

pch

The type of the scatter points, if any.

col

The color of the scatter points, if any.

cex

The size of the scatter points, if any.

changepoints

IfTRUE, changepoints are drawn as vertical lines.

grid

IfTRUE, horizontal lines are displayed.

quantiles

Anumericvector in [0,1] specifying the quantilesof the confidence bands to be drawn, if any.

xlim

(Optional) The genomic range to plot.

Clim

The range of copy numbers.

Blim

The range of allele B fractions (BAFs) anddecrease of heterozygosity (DHs).

xScale

The scale factor used for genomic positions.

...

Not used.

add

IfTRUE, the panels plotted are added to the existing plot,otherwise a new plot is created.

subplots

IfTRUE, then subplots are automatically setup.

verbose

SeeVerbose.

Value

Returns nothing.

Author(s)

Henrik Bengtsson


Prunes the CN profile using dynamical programming

Description

Prunes the CN profile using dynamical programming by specifying the target number of segments or alternativehow of many change points to drop.

Usage

## S3 method for class 'AbstractCBS'pruneByDP(fit, nbrOfSegments, ..., verbose=FALSE)

Arguments

nbrOfSegments

Aninteger specifying the number of segments afterpruning. If negative, the it specifies the number of change pointsto drop.

...

Optional arguments passed to*seqOfSegmentsByDP().

verbose

SeeVerbose.

Value

Returns a pruned object of the same class.

Author(s)

Henrik Bengtsson, Pierre Neuvial

References

[1] ...

Examples

## Not run:  # Drop two segments fitP <- pruneByDP(fit, nbrOfSegments=-2)## End(Not run)

Prunes the CN profile by pruning and merging through hierarchical clustering

Description

Prunes the CN profile by pruning and merging through hierarchical clustering.

Usage

## S3 method for class 'AbstractCBS'pruneByHClust(fit, ..., size=NULL, distMethod="euclidean", hclustMethod="ward.D",  merge=TRUE, update=TRUE, verbose=FALSE)

Arguments

...

Arguments passed tocutree,particularly either of thresholdsh ork.

size,distMethod,hclustMethod

Arguments (as well assome of...) passed to*hclustCNs().

merge

IfTRUE, consecutive segments that belong to thesame PSCN cluster will be merged into one large segment.

update

IfTRUE, segment means are updated afterwards, otherwise not.

verbose

SeeVerbose.

Value

Returns a pruned object of the same class.

Author(s)

Henrik Bengtsson

Examples

## Not run:  fitP <- pruneByHClust(fit, h=0.25)## End(Not run)

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 thechange points is less than a multiple of the overall standard deviationof the copy-number signals.

Usage

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

Arguments

fit

ACBS object.

rho

A positivedouble scalar specifying the number of standarddeviations (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-levelcopy number signals. The default is to calculate it from the dataand as done in theDNAcopy package.

...

(Optional) Additional arguments passed to the standarddeviation estimator function.

verbose

SeeVerbose.

Details

This method corresponds to using theundo argument when callingsegmentByCBS(), which in turn corresponds to using theundo.splits="sdundo" andundo.SD of the underlyingsegment method.

Value

Returns aCBS object (of the same class asfit).

Author(s)

Henrik Bengtsson, Pierre Neuvial

Examples

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Simulating copy-number data# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -set.seed(0xBEEF)# Number of lociJ <- 1000mu <- double(J)mu[1:100] <- mu[1:100] + 0.3mu[200:300] <- mu[200:300] + 1mu[350:400] <- NA # centromeremu[650:800] <- mu[650:800] - 1eps <- rnorm(J, sd=1/2)y <- mu + epsx <- sort(runif(length(y), max=length(y))) * 1e5w <- 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")

Sets and resets the .Random.seed in the global environment

Description

Sets and resets the .Random.seed in the global environment.

Usage

 randomSeed(action=c("set", "advance", "reset", "get"), seed=NULL, kind=NULL, n=1L,  backup=TRUE)

Arguments

action

Acharacter string specifying the action.

seed

Random seed to be set; only foraction="set".Iflength(seed) == 1, thenset.seed(seed) isused, otherwise.Random.seed is assigned the value.

kind

(optional) Acharacter string specifying type ofrandom number generator to use, cf.RNGkind().

n

Number of random seeds to generate byaction.

backup

IfTRUE, the previous (seed, kind) state is recordedsuch that it can be reset later.

Value

Returns a.Random.seed.If more than one is returned, the they are returned as alist.

Author(s)

Henrik Bengtsson


Generates a report of the segmentation results

Description

Generates a report of the segmentation results.Currently reports can be generated for segmentation results of classCBS andPairedPSCBS.

Usage

## S3 method for class 'AbstractCBS'report(fit, sampleName=getSampleName(fit), studyName, ..., rspTags=NULL,  rootPath="reports/", .filename="*", skip=TRUE, envir=new.env(), verbose=FALSE)

Arguments

fit

AnAbstractCBS object.

sampleName

Acharacter string specifying the name of thesample segmented.

studyName

Acharacter string specifying the name of study/project.

...

Optional arguments passed to the RSP template.

rspTags

Optionalcharactervector of tags for further specifyingwhich RSP report to generate.

rootPath

The root directory where to write the report.

verbose

SeeVerbose.

Value

Returns the pathname of the generated PDF.

Author(s)

Henrik Bengtsson

See Also

For more information seeAbstractCBS.


Reset the segments

Description

Reset the segments. More precisely, it removes columns in the segmentationresult table that have been added by methods after the actualsegmentation method, e.g. bootstrap estimated mean level quantilesand various calls.It leave the basic segmentation results untouched,i.e. the partitioning and the segment means.

Usage

## S3 method for class 'AbstractCBS'resetSegments(fit, ...)

Arguments

...

Not used.

Value

Returns an object if the same class as the input result.

Author(s)

Henrik Bengtsson

See Also

For more information seeAbstractCBS.


Segment genomic signals using the CBS method

Description

Segment genomic signals using the CBS method of theDNAcopy package.This is a convenient low-level wrapper for theDNAcopy::segment()method. It is intended to be applied to a sample at the time.For more details on the Circular Binary Segmentation (CBS) methodsee [1,2].

Usage

## Default S3 method:segmentByCBS(y, chromosome=0L, x=NULL, index=seq_along(y), w=NULL, undo=0,  avg=c("mean", "median"), ..., joinSegments=TRUE, knownSegments=NULL, seed=NULL,  verbose=FALSE)

Arguments

y

Anumericvector of J genomic signals to be segmented.

chromosome

Optionalnumericvector of length J, specifyingthe chromosome of each loci. If a scalar, it is expanded toa vector of length J.

x

Optionalnumericvector of J genomic locations.IfNULL, index locations1:J are used.

index

An optionalintegervector of length J specifyingthe genomewide indices of the loci.

w

Optionalnumericvector in [0,1] of J weights.

undo

A non-negativenumeric. If greater than zero, thenargumentsundo.splits="sdundo" andundo.SD=undoare passed toDNAcopy::segment().In the special case whenundo is +Inf, the segmentationresult will not contain any changepoints (in addition to whatis specified by argumentknownSegments).

avg

Acharacter string specifying how to calculatingsegment mean levelsafter change points have beenidentified.

...

Additional arguments passed to theDNAcopy::segment()segmentation function.

joinSegments

IfTRUE, there are no gaps between neighboringsegments.IfFALSE, the boundaries of a segment are defined by the supportthat the loci in the segments provides, i.e. there exist a locusat each end point of each segment. This also means that thereis a gap between any neighboring segments, unless the change pointis in the middle of multiple loci with the same position.The latter is whatDNAcopy::segment() returns.

knownSegments

Optionaldata.frame specifyingnon-overlapping known segments. These segments mustnot share loci. SeefindLargeGaps() andgapsToSegments().

seed

An (optional)integer specifying the random seed to beset before calling the segmentation method. The random seed isset to its original state when exiting. IfNULL, it is not set.

verbose

SeeVerbose.

Details

Internallysegment ofDNAcopy is used tosegment the signals.This segmentation method support weighted segmentation.

Value

Returns aCBS object.

Reproducibility

TheDNAcopy::segment() implementation of CBS uses approximationthrough random sampling for some estimates. Because of this,repeated calls using the same signals may result in slightlydifferent results, unless the random seed is set/fixed.

Missing and non-finite values

Signals may contain missing values (NA orNaN), but notinfinite values (+/-Inf). Loci with missing-value signalsare preserved and keep in the result.

Likewise, genomic positions may contain missing values.However, if they do, such loci are silently excluded beforeperforming the segmentation, and are not kept in the results.The mapping between the input locus-level data and ditto ofthe result can be inferred from theindex column ofthe locus-level data of the result.

None of the input data may have infinite values,i.e. -Inf or +Inf. If so, an informative error is thrown.

Author(s)

Henrik Bengtsson

References

[1] A.B. Olshen, E.S. Venkatraman (aka Venkatraman E. Seshan), R. Lucito and M. Wigler,Circular binary segmentation for the analysis of array-based DNA copy number data, Biostatistics, 2004
[2] E.S. Venkatraman and A.B. Olshen,A faster circular binary segmentation algorithm for the analysis of array CGH data, Bioinformatics, 2007

See Also

To segment allele-specific tumor copy-number signals from a tumorwith a matched normal, seesegmentByPairedPSCBS().For the samewithout a matched normal,seesegmentByNonPairedPSCBS().

It is also possible to prune change points after segmentation (withidentical results) usingpruneBySdUndo().

Examples

 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Simulating copy-number data# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -set.seed(0xBEEF)# Number of lociJ <- 1000mu <- double(J)mu[200:300] <- mu[200:300] + 1mu[350:400] <- NA # centromeremu[650:800] <- mu[650:800] - 1eps <- rnorm(J, sd=1/2)y <- mu + epsx <- sort(runif(length(y), max=length(y))) * 1e5w <- runif(J)w[650:800] <- 0.001# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Segmentation# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -fit <- segmentByCBS(y, x=x)print(fit)plotTracks(fit)     xlab <- "Position (Mb)"ylim <- c(-3,3)xMb <- x/1e6plot(xMb,y, pch=20, col="#aaaaaa", xlab=xlab, ylim=ylim)drawLevels(fit, col="red", lwd=2, xScale=1e-6) # - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# TESTS# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -fit <- segmentByCBS(y, x=x, seed=0xBEEF)print(fit)##   id chromosome       start      end nbrOfLoci    mean## 1  y          0    55167.82 20774251       201  0.0164## 2  y          0 20774250.85 29320105        99  1.0474## 3  y          0 29320104.86 65874675       349 -0.0227## 4  y          0 65874675.06 81348129       151 -1.0813## 5  y          0 81348129.20 99910827       200 -0.0612# Test #1: Reverse the ordering and segmentfitR <- segmentByCBS(rev(y), x=rev(x), seed=0xBEEF)# Sanity checkstopifnot(all.equal(getSegments(fitR), getSegments(fit)))# Sanity checkstopifnot(all.equal(rev(getLocusData(fitR)$index), getLocusData(fit)$index))# Test #2: Reverse, but preserve ordering of 'data' objectfitRP <- segmentByCBS(rev(y), x=rev(x), preserveOrder=TRUE)stopifnot(all.equal(getSegments(fitRP), getSegments(fit)))# (Test #3: Change points inbetween data points at the same locus)x[650:654] <- x[649]fitC <- segmentByCBS(rev(y), x=rev(x), preserveOrder=TRUE, seed=0xBEEF)# Test #4: Allow for some missing values in signalsy[450] <- NAfitD <- segmentByCBS(y, x=x, seed=0xBEEF)# Test #5: Allow for some missing genomic annotationsx[495] <- NAfitE <- segmentByCBS(y, x=x, seed=0xBEEF)# Test #6: Undo all change points foundfitF <- segmentByCBS(y, x=x, undo=Inf, seed=0xBEEF)print(fitF)stopifnot(nbrOfSegments(fitF) == 1L)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# MISC.# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Emulate a centromerex[650:699] <- NAfit <- segmentByCBS(y, x=x, seed=0xBEEF)xMb <- x/1e6plot(xMb,y, pch=20, col="#aaaaaa", xlab=xlab, ylim=ylim)drawLevels(fit, col="red", lwd=2, xScale=1e-6)fitC <- segmentByCBS(y, x=x, joinSegments=FALSE, seed=0xBEEF)drawLevels(fitC, col="blue", lwd=2, xScale=1e-6)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Multiple chromosomes# - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Appending CBS resultsfit1 <- segmentByCBS(y, chromosome=1, x=x)fit2 <- segmentByCBS(y, chromosome=2, x=x)fit <- c(fit1, fit2)print(fit)plotTracks(fit, subset=NULL, lwd=2, Clim=c(-3,3))# Segmenting multiple chromosomes at oncechromosomeWG <- rep(1:2, each=J)xWG <- rep(x, times=2)yWG <- rep(y, times=2)fitWG <- segmentByCBS(yWG, chromosome=chromosomeWG, x=xWG)print(fitWG)plotTracks(fitWG, subset=NULL, lwd=2, Clim=c(-3,3))# Assert same resultsfit$data[,"index"] <- getLocusData(fitWG)[,"index"] # Ignore 'index'stopifnot(all.equal(getLocusData(fitWG), getLocusData(fit)))stopifnot(all.equal(getSegments(fitWG), getSegments(fit)))

Segment total copy numbers and allele B fractions using the Non-paired PSCBS method

Description

Segment total copy numbers and allele B fractions using the Non-paired PSCBS method [1].This method does not requires matched normals.This is a low-level segmentation method.It is intended to be applied to one tumor sample at the time.

Usage

## Default S3 method:segmentByNonPairedPSCBS(CT, betaT, ..., flavor=c("tcn", "tcn&dh", "tcn,dh",  "sqrt(tcn),dh", "sqrt(tcn)&dh"), tauA=NA, tauB=1 - tauA, verbose=FALSE)

Arguments

CT

Anumericvector of J tumor total copy number (TCN)ratios in [0,+Inf) (due to noise, small negative values arealso allowed). The TCN ratios are typically scaled such thatcopy-neutral diploid loci have a mean of two.

betaT

Anumericvector of J tumor allele B fractions (BAFs)in [0,1] (due to noise, values may be slightly outside as well)orNA for non-polymorphic loci.

...

Additional arguments passed tosegmentByPairedPSCBS().

flavor

Acharacter specifying what type of segmentation andcalling algorithm to be used.

tauA,tauB

Lower and upper thresholds (tauA < tauB forcalling SNPs heterozygous based on the tumor allele B fractions(betaT). IfNA, then they are estimates from data.

verbose

SeeVerbose.

Details

InternallysegmentByPairedPSCBS() is used for segmentation.This segmentation method doesnot support weights.

Value

Returns the segmentation results as aNonPairedPSCBS object.

Reproducibility

The "DNAcopy::segment" implementation of CBS uses approximationthrough random sampling for some estimates. Because of this,repeated calls using the same signals may result in slightlydifferent results, unless the random seed is set/fixed.

Whole-genome segmentation is preferred

Although it is possible to segment each chromosome independentlyusing Paired PSCBS, we strongly recommend to segment whole-genome(TCN,BAF) data at once. The reason for this is that downstreamCN-state calling methods, such as the AB and the LOH callers,performs much better on whole-genome data. In fact, they mayfail to provide valid calls if done chromosome by chromosome.

Missing and non-finite values

The total copy number signals as well as any optional positionsmust not contain missing values, i.e.NAs orNaNs.If there are any, an informative error is thrown.Allele B fractions may contain missing values, because such areinterpreted as representing non-polymorphic loci.

None of the input signals may have infinite values, i.e. -Inf or +Inf.If so, an informative error is thrown.

Non-Paired PSCBS with known genotypes

If allele B fractions for the matched normal (betaN) arenot available, but genotypes (muN) are, then it is possibleto run Paired PSCBS. SeesegmentByPairedPSCBS() for details.

Author(s)

Henrik Bengtsson

References

[1] A.B. Olshen, H. Bengtsson, P. Neuvial, P.T. Spellman, R.A. Olshen, V.E. Seshan,Parent-specific copy number in paired tumor-normal studies using circular binary segmentation, Bioinformatics, 2011
[2] H. Bengtsson, P. Neuvial and T.P. Speed,TumorBoost: Normalization of allele-specific tumor copy numbers from a single pair of tumor-normal genotyping microarrays, BMC Bioinformatics, 2010

See Also

To segment paired tumor-normal total copy numbers and allele B fractions,seesegmentByPairedPSCBS().

To segment total copy numbers, or any other unimodal signals,seesegmentByCBS().

Examples

verbose <- R.utils::Arguments$getVerbose(-10*interactive(), timestamp=TRUE)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Load SNP microarray data# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -data <- PSCBS::exampleData("paired.chr01")str(data)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Paired PSCBS segmentation# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Drop single-locus outliersdataS <- dropSegmentationOutliers(data)# Speed up example by segmenting fewer locidataS <- dataS[seq(from=1, to=nrow(data), by=20),]str(dataS)R.oo::attachLocally(dataS)# Non-Paired PSCBS segmentationfit <- segmentByNonPairedPSCBS(CT, betaT=betaT,                            chromosome=chromosome, x=x,                            seed=0xBEEF, verbose=verbose)print(fit)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Bootstrap segment level estimates# (used by the AB caller, which, if skipped here,#  will do it automatically)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -fit <- bootstrapTCNandDHByRegion(fit, B=100, verbose=verbose)print(fit)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Calling segments in allelic balance (AB)# NOTE: Ideally, this should be done on whole-genome data# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Explicitly estimate the threshold in DH for calling AB# (which be done by default by the caller, if skipped here)deltaAB <- estimateDeltaAB(fit, flavor="qq(DH)", verbose=verbose)print(deltaAB)fit <- callAB(fit, delta=deltaAB, verbose=verbose)print(fit)# Even if not explicitly specified, the estimated# threshold parameter is returned by the callerstopifnot(fit$params$deltaAB == deltaAB)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Calling segments in loss-of-heterozygosity (LOH)# NOTE: Ideally, this should be done on whole-genome data# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Explicitly estimate the threshold in C1 for calling LOH# (which be done by default by the caller, if skipped here)deltaLOH <- estimateDeltaLOH(fit, flavor="minC1|nonAB", verbose=verbose)print(deltaLOH)fit <- callLOH(fit, delta=deltaLOH, verbose=verbose)print(fit)plotTracks(fit)# Even if not explicitly specified, the estimated# threshold parameter is returned by the callerstopifnot(fit$params$deltaLOH == deltaLOH)

Segment total copy numbers and allele B fractions using the Paired PSCBS method

Description

Segment total copy numbers and allele B fractions using the Paired PSCBS method [1].This method requires matched normals.This is a low-level segmentation method.It is intended to be applied to one tumor-normal sample at the time.

Usage

## Default S3 method:segmentByPairedPSCBS(CT, thetaT=NULL, thetaN=NULL, betaT=NULL, betaN=NULL, muN=NULL,  rho=NULL, chromosome=0, x=NULL, alphaTCN=0.009, alphaDH=0.001, undoTCN=0, undoDH=0,  ..., avgTCN=c("mean", "median"), avgDH=c("mean", "median"),  flavor=c("tcn&dh", "tcn,dh", "sqrt(tcn),dh", "sqrt(tcn)&dh", "tcn"), tbn=is.null(rho),  joinSegments=TRUE, knownSegments=NULL, dropMissingCT=TRUE, seed=NULL, verbose=FALSE,  preserveScale=FALSE)

Arguments

CT

Anumericvector of J tumor total copy number (TCN)ratios in [0,+Inf) (due to noise, small negative values arealso allowed). The TCN ratios are typically scaled such thatcopy-neutral diploid loci have a mean of two.

thetaT,thetaN

(alternative) As an alternative to specifyingtumor TCNratios relative to the match normal byargumentCT, on may specify total tumor and normalsignals seperately, in which case the TCN ratiosCT arecalculated asCT = 2*thetaT/thetaN.

betaT

Anumericvector of J tumor allele B fractions (BAFs)in [0,1] (due to noise, values may be slightly outside as well)orNA for non-polymorphic loci.

betaN

Anumericvector of J matched normal BAFs in [0,1](due to noise, values may be slightly outside as well) orNAfor non-polymorphic loci.

muN

An optionalnumericvector of J genotype calls in{0,1/2,1} for AA, AB, and BB, respectively,andNA for non-polymorphic loci.If not given, they are estimated from the normal BAFs usingcallNaiveGenotypes as described in [2].

rho

(alternative tobetaT andbetaN/muN)Anumericvector of J decrease-of-heterozygosity signals (DHs)in [0,1] (due to noise, values may be slightly larger than oneas well). By definition, DH should beNA for homozygous lociand for non-polymorphic loci.

chromosome

(Optional) Aninteger scalar (or avector of length J),which can be used to specify which chromosome each locus belongs toin case multiple chromosomes are segments.This argument is also used for annotation purposes.

x

Optionalnumericvector of J genomic locations.IfNULL, index locations1:J are used.

alphaTCN,alphaDH

The significance levels for segmenting totalcopy numbers (TCNs) and decrease-in-heterozygosity signals (DHs),respectively.

undoTCN,undoDH

Non-negativenumerics. If greater than 0,then a cleanup of segmentions post segmentation is done.See argumentundo ofsegmentByCBS() for moredetails.

avgTCN,avgDH

Acharacter string specifying how to calculatingsegment mean levelsafter change points have beenidentified.

...

Additional arguments passed tosegmentByCBS().

flavor

Acharacter specifying what type of segmentation andcalling algorithm to be used.

tbn

IfTRUE,betaT is normalized before segmentationusing the TumorBoost method [2], otherwise not.

joinSegments

IfTRUE, there are no gaps between neighboringsegments.IfFALSE, the boundaries of a segment are defined by the supportthat the loci in the segments provides, i.e. there exist a locusat each end point of each segment. This also means that thereis a gap between any neighboring segments, unless the change pointis in the middle of multiple loci with the same position.The latter is whatDNAcopy::segment() returns.

knownSegments

Optionaldata.frame specifyingnon-overlapping known segments. These segments mustnot share loci. SeefindLargeGaps() andgapsToSegments().

dropMissingCT

IfTRUE, loci for which 'CT' is missingare dropped, otherwise not.

seed

An (optional)integer specifying the random seed to beset before calling the segmentation method. The random seed isset to its original state when exiting. IfNULL, it is not set.

verbose

SeeVerbose.

preserveScale

Defunct - gives an error is specified.

Details

InternallysegmentByCBS() is used for segmentation.The Paired PSCBS segmentation method doesnot support weights.

Value

Returns the segmentation results as aPairedPSCBS object.

Reproducibility

The "DNAcopy::segment" implementation of CBS uses approximationthrough random sampling for some estimates. Because of this,repeated calls using the same signals may result in slightlydifferent results, unless the random seed is set/fixed.

Whole-genome segmentation is preferred

Although it is possible to segment each chromosome independentlyusing Paired PSCBS, we strongly recommend to segment whole-genome(TCN,BAF) data at once. The reason for this is that downstreamCN-state calling methods, such as the AB and the LOH callers,performs much better on whole-genome data. In fact, they mayfail to provide valid calls if done chromosome by chromosome.

Missing and non-finite values

The total copy number signals as well as any optional positionsmust not contain missing values, i.e.NAs orNaNs.If there are any, an informative error is thrown.Allele B fractions may contain missing values, because such areinterpreted as representing non-polymorphic loci.

None of the input signals may have infinite values, i.e. -Inf or +Inf.If so, an informative error is thrown.

Paired PSCBS with only genotypes

If allele B fractions for the matched normal (betaN) arenot available, but genotypes (muN) are, then it is possibleto run a version of Paired PSCBS where TumorBoost normalizationof the tumor allele B fractions is skipped. In order for thisto work, argumenttbn must be set toFALSE.

Author(s)

Henrik Bengtsson

References

[1] A.B. Olshen, H. Bengtsson, P. Neuvial, P.T. Spellman, R.A. Olshen, V.E. Seshan,Parent-specific copy number in paired tumor-normal studies using circular binary segmentation, Bioinformatics, 2011
[2] H. Bengtsson, P. Neuvial and T.P. Speed,TumorBoost: Normalization of allele-specific tumor copy numbers from a single pair of tumor-normal genotyping microarrays, BMC Bioinformatics, 2010

See Also

Internally,callNaiveGenotypes is used tocall naive genotypes,normalizeTumorBoost isused for TumorBoost normalization, andsegmentByCBS() is usedto segment TCN and DH separately.

To segment tumor total copy numbers and allele B fractionswithout a matched normal, seesegmentByNonPairedPSCBS().

To segment total copy-numbers, or any other unimodal signals,seesegmentByCBS().

Examples

verbose <- R.utils::Arguments$getVerbose(-10*interactive(), timestamp=TRUE)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Load SNP microarray data# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -data <- PSCBS::exampleData("paired.chr01")str(data)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Paired PSCBS segmentation# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Drop single-locus outliersdataS <- dropSegmentationOutliers(data)# Speed up example by segmenting fewer locidataS <- dataS[seq(from=1, to=nrow(data), by=10),]str(dataS)R.oo::attachLocally(dataS)# Paired PSCBS segmentationfit <- segmentByPairedPSCBS(CT, betaT=betaT, betaN=betaN,                            chromosome=chromosome, x=x,                            seed=0xBEEF, verbose=verbose)print(fit)# Plot resultsplotTracks(fit)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Bootstrap segment level estimates# (used by the AB caller, which, if skipped here,#  will do it automatically)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -fit <- bootstrapTCNandDHByRegion(fit, B=100, verbose=verbose)print(fit)plotTracks(fit)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Calling segments in allelic balance (AB)# NOTE: Ideally, this should be done on whole-genome data# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Explicitly estimate the threshold in DH for calling AB# (which be done by default by the caller, if skipped here)deltaAB <- estimateDeltaAB(fit, flavor="qq(DH)", verbose=verbose)print(deltaAB)## [1] 0.1657131fit <- callAB(fit, delta=deltaAB, verbose=verbose)print(fit)plotTracks(fit)# Even if not explicitly specified, the estimated# threshold parameter is returned by the callerstopifnot(fit$params$deltaAB == deltaAB)# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Calling segments in loss-of-heterozygosity (LOH)# NOTE: Ideally, this should be done on whole-genome data# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# Explicitly estimate the threshold in C1 for calling LOH# (which be done by default by the caller, if skipped here)deltaLOH <- estimateDeltaLOH(fit, flavor="minC1|nonAB", verbose=verbose)print(deltaLOH)## [1] 0.625175fit <- callLOH(fit, delta=deltaLOH, verbose=verbose)print(fit)plotTracks(fit)# Even if not explicitly specified, the estimated# threshold parameter is returned by the callerstopifnot(fit$params$deltaLOH == deltaLOH)

Sets the name of the sample segmented

Description

Sets the name of the sample segmented.

Usage

## S3 method for class 'AbstractCBS'setSampleName(fit, name, ...)

Arguments

name

Acharacter string.

...

Not used.

Value

Returns (invisibly) an updated object.

Author(s)

Henrik Bengtsson

See Also

For more information seeAbstractCBS..


Tests if a segment is in Run-of-Homozygosity (ROH)

Description

Tests if a segment is in Run-of-Homozygosity (ROH).

Usage

## S3 method for class 'numeric'testROH(muN, csN=NULL, betaN=NULL, minNbrOfSnps=1, delta=1/12, ..., verbose=FALSE)

Arguments

muN

Annumericvector of J genotype calls in{0,1/2,1} for AA, AB, and BB, respectively,andNA for non-polymorphic loci.

csN

(optional) Anumericvector of J genotype confidence scores.IfNULL, ad hoc scores calculated frombetaN are used.

betaN

(optional) Anumericvector of J matched normal BAFsin [0,1] (due to noise, values may be slightly outside as well)orNA for non-polymorphic loci.

minNbrOfSnps

Minimum number of SNPs required to test segment.If not tested,NA is returned.

delta

Adouble scalar specifying the maximum (weighted)proportion of heterozygous SNPs allowed in an ROH region.

...

Not used.

verbose

SeeVerbose.

Value

Returns alogical.

Author(s)

Pierre Neuvial, Henrik Bengtsson


Updates the CN mean levels for each segment independently

Description

Updates the CN mean levels for each segment independently as if they were one large segment.The locus-level data is not updated/modified.

Usage

## S3 method for class 'AbstractCBS'updateMeans(...)

Arguments

...

Arguments specific to the class.

Value

Returns an object of the same class.

Author(s)

Henrik Bengtsson


Updates the CN mean levels jointly in sets of segments

Description

Updates the CN mean levels jointly in sets of segments as if they were one large segment.The locus-level data is not updated/modified.

Usage

## S3 method for class 'AbstractCBS'updateMeansTogether(...)

Arguments

...

Not used.

Value

Returns an object of the same class.

Author(s)

Henrik Bengtsson

See Also

This method is utilized by*pruneByHClust().


Weighted Quantile Value

Description

Computes a weighted quantile of a numeric vector.

Usage

## Default S3 method:weightedQuantile(x, w, probs=c(0, 0.25, 0.5, 0.75, 1), na.rm=TRUE,  method=c("wtd.quantile"), ...)

Arguments

x

anumericvector containing the values whose weightedquantile is to be computed.

w

a numericvector of weights the same length asx giving the weights to use for each element ofx.Negative weights are treated as zero weights.Default value is equal weight to all values.

probs

anumericvector of quantiles in [0,1] to be retrieved.

na.rm

alogical value indicating whetherNA values inx should be stripped before the computation proceeds,or not.

method

If"wtd.quantile", then an internal copy ofHmisc::wtd.quantile() is used.No other methods are currently supported.

...

Additional arguments passed to the estimator.

Value

Returns the weighted quantile.

Author(s)

Henrik Bengtsson

See Also

Internally the following functions may be used:quantile (if no weights are specified), or an internalcopy ofHmisc::wtd.quantile().For a weighted median estimator,weightedMedianof thematrixStats package.


Writes the table of segments to file

Description

Writes the table of segments to file.

Usage

## S3 method for class 'CBS'writeSegments(fit, name=getSampleName(fit), tags=NULL, ext="tsv", path=NULL,  addHeader=TRUE, createdBy=NULL, sep="\t", nbrOfDecimals=4L, splitters=FALSE,  overwrite=FALSE, skip=FALSE, ...)

Arguments

name,tags

Name and optional tags part of the filename

.

path

The directory where the file will be written.

addHeader

IfTRUE, header comments are written.

createdBy

A header comment of whom created the file.

splitters

IfTRUE, each chromosome is separated by a rowof missing values.

overwrite,skip

If an output file already exists, thesearguments specifies what should happen.

...

Additional arguments pass togetSegments().

Value

Returns the pathname of the the file written.

Author(s)

Henrik Bengtsson

See Also

Utilizes*getSegments().For more information seeCBS..


Writes the table of segments to file

Description

Writes the table of segments to file.

Usage

## S3 method for class 'PSCBS'writeSegments(fit, name=getSampleName(fit), tags=NULL, ext="tsv", path=NULL,  addHeader=TRUE, createdBy=NULL, sep="\t", nbrOfDecimals=4L, splitters=FALSE,  overwrite=FALSE, skip=FALSE, ...)

Arguments

name,tags

Name and optional tags part of the filename

.

path

The directory where the file will be written.

addHeader

IfTRUE, header comments are written.

createdBy

A header comment of whom created the file.

splitters

IfTRUE, each chromosome is separated by a rowof missing values.

overwrite,skip

If an output file already exists, thesearguments specifies what should happen.

...

Additional arguments pass togetSegments().

Value

Returns the pathname of the the file written.

Author(s)

Henrik Bengtsson

See Also

Utilizes*getSegments().For more information seePSCBS..


[8]ページ先頭

©2009-2025 Movatter.jp