diff --git a/test/rfile123.txt b/test/rfile123.txt index af5a0ead..eac6e460 100644 --- a/test/rfile123.txt +++ b/test/rfile123.txt @@ -1,9 +1,19 @@ -7 12673_8#24.contigs_velvet.fa -1 12673_8#34.contigs_velvet.fa -2 12673_8#43.contigs_velvet.fa -6 12754_4#79.contigs_velvet.fa -4 12754_4#85.contigs_velvet.fa -5 12754_4#89.contigs_velvet.fa -8 12754_5#73.contigs_velvet.fa -3 12754_5#78.contigs_velvet.fa -9 12754_5#71.contigs_velvet.fa +12754_5#73 12754_5#73.contigs_velvet.fa +12754_4#79 12754_4#79.contigs_velvet.fa +12754_4#71 12754_4#71.contigs_velvet.fa +19183_4#55 19183_4#55.contigs_velvet.fa +19183_4#59 19183_4#59.contigs_velvet.fa +12754_4#89 12754_4#89.contigs_velvet.fa +19183_4#48 19183_4#48.contigs_velvet.fa +12754_5#37 12754_5#37.contigs_velvet.fa +19183_4#63 19183_4#63.contigs_velvet.fa +12754_5#71 12754_5#71.contigs_velvet.fa +19183_4#67 19183_4#67.contigs_velvet.fa +19183_4#69 19183_4#69.contigs_velvet.fa +12754_5#55 12754_5#55.contigs_velvet.fa +12754_4#85 12754_4#85.contigs_velvet.fa +12673_8#34 12673_8#34.contigs_velvet.fa +19183_4#66 19183_4#66.contigs_velvet.fa +12754_5#57 12754_5#57.contigs_velvet.fa +12754_5#16 12754_5#16.contigs_velvet.fa +12754_5#88 12754_5#88.contigs_velvet.fa diff --git a/test/test-update.py b/test/test-update.py index 74067ebf..2fb88159 100755 --- a/test/test-update.py +++ b/test/test-update.py @@ -28,12 +28,12 @@ def run_regression(x, y, threshold = 0.99): sys.stderr.write("Distance matrix order failed!\n") sys.exit(1) -def compare_sparse_matrices(d1,d2,r1,r2): +def compare_sparse_matrices(d1,d2,r1,r2,flag): d1_pairs = get_seq_tuples(d1.row,d1.col,r1) d2_pairs = get_seq_tuples(d2.row,d2.col,r2) d1_dists = [] d2_dists = [] - if (len(d1_pairs) != len(d2_pairs)): + if (len(d1_pairs) != len(d2_pairs) and flag == " "): # May not be equal if reciprocal/unique count sys.stderr.write("Distance matrix number of entries differ!\n") print(d1_pairs) print(d2_pairs) @@ -41,6 +41,7 @@ def compare_sparse_matrices(d1,d2,r1,r2): for (pair1,dist1) in zip(d1_pairs,d1.data): for (pair2,dist2) in zip(d2_pairs,d2.data): +# print('Pair1: ' + str(pair1) + ' Dist1: ' + str(dist1) + 'Pair2: ' + str(pair2) + ' Dist2: ' + str(dist2)) if pair1 == pair2: d1_dists.append(dist1) d2_dists.append(dist2) @@ -90,13 +91,13 @@ def old_get_seq_tuples(rows,cols): S1 = scipy.sparse.load_npz("batch12/batch12_rank_2_fit.npz") S2 = scipy.sparse.load_npz("batch2/batch2_rank_2_fit.npz") sys.stderr.write("Comparing sparse matrices at rank 2 after first query calculated with options " + lineage_option_string + "\n") - compare_sparse_matrices(S1,S2,rlist1,rlist2) + compare_sparse_matrices(S1,S2,rlist1,rlist2,lineage_option_string) # Check rank 1 S3 = scipy.sparse.load_npz("batch12/batch12_rank_1_fit.npz") S4 = scipy.sparse.load_npz("batch2/batch2_rank_1_fit.npz") sys.stderr.write("Comparing sparse matrices at rank 1 after first query calculated with options " + lineage_option_string + "\n") - compare_sparse_matrices(S3,S4,rlist1,rlist2) + compare_sparse_matrices(S3,S4,rlist1,rlist2,lineage_option_string) # Check distances after second query @@ -117,10 +118,10 @@ def old_get_seq_tuples(rows,cols): S5 = scipy.sparse.load_npz("batch123/batch123_rank_2_fit.npz") S6 = scipy.sparse.load_npz("batch3/batch3_rank_2_fit.npz") sys.stderr.write("Comparing sparse matrices at rank 2 after second query calculated with options " + lineage_option_string + "\n") - compare_sparse_matrices(S5,S6,rlist3,rlist4) + compare_sparse_matrices(S5,S6,rlist3,rlist4,lineage_option_string) # Check rank 1 S7 = scipy.sparse.load_npz("batch123/batch123_rank_1_fit.npz") S8 = scipy.sparse.load_npz("batch3/batch3_rank_1_fit.npz") sys.stderr.write("Comparing sparse matrices at rank 1 after second query calculated with options " + lineage_option_string + "\n") - compare_sparse_matrices(S7,S8,rlist3,rlist4) + compare_sparse_matrices(S7,S8,rlist3,rlist4,lineage_option_string)