getLowestDists {hiAnnotator} | R Documentation |
Given a query and subject with indicies from nearest
,
calculate the shortest biological distance to either boundaries of the query
and subject. This is a helper function utilized in
getNearestFeature
, get2NearestFeature
getLowestDists(query = NULL, subject = NULL, res.nrst = NULL, side = "either", relativeTo = "subject")
query |
GRanges object to be used as the query which holds data for 'queryHits' attribute of res.nrst. |
subject |
GRanges object to be used as the subject which holds data for 'subjectHits' attribute of res.nrst. |
res.nrst |
a dataframe of nearest indices as returned by
|
side |
boundary of subject/annotation to use to calculate the nearest distance. Options are '5p','3p', or the default 'either'. |
relativeTo |
calculate distance relative to query or subject.
Default is 'subject'. See documentation of |
res.nrst with lowest distances appended at the end.
for cases where a query has multiple nearest neighbors or overlaps with >1 subjects, the function will choose the subject with the lowest absolute distance.
getNearestFeature
, get2NearestFeature
.
query <- GRanges("A", IRanges(c(1, 5, 12, 20), width = 1), strand = c("-", "+", "-", "+")) subject <- GRanges("A", IRanges(c(1, 5, 10, 15, 21), width = 8:4), strand = c("+", "+", "-", "-", "-")) res <- as.data.frame(nearest(query, subject, select = "all", ignore.strand = TRUE)) res <- getLowestDists(query, subject, res, "either", "query")