Last data update: 2014.03.03

R: Max-gap-min-run algorithm for 2 states segmentation
maxGapminRunR Documentation

Max-gap-min-run algorithm for 2 states segmentation

Description

A custom Max-gap-min-run implementation using physical position for gap and run length calculation.

Usage

maxGapminRun(x, xPos = NULL, xRange = NULL, cutoff = NULL, q = 0.9, high=TRUE, minrun = 5, maxgap = 2, splitLen = Inf, na.rm=TRUE)

Arguments

x

a numeric vector for the input signal

xPos

a numeric vector, same length as x, carrying positional information for each element of x

xRange

an IRanges object, same length as x, carrying range information for each element of x

cutoff

numeric value used as cut-off, optional if q is specified

q

numeric value used to derive cut-off of x, as the q quantile of x , optional if cutoff is specified

high

TRUE if the cutoff or q here is the lower bound and values greater than the threshold are considered

minrun

minimum run length for the resulting segments

maxgap

maximum genomic distance below which two adjacent qualified tiles can be joined

splitLen

numeric value, maximum length of segments, split if too long

na.rm

TRUE if NA value should be ignored

Details

A custom Max-gap-min-run implementation using physical position for gap and run length calculation.

Value

a list of segment starts and ends indices

IS

the start index for each segment

IE

the end index for each segment

CUTOFF

the cutoff value used in the run

MG

the parameter value for maxgap

MR

the parameter value for minrun

SPL

the parameter value for splitLen

Author(s)

Yang Du

See Also

biomvRhsmm biomvRseg biomvRmgmr

Examples

	x<-rpois(50, 10)
	xpos<-rnorm(50, 300, 100)
	xpos<-xpos[order(xpos)]
	maxGapminRun(x, xpos, cutoff=9.5, maxgap=30, minrun=100)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(biomvRCNS)
Loading required package: IRanges
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Loading required package: S4Vectors
Loading required package: stats4

Attaching package: 'S4Vectors'

The following objects are masked from 'package:base':

    colMeans, colSums, expand.grid, rowMeans, rowSums

Loading required package: GenomicRanges
Loading required package: GenomeInfoDb
Loading required package: Gviz
Loading required package: grid
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/biomvRCNS/maxGapminRun.Rd_%03d_medium.png", width=480, height=480)
> ### Name: maxGapminRun
> ### Title: Max-gap-min-run algorithm for 2 states segmentation
> ### Aliases: maxGapminRun
> 
> ### ** Examples
> 
> 	x<-rpois(50, 10)
> 	xpos<-rnorm(50, 300, 100)
> 	xpos<-xpos[order(xpos)]
> 	maxGapminRun(x, xpos, cutoff=9.5, maxgap=30, minrun=100)
$IS
integer(0)

$IE
integer(0)

$CUTOFF
[1] 9.5

$MG
[1] 30

$MR
[1] 100

$SPL
[1] Inf

> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>