Uses RemoveGapsCommand
[jalview.git] / src / jalview / gui / AlignFrame.java
index 1bcd39e..73872d0 100755 (executable)
@@ -44,8 +44,7 @@ import org.biojava.dasobert.eventmodel.*;
  * @author $author$
  * @version $Revision$
  */
-public class AlignFrame
-    extends GAlignFrame implements DropTargetListener, FeatureListener
+public class AlignFrame extends GAlignFrame implements DropTargetListener
 {
   /** DOCUMENT ME!! */
   public static final int DEFAULT_WIDTH = 700;
@@ -115,15 +114,14 @@ public class AlignFrame
   {
     this.setDropTarget(new java.awt.dnd.DropTarget(this, this));
 
-    if (viewport.hconsensus == null)
+    if (viewport.conservation == null)
     {
-      //Out of memory calculating consensus.
       BLOSUM62Colour.setEnabled(false);
-      PIDColour.setEnabled(false);
       conservationMenuItem.setEnabled(false);
       modifyConservation.setEnabled(false);
-      abovePIDThreshold.setEnabled(false);
-      modifyPID.setEnabled(false);
+    //  PIDColour.setEnabled(false);
+    //  abovePIDThreshold.setEnabled(false);
+    //  modifyPID.setEnabled(false);
     }
 
     String sortby = jalview.bin.Cache.getDefault("SORT_ALIGNMENT", "No sort");
@@ -415,6 +413,9 @@ public class AlignFrame
       tabbedPane.addTab(ap.av.viewName==null?"Original":ap.av.viewName, ap);
     }
 
+    ap.av.updateConsensus(ap);
+    ap.av.updateConservation(ap);
+
 
     ap.av.addPropertyChangeListener(new PropertyChangeListener()
     {
@@ -487,17 +488,6 @@ public class AlignFrame
     }
   }
 
-  public void comeBackLater(FeatureEvent evt)
-  {}
-
-  public void newFeatures(FeatureEvent evt)
-  {
-    if (evt.getFeatures().length > 0)
-    {
-      alignPanel.seqPanel.seqCanvas.fr.featuresAdded();
-      alignPanel.repaint();
-    }
-  }
 
   Hashtable progressBars;
   public void setProgressBar(String message, long id)
@@ -538,6 +528,8 @@ public class AlignFrame
   }
 
 
+
+
   /*
    Added so Castor Mapping file can obtain Jalview Version
   */
@@ -1289,8 +1281,6 @@ public class AlignFrame
     for (int i = 0; i < sg.getSize(false); i++)
     {
       SequenceI seq = sg.getSequenceAt(i);
-      int index = viewport.getAlignment().findIndex(seq);
-
       seq.deleteChars(sg.getStartRes(), sg.getEndRes() + 1);
 
       // If the cut affects all sequences, remove highlighted columns
@@ -1305,10 +1295,6 @@ public class AlignFrame
         viewport.getAlignment().deleteSequence(seq);
         PaintRefresher.Refresh(alignPanel,alignPanel.av.getSequenceSetId(),seq,null);
       }
-      else
-      {
-        viewport.getAlignment().getSequences().setElementAt(seq, index);
-      }
     }
 
     viewport.setSelectionGroup(null);
@@ -1616,8 +1602,9 @@ public class AlignFrame
 
      if (av.hconsensus != null && av.autoCalculateConsensus)
      {
-       av.updateConsensus();
-       av.updateConservation();
+       av.updateConsensus(ap);
+       av.updateConservation(ap);
+       ap.annotationPanel.repaint();
      }
 
      resetAllColourSchemes();
@@ -2747,16 +2734,26 @@ public class AlignFrame
   {
     return ShowNewickTree(nf,title,600,500,4,5);
   }
+  public TreePanel ShowNewickTree(NewickFile nf, String title, AlignmentView input)
+  {
+    return ShowNewickTree(nf,title, input, 600,500,4,5);
+  }
+  public TreePanel ShowNewickTree(NewickFile nf, String title, int w,int h,int x, int y) {
+    return ShowNewickTree(nf, title, null, w, h, x, y);
+  }
   /**
-   * DOCUMENT ME!
+   * Add a treeviewer for the tree extracted from a newick file object to the current alignment view
    *
-   * @param nf DOCUMENT ME!
-   * @param title DOCUMENT ME!
-   *
-   * @return DOCUMENT ME!
+   * @param nf the tree
+   * @param title tree viewer title
+   * @param input Associated alignment input data (or null)
+   * @param w width
+   * @param h height
+   * @param x position
+   * @param y position
+   * @return TreePanel handle
    */
-  public TreePanel ShowNewickTree(NewickFile nf, String title, int w,int h,int x, int y)
-  {
+  public TreePanel ShowNewickTree(NewickFile nf, String title, AlignmentView input, int w,int h,int x, int y) {
     TreePanel tp = null;
 
     try
@@ -2768,7 +2765,7 @@ public class AlignFrame
         tp = new TreePanel(alignPanel,
                            "FromFile",
                            title,
-                           nf);
+                           nf, input);
 
         tp.setSize(w,h);
 
@@ -2884,7 +2881,7 @@ public class AlignFrame
               if (msa.getSequences().length == 1)
               {
                 // Single Sequence prediction
-                new jalview.ws.JPredClient(sh, title, false, msa, af);
+                new jalview.ws.JPredClient(sh, title, false, msa, af, true);
               }
               else
               {
@@ -2892,7 +2889,7 @@ public class AlignFrame
                 {
                   // Sequence profile based prediction
                   new jalview.ws.JPredClient(sh,
-                      title, true, msa, af);
+                      title, true, msa, af, true);
                 }
               }
             }