doDynamicProgramming {jointseg} | R Documentation |
Run segmentation by dynamic programming
Description
High-level function for univariate or multivariate segmentation by dynamic programming
Usage
doDynamicProgramming(Y, K, stat = NULL, verbose = FALSE)
Arguments
Y |
A numeric vector or a matrix, the signal to be segmented |
K |
The number of change points to find |
stat |
A vector containing the names or indices of the columns of
|
verbose |
A |
Details
If the signal is uni-dimensional, this function simply uses the segmentation
method provided in the cghseg
package reshapes the results.
If the signal is multi-dimensional, this function applies the
pruneByDP
function and reshapes the results.
Value
bkp |
A vector of |
dpseg |
A list of two elements
|
Note
This is essentially a wrapper for convenient segmentation by dynamic
programming using the PSSeg
function.
Author(s)
Morgane Pierre-Jean and Pierre Neuvial
References
Rigaill, G. (2015). A pruned dynamic programming algorithm to recover the best segmentations with 1 to K_max change-points. Journal de la Societe Francaise de Statistique, 156(4), 180-205.
Examples
## load known real copy number regions
affyDat <- acnr::loadCnRegionData(dataSet="GSE29172", tumorFraction=1)
## generate a synthetic CN profile
K <- 10
len <- 1e4
sim <- getCopyNumberDataByResampling(len, K, minLength=100, regData=affyDat)
datS <- sim$profile
## run pruned DPA segmentation
resDP <- doDynamicProgramming(datS[["c"]], K=K)
getTpFp(resDP$bkp, sim$bkp, tol=5, relax = -1) ## true and false positives
plotSeg(datS, breakpoints=list(sim$bkp, resDP$bkp))
## run 2d dynamic programming segmentation
K <- 2
len <- 1e3
sim <- getCopyNumberDataByResampling(len, K, minLength=100, regData=affyDat)
datS <- sim$profile
datS$d <- 2*abs(datS$b-1/2)
datS[which(datS$genotype!=0.5),"d"] <- NA
Y = cbind(datS$c,datS$d)
resDP2d <- doDynamicProgramming(Y, K = K)