I have a GRanges that represents ~150 genomic regions of interest. I want to use the location of those regions to identify any overlap with gene CDS or Promoters within the yeast genome.
There is a convenient function within the GenomicFeatures package for doing this for CDS.
cdsByOverlaps(TxDb.Scerevisiae.UCSC.sacCer3.sgdGene, MyRegionsGRanges, maxgap = -1L, minoverlap = 0L, type = c("any", "start", "end"), columns = c("txid", "tx_name"))
However, there is no equivalent function for the comparison against Promoters by overlap. There is however, a promoter function that can be run on the TxDb to generate a GRanges of Promoters for the yeast genome.
promoters(transcripts(txdb, columns=columns, use.names=TRUE), upstream=100, downstream=50)
I could then compare my two GRanges (Promoters vs. RegionsofInterest) to find overlap and extract the gene information. I just don't know how to do that within the packages. Maybe I should just shift to base R for this comparison? Any ideas?
The above should be reversed if you want the regions defined in
MyRegionsGRanges
that overlap any promoters.Yes, works with the change you mentioned: olaps <- subsetByOverlaps(MyRegionsGRanges, prom)
Thanks!