Skip to content

Commit

Permalink
fixed clustering using distance correlation
Browse files Browse the repository at this point in the history
  • Loading branch information
trvinh committed May 13, 2019
1 parent 804f5a4 commit db77479
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions R/clusterProfile.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ getDistanceMatrix <- function(profiles = NULL, method = "mutualInformation") {
distanceMatrix <- stats::dist(profiles, method = method)
} else if (method == "distanceCorrelation") {
n <- seq_len(nrow(profiles))
matrix[cbind(n, n)] <- 0
matrix <- matrix(0L, nrow = nrow(profiles), ncol = nrow(profiles))
for (i in seq_len(nrow(profiles))) { # rows
p_i <- unlist(profiles[i,])
for (j in seq_len(nrow(profiles))) { # columns
Expand All @@ -111,7 +111,8 @@ getDistanceMatrix <- function(profiles = NULL, method = "mutualInformation") {
# Swich the value so that the profiles with a high correlation
# are clustered together
matrix <- 1 - matrix

matrix <- as.data.frame(matrix)

profileNames <- rownames(profiles)
colnames(matrix) <- profileNames[seq_len(length(profileNames)) - 1]
rownames(matrix) <- profileNames
Expand Down
1 change: 0 additions & 1 deletion inst/PhyloProfile/data/newTaxa.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
ncbiID fullName rank parentID
473542 test unknown species species 39107

0 comments on commit db77479

Please sign in to comment.