segmentAnnotate: Overlaps between two sets of chromosome segments

segmentAnnotateR Documentation

Overlaps between two sets of chromosome segments

Description

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.

Usage

segmentAnnotate(
  query,
  target,
  details = FALSE,
  distance,
  add.na = FALSE,
  untie = FALSE,
  collapse = FALSE,
  sort = FALSE,
  msgfile = stdout()
)

Arguments

query

the query set of segments (genomic intervals)

target

the target set of segments (genomic intervals)

details

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.

distance

not yet implemented: maximal distance for neighbor count

add.na

add an empty overlap line for targets without overlaps

untie

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

collapse

if TRUE multiple query hits are collapsed into a single row, with ;-separated strings in the respective fields. If both add.na 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

sort query hits by their rank

msgfile

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

Details

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 segmentAnnotate.


raim/segmenTools documentation built on May 5, 2024, 11:30 a.m.