Learn R Programming

fingerprint (version 2.1)

fingerprint-class: Class "fingerpint"

Description

This class represents binary fingerprints, usually generated by a variety of cheminformatics software, but not restricted to such

Arguments

Objects from the Class

Objects can be created by calls of the form new("fingerprint", ...). Fingerprints can traditionally thought of as a vector of 1's and 0's. However for large fingerprints this is inefficient and instead we simply store the positions of the bits that are on. Certain operations also need to know the length of the original bit string and this length is stored in the object at construction. Even though we store extra information along with the bit positions, conceptually we still consider the objects as simple bit strings. Thus the usual bitwise logical operations (&, |, !, xor) can be applied to objects of this class.

See Also

fp.read, fp.read.to.matrix fp.sim.matrix, fp.to.matrix, fp.factor.matrix random.fingerprint

Examples

Run this code
## make fingerprints
x <- new("fingerprint", nbit=128, bits=sample(1:128, 100))
y <- x
distance(x,y) # should be 1
x <- new("fingerprint", nbit=128, bits=sample(1:128, 100))
distance(x,y)
folded <- fold(x)

## binary operations on fingerprints
x <- new("fingerprint", nbit=8, bits=c(1,2,3,6,8))
y <- new("fingerprint", nbit=8, bits=c(1,2,4,5,7,8))
x & y
x | y
!x

Run the code above in your browser using DataLab