TranscriptDb-class {GenomicFeatures} | R Documentation |
The TranscriptDb class is a container for storing transcript annotations. The FeatureDb class is a container for storing more generic GenomicFeature annotations.
See ?makeTranscriptDbFromUCSC
and
?makeTranscriptDbFromBiomart
for making a
TranscriptDb object from the UCSC or BioMart sources.
See ?makeFeatureDbFromUCSC
for making a
FeatureDb object from the UCSC or BioMart sources.
See ?saveDb
and ?loadDb
for
saving and loading the database contents of a TranscriptDb or FeatureDb
object.
select
, cols
and keys
are used together to
extract data from an TranscriptDb
object.
In the code snippets below, x
is a TranscriptDb object. For the
metadata and show methods, there is also support for FeatureDb objects.
metadata(x)
:
Returns x
's metadata in a data frame.
seqinfo(x)
:
Gets the information about the underlying sequences as a
Seqinfo object.
as.list(x)
:
Dumps the entire db into a list of data frames txdump
that can
be used in do.call(makeTranscriptDb, txdump)
to make the db
again with no loss of information.
Note that the transcripts are dumped in the same order in all the
data frames.
isActiveSeq(x)
:
Returns the currently active sequences for this txdb object as a
named logical vector. Only active sequences will be tapped when
using the supplied accessor methods. Inactive sequences will be
ignored. By default, all available sequences will be active.
isActiveSeq(x) <-
:
Allows the user to change which sequences will be actively
accessed by the accessor methods by altering the contents of this
named logical vector.
keytypes(x)
:
allows the user to discover which keytypes can be passed in to
select
or keys
and the keytype
argument.
keys(x, keytype)
:
returns keys for the database contained in the TranscriptDb
object . By default it will return the "TXNAME" keys for the database,
but if used with the keytype
argument, it will return the keys
from that keytype.
cols(x)
:
shows which kinds of data can be returned for the
TranscriptDb
object.
select(x, keys, cols, keytype)
:
When all the appropriate arguments are specifiedm select
will retrieve the matching data as a data.frame based on
parameters for selected keys
and cols
and
keytype
arguments.
See ?transcripts
, ?transcriptsByOverlaps
,
?id2name
and ?transcriptsBy
for other useful
operations on TranscriptDb objects.
H. Pages, Marc Carlson
Seqinfo-class,
makeTranscriptDbFromUCSC
,
makeTranscriptDbFromBiomart
,
loadFeatures
,
transcripts
,
transcriptsByOverlaps
,
id2name
, transcriptsBy
txdb_file <- system.file("extdata", "Biomart_Ensembl_sample.sqlite", package="GenomicFeatures") txdb <- loadFeatures(txdb_file) txdb ## Use of seqinfo seqinfo(txdb) seqlevels(txdb) # shortcut for 'seqlevels(seqinfo(txdb))' seqlengths(txdb) # shortcut for 'seqlengths(seqinfo(txdb))' isCircular(txdb) # shortcut for 'isCircular(seqinfo(txdb))' names(which(isCircular(txdb))) ## Examples on how to change which sequences are active ## Set chr1 and chr3 to be inactive: isActiveSeq(txdb)[c("1", "3")] <- FALSE ## Set ALL of the chromsomed to be inactive isActiveSeq(txdb)[seqlevels(txdb)] <- FALSE ## Now set only chr1 and chr5 to be active isActiveSeq(txdb)[c("1", "4")] <- TRUE ## Use of as.list txdump <- as.list(txdb) txdump txdb1 <- do.call(makeTranscriptDb, txdump) stopifnot(identical(as.list(txdb1), txdump)) ## Use of select and supporting methods ## find key types keytypes(txdb) ## list IDs that can be used to filter head(keys(txdb, "GENEID")) head(keys(txdb, "TXID")) head(keys(txdb, "TXNAME")) ## list columns that can be returned by select cols(txdb) ## call select res = select(txdb, head(keys(txdb, "GENEID")), cols = c("GENEID","TXNAME"), keytype="GENEID") head(res)