|
|
@@ -1,3 +1,56 @@ |
|
|
#' Generate molecular fingerprints
|
|
|
#'
|
|
|
#' `get.fingerprint` returns a `fingerprint` object representing molecular fingerprint of
|
|
|
#' the input molecule.
|
|
|
#'
|
|
|
#' @param molecule A \code{jobjRef} object to an \code{IAtomContaine}
|
|
|
#' @param type The type of fingerprint. Possible values are:
|
|
|
#' \itemize{
|
|
|
#' \item standard - Considers paths of a given length. The default is
|
|
|
#' but can be changed. These are hashed fingerprints, with a
|
|
|
#' default length of 1024
|
|
|
#' \item extended - Similar to the standard type, but takes rings and
|
|
|
#' atomic properties into account into account
|
|
|
#' \item graph - Similar to the standard type by simply considers connectivity
|
|
|
#' \item hybridization - Similar to the standard type, but only consider hybridization state
|
|
|
#' \item maccs - The popular 166 bit MACCS keys described by MDL
|
|
|
#' \item estate - 79 bit fingerprints corresponding to the E-State atom types described by Hall and Kier
|
|
|
#' \item pubchem - 881 bit fingerprints defined by PubChem
|
|
|
#' \item kr - 4860 bit fingerprint defined by Klekota and Roth
|
|
|
#' \item shortestpath - A fingerprint based on the shortest paths between pairs of atoms and takes into account ring systems, charges etc.
|
|
|
#' \item signature - A feature,count type of fingerprint, similar in nature to circular fingerprints, but based on the signature
|
|
|
#' descriptor
|
|
|
#' \item circular - An implementation of the ECFP6 fingerprint
|
|
|
#' }
|
|
|
#' @param fp.mode The style of fingerprint. Specifying "`bit`" will return a binary fingerprint,
|
|
|
#' "`raw`" returns the the original representation (usually sequence of integers) and
|
|
|
#' "`count`" returns the fingerprint as a sequence of counts.
|
|
|
#' @param depth The search depth. This argument is ignored for the
|
|
|
#' `pubchem`, `maccs`, `kr` and `estate` fingerprints
|
|
|
#' @param size The final length of the fingerprint.
|
|
|
#' This argument is ignored for the `pubchem`, `maccs`, `kr`, `signature`, `circular` and
|
|
|
#' `estate` fingerprints
|
|
|
#' @param verbose Verbose output if \code{TRUE}
|
|
|
#' @return an S4 object of class \code{\link{fingerprint-class}} or \code{\link{featvec-class}},
|
|
|
#' which can be manipulated with the fingerprint package.
|
|
|
#' @export
|
|
|
#' @author Rajarshi Guha (\email{rajarshi.guha@@gmail.com})
|
|
|
#' @examples
|
|
|
#' ## get some molecules
|
|
|
#' sp <- get.smiles.parser()
|
|
|
#' smiles <- c('CCC', 'CCN', 'CCN(C)(C)', 'c1ccccc1Cc1ccccc1','C1CCC1CC(CN(C)(C))CC(=O)CC')
|
|
|
#' mols <- parse.smiles(smiles)
|
|
|
#'
|
|
|
#' ## get a single fingerprint using the standard
|
|
|
#' ## (hashed, path based) fingerprinter
|
|
|
#' fp <- get.fingerprint(mols[[1]])
|
|
|
#'
|
|
|
#' ## get MACCS keys for all the molecules
|
|
|
#' fps <- lapply(mols, get.fingerprint, type='maccs')
|
|
|
#'
|
|
|
#' ## get Signature fingerprint
|
|
|
#' ## feature, count fingerprinter
|
|
|
#' fps <- lapply(mols, get.fingerprint, type='signature', fp.mode='raw')
|
|
|
get.fingerprint <- function(molecule, type = 'standard', fp.mode = 'bit', depth=6, size=1024, verbose=FALSE) {
|
|
|
if (is.null(attr(molecule, 'jclass'))) stop("Must supply an IAtomContainer or something coercable to it")
|
|
|
if (attr(molecule, "jclass") != "org/openscience/cdk/interfaces/IAtomContainer") {
|
|
|
0 comments on commit
5d074e5