Skip to content

Commit

Permalink
Fix incorrect generation of axis labels for pcoa algorithms with no e…
Browse files Browse the repository at this point in the history
…igenvalues
  • Loading branch information
HannesHolste committed Feb 20, 2017
1 parent 15fe016 commit a3cfcf2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions mdsa/pcoa.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def pcoa(distance_matrix, algorithm, num_dimensions_out=10):

# Generate axis labels for output
axis_labels = ['PC%d' % i for i in range(1, len(eigenvectors) + 1)]
axis_labels = axis_labels[:num_dimensions_out]

# Some algorithms do not return eigenvalues. Thus, we cannot compute
# the array of proportion of variance explained and we cannot sort the
Expand Down Expand Up @@ -182,8 +183,6 @@ def pcoa(distance_matrix, algorithm, num_dimensions_out=10):
eigenvectors = eigenvectors[:, :num_dimensions_out]
eigenvalues = eigenvalues[:num_dimensions_out]

axis_labels = axis_labels[:num_dimensions_out]

# Calculate the array of proportion of variance explained
proportion_explained = eigenvalues / eigenvalues.sum()

Expand Down

0 comments on commit a3cfcf2

Please sign in to comment.