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.
makeTxDbFromGRanges(gr, drop.stop.codons=FALSE, metadata=NULL, taxonomyId=NA)
TRUE
or FALSE
. If TRUE
, then features of type
stop_codon
are ignored. Otherwise (the default) the stop codons
are considered to be part of the CDS and merged to them.
makeTxDb
, which makeTxDbFromGRanges
calls at the
end to make the TxDb object from the information extracted from
gr
. See ?makeTxDb
for more information about the
format of metadata
.
makeTxDbFromUCSC
, makeTxDbFromBiomart
,
and makeTxDbFromGFF
, for convenient ways to make a
TxDb object from UCSC or BioMart online resources, or
directly from a GFF or GTF file.
import
function in the
rtracklayer package.
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.
makeTxDb
for the low-level function used by the
makeTxDbFrom*
functions to make the TxDb object
returned to the user.
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:
stopifnot(identical(as.list(txdb), 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
Run the code above in your browser using DataLab