pack | R Documentation |
GenomicRanges
object for
optimal file queries.
Given a GRanges
object, pack
produces a GRangesList
of the same ranges grouped and re-ordered.
## S4 method for signature 'GRanges'
pack(x, ..., range_len = 1e9, inter_range_len = 1e7)
x |
A |
range_len |
A numeric specifying the max length allowed for ranges in |
inter_range_len |
A numeric specifying the max length allowed between ranges in |
... |
Arguments passed to other methods. |
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).
isPacked(x, ...)
:
Returns a logical indicating if the ranges in x
are packed.
x
must be a GRangesList
object.
A GRanges
object.
unpack
for unpacking the result obtained
with ‘packed’ ranges.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.