rename [gset_soft_thres to [gs]et_soft_threshold]
authorDiane Trout <diane@caltech.edu>
Sat, 27 May 2006 01:08:29 +0000 (01:08 +0000)
committerDiane Trout <diane@caltech.edu>
Sat, 27 May 2006 01:08:29 +0000 (01:08 +0000)
alg/mussa.cpp
alg/mussa.hpp
alg/nway_paths.cpp
alg/nway_paths.hpp
alg/test/test_mussa.cpp
alg/test/test_nway.cpp
py/mussa.cpp
qui/MussaWindow.cpp

index 9efe35adf5781b48f0ff405336e80ddd7eac0101..003f68aac8e045e2b8b309133c2914b75b167f2e 100644 (file)
@@ -95,7 +95,8 @@ void
 Mussa::set_threshold(int a_threshold)
 {
   threshold = a_threshold;
-  //soft_thres = a_threshold;
+  if (a_threshold > soft_thres) 
+    soft_thres = a_threshold;
 }
 
 int Mussa::get_threshold() const
@@ -104,12 +105,18 @@ int Mussa::get_threshold() const
 }
 
 void
-Mussa::set_soft_thres(int sft_thres)
+Mussa::set_soft_threshold(int new_threshold)
 {
-  soft_thres = sft_thres;
+  if (new_threshold < threshold) {
+    soft_thres = threshold;
+  } else if (new_threshold > window) {
+    soft_thres = window; 
+  } else {
+    soft_thres = new_threshold;
+  }
 }
 
-int Mussa::get_soft_thres() const
+int Mussa::get_soft_threshold() const
 {
   return soft_thres;
 }
@@ -471,7 +478,7 @@ Mussa::nway()
 {
   vector<string> some_Seqs;
 
-  the_paths.set_soft_thres(soft_thres);
+  the_paths.set_soft_threshold(soft_thres);
 
   if (ana_mode == TransitiveNway) {
     the_paths.trans_path_search(all_comps);
index 4fae7de68b8f90be4f34f98a420ffe97319c389b..2ba11719bed212cbef33c4ce9093652a2919451c 100644 (file)
@@ -66,12 +66,15 @@ class Mussa
     void set_window(int a_window);
     //! get number of bases for the sliding window
     int get_window() const;
-    //! set number of bases that must match for a window to be saved
+    //! set number of bases that must match for a window to be saved 
+    //! if threshold > soft_threshold this also sets soft_threshold
     void set_threshold(int a_threshold);
     //! get number of bases that must match for a window to be saved
     int get_threshold() const;
-    void set_soft_thres(int sft_thres);
-    int get_soft_thres() const;
+    //! sets the threshold used for computing the nway paths 
+    //! must be in range [threshold..window size]
+    void set_soft_threshold(int sft_thres);
+    int get_soft_threshold() const;
  
     void set_analysis_mode(enum analysis_modes new_ana_mode);
     enum analysis_modes get_analysis_mode() const;
index f71b0283bb84db0e87981ecf358a6972795ae46e..4f49deb6806c4694c47faac9112b19a7c582af98 100644 (file)
@@ -41,7 +41,7 @@ NwayPaths::setup(int w, int t)
 }
 
 void
-NwayPaths::set_soft_thres(int sft_thres)
+NwayPaths::set_soft_threshold(int sft_thres)
 {
   soft_thres = sft_thres;
 }
index a25cfcebeaf751e3b6669a8d14228dfa440807f3..10aa6cba8581d861d0b47773b02d5adb8334ce46 100644 (file)
@@ -40,7 +40,7 @@ class NwayPaths
     //! threshold
     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);
+    void set_soft_threshold(int soft_thres);
     //! return minimum threshold for this analysis
     int get_threshold() const;
     //! return window size used for this analysis
index f215816efd396bc8925ebc9e242b375ff8da0873..8e31eb4de4bb9b1b6a6c28c694f7883b21f1809f 100644 (file)
@@ -28,6 +28,13 @@ BOOST_AUTO_TEST_CASE( mussa_simple )
   BOOST_CHECK_EQUAL(m.get_window(), 30);
   m.set_threshold(21);
   BOOST_CHECK_EQUAL(m.get_threshold(), 21);
+  BOOST_CHECK_EQUAL(m.get_soft_threshold(), 21);
+  m.set_soft_threshold(19);
+  BOOST_CHECK_EQUAL(m.get_soft_threshold(), 21);
+  m.set_soft_threshold(35);
+  BOOST_CHECK_EQUAL(m.get_soft_threshold(), 30);
+  m.set_soft_threshold(25);
+  BOOST_CHECK_EQUAL(m.get_soft_threshold(), 25);
   m.set_analysis_mode(Mussa::RadialNway);
   BOOST_CHECK_EQUAL(m.get_analysis_mode(), Mussa::RadialNway);
     
@@ -74,10 +81,10 @@ BOOST_AUTO_TEST_CASE( mussa_sequences )
 BOOST_AUTO_TEST_CASE ( empty_mussa_set_threshold )
 {
   Mussa m;
-  m.set_soft_thres(15);
+  m.set_soft_threshold(15);
   m.nway();
 
-  m.set_soft_thres(25);
+  m.set_soft_threshold(25);
   m.nway();
 }
 
index 68ee988d4cb65187699d9b604c78cdd4eda2a817..1c63a4a9681af26cdcc8883f3a377ed75c960b41 100644 (file)
@@ -70,12 +70,12 @@ BOOST_AUTO_TEST_CASE( nway_refine )
   BOOST_CHECK( first_refined_size > 0 );
 
   // we're using a window size 30 (threshold 20) example
-  m1.set_soft_thres(22);
+  m1.set_soft_threshold(22);
   m1.nway();
   BOOST_CHECK( npath.refined_path_size() > 0);
   BOOST_CHECK( npath.refined_path_size() < first_refined_size);
 
-  m1.set_soft_thres(20);
+  m1.set_soft_threshold(20);
   m1.nway();
   BOOST_CHECK_EQUAL(npath.refined_path_size(), first_refined_size);
 }
@@ -184,6 +184,6 @@ GTTTTAATAAATGCACAATGCTCTCTTCCTGTTCTTC";
   m1.add_a_seq(seq3);
 
   m1.analyze(10, 8);
-  m1.set_soft_thres(10);
+  m1.set_soft_threshold(10);
   m1.nway();
 }
index a16f9ad40abe92a53d8603f2a42de07fc66ad099..ac29ff5cdb61926ba1096b12a712b936bb4f30c9 100644 (file)
@@ -19,7 +19,7 @@ void export_mussa()
                   "the number of base pairs in the sliding window")
     .add_property("threshold", &Mussa::get_threshold, &Mussa::set_threshold,
                   "how many base pairs must match between two windows")
-    .def("softThreshold", &Mussa::set_soft_thres)
+    .def("softThreshold", &Mussa::set_soft_threshold)
     .add_property("analysisMode", &Mussa::get_analysis_mode, 
                                    &Mussa::set_analysis_mode)
     .add_property("analysisModeName", &Mussa::get_analysis_mode_name)
index e76e7a1c2860699c2bbd12b0177034c60c8f0757..354f8b65697f8560350b321992c4f8dac3daf019 100644 (file)
@@ -401,8 +401,8 @@ void MussaWindow::newMussaWindow()
 
 void MussaWindow::setSoftThreshold(int threshold)
 {
-  if (analysis->get_soft_thres() != threshold) {
-    analysis->set_soft_thres(threshold);
+  if (analysis->get_soft_threshold() != threshold) {
+    analysis->set_soft_threshold(threshold);
     analysis->nway();
     updateLinks();
     update();