pack {GenomicFiles} | R Documentation

## Range transformations of a `GenomicRanges` object for optimal file queries.

### Description

Given a `GRanges` object, `pack` produces a `GRangesList` of the same ranges grouped and re-ordered.

### Usage

    ## S4 method for signature 'GRanges'
    pack(x, ..., range_len = 1e9, inter_range_len = 1e7)

### Arguments

`x` | A `GRanges` object.
`range_len` | A numeric specifying the max length allowed for ranges in `x`.
`inter_range_len` | A numeric specifying the max length allowed between ranges in `x`.
`...` | Arguments passed to other methods.

### Details

#### Packing ranges

The `pack` method attempts to re-package ranges in optimal form for extracting data from files. Ranges are not modified (made shorter or longer) but re-ordered and / or re-grouped according to the following criteria.

- order: Ranges are ordered by genomic position within chromosomes.

- distance: Ranges separted by a distance greater than the `inter_range_len` are packed in groups around the gap separating the distant ranges.

- length: Ranges longer than `range_len` are packed ‘individually’ (i.e., retrived from the file as a single range vs grouped with other ranges).

#### Utilities

  `isPacked(x, ...)`: Returns a logical indicating if the ranges in `x` are packed. `x` must be a `GRangesList` object.

### Value

A `GRanges` object.

### See Also

- `unpack` for unpacking the result obtained with ‘packed’ ranges.

### Examples

      ## Ranges are ordered by position within chromosome.
      gr1 <- GRanges("chr1", IRanges(5:1*5, width = 3))
      pack(gr1)

      ## Ranges separated by > inter_range_len are partitioned
      ## into groups defined by the endpoints of the gap.
      gr2 <- GRanges("chr2", IRanges(c(1:3, 30000:30003), width = 1000))
      pack(gr2, inter_range_len = 20000)

      ## Ranges exceeding 'range_len' are isolated in a single element
      ## of the GRangesList.
      gr3 <- GRanges("chr3", IRanges(c(1:4), width=c(45, 1e8, 45, 45)))
      width(gr3)
      pack(gr3, range_len = 1e7)

[Package GenomicFiles version 1.30.0 Index]