Learn R Programming

hiAnnotator (version 1.6.2)

getLowestDists: Get the lowest biological distance from the 5' or 3' boundaries of query and subject.

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

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.

See Also

getNearestFeature, get2NearestFeature.

Examples

Run this code
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")

Run the code above in your browser using DataLab