Find the closest feature to a given set of genomic regions
ClosestFeature(object, regions, annotation = NULL, ...)
A Seurat object
A set of genomic regions to query
A GRanges object containing annotation information. If NULL, use the annotations stored in the object.
Additional arguments passed to StringToGRanges
Returns a dataframe with the name of each region, the closest feature in the annotation, and the distance to the feature.
# \donttest{
ClosestFeature(
object = atac_small,
regions = head(granges(atac_small))
)
#> tx_id gene_name gene_id gene_biotype
#> ENSE00001787178 ENST00000450983 RP4-669L17.2 ENSG00000236601 lincRNA
#> ENSE00001787178.1 ENST00000450983 RP4-669L17.2 ENSG00000236601 lincRNA
#> ENSE00001787178.2 ENST00000450983 RP4-669L17.2 ENSG00000236601 lincRNA
#> ENSE00001787178.3 ENST00000450983 RP4-669L17.2 ENSG00000236601 lincRNA
#> ENSE00001787178.4 ENST00000450983 RP4-669L17.2 ENSG00000236601 lincRNA
#> ENSE00001787178.5 ENST00000450983 RP4-669L17.2 ENSG00000236601 lincRNA
#> type closest_region query_region distance
#> ENSE00001787178 exon chr1-453633-454166 chr1-713460-714823 259293
#> ENSE00001787178.1 exon chr1-453633-454166 chr1-752422-753038 298255
#> ENSE00001787178.2 exon chr1-453633-454166 chr1-762106-763359 307939
#> ENSE00001787178.3 exon chr1-453633-454166 chr1-779589-780271 325422
#> ENSE00001787178.4 exon chr1-453633-454166 chr1-804872-805761 350705
#> ENSE00001787178.5 exon chr1-453633-454166 chr1-839520-841123 385353
# }