
Perform Sample Clustering
calculate_sample_clustering.RdThis function computes a distance matrix based on the provided method (either "euclidean" or "cosine") and performs hierarchical clustering on the samples. It then cuts the resulting dendrogram into a specified number of clusters (k) and returns both the hierarchical clustering object and the cluster assignments for each sample.