From: Diane Trout Date: Wed, 8 Mar 2006 06:57:29 +0000 (+0000) Subject: fix segfault when changing soft threshold when no analysis is loaded X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=mussa.git;a=commitdiff_plain;h=263c577e74c6a9d986ea02dc6f2a41ac965d488f fix segfault when changing soft threshold when no analysis is loaded somehow the trans_path_search tweaked things so that it when it was called again it'd seg fault. --- diff --git a/alg/nway_other.cxx b/alg/nway_other.cxx index 94df136..b788d6e 100644 --- a/alg/nway_other.cxx +++ b/alg/nway_other.cxx @@ -210,6 +210,8 @@ bool is_transitive_path(const vector& path, void NwayPaths::trans_path_search(vector > all_comparisons) { + if (all_comparisons.size() == 0 or all_comparisons[0].size() == 0) + return; vector path; int win_i, window_num; bool still_paths; @@ -227,7 +229,7 @@ NwayPaths::trans_path_search(vector > all_comparisons) cout << "window number = " << window_num << endl; // just a sanity check cout << "trans: comparison size= " << all_comparisons.size() << endl; // loop thru all windows in first species - for (win_i = 0; win_i < window_num; win_i++) + for (win_i = 0; win_i != window_num; win_i++) { // if 1st seq has a match to all the others for this window, // then make all possible paths out of all these matches (in all_matches) diff --git a/alg/test/test_mussa.cxx b/alg/test/test_mussa.cxx index a55b8b5..00cae24 100644 --- a/alg/test/test_mussa.cxx +++ b/alg/test/test_mussa.cxx @@ -58,6 +58,19 @@ BOOST_AUTO_TEST_CASE( mussa_sequences ) BOOST_CHECK_EQUAL( analysis.sequences()[2].get_seq(), s2); } +// for some reason we can call nway once safely but it +// somehow changed things and caused a segfault +// fixed by adding a return statement in trans_path_search +BOOST_AUTO_TEST_CASE ( empty_mussa_set_threshold ) +{ + Mussa m; + m.set_soft_thres(15); + m.nway(); + + m.set_soft_thres(25); + m.nway(); +} + #include BOOST_AUTO_TEST_CASE( mussa_load_mupa ) { diff --git a/py/getm.py b/py/getm.py index be5be65..e11d0c3 100644 --- a/py/getm.py +++ b/py/getm.py @@ -4,7 +4,7 @@ import mussa m = mussa.Mussa() #m.load_mupa("examples/mck3test.mupa") #m.analyze(0, 0, mussa.analysis_modes.TransitiveNway, 0) -m.load("../mussa_analyses/land/myogenin_w30_t21") +m.load("../../mussa_analyses/land/myogenin_w30_t21") path = m.paths() count = 0