\name{SAGELyzer} \alias{SAGELyzer} \alias{getSAGESQL} \alias{getTotalRNum} \alias{getKNN} \alias{noChunkKNN} \alias{chunkKNN} \alias{findNeighborTags} \alias{getColNames} \title{Function to filter out the k nearest neighbors for a given tag} \description{ This function finds the k nearest neighbors for a given SAGE tag based on the expression of SAGE tags across selected SAGE labraries. The calculations are based on data stored in a table in a databse. } \usage{ SAGELyzer(dbArgs, targetSAGE, libs = "*", normalize = "min", tagColName = "tag", k = 500, dist = "euclidean", trans = "sqrt") getSAGESQL(dbArgs, conn, targetSAGE, libs, tagColName, chunk = FALSE, cursor = "sageRows", ignorZeros = TRUE, what = c("map", "counts", "info")) getTotalRNum(dbArgs, conn, tagColName, what = "counts") getKNN(dbArgs, targetSAGE, libs, tagColName, normalize, k, dist, trans, max = 10000) noChunkKNN(dbArgs, conn, targetSAGE, libs, tagColName, normalize, k, dist, trans) chunkKNN(dbArgs, conn, targetSAGE, libs, tagColName, normalize, k, dist, trans, rowNum, max = 50000) findNeighborTags(targetRow, data, k, NF, dist, trans) getColNames(dbArgs, conn, what = "counts") } \arguments{ \item{dbArgs}{\code{dbArgs} a list containing arguments needed to make connection to a database and queries against a table. The elements include a DSN under Windows and database name, user name, password, and host under Unix plus the names for three tables that will be used by SAGElyzer} \item{targetSAGE}{\code{targetSAGE} a character string for the SAGE tag whose neighbors will be sought} \item{libs}{\code{libs} a vector of character strings for column names of database table where SAGE library data are stored} \item{normalize}{\code{normalize} a character string for the means to perfrom data normalization. Can be either "min", "max", or "none"} \item{tagColName}{\code{tagColName} a character string for the column name of a database table where SAGE tags are stored} \item{k}{\code{k} an integer for the number of nearest neighbors to be sought} \item{dist}{\code{dist} a character string corresponding to an existing R object for calculating distances between two data sets} \item{trans}{\code{trans} a character string corresponding to an existing R object that will be used to transform the data} \item{conn}{\code{conn} a connection to a database} \item{chunk}{\code{chunk} a boolean indicating whether data will be processed in chunks to avoid running out space} \item{ignorZeros}{\code{ignorZeros} a boolean indicating whether data rows with all 0s will be ignored} \item{what}{\code{what} a character string for the type of database table to use for getting data. Have to be either "map", "counts", or "info"} \item{max}{\code{max} an integer for the maximum number of data rows in a chunk to be processed} \item{rowNum}{\code{rowNum} an integer for row number} \item{NF}{\code{NF} a vector of numerical data that will be used as normalization factor for SAGE counts} \item{targetRow}{\code{targetRow} a vector of character strings containing data for the target SAGE tag} \item{data}{\code{data} a matrix containing SAGE counts across selected libraries} \item{cursor}{\code{cursor} a character string for the name of a cursor to reterive data in chunks from a database table} } \details{ Two database tables (default names "sagecounts" and "sageinfo" have to exist (tables can be created using other function in this package). One table (sagecounts) contains counts for SAGE tags for libraries and the other (sageinfo) contains mappings between column names used in "sagecounts" to store data for a given SAGE library. Functions in this package are normally called by interactive interfaces that are invoked when the package is loaded. } \value{ \code{\link{SAGELyzer}} returns a named vector with SAGE tags being the names and the corresponding calculated distances to a given tag being the values. \code{\link{getSAGESQL}} returns a character string for a SQL statement to use to query a database. \code{\link{getTotalRNum}} returns an integer for the total row number of a database table. } \references{\url{www.sagenet.org}} \author{Jianhua Zhang} \seealso{\code{\link{SAGE4Unix}}} \examples{ # No example is given as the code requires data with existing tables } \keyword{manip}