| select-methods {GenomicFeatures} | R Documentation |
select, cols and keys can be used together to
extract data from a TranscriptDb object.
In the code snippets below, x is a TranscriptDb object.
keytypes(x):
allows the user to discover which keytypes can be passed in to
select or keys and the keytype argument.
keys(x, keytype):
Return 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):
Show which kinds of data can be returned for the
TranscriptDb object.
select(x, keys, cols, keytype):
When all the appropriate arguments are specified select
will retrieve the matching data as a data.frame based on
parameters for selected keys and cols and
keytype arguments.
Marc Carlson
transcripts, transcriptsBy,
and transcriptsByOverlaps, for other ways to
extract genomic features from a TranscriptDb object.
The TranscriptDb class.
txdb_file <- system.file("extdata", "Biomart_Ensembl_sample.sqlite",
package="GenomicFeatures")
txdb <- loadDb(txdb_file)
txdb
## 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)