JAL-4134 display tree for columns - selecting an internal node selects column in...
[jalview.git] / src / jalview / gui / AlignFrame.java
index 7b310b1..82ec1d2 100644 (file)
@@ -155,6 +155,7 @@ import jalview.viewmodel.AlignmentViewport;
 import jalview.viewmodel.ViewportRanges;
 import jalview.ws.DBRefFetcher;
 import jalview.ws.DBRefFetcher.FetchFinishedListenerI;
+import jalview.ws.datamodel.alphafold.PAEContactMatrix;
 import jalview.ws.jws1.Discoverer;
 import jalview.ws.jws2.Jws2Discoverer;
 import jalview.ws.jws2.jabaws2.Jws2Instance;
@@ -4131,6 +4132,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     return showNewickTree(nf, treeTitle, null, w, h, x, y);
   }
 
+
   /**
    * Add a treeviewer for the tree extracted from a Newick file object to the
    * current alignment view
@@ -4181,6 +4183,40 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     return tp;
   }
 
+
+  public void showContactMapTree(AlignmentAnnotation aa,
+          PAEContactMatrix cm)
+  {
+    int x = 4, y = 5;
+    int w = 400, h = 500;
+    try
+    {
+      NewickFile fin = new NewickFile(
+              new FileParse(cm.getNewickString(), DataSourceType.PASTE));
+      fin.parse();
+      if (fin.getTree() == null)
+      {
+        return;
+      }
+      String title = "PAE Matrix Tree for "
+              + cm.getReferenceSeq().getDisplayId(false);
+      TreePanel tp = new TreePanel(alignPanel, fin, aa, title);
+
+      tp.setSize(w, h);
+
+      if (x > 0 && y > 0)
+      {
+        tp.setLocation(x, y);
+      }
+
+      Desktop.addInternalFrame(tp, title, w, h);
+    } catch (Throwable xx)
+    {
+      Console.error("Unexpected exception showing tree for contact matrix",
+              xx);
+    }
+
+  }
   private boolean buildingMenu = false;
 
   /**
@@ -5930,6 +5966,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   {
     return lastFeatureSettingsBounds;
   }
+
 }
 
 class PrintThread extends Thread