| 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:
Vignettes 'Parent-specific copy-number segmentation using Paired PSCBS' and 'Total copy-number segmentation using CBS'.
segmentByCBS() - segments total copy-numbers, or anyother unimodal genomic signals, using the CBS method [3,4].segmentByPairedPSCBS() - segments allele-specifictumor signal from a tumorwith a matched normalusing the Paired PSCBS method [1,2].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 | A |
sampleName | A |
... | 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 of |
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 | A |
... | 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 | A |
... | 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
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 | A |
... | 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.
*extractChromosomes()/*extractChromosome()- Extracts anAbstractCBSwith the specified chromosomes.*extractSegments()/*extractSegment()- Extracts anAbstractCBSwith the specified segments.*extractRegions()/*extractRegion()- Extracts anAbstractCBSwith the specified regionseach of a certain size, where a region is defined as aconnected set of segments.*dropRegions()/*dropRegion()- Drops specified regions and returns anAbstractCBSwithout them.*dropChangePoint()/*mergeTwoSegments()- Drops a change point by merging two neighboring segmentsand recalculates the statistics for the merged segmentbefore returning anAbstractCBS.*dropChangePoints()- Drops zero or more change pointsand recalculates the segment statisticsbefore returning anAbstractCBS.*mergeThreeSegments()- Merges a segment with its two flanking segmentsand recalculates the statistics for the merged segmentbefore returning anAbstractCBS.
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 | A |
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 | A |
... | 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 positive |
boot | Alternatively, to generating |
... | Additional arguments passed to |
probs | The default quantiles to be estimated. |
statsFcn | A (optional) |
what | |
force | If |
verbose | See |
.debug | (internal) If |
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 more |
addSplit | If |
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 | A |
... | Additional arguments passed to the caller. |
minSize | An optional |
xorCalls | If |
force | If |
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 | A |
delta | (Tuning parameter) A non-negative |
alpha | A |
... | Additional arguments passed to the bootstrap estimator |
Value
Returns aPairedPSCBS object with allelic-balance calls.
Algorithm
Foo
Bar
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 | A |
method | A |
... | Additional/optional arguments used to override the defaultparameters used by the caller. |
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 | A |
... | Additional arguments passed to the caller. |
minSize | An optional |
force | If |
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 by |
delta | A non-negative |
alpha | A |
... | Additional arguments passed to |
force | If |
verbose | See |
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 | A |
... | Additional arguments passed to the caller. |
minSize | An optional |
force | If |
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 | A |
... | 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 | A |
... | Additional arguments passed to the caller. |
minSize | An optional |
xorCalls | If |
force | If |
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 | A |
... | 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 to |
updateMeans | If |
force | If |
verbose | See |
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 | |
chromosome | (Optional) An |
x | Optional |
method | A |
... | Additional arguments passed to internal outlierdetection method. |
verbose | See |
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 | |
update | If |
... | Other arguments passed to |
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 | An |
H | A non-negative |
... | Additional arguments passed to |
asMissing | If |
verbose |
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 optional |
flavor | A |
... | Additional arguments passed to the estimator. |
max | (Optional) The maximum estimate allowed. If greater thanthis value, the estimate will be truncated. |
verbose | See |
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 | A |
q2 | A |
... | Not used. |
verbose | See |
Value
Returns the threshold estimate as anumeric scalar.
Algorithm
Grabs the segment-level DH estimates.
Calculate segment weights proportional to the numberof heterozygous SNPs.
Calculate
\Deltaas the 5% quantile of the weighted DH means.Choose the segments with means less than
\Delta.Calculate threshold
\Delta_{AB}as the 90% "symmetric" quantileof the observed locus-level DHs from the selected segmentsin Step 4.The q:th "symmetric" quantile is estimated by estimatingthe ((1-q), 50%) quantiles, calculating their distance as"50%-(1-q)" and add to the median (50%), i.e."median + (median-(1-q))" = "2*median-1 + q", which shouldequal q if the distribution is symmetric.
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 | A |
flavor | Specifies which type of estimator should be used. |
kappa | Estimate of background signal (used by the |
adjust,quantile | Tuning parameters (used by the |
... | 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 | A |
... | Additional arguments passed to the estimator. |
max | (Optional) The maximum estimate allowed. If greater thanthis value, the estimate will be truncated. |
verbose | See |
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 | A |
maxC | Maximum total copy number of a segment in order tobe included in the initial set of segments. |
... | Not used. |
verbose | See |
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
Grabs the segment-level C1 estimates.
Calculate segment weights proportional to the number of heterozygous SNPs.
Estimate the C1=1 location as the weighted median C1 for segments that have been called to be in allelic balance.
Estimate the C1=0 location as the smallest C1 among segments that are not in allelic balance.
Let the LOH threshold be the midpoint of the estimates C1=0 and C1=1 locations.
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 | A |
... | 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 | A |
adjust | A |
from | A |
minDensity | A non-negative |
... | Not used. |
verbose | See |
Value
Returns the background estimate as anumeric scalar.
Algorithm
Retrieve segment-level minor copy numbers and corresponding weights:
Grabs the segment-level C1 estimates.
Calculate segment weights.The default (
typeOfWeights="dhNbrOfLoci") is to useweights proportional to the number of heterozygous SNPs.An alternative (typeOfWeights="sqrt(dhNbrOfLoci)") isto use the square root of those counts.
Identify subset of regions with C1=0:
Estimates the weighted empirical density function(truncated at zero below). Tuning parameter 'adjust'.
Find the first two peaks(with a density greater than tuning parameter 'minDensity').
Assumes that the two peaks corresponds to C1=0 and C1=1.
Defines threshold Delta0.5 as the center location betweenthese two peaks.
Estimate the global background signal:
For all segments with C1 < Delta0.5, calculate the weightedmedian of their C1:s.
Let kappa be the above weighted median.This is the estimated background.
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 optional |
method | A |
estimator | A |
na.rm | If |
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 | A |
... | 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 |
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 to |
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) An |
x | |
minLength | A positive |
resolution | A non-negative |
... | 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 | |
isAI | |
weights | |
... | Further arguments to be passed to the density estimationfunction. |
minDensity | A |
flavor | A |
verbose | If |
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 | A |
resolution | A non-negative |
minLength | Minimum length of segments to be kept. |
dropGaps | If |
... | 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
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-negative |
by | Should |
seed | An (optional) |
verbose | See |
.validate | If |
... | 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 optional |
shrinkRegions | If |
... | Not used. |
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 |
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 | If |
#
splitters | If |
... | 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 | An |
by | A |
... | 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 |
distMethod,hclustMethod | Argument |
... | Not used. |
verbose | See |
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 | If |
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 | |
verbose | See |
... | 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 |
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 | An |
... | Additional arguments passed to |
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 | An |
update | If |
verbose | |
... | 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 |
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 |
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 |
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) <- valueArguments
fit | An |
value | An |
... | 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 by |
pch | The type of points to use. |
Clim | The range of copy numbers. |
xScale | The scale factor used for genomic positions. |
... | Not used. |
add | If |
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 by |
tracks | |
scatter | A |
calls | A |
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 | If |
grid | If |
quantiles | A |
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 | If |
subplots | If |
verbose | See |
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 | An |
... | Optional arguments passed to |
verbose | See |
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 to |
size,distMethod,hclustMethod | Arguments (as well assome of |
merge | If |
update | If |
verbose | See |
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 | A |
rho | A positive |
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 | See |
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 | A |
seed | Random seed to be set; only for |
kind | (optional) A |
n | Number of random seeds to generate by |
backup | If |
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 | An |
sampleName | A |
studyName | A |
... | Optional arguments passed to the RSP template. |
rspTags | Optional |
rootPath | The root directory where to write the report. |
verbose | See |
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 | |
chromosome | Optional |
x | Optional |
index | An optional |
w | |
undo | A non-negative |
avg | A |
... | Additional arguments passed to the |
joinSegments | If |
knownSegments | Optional |
seed | An (optional) |
verbose | See |
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 | A |
betaT | A |
... | Additional arguments passed to |
flavor | A |
tauA,tauB | Lower and upper thresholds ( |
verbose | See |
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 | A |
thetaT,thetaN | (alternative) As an alternative to specifyingtumor TCNratios relative to the match normal byargument |
betaT | A |
betaN | A |
muN | An optional |
rho | (alternative to |
chromosome | (Optional) An |
x | Optional |
alphaTCN,alphaDH | The significance levels for segmenting totalcopy numbers (TCNs) and decrease-in-heterozygosity signals (DHs),respectively. |
undoTCN,undoDH | Non-negative |
avgTCN,avgDH | A |
... | Additional arguments passed to |
flavor | A |
tbn | If |
joinSegments | If |
knownSegments | Optional |
dropMissingCT | If |
seed | An (optional) |
verbose | See |
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 | A |
... | 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 | An |
csN | (optional) A |
betaN | (optional) A |
minNbrOfSnps | Minimum number of SNPs required to test segment.If not tested, |
delta | A |
... | Not used. |
verbose | See |
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 | a |
w | a numeric |
probs | |
na.rm | a |
method | If |
... | 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 | If |
createdBy | A header comment of whom created the file. |
splitters | If |
overwrite,skip | If an output file already exists, thesearguments specifies what should happen. |
... | Additional arguments pass to |
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 | If |
createdBy | A header comment of whom created the file. |
splitters | If |
overwrite,skip | If an output file already exists, thesearguments specifies what should happen. |
... | Additional arguments pass to |
Value
Returns the pathname of the the file written.
Author(s)
Henrik Bengtsson
See Also
Utilizes*getSegments().For more information seePSCBS..