annotateBedFromDb {CompGO} | R Documentation |
Wrapper for transcriptsByOverlaps(). Returns a GRanges with the gene and transcript ids associated with the input .bed regions. Sometimes it is necessary to expand the search window a bit, because not all .bed regions directly overlap with a transcription start site, so the 'window' parameter is provided to accomplish this.
annotateBedFromDb(pathToBed = NULL, gRanges = NULL, db = NULL, window = 5000)
pathToBed |
The system path to a .bed file (directory + file name) |
gRanges |
If the user has a .bed file already loaded in R, they can supply it here as a GRanges object rather than re-importing it |
db |
A TxDb object containing the transcripts of the organism (required) |
window |
The window around a .bed region to search for genes, default 5kb |
A GRanges object with corresponding EntrezGene IDs in gene_id column, plus transcript IDs in tx_id
library(TxDb.Mmusculus.UCSC.mm9.knownGene) txdb = TxDb.Mmusculus.UCSC.mm9.knownGene data(bed.sample) range = GRanges(seqnames=bed.sample$chr, IRanges(start=bed.sample$start, end=bed.sample$end)) x = annotateBedFromDb(gRanges = range, db = txdb) x