load and display a motif list
[mussa.git] / qui / PathScene.cpp
index 3f0e3355de96facf70f0c7259d9c749ef0357aeb..7040b6969fd71667e284357122ed4cfffefbc95a 100644 (file)
@@ -112,6 +112,30 @@ void PathScene::setClipPlane(int newZ)
   }
 }
 
+void PathScene::loadMotifList()
+{
+  QString caption("Load a motif list");
+  QString filter("Motif list(*.txt *.mtl)");
+  QString path = QFileDialog::getOpenFileName(this,
+                                                   caption, 
+                                                   QDir::currentPath(),
+                                                   filter);
+  // user hit cancel?
+  if (path.isNull()) 
+    return;
+  // try to load safely
+  try {
+    mussaAnalysis->load_motifs(path.toStdString());
+    updateScene();
+  } catch (runtime_error e) {
+    QString msg("Unable to load ");
+    msg += path;
+    msg += "\n";
+    msg += e.what();
+    QMessageBox::warning(this, "Load Motifs", msg);
+  }
+  assert (mussaAnalysis != 0);
+}
 void PathScene::loadMupa()
 {
   QString caption("Load a mussa parameter file");
@@ -245,7 +269,7 @@ void PathScene::updateScene()
       ++seq_itor)
   {
     y = y - 100;
-    gl_seq = new GlSequence(*seq_itor);
+    gl_seq = new GlSequence(*seq_itor, mussaAnalysis->colorMapper());
     gl_seq->setX(0);
     gl_seq->setY(y);
     if (gl_seq->length() > max_base_pairs ) max_base_pairs = gl_seq->length();