GenomicData {rtracklayer} | R Documentation |
Data on a Genome
Description
The rtracklayer
package adds
convenience methods on top of GenomicRanges
and IntegerRangesList
to manipulate data on genomic ranges.
Accessors
In the code snippets below,
x
is a GenomicRanges
or IntegerRangesList
object.
-
chrom(x), chrom(x) <- value
: Gets or sets the chromosome names forx
. The length ofvalue
should equal the length ofx
. -
score(x)
: Gets the “score” column from the element metadata of aGenomicRanges
orGRangesList
. Many track formats have a score column, so this is often used during export. TheANY
fallback for this method simply returnsNULL
.
Constructor
-
GenomicData(ranges, ..., strand = NULL, chrom = NULL, genome = NULL)
: Constructs aGRanges
instance with the givenranges
and variables in...
(see theGRanges
constructor).If non-
NULL
, thestrand
argument specifies the strand of each range. It should be a character vector or factor of length equal to that ofranges
. All values should be either-
,+
, or*
. To get the levels forstrand
, calllevels(strand())
.chrom
argument is analogous toseqnames
in theGRanges
constructor.The
genome
argument should be a scalar string. See the examples.
Author(s)
Michael Lawrence and Patrick Aboyoun
Examples
range1 <- IRanges(c(1,2,3), c(5,2,8))
## with some data ##
filter <- c(1L, 0L, 1L)
score <- c(10L, 2L, NA)
strand <- factor(c("+", NA, "-"), levels = levels(strand()))
## GRanges instance
gr <- GenomicData(range1, score, chrom = "chr1", genome = "hg18")
mcols(gr)[["score"]]
strand(gr) ## all '*'
gr <- GenomicData(range1, score, filt = filter, strand = strand,
chrom = "chr1")
mcols(gr)[["filt"]]
strand(gr) ## equal to 'strand'
## coercion from data.frame ##
df <- as.data.frame(gr)