R/utils.R
get_nearest_annotation.Rd
For a given set of genomic regions, this function computes the nearest
annotation information using the Annotated Genes required by this package.
The Annotated Genes are actually provided by
GenomicState::GenomicStateHub()
.
get_nearest_annotation(gr, CODING_ONLY = FALSE)
A GenomicRanges::GRanges() object.
A logical vector of length 1 specifying whether to
subset the Annotated Genes to only the coding genes. That is, whether to
subset the genes by whether they have a non-NA CSS
value. The Annotated
Genes are downloaded with GenomicState::GenomicStateHub()
.
The bumphunter::matchGenes()
output for the annotation information
using the Annotated Genes for Gencode version 31 on hg19 coordinates (subset
to only the coding elements if CODING_ONLY
was set to TRUE
).
This is an utility function used by region_info, four_panels and plot_coverage.
gr <- GenomicRanges::GRanges("chr10:135379301-135379311:+")
get_nearest_annotation(gr)
#> loading from cache
#> name annotation description region distance subregion insideDistance
#> 1 <NA> <NA> inside exon inside 0 inside exon 0
#> exonnumber nexons UTR strand geneL codingL
#> 1 1 5 inside transcription region + 63710 NA
#> Geneid subjectHits
#> 1 ENSG00000288107 62226
get_nearest_annotation(gr, CODING_ONLY = TRUE)
#> loading from cache
#> name annotation description region distance subregion
#> 1 CYP2E1 NM_000773 NP_000764 downstream downstream 45391 <NA>
#> insideDistance exonnumber nexons UTR strand geneL codingL Geneid
#> 1 NA NA 12 <NA> + 40814 11568 ENSG00000130649
#> subjectHits
#> 1 6233