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