getLowestDists: Get the lowest biological distance from the 5' or 3'...

Description Usage Arguments Value Note See Also Examples

View source: R/hiAnnotator.R

Description

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

Usage

1
2
3
4
5
6
7
getLowestDists(
  query = NULL,
  subject = NULL,
  res.nrst = NULL,
  side = "either",
  relativeTo = "subject"
)

Arguments

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 nearest.

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 getNearestFeature for more information.

Value

res.nrst with lowest distances appended at the end.

Note

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.

See Also

getNearestFeature, get2NearestFeature.

Examples

1
2
3
4
5
6
7
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")

malnirav/hiAnnotator documentation built on July 29, 2021, 6:32 a.m.