segMerge {Rgb} | R Documentation

## Merges consecutive segments

### Description

Given a set of segments defined by "chrom", "start", "end" and various data, it merges consecutive rows (sorted by "chrom" then "start") that share same data. As an example, it is useful to merge consecutive regions of the genome sharing same copy numbers after modelization, or filling small gaps.

### Usage

      segMerge(segTable, on = names(segTable), fun = list(unique, start=min, end=max))

### Arguments

`segTable` | A `data.frame` of segments, with at least "chrom", "start" and "end" columns. Standard behavior (default `fun` value) assumes "start" and "end" to be at least `numeric`, preferably `integer`.
`on` | Character vector, `segTable` columns that must all be identical for the consecutive rows to be merged. For convenience, "chrom" is forced in and "start" / "end" are forced out.
`fun` | A `list` of `function`s, defining how to merge values when merging rows. It should contain an unamed element for the default function, and named elements to deal with specific columns.

### Value

Returns a `data.frame` similar to `segTable`.

### Author(s)

Sylvain Mareschal

### See Also

`segOverlap`

[Package Rgb version 1.6.1 Index]