reduceKeepAttr: Reduce GRanges / GRangesList

View source: R/ranges_helpers.R

reduceKeepAttrR Documentation

Reduce GRanges / GRangesList

Description

Reduce away all GRanges elements with 0-width.

Usage

reduceKeepAttr(
  grl,
  keep.names = FALSE,
  drop.empty.ranges = FALSE,
  min.gapwidth = 1L,
  with.revmap = FALSE,
  with.inframe.attrib = FALSE,
  ignore.strand = FALSE,
  min.strand.decreasing = TRUE
)

Arguments

grl

a GRangesList or GRanges object

keep.names

(FALSE) keep the names and meta columns of the GRangesList

drop.empty.ranges

(FALSE) if a group is empty (width 0), delete it.

min.gapwidth

(1L) how long gap can it be between two ranges, to merge them.

with.revmap

(FALSE) return info on which mapped to which

with.inframe.attrib

(FALSE) For internal use.

ignore.strand

(FALSE), can different strands be reduced together.

min.strand.decreasing

(TRUE), if GRangesList, return minus strand group ranges in decreasing order (1-5, 30-50) -> (30-50, 1-5)

Details

Extends function reduce by trying to keep names and meta columns, if it is a GRangesList. It also does not lose sorting for GRangesList, since original reduce sorts all by ascending position. If keep.names == FALSE, it's just the normal GenomicRanges::reduce with sorting negative strands descending for GRangesList.

Value

A reduced GRangesList

See Also

Other ExtendGenomicRanges: asTX(), coveragePerTiling(), extendLeaders(), extendTrailers(), tile1(), txSeqsFromFa(), windowPerGroup()

Examples

ORF <- GRanges(seqnames = "1",
               ranges = IRanges(start = c(1, 2, 3), end = c(1, 2, 3)),
               strand = "+")
# For GRanges
reduceKeepAttr(ORF, keep.names = TRUE)
# For GRangesList
grl <- GRangesList(tx1_1 = ORF)
reduceKeepAttr(grl, keep.names = TRUE)


Roleren/ORFik documentation built on Nov. 13, 2024, 10 p.m.