I created my own linkage function, that produces a linkage matrix with the right format of scipy (n-1x4). When I try to use the dendrogram function with the labels I used for the linkage, the dendrogram shows that in an iteration certain sequences are merged but the linkage matrix showed that other sequences were merged at the same iteration.
Adding Images: https://i.sstatic.net/JKKBH02C.png These are the actual sequences merged: "Step 1: Merging 80c8714e-1899-407e-960d-5391bfba9a75 and b4a3e9f4-aae9-41d4-930a-9d2422e1b37f"
As you can see these are different sequences.
I'd like to ask if I'm missing something perhaps there's a way to use the linkage matrix to create the sequence labels since they are correct. (Also the dendrogram shoes correct output only the labels are not)
That's the code for the dendrogram
sequence_string_data = [code_from_before]
linkage_matrix = clustering(sequence_string_data)
seq_ids = list(sequences.keys())
seq_labels = [f"{seq_id} (size={len(sequences[seq_id])})" for seq_id in seq_ids]
plt.figure(figsize=(15, 10))
dendro = dendrogram(linkage_matrix, labels=seq_labels, leaf_rotation=90, leaf_font_size=8)
Thank you!
I tried changing both functions to see if there's something else but to no avail.