recover threshold and window size
authorDiane Trout <diane@caltech.edu>
Tue, 28 Mar 2006 02:40:09 +0000 (02:40 +0000)
committerDiane Trout <diane@caltech.edu>
Tue, 28 Mar 2006 02:40:09 +0000 (02:40 +0000)
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
alg/nway_paths.cpp
alg/nway_paths.hpp
alg/test/test_mussa.cpp
qui/MussaWindow.cpp

index 09cb297db3d57e4e0d329973a328188b708e89cb..e713f52cf7130ea76f40b72a464416d855f6b1e5 100644 (file)
@@ -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();
 
index 3cd47232e1da60c2a007e589bad5dfaeff7c3c9a..33c195b5e6aa3288164126cbdd8541dd4eb61876 100644 (file)
@@ -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
index 3e23f15c5bcd438e1c85aaca341ed42aaa4fdb54..f8337e22b5cd46ad0b31d00a3dfc100df4841fef 100644 (file)
@@ -40,6 +40,10 @@ class NwayPaths
     void setup(int w, int t);
     void setup_ent(double new_entropy_thres, std::vector<std::string> 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<std::vector<FLPs> > all_comparisons);
     void trans_path_search(std::vector<std::vector<FLPs> > all_comparisons);
index 97044d61b6e6155a1b424427e50b9e5e8ccf1359..852d2fd0aa98bb80f67d95d3ebbf2d7de9255ba8 100644 (file)
@@ -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 )
index 808d1888875599291061120e862bc772fa2da46a..4e11f474d4418ca65e1c51f309a19a7269e250d0 100644 (file)
@@ -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<MussaAlignedWindow *>::iterator maw_i = aligned_windows.begin();
        maw_i != aligned_windows.end();
        ++maw_i)