R/517-extractPCMPropScales.R

Defines functions extrPCMPropScales

Documented in extrPCMPropScales

#' Generalized AA-Properties Based Scales Descriptors
#'
#' Generalized AA-Properties Based Scales Descriptors
#'
#' This function calculates the generalized amino acid properties based 
#' scales descriptors.
#' Users could specify which AAindex properties to select from the 
#' AAindex database by specify the numerical or character index of 
#' the properties in the AAindex database.
#' 
#' @param x A character vector, as the input protein sequence.
#' @param index Integer vector or character vector. Specify which 
#'        AAindex properties to select from the AAindex database by 
#'        specify the numerical or character index of the properties 
#'        in the AAindex database. 
#'        Default is \code{NULL}, means selecting all the AA properties 
#'        in the AAindex database.
#' @param pc Integer. Use the first pc principal components as the scales.
#'        Must be no greater than the number of AA properties provided.
#' @param lag The lag parameter. Must be less than the amino acids.
#' @param scale Logical. Should we auto-scale the property matrix 
#'        before PCA? Default is \code{TRUE}.
#' @param silent Logical. Whether we print the standard deviation, 
#'        proportion of variance and the cumulative proportion of 
#'        the selected principal components or not.
#'        Default is \code{TRUE}.
#'
#' @return A length \code{lag * p^2} named vector, 
#'         \code{p} is the number of scales (principal components) selected.
#' 
#' @keywords extract descriptor scales extrPCMPropScales AAindex
#'
#' @aliases extrPCMPropScales
#' 
#' @author Min-feng Zhu <\email{wind2zhu@@163.com}>, 
#'         Nan Xiao <\url{http://r2s.name}>
#' 
#' @seealso See \code{\link{extrPCMScales}} for 
#' generalized scales-based descriptors.
#' 
#' @export extrPCMPropScales
#' 
#' @examples
#' x = readFASTA(system.file('protseq/P00750.fasta', package = 'BioMedR'))[[1]]
#' propscales = extrPCMPropScales(x, index = c(160:165, 258:296), pc = 5, lag = 7, silent = FALSE)
#' 

extrPCMPropScales = function (x, index = NULL, pc, lag, 
                                 scale = TRUE, silent = TRUE) {

    aaidx = get('AAindex')
    if (!is.null(index)) propmat = t(na.omit(as.matrix(aaidx[index, 7:26])))

    result = extrPCMScales(x = x, propmat = propmat, pc = pc, lag = lag, 
                              scale = scale, silent = silent)

    return(result)

}

Try the BioMedR package in your browser

Any scripts or data that you put into this service are public.

BioMedR documentation built on Nov. 17, 2017, 10:08 a.m.