File size: 1,384 Bytes
9aaa76b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
#' dendrogramCreator
#'
#' @param bootstraps integer number of bootstraps
#' @param distanceMethod distance method to use
#' @param clusteringMethod clustering method to use
#' @param proteinMatrix proteinMatrix , rows are samples, cols are peak intensities
#'
#' @return dendrogram
#' @export
#'
idbac_dendrogram_creator <- function(bootstraps = 0L,
distanceMethod,
clusteringMethod,
proteinMatrix){
createHclustObject <- function(x){
x <- distMatrix(data = x,
method = distanceMethod)
stats::hclust(x,
method = clusteringMethod)
}
if (is.numeric(bootstraps)) {
if ((bootstraps > 1) & (bootstraps < 1000)) {
bootstraps <- bootstrap(proteinMatrix,
fun = createHclustObject,
n = bootstraps)
}
}
distance_matrix <- distMatrix(data = proteinMatrix,
method = distanceMethod)
dend <- stats::hclust(distance_matrix,
method = clusteringMethod)
dend <- stats::as.dendrogram(dend)
return(list(dendrogram = dend,
bootstraps = bootstraps,
distance = distance_matrix))
}
|