initialize the motif_editor with analysis motifs
[mussa.git] / qui / motif_editor / MotifModel.cpp
index 1bb05e471a3b1db5d62a48601986262eb7efda58..81bd954c5fc02a42cd2b4407c18761588a615976 100644 (file)
@@ -2,9 +2,25 @@
 
 #include <QColor>
 
-MotifModel::MotifModel(QObject *parent) 
+MotifModel::MotifModel(MussaRef m, QObject *parent) 
   : QAbstractTableModel(parent)
 {
+  const std::set<Sequence>& motif_set = m->motifs();
+  boost::shared_ptr<AnnotationColors> cm = m->colorMapper();
+  
+  if (motif_set.size() == 0) {
+    push_empty();
+  } else {
+    std::set<Sequence>::const_iterator motif_i;
+    for(motif_i = motif_set.begin();
+        motif_i != motif_set.end();
+        ++motif_i)
+    {
+      // ideally we'd know what the motif color was?
+      MotifElement new_element(*motif_i, cm->lookup("motif", motif_i->get_sequence()));
+      push_back(new_element);
+    }
+  }
 }
 
 void MotifModel::assign(