lingpy / lingpy
Showing 1 of 1 files from the diff.

@@ -979,7 +979,7 @@
 979 979 980 980 ` # plot the reference tree` 981 981 ` if keywords['show_tree']:` 982 - ` tree_matrix, taxa = nwk2tree_matrix(tree)` 982 + ` tree_matrix, taxa_in_matrix = nwk2tree_matrix(tree)` 983 983 ` ax1 = fig.add_axes(` 984 984 ` [` 985 985 ` keywords['left'],`
@@ -991,7 +991,7 @@
 991 991 ` # [0.01,0.1,0.2,0.7])` 992 992 ` d = sch.dendrogram(` 993 993 ` np.array(tree_matrix),` 994 - ` labels=[t for t in taxa],` 994 + ` labels=[t for t in taxa_in_matrix],` 995 995 ` orientation='left',` 996 996 997 997 ` )`
@@ -1007,11 +1007,18 @@
 1007 1007 ` else:` 1008 1008 ` left = keywords['left']` 1009 1009 ` taxa = tree.taxa` 1010 + ` taxa_in_matrix = taxa` 1010 1011 1011 1012 ` # start iterating over taxa in order of the reference tree and fill in the` 1012 1013 ` # matrix with numbers of shared cognates` 1013 1014 ` if keywords['matrix']:` 1014 - ` matrix = keywords['matrix']` 1015 + ` matrix = [[cell for cell in row] for row in keywords['matrix']]` 1016 + ` conv = {}` 1017 + ` for i, taxon in enumerate(taxa):` 1018 + ` conv[i] = taxa_in_matrix.index(taxon)` 1019 + ` for i, taxonA in enumerate(taxa):` 1020 + ` for j, taxonB in enumerate(taxa):` 1021 + ` matrix[i][j] = keywords["matrix"][conv[i]][conv[j]]` 1015 1022 ` else:` 1016 1023 ` for i, taxonA in enumerate(taxa):` 1017 1024 ` for j, taxonB in enumerate(taxa):`
Files Coverage
src/lingpy 87.57%
tests 98.86%
Project Totals (123 files) 89.24%