segmentOverlap: Overlaps between two sets of chromosome segments

Description Usage Arguments Details

View source: R/segmenTools.R


Simple sweeping algorithm to find overlapping intervals. Both intervals must be in continuous index (coor2index) and start<end, with strand information implied in the continuous index position. see bedtools intersects, the Binary Interval Search (BITS) algorithm, and the NClist algorithm (implemented in packages IRanges and GenomicRanges) for similar tools. It loops over targets and collects all queries that match, and optionally adds NA lines for non-matched targets.


segmentOverlap(query, target, details = FALSE, distance, = FALSE,
  untie = FALSE, collapse = FALSE, sort = FALSE, msgfile = stdout())



the query set of segments (genomic intervals)


the target set of segments (genomic intervals)


add details on the relative positions of the query wrt the target (covers,left,inside,right); note, that keywords 'left' and 'right' will be converted to 'upstream' or 'downstream' by index2coor, accounting for strand info.


not yet implemented: maximal distance for neighbor count

add an empty overlap line for targets without overlaps


if several queries have equal top rank of 1, the rank can be replaced by simple order, such that only the first query will have rank 1


if TRUE multiple query hits are collapsed into a single row, with ;-separated strings in the respective fields. If both and collapse are set to TRUE the resulting overlap matrix will be of the same dimension as the input target, i.e., it will contain one row for each target.


sort query hits by their rank


file pointer for progress messages and warnings, defaults to stdout, useful when using in context of command line pipes


If details==TRUE, a column qpos will indicate the relative position of the query to the target (e.g. ‘inside’ means that the query is ‘inside’ the target, ‘left’ means at lower coordinates then the target). The positions ‘right’ and ‘left’ can later can be converted to ‘upstream/downstream/etc.’ by index2coor which re-introduces strand information. To analyze relative positions between features on distinct strands, the target or query has to be mapped to the opposite strand by switchStrand before passing it to segmentOverlap.

raim/segmenTools documentation built on Nov. 9, 2018, 5:38 p.m.