From 15c1aab574804da28427820a72a1b99a7400c2e8 Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Tue, 28 Mar 2006 02:40:09 +0000 Subject: [PATCH] recover threshold and window size ticket:55 This recovers the threshold and window size from the museq and makes sure that the spinner is set to that range. --- alg/mussa.cpp | 5 +++++ alg/nway_paths.cpp | 9 +++++++++ alg/nway_paths.hpp | 4 ++++ alg/test/test_mussa.cpp | 22 ++++++++++++++++++++++ qui/MussaWindow.cpp | 9 +++++---- 5 files changed, 45 insertions(+), 4 deletions(-) diff --git a/alg/mussa.cpp b/alg/mussa.cpp index 09cb297..e713f52 100644 --- a/alg/mussa.cpp +++ b/alg/mussa.cpp @@ -540,6 +540,11 @@ Mussa::load(string ana_file) a_file_path = file_path_base + ".muway"; //cout << " loading museq: " << a_file_path << endl; the_paths.load(a_file_path); + // perhaps this could be more elegent, but at least this'll let + // us know what our threshold and window sizes were when we load a muway + window = the_paths.get_window(); + threshold = the_paths.get_threshold(); + soft_thres = threshold; int seq_num = the_paths.sequence_count(); diff --git a/alg/nway_paths.cpp b/alg/nway_paths.cpp index 3cd4723..33c195b 100644 --- a/alg/nway_paths.cpp +++ b/alg/nway_paths.cpp @@ -44,6 +44,15 @@ NwayPaths::set_soft_thres(int sft_thres) soft_thres = sft_thres; } +int NwayPaths::get_threshold() const +{ + return threshold; +} + +int NwayPaths::get_window() const +{ + return win_size; +} // dumbly goes thru and combines path windows exactly adjacent (ie + 1 index) // doesn't deal with interleaved adjacency diff --git a/alg/nway_paths.hpp b/alg/nway_paths.hpp index 3e23f15..f8337e2 100644 --- a/alg/nway_paths.hpp +++ b/alg/nway_paths.hpp @@ -40,6 +40,10 @@ class NwayPaths void setup(int w, int t); void setup_ent(double new_entropy_thres, std::vector some_Seqs); void set_soft_thres(int soft_thres); + //! return minimum threshold for this analysis + int get_threshold() const; + //! return window size used for this analysis + int get_window() const; void radiate_path_search(std::vector > all_comparisons); void trans_path_search(std::vector > all_comparisons); diff --git a/alg/test/test_mussa.cpp b/alg/test/test_mussa.cpp index 97044d6..852d2fd 100644 --- a/alg/test/test_mussa.cpp +++ b/alg/test/test_mussa.cpp @@ -109,6 +109,28 @@ BOOST_AUTO_TEST_CASE( mussa_load_full_path ) m1.analyze(0, 0); BOOST_CHECK( m1.size() > 0); + BOOST_CHECK_EQUAL( m1.get_window(), 30 ); + BOOST_CHECK_EQUAL( m1.get_threshold(), 20); +} + +BOOST_AUTO_TEST_CASE( mussa_load_analysis ) +{ + Mussa m1; + chdir( "examples" ); + const int bufsize = 1024; + char path_buf[bufsize]; + getcwd(path_buf, bufsize); + std::string base_path(path_buf); + chdir( ".." ); + m1.load_mupa_file( base_path + "/mck3test.mupa" ); + m1.analyze(0, 0); + + Mussa m2; + m2.load(base_path + "/mck3test_w30_t20"); + + BOOST_CHECK_EQUAL( m1.size(), m2.size() ); + BOOST_CHECK_EQUAL( m1.get_window(), m2.get_window() ); + BOOST_CHECK_EQUAL( m1.get_threshold(), m2.get_threshold() ); } BOOST_AUTO_TEST_CASE( mussa_load_motif ) diff --git a/qui/MussaWindow.cpp b/qui/MussaWindow.cpp index 808d188..4e11f47 100644 --- a/qui/MussaWindow.cpp +++ b/qui/MussaWindow.cpp @@ -53,9 +53,9 @@ MussaWindow::MussaWindow(Mussa *analysis_, QWidget *parent) : mussaViewTB.addWidget(&zoomBox); connect(&zoomBox, SIGNAL(valueChanged(int)), &browser, SLOT(setZoom(int))); - - threshold.setRange(10,30); - threshold.setThreshold(20); + + // threshold range is set in updateAnalysis + //scene->setClipPlane(20); // FIXME: for when we get the paths drawn at the appropriate depth //connect(&threshold, SIGNAL(thresholdChanged(int)), @@ -368,7 +368,8 @@ void MussaWindow::viewMussaAlignment() void MussaWindow::updateAnalysis() { - cout << "analysis updated" << endl; + threshold.setRange(analysis->get_threshold(),analysis->get_window()); + threshold.setThreshold(analysis->get_threshold()); for (list::iterator maw_i = aligned_windows.begin(); maw_i != aligned_windows.end(); ++maw_i) -- 2.30.2