| seqinfo {GenomicRanges} | R Documentation |
A set of generic functions for getting/setting sequence information from/on an object.
seqinfo(x) seqinfo(x, new2old=NULL, force=FALSE) <- value seqnames(x) seqnames(x) <- value seqlevels(x) seqlevels(x, force=FALSE) <- value seqlengths(x) seqlengths(x) <- value isCircular(x) isCircular(x) <- value genome(x) genome(x) <- value seqnameStyle(x) seqnameStyle(x) <- value
x |
The object from/on which to get/set the sequence information. |
new2old |
The
If |
force |
Force dropping sequence levels currently in use. This is achieved by
dropping the elements in |
value |
Typically a Seqinfo object for the Either a named or unnamed character vector for the A vector containing the sequence information to store for the other setters. |
Various classes implement methods for those generic functions.
The Seqinfo class plays a central role for those generics because:
It has methods for all those generics (except seqinfo).
That is, the seqnames, seqlevels, seqlengths,
isCircular, genome and seqnameStyle getters
and setters are defined for Seqinfo objects.
For classes that implement it, the seqinfo getter should
return a Seqinfo object.
Default seqlevels, seqlengths, isCircular,
genome, and seqnameStyle getters and setters are
provided.
By default, seqlevels(x) does seqlevels(seqinfo(x)),
seqlengths(x) does seqlengths(seqinfo(x)),
isCircular(x) does isCircular(seqinfo(x)),
genome(x) does genome(seqinfo(x)),
and seqnameStyle(x) does seqnameStyle(seqinfo(x)).
So any class with a seqinfo getter will have all the above
getters work out-of-the-box. If, in addition, the class defines
a seqinfo setter, then all the corresponding setters will
also work out-of-the-box.
See the GRanges, GRangesList, GappedAlignments,
and GappedAlignmentPairs classes for examples of classes that
define the seqinfo getter and setter (those 4 classes are
defined in the GenomicRanges package).
See the TranscriptDb class (defined in the
GenomicFeatures package) for an example of a class that defines only
the seqinfo getter (no setter).
The GenomicRanges package defines seqinfo and
seqinfo<- methods for these low-level IRanges data
structures: List, RangesList and
RangedData. Those objects do not have the means to formally
store sequence information. Thus, the wrappers simply store the
Seqinfo object within metadata(x). Initially, the
metadata is empty, so there is some effort to generate a
reasonable default Seqinfo. The names of any List
are taken as the seqnames, and the universe of
RangesList or RangedData is taken as the
genome.
The full list of methods defined for a given generic can
be seen with e.g. showMethods("seqinfo") or
showMethods("seqnames") (for the getters),
and showMethods("seqinfo<-") or showMethods("seqnames<-")
(for the setters aka replacement methods).
Please be aware that this shows only methods defined in packages
that are currently attached.
showMethods("seqinfo")
showMethods("seqinfo<-")
showMethods("seqnames")
showMethods("seqnames<-")
if (interactive())
?`GRanges-class`