Annotates a GRanges object with nearby features in another GRanges object
annotate_nearby_features.RdDistance is measured as distance from end and start depending whether the target locus is downstream or upstream.
Usage
annotate_nearby_features(
gr,
feat_gr,
name_field,
distance_cutoff = 2500,
ignore.strand = TRUE
)Value
A GRanges object with a nearby_features field in it containing names of overlapping features in that distance range (separated by commas)
Examples
features_gr <- GenomicRanges::GRanges(
seqnames = c("chr1", "chr1"),
IRanges::IRanges(c(10,22), c(20,30)),
strand = c("-", "-"),
name = c("Feat_A", "Feat_B")
)
gr <- GenomicRanges::GRanges(
seqnames = c("chr1"),
IRanges::IRanges(15, 25),
strand = "+"
)
annotate_nearby_features(gr, features_gr, "name", ignore.strand = TRUE)
#> GRanges object with 1 range and 1 metadata column:
#> seqnames ranges strand | annotation
#> <Rle> <IRanges> <Rle> | <character>
#> [1] chr1 15-25 + | Feat_A,Feat_B
#> -------
#> seqinfo: 1 sequence from an unspecified genome; no seqlengths