Description Usage Arguments Value Author(s) See Also Examples
View source: R/makeTxDbFromGRanges.R
The makeTxDbFromGRanges
function allows the user
to extract gene, transcript, exon, and CDS information from a
GRanges object structured as GFF3 or GTF,
and to return that information in a TxDb object.
1 | makeTxDbFromGRanges(gr, drop.stop.codons=FALSE, metadata=NULL, taxonomyId=NA)
|
gr |
A GRanges object structured as GFF3 or GTF,
typically obtained with |
drop.stop.codons |
|
metadata |
A 2-column data frame containing meta information to be included in the
TxDb object. This data frame is just passed to
|
taxonomyId |
By default this value is NA which will result in an NA field since there is no reliable way to infer this from a GRanges object. But you can use this argument to supply your own valid taxId here and if you do, then the Organism can be filled in as well |
A TxDb object.
Hervé Pagès
makeTxDbFromUCSC
, makeTxDbFromBiomart
,
and makeTxDbFromEnsembl
, for making a TxDb
object from online resources.
makeTxDbFromGFF
for making a TxDb object
from a GFF or GTF file.
The import
function in the
rtracklayer package.
The asGFF
method for TxDb objects
(asGFF,TxDb-method) for the reverse of
makeTxDbFromGRanges
, that is, for turning a TxDb
object into a GRanges object structured as
GFF.
The TxDb class.
makeTxDb
for the low-level function used by the
makeTxDbFrom*
functions to make the TxDb object
returned to the user.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | library(rtracklayer) # for the import() function
## ---------------------------------------------------------------------
## WITH A GRanges OBJECT STRUCTURED AS GFF3
## ---------------------------------------------------------------------
GFF3_files <- system.file("extdata", "GFF3_files",
package="GenomicFeatures")
path <- file.path(GFF3_files, "a.gff3")
gr <- import(path)
txdb <- makeTxDbFromGRanges(gr)
txdb
## Reverse operation:
gr2 <- asGFF(txdb)
## Sanity check (asGFF() does not propagate the CDS phase at the moment):
target <- as.list(txdb)
target$splicings$cds_phase <- NULL
stopifnot(identical(target, as.list(makeTxDbFromGRanges(gr2))))
## ---------------------------------------------------------------------
## WITH A GRanges OBJECT STRUCTURED AS GTF
## ---------------------------------------------------------------------
GTF_files <- system.file("extdata", "GTF_files", package="GenomicFeatures")
## test1.gtf was grabbed from http://mblab.wustl.edu/GTF22.html (5 exon
## gene with 3 translated exons):
path <- file.path(GTF_files, "test1.gtf")
gr <- import(path)
txdb <- makeTxDbFromGRanges(gr)
txdb
path <- file.path(GTF_files, "Aedes_aegypti.partial.gtf")
gr <- import(path)
txdb <- makeTxDbFromGRanges(gr)
txdb
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.