SegAnnot

Share:

Description

Annotation-aware segmentation via dynamic programming. We assume a complete 0/1 annotation of the signal, so you just need to specify where the 1-annotated regions occur, in terms of indices. The solver gives you the solution y of min_y ||y-x||^2 such that there is exactly 1 break in each of the annotated regions, and no breaks elsewhere. See also the SegAnnotBases function, for which the annotations are specified in terms of base pairs.

Usage

1
SegAnnot(x, sR, eR)

Arguments

x

Numeric vector: the signal to segment.

sR

Starts of the 1-annotated regions.

eR

Ends of the 1-annotated regions.

Value

List describing the segmentation model.

Author(s)

Guillem Rigaill, Toby Dylan Hocking

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
set.seed(1)
x <- rnorm(100000)+	rep(c(1, 2), c(600, 1e5 - 600))

sR = as.integer(c(500, 2000))
eR = as.integer(c(1900, 5000))
result1 <- SegAnnot(x, sR, eR)
which(diff(result1$smt)!=0)
sR = as.integer(c(1000, 2000))
eR = as.integer(c(2100, 5000))
result2 <- SegAnnot(x, sR, eR)
which(diff(result2$smt)!=0)