Added clustalW 'realignment' (primitive)
authorjprocter <Jim Procter>
Mon, 30 May 2005 16:10:11 +0000 (16:10 +0000)
committerjprocter <Jim Procter>
Mon, 30 May 2005 16:10:11 +0000 (16:10 +0000)
src/jalview/gui/AlignFrame.java
src/jalview/jbgui/GAlignFrame.java
src/jalview/ws/MsaWSClient.java

index 343ca2b..4b2bdab 100755 (executable)
@@ -250,12 +250,12 @@ public class AlignFrame extends GAlignFrame
             viewport.alignment.deleteSequence(i);
         }
       }
-      viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences());
       updateEditMenuBar();
 
       viewport.updateConsensus();
       viewport.updateConservation();
       alignPanel.repaint();
+      viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences());
   }
 
   public void moveSelectedSequences(boolean up)
@@ -1190,6 +1190,42 @@ public class AlignFrame extends GAlignFrame
           jalview.ws.MsaWSClient ct = new jalview.ws.MsaWSClient("ClustalWS", title, msa, false, true);
         }
   }
+  public void ClustalRealign_actionPerformed(ActionEvent e)
+  {
+      // TODO:resolve which menu item was actually selected
+      // Now, check we have enough sequences
+        SequenceI[] msa=null;
+        if (viewport.getSelectionGroup() != null && viewport.getSelectionGroup().getSize()>1)
+        {
+          // JBPNote UGLY! To prettify, make SequenceGroup and Alignment conform to some common interface!
+          SequenceGroup seqs = viewport.getSelectionGroup();
+          int sz;
+          msa = new SequenceI[sz=seqs.getSize()];
+          for (int i = 0; i < sz; i++)
+          {
+            msa[i] = (SequenceI) seqs.getSequenceAt(i);
+          }
+
+          }
+        else
+        {
+          Vector seqs = viewport.getAlignment().getSequences();
+
+          if (seqs.size() > 1) {
+            msa = new SequenceI[seqs.size()];
+            for (int i = 0; i < seqs.size(); i++)
+            {
+              msa[i] = (SequenceI) seqs.elementAt(i);
+            }
+
+          }
+
+        }
+        if (msa!=null) {
+          jalview.ws.MsaWSClient ct = new jalview.ws.MsaWSClient("ClustalWS", title, msa, true, true);
+        }
+  }
+
 
   protected void jpred_actionPerformed(ActionEvent e)
 {
index 060c387..23c78f3 100755 (executable)
@@ -103,6 +103,7 @@ public class GAlignFrame extends JInternalFrame
   JMenuItem msaAlignMenuItem = new JMenuItem();\r
   JMenu jMenu2 = new JMenu();\r
   JMenuItem padGapsMenuitem = new JMenuItem();\r
+  JMenuItem ClustalRealign = new JMenuItem();\r
   public GAlignFrame()\r
   {\r
     ButtonGroup colours = new ButtonGroup();\r
@@ -787,6 +788,14 @@ public class GAlignFrame extends JInternalFrame
         padGapsMenuitem_actionPerformed(e);\r
       }\r
     });\r
+    ClustalRealign.setText("Clustal Realign...");\r
+    ClustalRealign.addActionListener(new ActionListener()\r
+    {\r
+      public void actionPerformed(ActionEvent e)\r
+      {\r
+        ClustalRealign_actionPerformed(e);\r
+      }\r
+    });\r
     alignFrameMenuBar.add(fileMenu);\r
     alignFrameMenuBar.add(editMenu);\r
     alignFrameMenuBar.add(searchMenu);\r
@@ -864,8 +873,9 @@ public class GAlignFrame extends JInternalFrame
     calculateMenu.addSeparator();\r
     calculateMenu.add(webService);\r
     webService.add(clustalAlignMenuItem);\r
-    webService.add(jpred);\r
     webService.add(msaAlignMenuItem);\r
+    webService.add(jpred);\r
+    webService.add(ClustalRealign);\r
     this.getContentPane().add(statusBar, BorderLayout.SOUTH);\r
     jMenu1.add(pasteNew);\r
     jMenu1.add(pasteThis);\r
@@ -1252,4 +1262,9 @@ public class GAlignFrame extends JInternalFrame
 \r
   }\r
 \r
+  protected void ClustalRealign_actionPerformed(ActionEvent e)\r
+  {\r
+\r
+  }\r
+\r
 }\r
index 36c3823..9626132 100755 (executable)
@@ -47,7 +47,7 @@ public class MsaWSClient
 
     wsInfo = new jalview.gui.WebserviceInfo(WebServiceJobTitle, WebServiceReference);
 
-    wsInfo.setProgressText("Alignment of "+altitle+"\nJob details\n");
+    wsInfo.setProgressText(((submitGaps) ? "Re-alignment" : "Alignment")+" of "+altitle+"\nJob details\n");
 
     // TODO: MuscleWS transmuted to generic MsaWS client
     MuscleWSServiceLocator loc = new MuscleWSServiceLocator(); // Default