nearest(IRanges)
nearest()所属R语言包:IRanges
Nearest neighbor finding
最近的邻居发现
译者:生物统计家园网 机器人LoveR
描述----------Description----------
The nearest, precede and follow methods find nearest neighbors between Ranges instances.
nearest,precede和follow方法之间找到Ranges实例的近邻。
用法----------Usage----------
nearest(x, subject, ...)
## S4 method for signature 'Ranges,RangesORmissing'
nearest(x, subject,
select = c("arbitrary", "all"))
precede(x, subject = x, ...)
## S4 method for signature 'Ranges,RangesORmissing'
precede(x, subject,
select = c("first", "all"))
follow(x, subject = x, ...)
## S4 method for signature 'Ranges,RangesORmissing'
follow(x, subject,
select = c("last", "all"))
distanceToNearest(x, subject = x, ...)
## S4 method for signature 'Ranges,RangesORmissing'
distanceToNearest(x, subject,
select = c("arbitrary", "all"))
参数----------Arguments----------
参数:x
The query Ranges instance.
查询Ranges实例。
参数:subject
The subject Ranges instance, within which the nearest neighbors are found. Can be missing, in which case the query, x, is also the subject.
主题Ranges实例,近邻内被发现。可缺少,在这种情况下,查询,x,也是这个问题。
参数:select
Logic for handling ties. By default, all of the methods here will select a single interval (arbitrary for nearest, the first by order in subject for precede, and the last for follow). To get all matchings, as a RangesMatching object, use “all”.
逻辑处理关系。默认情况下,这里所有的方法,将选择一个单一的间隔(任意nearest,以便通过在subject,precede,follow)。要得到所有的匹配,作为一个RangesMatching对象,使用“所有”。
参数:...
Additional arguments for methods
附加参数的方法
Details
详情----------Details----------
nearest is the conventional nearest neighbor finder and returns a integer vector containing the index of the nearest neighbor range in subject for each range in x. If there is no nearest neighbor (if subject is empty), NA's are returned.
nearest是传统的近邻取景器和返回一个整数向量subject每个x的范围近邻范围内的指数。如果没有近邻(subject如果是空的),NA的返回。
The algorithm is roughly as follows, for a range xi in x:
该算法大致如下:范围,xix:
Find the ranges in subject that overlap xi. If a single range si in subject overlaps xi, si is returned as the nearest neighbor of xi. If there are multiple overlaps, one of the overlapping ranges is chosen arbitrarily.
查找subject重叠xi范围。如果一个单一的范围sisubject重叠xi,si作为近邻xi返回。如果有多个重叠,重叠的范围任意选择。
If no ranges in subject overlap with xi, then the range in subject with the shortest distance from its end to the start xi or its start to the end of xi is returned.
如果没有范围subjectxi重叠,然后在一系列subject结束的最短距离开始xi“或它的启动xi返回。
For each range in x, precede returns the index of the interval in subject that is directly preceded by the query range. Note that any overlapping ranges are excluded. NA is returned when there are no qualifying ranges in subject.
范围中的每个x,precede返回指数区间subject直接由前面的查询范围。请注意,任何重叠的范围被排除在外。 NA有subject没有资格范围时返回。
follow is the opposite of precede: it returns the index of the range in subject that a query range in x directly follows.
followprecede的相反:它返回subject查询范围x直接如下范围的索引。
distanceToNearest returns the distance for each range in x to its nearest neighbor in subject.
distanceToNearest返回x的距离其最近的邻居subject每个范围。
值----------Value----------
For nearest, precede and follow, an integer vector of indices in subject, or a RangesMatching if select is “all”.
nearest,precede和follow,一个整数向量在subject或RangesMatching指数如果select是“所有”。
For distanceToNearest, a DataFrame with a column for the query index, subject index and distance between the pair. This may become more formal in the future.
distanceToNearest,DataFramequery指数,subject指数和distance之间的对列。这可能会在未来变得更加正式。
作者(S)----------Author(s)----------
M. Lawrence
参见----------See Also----------
findOverlaps for finding just the overlapping ranges.
findOverlaps寻找仅仅是重叠的范围。
举例----------Examples----------
query <- IRanges(c(1, 3, 9), c(2, 7, 10))
subject <- IRanges(c(3, 5, 12), c(3, 6, 12))
nearest(query, subject) # c(1L, 1L, 3L)[C(1L,1L,3L)]
nearest(query) # c(2L, 1L, 2L)[C(2L,1L,2L)]
query <- IRanges(c(1, 3, 9), c(3, 7, 10))
subject <- IRanges(c(3, 2, 10), c(3, 13, 12))
precede(query, subject) # c(3L, 3L, NA)[C(3L,3L,不适用)]
precede(IRanges(), subject) # integer()[整数()]
precede(query, IRanges()) # rep(NA_integer_, 3)[REP(NA_integer_,3)]
precede(query) # c(3L, 3L, NA)[C(3L,3L,不适用)]
follow(query, subject) # c(NA, NA, 1L)[C(NA NA,1L)]
follow(IRanges(), subject) # integer()[整数()]
follow(query, IRanges()) # rep(NA_integer_, 3)[REP(NA_integer_,3)]
follow(query) # c(NA, NA, 2L)[C(NA NA,2L)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|