Calculate average loadings of each cluster

buildAvgLoading(dat, k, n = 20, cluster = NULL, study = TRUE)

Arguments

dat

A data frame. Each row represents principle components from different training datasets. Columns are genes used for PCA analysis.

k

The number of clusters used for hierarchical clustering

n

The number of top principle components from each datasets used for model building. Default is 20.

cluster

Provide pre-defined cluster membership of your data.

study

Under default (TRUE), studies involved in each cluster will be added in the output.

Value

A named list of 6 elements is returned. It contains:

cluster

A numeric vector on cluster membership of PCs

size

A integer vector on the size of clusters

avgLoading

A matrix of average loadings. Columns for clusters and rows for genes

k

The number of clusters

n

The number of top PCs used for clustering

studies

A list of character vector containing studies in each cluster

Examples

data(miniAllZ)
data(res_hcut)
res <- buildAvgLoading(miniAllZ, k = 40, cluster = res_hcut$cluster)