add dirty flag
[mussa.git] / alg / mussa.cpp
index 95a0a7daca91ec0564ddbbf55110c439b62749c2..dc86cba1b8bc97230d1e7e4faa01c5cc543e9046 100644 (file)
@@ -43,7 +43,8 @@ Mussa::Mussa(const Mussa& m)
     win_append(m.win_append),
     thres_append(m.thres_append),
     motif_sequences(m.motif_sequences),
-    color_mapper(m.color_mapper)
+    color_mapper(m.color_mapper),
+    dirty(m.dirty)
 {
   connect(&the_paths, SIGNAL(progress(const std::string&, int, int)), 
           this, SIGNAL(progress(const std::string&, int, int)));
@@ -63,6 +64,7 @@ Mussa::clear()
   motif_sequences.clear();
   if(color_mapper) color_mapper->clear();
   the_paths.clear();
+  dirty = false;
 }
 
 // these 5 simple methods manually set the parameters for doing an analysis
@@ -72,6 +74,7 @@ void
 Mussa::set_name(string a_name)
 {
   analysis_name = a_name;
+  dirty = true;
 }
 
 string Mussa::get_name()
@@ -92,6 +95,7 @@ void
 Mussa::set_window(int a_window)
 {
   window = a_window;
+  dirty = true;
 }
 
 int Mussa::get_window() const
@@ -103,8 +107,10 @@ void
 Mussa::set_threshold(int a_threshold)
 {
   threshold = a_threshold;
-  if (a_threshold > soft_thres) 
+  dirty = true;
+  if (a_threshold > soft_thres) {
     soft_thres = a_threshold;
+  }
 }
 
 int Mussa::get_threshold() const
@@ -133,6 +139,7 @@ void
 Mussa::set_analysis_mode(enum analysis_modes new_ana_mode)
 {
   ana_mode = new_ana_mode;
+  dirty = true;
 }
 
 enum Mussa::analysis_modes Mussa::get_analysis_mode() const
@@ -259,11 +266,13 @@ void Mussa::append_sequence(const Sequence& a_seq)
 {
   boost::shared_ptr<Sequence> seq_copy(new Sequence(a_seq));
   the_seqs.push_back(seq_copy);
+  dirty = true;
 }
 
 void Mussa::append_sequence(boost::shared_ptr<Sequence> a_seq)
 {
   the_seqs.push_back(a_seq);
+  dirty = true;
 }
 
 
@@ -286,6 +295,7 @@ void Mussa::load_sequence(fs::path seq_file, fs::path annot_file,
     aseq->set_species(*name);
   }
   the_seqs.push_back(aseq);
+  dirty = true;
 }
 
 void
@@ -399,6 +409,7 @@ Mussa::load_mupa_file(fs::path para_file_path)
   {
     throw mussa_load_error("Config File: " + para_file_path.string() + " not found");
   }
+  dirty = true;
 }
 
 
@@ -573,6 +584,7 @@ Mussa::save()
   } else {
     throw mussa_error("Can't save analysis without an analysis name");
   }
+  dirty = false;
 }
 
 void