Data on a Genome
The rtracklayer
package adds
convenience methods on top of GenomicRanges
and IntegerRangesList
to manipulate data on genomic ranges.
In the code snippets below,
x
is a GenomicRanges
or IntegerRangesList
object.
chrom(x), chrom(x) <- value
: Gets or
sets the chromosome names for x
. The length of value
should equal the length of x
.
score(x)
: Gets the “score” column from the element
metadata of a GenomicRanges
or GRangesList
. Many
track formats have a score column, so this is often used during
export. The ANY
fallback for this method simply returns
NULL
.
GenomicData(ranges, ..., strand = NULL, chrom = NULL,
genome = NULL)
: Constructs a GRanges
instance with
the given ranges
and variables in ...
(see the
GRanges
constructor).
If non-NULL
, the strand
argument specifies the strand
of each range. It should be a character vector or factor of length
equal to that of ranges
. All values should be either -
,
+
, or *
. To get the levels for strand
, call
levels(strand())
.
chrom
argument is analogous to seqnames
in the
GRanges
constructor.
The genome
argument should be a scalar string. See the examples.
Michael Lawrence and Patrick Aboyoun
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)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.