Learn R Programming

ChemmineR (version 2.24.2)

trimNeighbors: Trim Neighbors

Description

Further reduce the cutoff value of a nearest neighbor (NN) table, as produced by nearestNeighbors. This allows one to compute a very relaxed NN table initially, and then quickly restrict it later without having to re-compute all the similarities.

Usage

trimNeighbors(nnm, cutoff)

Arguments

nnm
A nearest neighbor table, as produced by nearestNeighbors.
cutoff
The new similarities cutoff value. All pairs with a similarity less than this value will be removed from the table.

Value

The return value has the same structure as nnm, with some neighbors removed from the indexes and similarties entries.

See Also

jarvisPatrick nearestNeighbors

Examples

Run this code

   data(sdfsample)
   ap = sdf2ap(sdfsample)
   nnm = nearestNeighbors(ap,numNbrs=20)
   nnm = trimNeighbors(nnm,cutoff=0.5)
   clustering = jarvisPatrick(nnm,k=2,mode="a1b")

Run the code above in your browser using DataLab