after merge
authoramwaterhouse <Andrew Waterhouse>
Tue, 6 Dec 2005 11:46:19 +0000 (11:46 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 6 Dec 2005 11:46:19 +0000 (11:46 +0000)
72 files changed:
src/jalview/appletgui/APopupMenu.java
src/jalview/appletgui/AlignFrame.java
src/jalview/appletgui/AlignViewport.java
src/jalview/appletgui/AlignmentPanel.java
src/jalview/appletgui/CutAndPasteTransfer.java
src/jalview/appletgui/FeatureRenderer.java
src/jalview/appletgui/Finder.java
src/jalview/appletgui/FontChooser.java
src/jalview/appletgui/IdCanvas.java
src/jalview/appletgui/IdPanel.java
src/jalview/appletgui/OverviewPanel.java
src/jalview/appletgui/PCAPanel.java
src/jalview/appletgui/PairwiseAlignPanel.java
src/jalview/appletgui/RedundancyPanel.java
src/jalview/appletgui/RotatableCanvas.java
src/jalview/appletgui/SeqCanvas.java
src/jalview/appletgui/SeqPanel.java
src/jalview/appletgui/SequenceRenderer.java
src/jalview/appletgui/SliderPanel.java
src/jalview/appletgui/TreeCanvas.java
src/jalview/appletgui/TreePanel.java
src/jalview/appletgui/UserDefinedColours.java
src/jalview/bin/Jalview.java
src/jalview/bin/JalviewLite.java
src/jalview/binding/Feature.java [new file with mode: 0755]
src/jalview/binding/FeatureSettings.java [new file with mode: 0755]
src/jalview/binding/Features.java [new file with mode: 0755]
src/jalview/binding/JSeq.java
src/jalview/binding/JalviewModelSequence.java
src/jalview/binding/JalviewModelSequence2.java [deleted file]
src/jalview/binding/JalviewModelSequence2Item.java [deleted file]
src/jalview/binding/Pdbentry.java [new file with mode: 0755]
src/jalview/binding/PdbentryItem.java [new file with mode: 0755]
src/jalview/binding/Pdbids.java [new file with mode: 0755]
src/jalview/binding/Property.java [new file with mode: 0755]
src/jalview/binding/Setting.java [new file with mode: 0755]
src/jalview/datamodel/Alignment.java
src/jalview/datamodel/AlignmentI.java
src/jalview/datamodel/DBRefEntry.java [new file with mode: 0755]
src/jalview/datamodel/PDBEntry.java [new file with mode: 0755]
src/jalview/datamodel/Provenance.java [new file with mode: 0755]
src/jalview/datamodel/ProvenanceEntry.java [new file with mode: 0755]
src/jalview/datamodel/Sequence.java
src/jalview/datamodel/SequenceFeature.java
src/jalview/datamodel/SequenceI.java
src/jalview/datamodel/UniprotEntry.java [new file with mode: 0755]
src/jalview/datamodel/UniprotFile.java [new file with mode: 0755]
src/jalview/datamodel/UniprotSequence.java [new file with mode: 0755]
src/jalview/io/AlignFile.java
src/jalview/io/AppletFormatAdapter.java [new file with mode: 0755]
src/jalview/io/BLCFile.java
src/jalview/io/ClustalFile.java
src/jalview/io/EBIFetchClient.java
src/jalview/io/FastaFile.java
src/jalview/io/FormatAdapter.java
src/jalview/io/HTMLOutput.java
src/jalview/io/IdentifyFile.java
src/jalview/io/MSFfile.java
src/jalview/io/PIRFile.java
src/jalview/io/PfamFile.java
src/jalview/io/PileUpfile.java
src/jalview/io/SequenceFeatureFetcher.java
src/jalview/io/WSWUBlastClient.java
src/jalview/jbgui/GAlignFrame.java
src/jalview/jbgui/GDesktop.java
src/jalview/jbgui/GPreferences.java
src/jalview/jbgui/GTreePanel.java
src/jalview/schemes/ResidueProperties.java
src/jalview/util/Comparison.java
src/jalview/util/ImageMaker.java [new file with mode: 0755]
src/jalview/ws/JPredClient.java
src/jalview/ws/MsaWSClient.java

index 272d653..8488dd8 100755 (executable)
@@ -46,7 +46,7 @@ public class APopupMenu
   MenuItem noColourmenuItem = new MenuItem();\r
   protected CheckboxMenuItem conservationMenuItem = new CheckboxMenuItem();\r
 \r
-  AlignmentPanel ap;\r
+  final AlignmentPanel ap;\r
   MenuItem unGroupMenuItem = new MenuItem();\r
   MenuItem nucleotideMenuItem = new MenuItem();\r
   Menu colourMenu = new Menu();\r
@@ -54,7 +54,7 @@ public class APopupMenu
   CheckboxMenuItem showText = new CheckboxMenuItem();\r
   CheckboxMenuItem showColourText = new CheckboxMenuItem();\r
 \r
-  public APopupMenu(AlignmentPanel ap, Sequence seq, Vector links)\r
+  public APopupMenu(AlignmentPanel apanel, final Sequence seq, Vector links)\r
   {\r
     ///////////////////////////////////////////////////////////\r
     // If this is activated from the sequence panel, the user may want to\r
@@ -63,7 +63,7 @@ public class APopupMenu
     // If from the IDPanel, we must display the sequence menu\r
     //////////////////////////////////////////////////////////\r
 \r
-    this.ap = ap;\r
+    this.ap = apanel;\r
 \r
     try\r
     {\r
@@ -97,23 +97,50 @@ public class APopupMenu
         link = links.elementAt(i).toString();\r
         final String target = link.substring(0, link.indexOf("|"));\r
         item = new MenuItem(target);\r
+        String id = seq.getName();\r
+        if(id.indexOf("|")>-1)\r
+             id = id.substring(id.lastIndexOf("|")+1);\r
+\r
         final String url = link.substring(link.indexOf("|")+1, link.indexOf("$SEQUENCE_ID$"))\r
-               + seq.getName() +\r
+               + id +\r
                link.substring(link.indexOf("$SEQUENCE_ID$") + 13);\r
 \r
            item.addActionListener(new java.awt.event.ActionListener()\r
            {\r
                public void actionPerformed(ActionEvent e)\r
                {\r
-                  jalview.bin.JalviewLite.showURL(url, target);\r
+                  ap.alignFrame.showURL(url, target);\r
                }\r
            });\r
           linkMenu.add(item);\r
       }\r
       add(linkMenu);\r
+\r
+      item = new MenuItem("Show PDB Structure");\r
+      item.addActionListener(new java.awt.event.ActionListener()\r
+           {\r
+               public void actionPerformed(ActionEvent e)\r
+               {\r
+                  addPDB(seq);\r
+               }\r
+           });\r
+\r
+      add(item);\r
+\r
+\r
     }\r
   }\r
 \r
+  void addPDB(Sequence seq)\r
+  {\r
+    CutAndPasteTransfer cap = new CutAndPasteTransfer(true, ap.alignFrame.applet);\r
+    cap.setText("Paste your PDB file here.");\r
+    cap.setPDBImport(seq, ap.seqPanel.seqCanvas);\r
+    Frame frame = new Frame();\r
+    frame.add(cap);\r
+    jalview.bin.JalviewLite.addFrame(frame, "Paste PDB file ", 400, 300);\r
+  }\r
+\r
   private void jbInit()\r
       throws Exception\r
   {\r
@@ -467,26 +494,6 @@ public class APopupMenu
     refresh();\r
   }\r
 \r
-  protected void analyze_actionPerformed(ActionEvent e)\r
-  {\r
-    CutAndPasteTransfer cap = new CutAndPasteTransfer(false, ap.alignFrame.applet);\r
-    Frame frame = new Frame();\r
-    frame.add(cap);\r
-    jalview.bin.JalviewLite.addFrame(frame, "Analyze this - ", 400, 300);\r
-    SequenceGroup sg = getGroup();\r
-    StringBuffer sb = new StringBuffer();\r
-\r
-    for (int i = 0; i < sg.sequences.size(); i++)\r
-    {\r
-      Sequence tmp = (Sequence) sg.sequences.elementAt(i);\r
-      sb.append(tmp.getSequence(sg.getStartRes(), sg.getEndRes() + 1));\r
-      sb.append("\n");\r
-    }\r
-\r
-    sb.append("Something amazing will happen soon");\r
-    cap.setText(sb.toString());\r
-\r
-  }\r
 \r
   SequenceGroup getGroup()\r
   {\r
index e303500..cf4c40d 100755 (executable)
@@ -19,7 +19,6 @@
 \r
 package jalview.appletgui;\r
 \r
-import jalview.jbappletgui.GAlignFrame;\r
 import jalview.schemes.*;\r
 import jalview.datamodel.*;\r
 import jalview.analysis.*;\r
@@ -29,12 +28,13 @@ import java.awt.event.*;
 import java.util.*;\r
 import java.io.InputStreamReader;\r
 import java.io.BufferedReader;\r
+import java.net.URL;\r
 \r
-public class AlignFrame\r
-    extends GAlignFrame\r
+\r
+public class AlignFrame extends Frame\r
 {\r
   final AlignmentPanel alignPanel;\r
-  final AlignViewport viewport;\r
+  public final AlignViewport viewport;\r
   int NEW_WINDOW_WIDTH = 700;\r
   int NEW_WINDOW_HEIGHT = 500;\r
   jalview.bin.JalviewLite applet;\r
@@ -42,6 +42,12 @@ public class AlignFrame
 \r
   public AlignFrame(AlignmentI al, jalview.bin.JalviewLite applet, String title)\r
   {\r
+    try{\r
+      jbInit();\r
+    }catch(Exception ex)\r
+    {\r
+      ex.printStackTrace();\r
+    }\r
     this.applet = applet;\r
     viewport = new AlignViewport(al, applet);\r
     alignPanel = new AlignmentPanel(this, viewport);\r
@@ -139,6 +145,99 @@ public class AlignFrame
 \r
   }\r
 \r
+  public AlignViewport getAlignViewport()\r
+  {\r
+    return viewport;\r
+  }\r
+\r
+  public SeqCanvas getSeqcanvas()\r
+  {\r
+    return alignPanel.seqPanel.seqCanvas;\r
+  }\r
+\r
+\r
+  /**\r
+   * DOCUMENT ME!\r
+   *\r
+   * @param String DOCUMENT ME!\r
+   */\r
+\r
+  public void parseFeaturesFile(String file)\r
+  {\r
+    try\r
+    {\r
+      URL url = new URL(file);\r
+\r
+      BufferedReader in =  new BufferedReader(new InputStreamReader(url.openStream()));\r
+      SequenceI seq = null;\r
+      String line, type, desc, token;\r
+\r
+      int index, start, end;\r
+      StringTokenizer st;\r
+      SequenceFeature sf;\r
+      FeatureRenderer fr = alignPanel.seqPanel.seqCanvas.getFeatureRenderer();\r
+      int lineNo = 0;\r
+      while ( (line = in.readLine()) != null)\r
+      {\r
+        lineNo++;\r
+        st = new StringTokenizer(line, "\t");\r
+        if (st.countTokens() == 2)\r
+        {\r
+          type = st.nextToken();\r
+          UserColourScheme ucs = new UserColourScheme(st.nextToken());\r
+          fr.setColour(type, ucs.findColour("A"));\r
+          continue;\r
+        }\r
+\r
+        while (st.hasMoreElements())\r
+        {\r
+          desc = st.nextToken();\r
+          token = st.nextToken();\r
+          if (!token.equals("ID_NOT_SPECIFIED"))\r
+          {\r
+            index = viewport.alignment.findIndex(viewport.alignment.findName(\r
+                token));\r
+            st.nextToken();\r
+          }\r
+          else\r
+          {\r
+            index = Integer.parseInt(st.nextToken());\r
+          }\r
+\r
+          start = Integer.parseInt(st.nextToken());\r
+          end = Integer.parseInt(st.nextToken());\r
+\r
+          seq = viewport.alignment.getSequenceAt(index);\r
+          start = seq.findIndex(start) - 1;\r
+          end = seq.findIndex(end) - 1;\r
+\r
+          type = st.nextToken();\r
+\r
+          if(fr.getColour(type)==null)\r
+          {\r
+            // Probably the old style groups file\r
+            UserColourScheme ucs = new UserColourScheme(type);\r
+            fr.setColour(type, ucs.findColour("A"));\r
+          }\r
+\r
+          sf = new SequenceFeature(type, desc, "", start, end);\r
+\r
+          seq.addSequenceFeature(sf);\r
+        }\r
+      }\r
+\r
+      viewport.showSequenceFeatures = true;\r
+\r
+      alignPanel.repaint();\r
+\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+      System.out.println("Error parsing groups file: " + ex);\r
+    }\r
+  }\r
+\r
+\r
   public void inputText_actionPerformed(ActionEvent e)\r
   {\r
     CutAndPasteTransfer cap = new CutAndPasteTransfer(true, applet);\r
@@ -155,15 +254,14 @@ public class AlignFrame
     jalview.bin.JalviewLite.addFrame(frame,\r
                                      "Alignment output - " + e.getActionCommand(),\r
                                      600, 500);\r
-    cap.setText(new FormatAdapter().formatSequences(e.getActionCommand(),\r
-                                              viewport.getAlignment().\r
-                                              getSequences()));\r
+    cap.setText(new AppletFormatAdapter().formatSequences(e.getActionCommand(),\r
+                                              viewport.getAlignment().getSequences(),\r
+                                                      viewport.showJVSuffix));\r
   }\r
 \r
   public void closeMenuItem_actionPerformed(ActionEvent e)\r
   {\r
     PaintRefresher.components.remove(viewport.alignment);\r
-    dispose();\r
     if(PaintRefresher.components.size()==0 && applet==null)\r
       System.exit(0);\r
   }\r
@@ -550,6 +648,7 @@ public class AlignFrame
     viewport.setSelectionGroup(null);\r
     viewport.getColumnSelection().clear();\r
     viewport.setSelectionGroup(null);\r
+    alignPanel.seqPanel.seqCanvas.highlightSearchResults(null);\r
     alignPanel.repaint();\r
     PaintRefresher.Refresh(null, viewport.alignment);\r
   }\r
@@ -778,13 +877,15 @@ public class AlignFrame
     new FontChooser(alignPanel);\r
   }\r
 \r
-  protected void fullSeqId_actionPerformed(ActionEvent e)\r
+\r
+  public void seqLimits_itemStateChanged(ItemEvent e)\r
   {\r
-    viewport.setShowFullId(fullSeqId.getState());\r
+    viewport.setShowJVSuffix(seqLimits.getState());\r
     alignPanel.fontChanged();\r
     alignPanel.repaint();\r
   }\r
 \r
+\r
   protected void colourTextMenuItem_actionPerformed(ActionEvent e)\r
   {\r
     viewport.setColourText(colourTextMenuItem.getState());\r
@@ -1275,7 +1376,7 @@ public class AlignFrame
 \r
   protected void documentation_actionPerformed(ActionEvent e)\r
   {\r
-    jalview.bin.JalviewLite.showURL("http://www.jalview.org/help.html");\r
+    showURL("http://www.jalview.org/help.html");\r
   }\r
 \r
   protected void about_actionPerformed(ActionEvent e)\r
@@ -1342,4 +1443,625 @@ public class AlignFrame
     jalview.bin.JalviewLite.addFrame(frame, "Jalview", 580, 200);\r
 \r
   }\r
+\r
+  /**\r
+   * Displays the given URL in a new browser window\r
+   *\r
+   * @param url URL to display in browser window.\r
+   * <br>New window will be named "HELP_WINDOW"\r
+   */\r
+  public void showURL(String url)\r
+  {\r
+    showURL(url, "HELP");\r
+  }\r
+\r
+  public void showURL(String url, String target)\r
+  {\r
+    if (applet == null)\r
+    {\r
+      System.out.println("Not running as applet - no browser available.");\r
+    }\r
+    else\r
+    {\r
+      try\r
+      {\r
+        applet.getAppletContext().showDocument(new java.net.URL(url),\r
+                                               target);\r
+      }\r
+      catch (Exception ex)\r
+      {\r
+        ex.printStackTrace();\r
+      }\r
+    }\r
+  }\r
+\r
+\r
+  //////////////////////////////////////////////////////////////////////////////////\r
+  //JBuilder Graphics here\r
+\r
+    protected MenuBar alignFrameMenuBar = new MenuBar();\r
+    protected Menu fileMenu = new Menu();\r
+    protected MenuItem closeMenuItem = new MenuItem();\r
+    protected Menu editMenu = new Menu();\r
+    protected Menu viewMenu = new Menu();\r
+    protected Menu colourMenu = new Menu();\r
+    protected Menu calculateMenu = new Menu();\r
+    protected MenuItem selectAllSequenceMenuItem = new MenuItem();\r
+    protected MenuItem deselectAllSequenceMenuItem = new MenuItem();\r
+    protected MenuItem invertSequenceMenuItem = new MenuItem();\r
+    protected MenuItem remove2LeftMenuItem = new MenuItem();\r
+    protected MenuItem remove2RightMenuItem = new MenuItem();\r
+    protected MenuItem removeGappedColumnMenuItem = new MenuItem();\r
+    protected MenuItem removeAllGapsMenuItem = new MenuItem();\r
+    protected CheckboxMenuItem viewBoxesMenuItem = new CheckboxMenuItem();\r
+    protected CheckboxMenuItem viewTextMenuItem = new CheckboxMenuItem();\r
+    protected MenuItem sortPairwiseMenuItem = new MenuItem();\r
+    protected MenuItem sortIDMenuItem = new MenuItem();\r
+    protected MenuItem sortGroupMenuItem = new MenuItem();\r
+    protected MenuItem removeRedundancyMenuItem = new MenuItem();\r
+    protected MenuItem pairwiseAlignmentMenuItem = new MenuItem();\r
+    protected MenuItem PCAMenuItem = new MenuItem();\r
+    protected MenuItem averageDistanceTreeMenuItem = new MenuItem();\r
+    protected MenuItem neighbourTreeMenuItem = new MenuItem();\r
+    BorderLayout borderLayout1 = new BorderLayout();\r
+    public Label statusBar = new Label();\r
+    protected Menu outputTextboxMenu = new Menu();\r
+    protected MenuItem clustalColour = new MenuItem();\r
+    protected MenuItem zappoColour = new MenuItem();\r
+    protected MenuItem taylorColour = new MenuItem();\r
+    protected MenuItem hydrophobicityColour = new MenuItem();\r
+    protected MenuItem helixColour = new MenuItem();\r
+    protected MenuItem strandColour = new MenuItem();\r
+    protected MenuItem turnColour = new MenuItem();\r
+    protected MenuItem buriedColour = new MenuItem();\r
+    protected MenuItem userDefinedColour = new MenuItem();\r
+    protected MenuItem PIDColour = new MenuItem();\r
+    protected MenuItem BLOSUM62Colour = new MenuItem();\r
+    MenuItem njTreeBlosumMenuItem = new MenuItem();\r
+    MenuItem avDistanceTreeBlosumMenuItem = new MenuItem();\r
+    protected CheckboxMenuItem annotationPanelMenuItem = new CheckboxMenuItem();\r
+    protected CheckboxMenuItem colourTextMenuItem = new CheckboxMenuItem();\r
+    MenuItem overviewMenuItem = new MenuItem();\r
+    protected MenuItem undoMenuItem = new MenuItem();\r
+    protected MenuItem redoMenuItem = new MenuItem();\r
+    protected CheckboxMenuItem conservationMenuItem = new CheckboxMenuItem();\r
+    MenuItem noColourmenuItem = new MenuItem();\r
+    protected CheckboxMenuItem wrapMenuItem = new CheckboxMenuItem();\r
+    protected CheckboxMenuItem renderGapsMenuItem = new CheckboxMenuItem();\r
+    MenuItem findMenuItem = new MenuItem();\r
+    Menu searchMenu = new Menu();\r
+    protected CheckboxMenuItem abovePIDThreshold = new CheckboxMenuItem();\r
+    protected MenuItem nucleotideColour = new MenuItem();\r
+    MenuItem deleteGroups = new MenuItem();\r
+    MenuItem delete = new MenuItem();\r
+    MenuItem copy = new MenuItem();\r
+    MenuItem cut = new MenuItem();\r
+    Menu Menu1 = new Menu();\r
+    MenuItem pasteNew = new MenuItem();\r
+    MenuItem pasteThis = new MenuItem();\r
+    protected CheckboxMenuItem applyToAllGroups = new CheckboxMenuItem();\r
+    protected MenuItem font = new MenuItem();\r
+    protected CheckboxMenuItem scaleAbove = new CheckboxMenuItem();\r
+    protected CheckboxMenuItem scaleLeft = new CheckboxMenuItem();\r
+    protected CheckboxMenuItem scaleRight = new CheckboxMenuItem();\r
+    MenuItem modifyPID = new MenuItem();\r
+    MenuItem modifyConservation = new MenuItem();\r
+    protected Menu sortByTreeMenu = new Menu();\r
+    Menu sort = new Menu();\r
+    Menu calculate = new Menu();\r
+    MenuItem inputText = new MenuItem();\r
+    Menu helpMenu = new Menu();\r
+    MenuItem documentation = new MenuItem();\r
+    MenuItem about = new MenuItem();\r
+    protected CheckboxMenuItem seqLimits = new CheckboxMenuItem();\r
+\r
+    private void jbInit() throws Exception {\r
+\r
+      setMenuBar(alignFrameMenuBar);\r
+\r
+      MenuItem item;\r
+\r
+      // dynamically fill save as menu with available formats\r
+      for (int i = 0; i < jalview.io.AppletFormatAdapter.formats.size(); i++)\r
+      {\r
+\r
+        item = new MenuItem( (String) jalview.io.AppletFormatAdapter.formats.\r
+                            elementAt(\r
+                                i));\r
+        item.addActionListener(new java.awt.event.ActionListener()\r
+        {\r
+          public void actionPerformed(ActionEvent e)\r
+          {\r
+            outputText_actionPerformed(e);\r
+          }\r
+        });\r
+\r
+        outputTextboxMenu.add(item);\r
+      }\r
+\r
+\r
+        fileMenu.setLabel("File");\r
+        closeMenuItem.setLabel("Close");\r
+        closeMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    closeMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        editMenu.setLabel("Edit");\r
+        viewMenu.setLabel("View");\r
+        colourMenu.setLabel("Colour");\r
+        calculateMenu.setLabel("Calculate");\r
+        selectAllSequenceMenuItem.setLabel("Select all");\r
+        selectAllSequenceMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    selectAllSequenceMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        deselectAllSequenceMenuItem.setLabel("Deselect All");\r
+        deselectAllSequenceMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    deselectAllSequenceMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        invertSequenceMenuItem.setLabel("Invert Selection");\r
+        invertSequenceMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    invertSequenceMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        remove2LeftMenuItem.setLabel("Remove Left");\r
+        remove2LeftMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    remove2LeftMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        remove2RightMenuItem.setLabel("Remove Right");\r
+        remove2RightMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    remove2RightMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        removeGappedColumnMenuItem.setLabel("Remove Empty Columns");\r
+        removeGappedColumnMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    removeGappedColumnMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        removeAllGapsMenuItem.setLabel("Remove All Gaps");\r
+        removeAllGapsMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    removeAllGapsMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        viewBoxesMenuItem.setLabel("Boxes");\r
+        viewBoxesMenuItem.setState(true);\r
+        viewBoxesMenuItem.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    viewBoxesMenuItem_actionPerformed(null);\r
+                }\r
+            });\r
+        viewTextMenuItem.setLabel("Text");\r
+        viewTextMenuItem.setState(true);\r
+        viewTextMenuItem.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    viewTextMenuItem_actionPerformed(null);\r
+                }\r
+            });\r
+        sortPairwiseMenuItem.setLabel("by Pairwise Identity");\r
+        sortPairwiseMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    sortPairwiseMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        sortIDMenuItem.setLabel("by ID");\r
+        sortIDMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    sortIDMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        sortGroupMenuItem.setLabel("by Group");\r
+        sortGroupMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    sortGroupMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        removeRedundancyMenuItem.setLabel("Remove Redundancy...");\r
+        removeRedundancyMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    removeRedundancyMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        pairwiseAlignmentMenuItem.setLabel("Pairwise Alignments...");\r
+        pairwiseAlignmentMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    pairwiseAlignmentMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        PCAMenuItem.setLabel("Principal Component Analysis");\r
+        PCAMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    PCAMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        averageDistanceTreeMenuItem.setLabel(\r
+            "Average Distance Using % Identity");\r
+        averageDistanceTreeMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    averageDistanceTreeMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        neighbourTreeMenuItem.setLabel("Neighbour Joining Using % Identity");\r
+        neighbourTreeMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    neighbourTreeMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        alignFrameMenuBar.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        statusBar.setBackground(Color.white);\r
+        statusBar.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        statusBar.setText("Status bar");\r
+        outputTextboxMenu.setLabel("Output to Textbox");\r
+        clustalColour.setLabel("Clustalx");\r
+\r
+        clustalColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    clustalColour_actionPerformed(e);\r
+                }\r
+            });\r
+        zappoColour.setLabel("Zappo");\r
+        zappoColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    zappoColour_actionPerformed(e);\r
+                }\r
+            });\r
+        taylorColour.setLabel("Taylor");\r
+        taylorColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    taylorColour_actionPerformed(e);\r
+                }\r
+            });\r
+        hydrophobicityColour.setLabel("Hydrophobicity");\r
+        hydrophobicityColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    hydrophobicityColour_actionPerformed(e);\r
+                }\r
+            });\r
+        helixColour.setLabel("Helix Propensity");\r
+        helixColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    helixColour_actionPerformed(e);\r
+                }\r
+            });\r
+        strandColour.setLabel("Strand Propensity");\r
+        strandColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    strandColour_actionPerformed(e);\r
+                }\r
+            });\r
+        turnColour.setLabel("Turn Propensity");\r
+        turnColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    turnColour_actionPerformed(e);\r
+                }\r
+            });\r
+        buriedColour.setLabel("Buried Index");\r
+        buriedColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    buriedColour_actionPerformed(e);\r
+                }\r
+            });\r
+        userDefinedColour.setLabel("User Defined...");\r
+        userDefinedColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    userDefinedColour_actionPerformed(e);\r
+                }\r
+            });\r
+        PIDColour.setLabel("Percentage Identity");\r
+        PIDColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    PIDColour_actionPerformed(e);\r
+                }\r
+            });\r
+        BLOSUM62Colour.setLabel("BLOSUM62 Score");\r
+        BLOSUM62Colour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    BLOSUM62Colour_actionPerformed(e);\r
+                }\r
+            });\r
+        avDistanceTreeBlosumMenuItem.setLabel(\r
+            "Average Distance Using BLOSUM62");\r
+        avDistanceTreeBlosumMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    avTreeBlosumMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        njTreeBlosumMenuItem.setLabel("Neighbour Joining Using BLOSUM62");\r
+        njTreeBlosumMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    njTreeBlosumMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        annotationPanelMenuItem.setActionCommand("");\r
+        annotationPanelMenuItem.setState(true);\r
+        annotationPanelMenuItem.setLabel("Show Annotations");\r
+        annotationPanelMenuItem.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    annotationPanelMenuItem_actionPerformed(null);\r
+                }\r
+            });\r
+        colourTextMenuItem.setLabel("Colour Text");\r
+        colourTextMenuItem.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    colourTextMenuItem_actionPerformed(null);\r
+                }\r
+            });\r
+        overviewMenuItem.setLabel("Overview Window");\r
+        overviewMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    overviewMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        undoMenuItem.setEnabled(false);\r
+        undoMenuItem.setLabel("Undo");\r
+        undoMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    undoMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        redoMenuItem.setEnabled(false);\r
+        redoMenuItem.setLabel("Redo");\r
+        redoMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    redoMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        conservationMenuItem.setLabel("by Conservation");\r
+        conservationMenuItem.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    conservationMenuItem_actionPerformed(null);\r
+                }\r
+            });\r
+        noColourmenuItem.setLabel("None");\r
+        noColourmenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    noColourmenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        wrapMenuItem.setLabel("Wrap");\r
+        wrapMenuItem.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    wrapMenuItem_actionPerformed(null);\r
+                }\r
+            });\r
+        renderGapsMenuItem.setLabel("Show Gaps");\r
+        renderGapsMenuItem.setState(true);\r
+        renderGapsMenuItem.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    renderGapsMenuItem_actionPerformed(null);\r
+                }\r
+            });\r
+        findMenuItem.setLabel("Find...");\r
+        findMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    findMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        searchMenu.setLabel("Search");\r
+\r
+        abovePIDThreshold.setLabel("Above Identity Threshold");\r
+        abovePIDThreshold.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    abovePIDThreshold_actionPerformed(null);\r
+                }\r
+            });\r
+        nucleotideColour.setLabel("Nucleotide");\r
+        nucleotideColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    nucleotideColour_actionPerformed(e);\r
+                }\r
+            });\r
+        deleteGroups.setLabel("Undefine Groups");\r
+        deleteGroups.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    deleteGroups_actionPerformed(e);\r
+                }\r
+            });\r
+        copy.setLabel("Copy");\r
+        copy.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    copy_actionPerformed(e);\r
+                }\r
+            });\r
+        cut.setLabel("Cut");\r
+        cut.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    cut_actionPerformed(e);\r
+                }\r
+            });\r
+        delete.setLabel("Delete");\r
+        delete.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    delete_actionPerformed(e);\r
+                }\r
+            });\r
+        Menu1.setLabel("Paste");\r
+        pasteNew.setLabel("To New Alignment");\r
+        pasteNew.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    pasteNew_actionPerformed(e);\r
+                }\r
+            });\r
+        pasteThis.setLabel("Add To This Alignment");\r
+        pasteThis.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    pasteThis_actionPerformed(e);\r
+                }\r
+            });\r
+        applyToAllGroups.setLabel("Apply Colour To All Groups");\r
+        applyToAllGroups.setState(true);\r
+        applyToAllGroups.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    applyToAllGroups_actionPerformed(null);\r
+                }\r
+            });\r
+        font.setLabel("Font...");\r
+        font.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    font_actionPerformed(e);\r
+                }\r
+            });\r
+        scaleAbove.setLabel("Scale Above");\r
+        scaleAbove.setState(true);\r
+        scaleAbove.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    scaleAbove_actionPerformed(null);\r
+                }\r
+            });\r
+        scaleLeft.setEnabled(false);\r
+        scaleLeft.setState(true);\r
+        scaleLeft.setLabel("Scale Left");\r
+        scaleLeft.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    scaleLeft_actionPerformed(null);\r
+                }\r
+            });\r
+        scaleRight.setEnabled(false);\r
+        scaleRight.setState(true);\r
+        scaleRight.setLabel("Scale Right");\r
+        scaleRight.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    scaleRight_actionPerformed(null);\r
+                }\r
+            });\r
+        modifyPID.setLabel("Modify Identity Threshold...");\r
+        modifyPID.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    modifyPID_actionPerformed(e);\r
+                }\r
+            });\r
+        modifyConservation.setLabel("Modify Conservation Threshold...");\r
+        modifyConservation.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    modifyConservation_actionPerformed(e);\r
+                }\r
+            });\r
+        sortByTreeMenu.setLabel("By Tree Order");\r
+        sort.setLabel("Sort");\r
+        calculate.setLabel("Calculate Tree");\r
+        inputText.setLabel("Input from textbox");\r
+        inputText.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    inputText_actionPerformed(e);\r
+                }\r
+            });\r
+\r
+        helpMenu.setLabel("Help");\r
+        documentation.setLabel("Documentation");\r
+        documentation.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    documentation_actionPerformed(e);\r
+                }\r
+            });\r
+\r
+        about.setLabel("About...");\r
+        about.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    about_actionPerformed(e);\r
+                }\r
+            });\r
+          seqLimits.setState(true);\r
+    seqLimits.setLabel("Show Sequence Limits");\r
+    seqLimits.addItemListener(new ItemListener()\r
+    {\r
+      public void itemStateChanged(ItemEvent e)\r
+      {\r
+        seqLimits_itemStateChanged(e);\r
+      }\r
+    });\r
+\r
+    alignFrameMenuBar.add(fileMenu);\r
+        alignFrameMenuBar.add(editMenu);\r
+        alignFrameMenuBar.add(searchMenu);\r
+        alignFrameMenuBar.add(viewMenu);\r
+        alignFrameMenuBar.add(colourMenu);\r
+        alignFrameMenuBar.add(calculateMenu);\r
+        alignFrameMenuBar.add(helpMenu);\r
+        fileMenu.add(inputText);\r
+        fileMenu.add(outputTextboxMenu);\r
+        fileMenu.addSeparator();\r
+        fileMenu.add(closeMenuItem);\r
+        editMenu.add(undoMenuItem);\r
+        editMenu.add(redoMenuItem);\r
+        editMenu.add(cut);\r
+        editMenu.add(copy);\r
+        editMenu.add(Menu1);\r
+        editMenu.add(delete);\r
+        editMenu.addSeparator();\r
+        editMenu.add(selectAllSequenceMenuItem);\r
+        editMenu.add(deselectAllSequenceMenuItem);\r
+        editMenu.add(invertSequenceMenuItem);\r
+        editMenu.add(deleteGroups);\r
+        editMenu.addSeparator();\r
+        editMenu.add(remove2LeftMenuItem);\r
+        editMenu.add(remove2RightMenuItem);\r
+        editMenu.add(removeGappedColumnMenuItem);\r
+        editMenu.add(removeAllGapsMenuItem);\r
+        editMenu.add(removeRedundancyMenuItem);\r
+        searchMenu.add(findMenuItem);\r
+        viewMenu.add(font);\r
+        viewMenu.addSeparator();\r
+        viewMenu.add(seqLimits);\r
+        viewMenu.addSeparator();\r
+    viewMenu.add(wrapMenuItem);\r
+        viewMenu.add(scaleAbove);\r
+        viewMenu.add(scaleLeft);\r
+        viewMenu.add(scaleRight);\r
+        viewMenu.addSeparator();\r
+    viewMenu.add(viewBoxesMenuItem);\r
+        viewMenu.add(viewTextMenuItem);\r
+        viewMenu.add(colourTextMenuItem);\r
+        viewMenu.add(renderGapsMenuItem);\r
+        viewMenu.add(annotationPanelMenuItem);\r
+        viewMenu.addSeparator();\r
+        viewMenu.add(overviewMenuItem);\r
+        colourMenu.add(applyToAllGroups);\r
+        colourMenu.addSeparator();\r
+        colourMenu.add(noColourmenuItem);\r
+        colourMenu.add(clustalColour);\r
+        colourMenu.add(BLOSUM62Colour);\r
+        colourMenu.add(PIDColour);\r
+        colourMenu.add(zappoColour);\r
+        colourMenu.add(taylorColour);\r
+        colourMenu.add(hydrophobicityColour);\r
+        colourMenu.add(helixColour);\r
+        colourMenu.add(strandColour);\r
+        colourMenu.add(turnColour);\r
+        colourMenu.add(buriedColour);\r
+        colourMenu.add(nucleotideColour);\r
+        colourMenu.add(userDefinedColour);\r
+        colourMenu.addSeparator();\r
+        colourMenu.add(conservationMenuItem);\r
+        colourMenu.add(modifyConservation);\r
+        colourMenu.add(abovePIDThreshold);\r
+        colourMenu.add(modifyPID);\r
+        calculateMenu.add(sort);\r
+        calculateMenu.add(calculate);\r
+        calculateMenu.addSeparator();\r
+        calculateMenu.add(pairwiseAlignmentMenuItem);\r
+        calculateMenu.add(PCAMenuItem);\r
+        this.add(statusBar, BorderLayout.SOUTH);\r
+        Menu1.add(pasteNew);\r
+        Menu1.add(pasteThis);\r
+        sort.add(sortIDMenuItem);\r
+        sort.add(sortByTreeMenu);\r
+        sort.add(sortGroupMenuItem);\r
+        sort.add(sortPairwiseMenuItem);\r
+        calculate.add(averageDistanceTreeMenuItem);\r
+        calculate.add(neighbourTreeMenuItem);\r
+        calculate.add(avDistanceTreeBlosumMenuItem);\r
+        calculate.add(njTreeBlosumMenuItem);\r
+        helpMenu.add(documentation);\r
+        helpMenu.add(about);\r
+    }\r
 }\r
+\r
index 209f939..2e0c1cb 100755 (executable)
@@ -36,7 +36,7 @@ public class AlignViewport
   int startSeq;\r
   int endSeq;\r
 \r
-  boolean showFullId = true;\r
+  boolean showJVSuffix = true;\r
   boolean showText = true;\r
   boolean showColourText = false;\r
   boolean showBoxes = true;\r
@@ -98,7 +98,7 @@ public class AlignViewport
       String param = applet.getParameter("showFullId");\r
       if (param != null)\r
       {\r
-        showFullId = Boolean.valueOf(param).booleanValue();\r
+        showJVSuffix = Boolean.valueOf(param).booleanValue();\r
       }\r
 \r
       param = applet.getParameter("showAnnotation");\r
@@ -596,14 +596,14 @@ public class AlignViewport
     return colourAppliesToAllGroups;\r
   }\r
 \r
-  public boolean getShowFullId()\r
+  public boolean getShowJVSuffix()\r
   {\r
-    return showFullId;\r
+    return showJVSuffix;\r
   }\r
 \r
-  public void setShowFullId(boolean b)\r
+  public void setShowJVSuffix(boolean b)\r
   {\r
-    showFullId = b;\r
+    showJVSuffix = b;\r
   }\r
 \r
   public boolean getShowAnnotation()\r
index 7332a1a..3771a57 100755 (executable)
@@ -23,10 +23,8 @@ import java.awt.*;
 import java.awt.event.*;\r
 \r
 import jalview.datamodel.*;\r
-import jalview.jbappletgui.*;\r
 \r
-public class AlignmentPanel\r
-    extends GAlignmentPanel implements AdjustmentListener\r
+public class AlignmentPanel extends Panel implements AdjustmentListener\r
 {\r
 \r
   AlignViewport av;\r
@@ -46,6 +44,15 @@ public class AlignmentPanel
 \r
   public AlignmentPanel(AlignFrame af, final AlignViewport av)\r
   {\r
+    try\r
+    {\r
+      jbInit();\r
+    }\r
+    catch (Exception e)\r
+    {\r
+      e.printStackTrace();\r
+    }\r
+\r
     if(System.getProperty("os.name").startsWith("Mac"))\r
       MAC = true;\r
 \r
@@ -204,14 +211,7 @@ public class AlignmentPanel
     while (i < al.getHeight() && al.getSequenceAt(i) != null)\r
     {\r
       SequenceI s = al.getSequenceAt(i);\r
-      if (av.getShowFullId())\r
-      {\r
-        id = s.getDisplayId();\r
-      }\r
-      else\r
-      {\r
-        id = s.getName();\r
-      }\r
+      id = s.getDisplayId(av.getShowJVSuffix());\r
 \r
       if (fm.stringWidth(id) > idWidth)\r
       {\r
@@ -484,7 +484,7 @@ public class AlignmentPanel
     {\r
       int max = av.alignment.getWidth() /\r
           seqPanel.seqCanvas.\r
-          getWrappedCanvasWidth(seqPanel.seqCanvas.getSize().width);\r
+          getWrappedCanvasWidth(seqPanel.seqCanvas.getSize().width) +1;\r
       vscroll.setMaximum(max);\r
       vscroll.setUnitIncrement(1);\r
       vscroll.setVisibleAmount(1);\r
@@ -500,5 +500,80 @@ public class AlignmentPanel
     scalePanel.repaint();\r
     annotationPanel.repaint();\r
 \r
+    if (getBounds() == g.getClipBounds())\r
+    {\r
+      if (overviewPanel != null)\r
+        overviewPanel.updateOverviewImage();\r
+    }\r
+\r
+  }\r
+\r
+  protected Panel sequenceHolderPanel = new Panel();\r
+  protected Scrollbar vscroll = new Scrollbar();\r
+  protected Scrollbar hscroll = new Scrollbar();\r
+  protected Panel seqPanelHolder = new Panel();\r
+  BorderLayout borderLayout1 = new BorderLayout();\r
+  BorderLayout borderLayout3 = new BorderLayout();\r
+  protected Panel scalePanelHolder = new Panel();\r
+  protected Panel idPanelHolder = new Panel();\r
+  BorderLayout borderLayout5 = new BorderLayout();\r
+  protected Panel idSpaceFillerPanel1 = new Panel();\r
+  public Panel annotationSpaceFillerHolder = new Panel();\r
+  BorderLayout borderLayout6 = new BorderLayout();\r
+  BorderLayout borderLayout7 = new BorderLayout();\r
+  Panel hscrollHolder = new Panel();\r
+  BorderLayout borderLayout10 = new BorderLayout();\r
+  protected Panel hscrollFillerPanel = new Panel();\r
+  BorderLayout borderLayout11 = new BorderLayout();\r
+  public Panel annotationScroller = new Panel();\r
+  BorderLayout borderLayout4 = new BorderLayout();\r
+  BorderLayout borderLayout2 = new BorderLayout();\r
+\r
+  private void jbInit() throws Exception {\r
+      //  idPanelHolder.setPreferredSize(new Dimension(70, 10));\r
+      this.setLayout(borderLayout7);\r
+\r
+      //   sequenceHolderPanel.setPreferredSize(new Dimension(150, 150));\r
+      sequenceHolderPanel.setLayout(borderLayout3);\r
+      seqPanelHolder.setLayout(borderLayout1);\r
+      scalePanelHolder.setBackground(Color.white);\r
+\r
+      // scalePanelHolder.setPreferredSize(new Dimension(10, 30));\r
+      scalePanelHolder.setLayout(borderLayout6);\r
+      idPanelHolder.setLayout(borderLayout5);\r
+      idSpaceFillerPanel1.setBackground(Color.white);\r
+\r
+      //  idSpaceFillerPanel1.setPreferredSize(new Dimension(10, 30));\r
+      idSpaceFillerPanel1.setLayout(borderLayout11);\r
+      annotationSpaceFillerHolder.setBackground(Color.white);\r
+\r
+      //  annotationSpaceFillerHolder.setPreferredSize(new Dimension(10, 80));\r
+      annotationSpaceFillerHolder.setLayout(borderLayout4);\r
+      hscroll.setOrientation(Scrollbar.HORIZONTAL);\r
+      hscrollHolder.setLayout(borderLayout10);\r
+      hscrollFillerPanel.setBackground(Color.white);\r
+\r
+      //  hscrollFillerPanel.setPreferredSize(new Dimension(70, 10));\r
+      hscrollHolder.setBackground(Color.white);\r
+\r
+      //    annotationScroller.setPreferredSize(new Dimension(10, 80));\r
+      //  this.setPreferredSize(new Dimension(220, 166));\r
+      seqPanelHolder.setBackground(Color.white);\r
+      idPanelHolder.setBackground(Color.white);\r
+      annotationScroller.setLayout(borderLayout2);\r
+      sequenceHolderPanel.add(scalePanelHolder, BorderLayout.NORTH);\r
+      sequenceHolderPanel.add(seqPanelHolder, BorderLayout.CENTER);\r
+      seqPanelHolder.add(vscroll, BorderLayout.EAST);\r
+      sequenceHolderPanel.add(annotationScroller, BorderLayout.SOUTH);\r
+\r
+      //  Panel3.add(secondaryPanelHolder,  BorderLayout.SOUTH);\r
+      this.add(idPanelHolder, BorderLayout.WEST);\r
+      idPanelHolder.add(idSpaceFillerPanel1, BorderLayout.NORTH);\r
+      idPanelHolder.add(annotationSpaceFillerHolder, BorderLayout.SOUTH);\r
+      this.add(hscrollHolder, BorderLayout.SOUTH);\r
+      hscrollHolder.add(hscroll, BorderLayout.CENTER);\r
+      hscrollHolder.add(hscrollFillerPanel, BorderLayout.WEST);\r
+      this.add(sequenceHolderPanel, BorderLayout.CENTER);\r
   }\r
+\r
 }\r
index 4c0d3de..ea9a8aa 100755 (executable)
@@ -24,15 +24,23 @@ import java.awt.event.*;
 \r
 import jalview.datamodel.*;\r
 import jalview.io.*;\r
-import jalview.jbappletgui.*;\r
 \r
-public class CutAndPasteTransfer\r
-    extends GCutAndPasteTransfer\r
+public class CutAndPasteTransfer extends Panel\r
 {\r
   jalview.bin.JalviewLite applet;\r
+\r
+  boolean pdbImport = false;\r
+  Sequence seq;\r
+  SeqCanvas seqcanvas;\r
+\r
   public CutAndPasteTransfer(boolean forImport, jalview.bin.JalviewLite mainApplet)\r
   {\r
-    super();\r
+    try {\r
+        jbInit();\r
+    } catch (Exception e) {\r
+        e.printStackTrace();\r
+    }\r
+\r
     applet = mainApplet;\r
 \r
     if (!forImport)\r
@@ -41,6 +49,14 @@ public class CutAndPasteTransfer
     }\r
   }\r
 \r
+  public void setPDBImport(Sequence seq, SeqCanvas seqcanvas)\r
+  {\r
+    this.seq = seq;\r
+    this.seqcanvas = seqcanvas;\r
+    pdbImport = true;\r
+  }\r
+\r
+\r
   public String getText()\r
   {\r
     return textarea.getText();\r
@@ -68,29 +84,72 @@ public class CutAndPasteTransfer
           +warning);\r
 \r
       textarea.setCaretPosition(text.length());\r
-      return;\r
     }\r
 \r
-    SequenceI[] sequences = null;\r
+    if(pdbImport)\r
+    {\r
+      new MCview.AppletPDBViewer(text, "Paste", seq, seqcanvas);\r
+    }\r
+    else\r
+    {\r
+      SequenceI[] sequences = null;\r
 \r
-    String format = IdentifyFile.Identify(text, "Paste");\r
-    sequences = new FormatAdapter().readFile(text, "Paste", format);\r
+      String format = IdentifyFile.Identify(text, "Paste");\r
+      sequences = new AppletFormatAdapter().readFile(text, "Paste", format);\r
 \r
-    if (sequences != null)\r
-    {\r
-      AlignFrame af = new AlignFrame(new Alignment(sequences), applet,\r
-                                     "Cut & Paste input - " + format);\r
-      af.statusBar.setText("Successfully pasted alignment file");\r
+      if (sequences != null)\r
+      {\r
+        AlignFrame af = new AlignFrame(new Alignment(sequences), applet,\r
+                                       "Cut & Paste input - " + format);\r
+        af.statusBar.setText("Successfully pasted alignment file");\r
+      }\r
     }\r
 \r
-    Frame frame = (Frame)this.getParent();\r
-    frame.setVisible(false);\r
+    ((Frame)this.getParent()).setVisible(false);\r
   }\r
 \r
   protected void cancel_actionPerformed(ActionEvent e)\r
   {\r
-    Frame frame = (Frame)this.getParent();\r
-    frame.setVisible(false);\r
+    ((Frame)this.getParent()).setVisible(false);\r
+  }\r
+\r
+  protected TextArea textarea = new TextArea();\r
+  Button ok = new Button();\r
+  Button cancel = new Button();\r
+  protected Panel buttonPanel = new Panel();\r
+  BorderLayout borderLayout1 = new BorderLayout();\r
+\r
+\r
+  private void jbInit() throws Exception {\r
+      textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 10));\r
+      textarea.setText("Paste your alignment file here");\r
+      textarea.addMouseListener(new java.awt.event.MouseAdapter() {\r
+              public void mousePressed(MouseEvent e) {\r
+                  textarea_mousePressed(e);\r
+              }\r
+          });\r
+      this.setLayout(borderLayout1);\r
+      ok.setLabel("OK");\r
+      ok.addActionListener(new java.awt.event.ActionListener() {\r
+              public void actionPerformed(ActionEvent e) {\r
+                  ok_actionPerformed(e);\r
+              }\r
+          });\r
+      cancel.setLabel("Cancel");\r
+      cancel.addActionListener(new java.awt.event.ActionListener() {\r
+              public void actionPerformed(ActionEvent e) {\r
+                  cancel_actionPerformed(e);\r
+              }\r
+          });\r
+      this.add(buttonPanel, BorderLayout.SOUTH);\r
+      buttonPanel.add(ok, null);\r
+      buttonPanel.add(cancel, null);\r
+      this.add(textarea, java.awt.BorderLayout.CENTER);\r
   }\r
 \r
+  void textarea_mousePressed(MouseEvent e) {\r
+      if (textarea.getText().startsWith("Paste your")) {\r
+          textarea.setText("");\r
+      }\r
+  }\r
 }\r
index 291ce5f..4a97e43 100755 (executable)
  * along with this program; if not, write to the Free Software\r
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
  */\r
-\r
 package jalview.appletgui;\r
 \r
-import java.util.*;\r
+import jalview.datamodel.*;\r
 \r
 import java.awt.*;\r
 \r
-import jalview.datamodel.*;\r
+import java.util.*;\r
+\r
 \r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
 public class FeatureRenderer\r
 {\r
-  AlignViewport av;\r
-\r
-  SequenceGroup currentSequenceGroup = null;\r
-  SequenceGroup[] allGroups = null;\r
-  Color resBoxColour;\r
-  Graphics graphics;\r
-\r
-  public FeatureRenderer(AlignViewport av)\r
-  {\r
-    this.av = av;\r
-  }\r
-\r
-  public void drawSequence(Graphics g, SequenceI seq, SequenceGroup[] sg,\r
-                           int start, int end, int x1, int y1, int width,\r
-                           int height)\r
-  {\r
-    Vector features = seq.getSequenceFeatures();\r
-    Enumeration e = features.elements();\r
-    while (e.hasMoreElements())\r
+    AlignViewport av;\r
+    SequenceGroup currentSequenceGroup = null;\r
+    SequenceGroup[] allGroups = null;\r
+    Color resBoxColour;\r
+    Graphics graphics;\r
+    float transparency = .4f;\r
+\r
+    // The following vector holds the features which are\r
+    // to be added, in the correct order or rendering\r
+    Vector featuresDisplayed;\r
+\r
+    /**\r
+     * Creates a new FeatureRenderer object.\r
+     *\r
+     * @param av DOCUMENT ME!\r
+     */\r
+    public FeatureRenderer(AlignViewport av)\r
     {\r
-      SequenceFeature sf = (SequenceFeature) e.nextElement();\r
-      if (sf.getStart() > seq.getEnd())\r
-      {\r
-        continue;\r
-      }\r
+        this.av = av;\r
+        initColours();\r
+        String version = System.getProperty("java.version");\r
+        if (version.indexOf("1.1") == 0)\r
+          highlightTransparent = false;\r
 \r
-      int fstart = seq.findIndex(sf.getStart()) - 1;\r
-      int fend = seq.findIndex(sf.getEnd()) - 1;\r
+    }\r
 \r
-      if ( (fstart <= end && fend >= start))\r
-      {\r
-        if (fstart < 0) // fix for if the feature we have starts before the sequence start,\r
+boolean highlightTransparent = true;\r
+    /**\r
+     * DOCUMENT ME!\r
+     *\r
+     * @param g DOCUMENT ME!\r
+     * @param seq DOCUMENT ME!\r
+     * @param sg DOCUMENT ME!\r
+     * @param start DOCUMENT ME!\r
+     * @param end DOCUMENT ME!\r
+     * @param x1 DOCUMENT ME!\r
+     * @param y1 DOCUMENT ME!\r
+     * @param width DOCUMENT ME!\r
+     * @param height DOCUMENT ME!\r
+     */\r
+    public void drawSequence(Graphics g, SequenceI seq, SequenceGroup[] sg,\r
+        int start, int end, int x1, int y1, int width, int height)\r
+    {\r
+\r
+        if(seq.getSequenceFeatures()==null)\r
+          return;\r
+\r
+        Enumeration e = null, e2;\r
+        String type;\r
+        if(featuresDisplayed!=null)\r
+          e = featuresDisplayed.elements();\r
+        else\r
+         e = seq.getSequenceFeatures().elements();\r
+\r
+       if(highlightTransparent)\r
         {\r
-          fstart = 0; // but the feature end is still valid!!\r
+        //  MyGraphics.SetTransparency(g, transparency);\r
         }\r
 \r
-        if (fstart == fend)\r
-        {\r
-          g.setColor(Color.red);\r
-          g.fillRoundRect( (fstart - start) * width, y1, width, height, 4, 4);\r
-          g.setColor(Color.white);\r
-\r
-          char s = seq.getSequence().charAt(fstart);\r
-          FontMetrics fm = g.getFontMetrics();\r
-          int charOffset = (width - fm.charWidth(s)) / 2;\r
-          int pady = height / 5;\r
-          g.drawString(String.valueOf(s),\r
-                       charOffset + x1 + width * (fstart - start),\r
-                       y1 + height - pady);\r
 \r
-        }\r
-        else\r
+        while (e.hasMoreElements())\r
         {\r
-          for (int i = fstart; i <= fend; i++)\r
-          {\r
-            char s = seq.getSequence().charAt(i);\r
-            if (jalview.util.Comparison.isGap(s))\r
+            SequenceFeature sf=null;\r
+            if(featuresDisplayed!=null)\r
+            {\r
+              e2 = seq.getSequenceFeatures().elements();\r
+              type = e.nextElement().toString();\r
+              while(e2.hasMoreElements())\r
+              {\r
+                sf = (SequenceFeature) e2.nextElement();\r
+                if(sf.getType().equals(type))\r
+                  break;\r
+                else\r
+                  sf = null;\r
+              }\r
+            }\r
+            else\r
             {\r
+              sf = (SequenceFeature) e.nextElement();\r
+              type = sf.getType();\r
+            }\r
+\r
+            if(sf==null)\r
               continue;\r
+\r
+\r
+            if (sf.getBegin() > seq.getEnd())\r
+            {\r
+                continue;\r
             }\r
 \r
-            g.setColor(Color.blue);\r
-            g.fillRect( (i - start) * width, y1, width, height);\r
+            int fstart = seq.findIndex(sf.getBegin()) - 1;\r
+            int fend = seq.findIndex(sf.getEnd()) - 1;\r
+\r
+            if (((fstart <= end) && (fend >= start)))\r
+            {\r
+                if (fstart < start)\r
+                { // fix for if the feature we have starts before the sequence start,\r
+                    fstart = start; // but the feature end is still valid!!\r
+                }\r
 \r
-            g.setColor(Color.white);\r
+                if (fend >= end)\r
+                {\r
+                    fend = end;\r
+                }\r
 \r
-            FontMetrics fm = g.getFontMetrics();\r
-            int charOffset = (width - fm.charWidth(s)) / 2;\r
-            int pady = height / 5;\r
-            g.drawString(String.valueOf(s),\r
-                         charOffset + x1 + width * (i - start),\r
-                         y1 + height - pady);\r
+                if (fstart == fend)\r
+                {\r
+                    g.setColor(getColour(type));\r
+                    g.fillRoundRect((fstart - start) * width, y1, width,\r
+                        height, 4, 4);\r
+                    g.setColor(Color.white);\r
+\r
+                    char s = seq.getSequence().charAt(fstart);\r
+                    FontMetrics fm = g.getFontMetrics();\r
+                    int charOffset = (width - fm.charWidth(s)) / 2;\r
+                    int pady = height / 5;\r
+                    g.drawString(String.valueOf(s),\r
+                        charOffset + x1 + (width * (fstart - start)),\r
+                        (y1 + height) - pady);\r
+                }\r
+                else\r
+                {\r
+                    for (int i = fstart; i <= fend; i++)\r
+                    {\r
+                        char s = seq.getSequence().charAt(i);\r
+\r
+                        if (jalview.util.Comparison.isGap(s))\r
+                        {\r
+                            continue;\r
+                        }\r
+\r
+                        g.setColor(getColour(type));\r
+                        g.fillRect((i - start) * width, y1, width, height);\r
+\r
+                        g.setColor(Color.white);\r
+\r
+                        FontMetrics fm = g.getFontMetrics();\r
+                        int charOffset = (width - fm.charWidth(s)) / 2;\r
+                        int pady = height / 5;\r
+                        g.drawString(String.valueOf(s),\r
+                            charOffset + x1 + (width * (i - start)),\r
+                            (y1 + height) - pady);\r
+                    }\r
+                }\r
+            }\r
           }\r
-        }\r
+\r
+          if (highlightTransparent)\r
+          {\r
+        //    MyGraphics.SetTransparency(g, 1.0f);\r
+          }\r
+    }\r
+\r
+    public Color getColour(String featureType)\r
+    {\r
+      return (Color)featureColours.get(featureType);\r
+    }\r
+\r
+    public void setColour(String featureType, Color col)\r
+    {\r
+      featureColours.put(featureType, col);\r
+    }\r
+\r
+    public void setTransparency(float value)\r
+    {\r
+      transparency = value;\r
+    }\r
+\r
+    public float getTransparency()\r
+    {\r
+      return transparency;\r
+    }\r
+\r
+    public void setFeaturePriority(Object [][] data)\r
+    {\r
+      // The feature table will display high priority\r
+      // features at the top, but theses are the ones\r
+      // we need to render last, so invert the data\r
+      featuresDisplayed = new Vector();\r
+      for(int i=data.length-1; i>-1; i--)\r
+      {\r
+       String type = data[i][0].toString();\r
+       setColour(type, (Color)data[i][1]);\r
+       if( ((Boolean)data[i][2]).booleanValue() )\r
+         featuresDisplayed.addElement(type);\r
       }\r
+    }\r
 \r
+    Hashtable featureColours = new Hashtable();\r
+    void initColours()\r
+    {\r
+      featureColours.put("active site", new Color(255, 75, 0));\r
+      featureColours.put("binding site", new Color(245, 85, 0));\r
+      featureColours.put("calcium-binding region", new Color(235, 95, 0));\r
+      featureColours.put("chain", new Color(225, 105, 0));\r
+      featureColours.put("coiled-coil region", new Color(215, 115, 0));\r
+      featureColours.put("compositionally biased region", new Color(205, 125, 0));\r
+      featureColours.put("cross-link", new Color(195, 135, 0));\r
+      featureColours.put("disulfide bond", new Color(185, 145, 0));\r
+      featureColours.put("DNA-binding region", new Color(175, 155, 0));\r
+      featureColours.put("domain", new Color(165, 165, 0));\r
+      featureColours.put("glycosylation site", new Color(155, 175, 0));\r
+      featureColours.put("helix", new Color(145, 185, 0));\r
+      featureColours.put("initiator methionine", new Color(135, 195, 5));\r
+      featureColours.put("lipid moiety-binding region", new Color(125, 205, 15));\r
+      featureColours.put("metal ion-binding site", new Color(115, 215, 25));\r
+      featureColours.put("modified residue", new Color(105, 225, 35));\r
+      featureColours.put("mutagenesis site", new Color(95, 235, 45));\r
+      featureColours.put("non-consecutive residues", new Color(85, 245, 55));\r
+      featureColours.put("non-terminal residue", new Color(75, 255, 65));\r
+      featureColours.put("nucleotide phosphate-binding region",\r
+                         new Color(65, 245, 75));\r
+      featureColours.put("peptide", new Color(55, 235, 85));\r
+      featureColours.put("propeptide", new Color(45, 225, 95));\r
+      featureColours.put("region of interest", new Color(35, 215, 105));\r
+      featureColours.put("repeat", new Color(25, 205, 115));\r
+      featureColours.put("selenocysteine", new Color(15, 195, 125));\r
+      featureColours.put("sequence conflict", new Color(5, 185, 135));\r
+      featureColours.put("sequence variant", new Color(0, 175, 145));\r
+      featureColours.put("short sequence motif", new Color(0, 165, 155));\r
+      featureColours.put("signal peptide", new Color(0, 155, 165));\r
+      featureColours.put("site", new Color(0, 145, 175));\r
+      featureColours.put("splice variant", new Color(0, 135, 185));\r
+      featureColours.put("strand", new Color(0, 125, 195));\r
+      featureColours.put("topological domain", new Color(0, 115, 205));\r
+      featureColours.put("transit peptide", new Color(0, 105, 215));\r
+      featureColours.put("transmembrane region", new Color(0, 95, 225));\r
+      featureColours.put("turn", new Color(0, 85, 235));\r
+      featureColours.put("unsure residue", new Color(0, 75, 245));\r
+      featureColours.put("zinc finger region", new Color(0, 65, 255));\r
     }\r
-  }\r
 \r
 }\r
+\r
+\r
+\r
index 7cb3763..fcca0c1 100755 (executable)
@@ -25,10 +25,8 @@ import java.awt.*;
 import java.awt.event.*;\r
 \r
 import jalview.datamodel.*;\r
-import jalview.jbappletgui.*;\r
 \r
-public class Finder\r
-    extends GFinder\r
+public class Finder extends Panel\r
 {\r
   AlignViewport av;\r
   AlignmentPanel ap;\r
@@ -40,6 +38,15 @@ public class Finder
   int resIndex = 0;\r
   public Finder(final AlignmentPanel ap)\r
   {\r
+    try\r
+    {\r
+      jbInit();\r
+    }\r
+    catch (Exception e)\r
+    {\r
+      e.printStackTrace();\r
+    }\r
+\r
     this.av = ap.av;\r
     this.ap = ap;\r
     frame = new Frame();\r
@@ -297,4 +304,71 @@ public class Finder
 \r
   }\r
 \r
+  Label jLabel1 = new Label();\r
+  protected TextField textfield = new TextField();\r
+  protected Button findAll = new Button();\r
+  protected Button findNext = new Button();\r
+  Panel jPanel1 = new Panel();\r
+  GridLayout gridLayout1 = new GridLayout();\r
+  protected Button createNewGroup = new Button();\r
+\r
+\r
+  private void jbInit() throws Exception {\r
+      jLabel1.setFont(new java.awt.Font("Verdana", 0, 12));\r
+      jLabel1.setText("Find");\r
+      jLabel1.setBounds(new Rectangle(3, 30, 34, 15));\r
+      this.setLayout(null);\r
+      textfield.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
+      textfield.setText("");\r
+      textfield.setBounds(new Rectangle(40, 27, 133, 21));\r
+      textfield.addKeyListener(new java.awt.event.KeyAdapter() {\r
+              public void keyTyped(KeyEvent e) {\r
+                  textfield_keyTyped(e);\r
+              }\r
+          });\r
+      textfield.addActionListener(new java.awt.event.ActionListener() {\r
+              public void actionPerformed(ActionEvent e) {\r
+                  textfield_actionPerformed(e);\r
+              }\r
+          });\r
+      findAll.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
+      findAll.setLabel("Find all");\r
+      findAll.addActionListener(new java.awt.event.ActionListener() {\r
+              public void actionPerformed(ActionEvent e) {\r
+                  findAll_actionPerformed(e);\r
+              }\r
+          });\r
+      findNext.setEnabled(false);\r
+      findNext.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
+      findNext.setLabel("Find Next");\r
+      findNext.addActionListener(new java.awt.event.ActionListener() {\r
+              public void actionPerformed(ActionEvent e) {\r
+                  findNext_actionPerformed(e);\r
+              }\r
+          });\r
+      jPanel1.setBounds(new Rectangle(180, 5, 141, 64));\r
+      jPanel1.setLayout(gridLayout1);\r
+      gridLayout1.setHgap(0);\r
+      gridLayout1.setRows(3);\r
+      gridLayout1.setVgap(2);\r
+      createNewGroup.setEnabled(false);\r
+      createNewGroup.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
+      createNewGroup.setLabel("Create new group");\r
+      createNewGroup.addActionListener(new java.awt.event.ActionListener() {\r
+              public void actionPerformed(ActionEvent e) {\r
+                  createNewGroup_actionPerformed(e);\r
+              }\r
+          });\r
+      jPanel1.add(findNext, null);\r
+      jPanel1.add(findAll, null);\r
+      jPanel1.add(createNewGroup, null);\r
+      this.add(textfield, null);\r
+      this.add(jLabel1, null);\r
+      this.add(jPanel1, null);\r
+  }\r
+\r
+  void textfield_keyTyped(KeyEvent e) {\r
+      findNext.setEnabled(true);\r
+  }\r
+\r
 }\r
index 17fe98a..27e2a93 100755 (executable)
@@ -21,10 +21,11 @@ package jalview.appletgui;
 \r
 import java.awt.*;\r
 \r
-import jalview.jbappletgui.*;\r
+import java.awt.event.ActionEvent;\r
+import java.awt.event.ItemEvent;\r
 \r
 public class FontChooser\r
-    extends GFontChooser\r
+    extends Panel\r
 {\r
   AlignmentPanel ap;\r
   TreePanel tp;\r
@@ -34,6 +35,15 @@ public class FontChooser
 \r
   public FontChooser(TreePanel tp)\r
   {\r
+    try\r
+    {\r
+      jbInit();\r
+    }\r
+    catch (Exception e)\r
+    {\r
+      e.printStackTrace();\r
+    }\r
+\r
     this.tp = tp;\r
     oldFont = tp.getTreeFont();\r
     init();\r
@@ -152,5 +162,90 @@ public class FontChooser
     }\r
     changeFont();\r
   }\r
+  Label label1 = new Label();\r
+  protected Choice fontSize = new Choice();\r
+  protected Choice fontStyle = new Choice();\r
+  Label label2 = new Label();\r
+  Label label3 = new Label();\r
+  protected Choice fontName = new Choice();\r
+  Button ok = new Button();\r
+  Button cancel = new Button();\r
+  Panel panel1 = new Panel();\r
+  Panel panel2 = new Panel();\r
+  Panel panel3 = new Panel();\r
+  BorderLayout borderLayout1 = new BorderLayout();\r
+  BorderLayout borderLayout2 = new BorderLayout();\r
+  BorderLayout borderLayout3 = new BorderLayout();\r
+  Panel panel4 = new Panel();\r
+  Panel panel5 = new Panel();\r
+  BorderLayout borderLayout4 = new BorderLayout();\r
+\r
+\r
+  private void jbInit() throws Exception {\r
+      label1.setFont(new java.awt.Font("Verdana", 0, 11));\r
+      label1.setAlignment(Label.RIGHT);\r
+      label1.setText("Font: ");\r
+      this.setLayout(borderLayout4);\r
+      fontSize.setFont(new java.awt.Font("Verdana", 0, 11));\r
+      fontSize.addItemListener(new java.awt.event.ItemListener() {\r
+              public void itemStateChanged(ItemEvent e) {\r
+                  fontSize_actionPerformed();\r
+              }\r
+          });\r
+      fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));\r
+      fontStyle.addItemListener(new java.awt.event.ItemListener() {\r
+              public void itemStateChanged(ItemEvent e) {\r
+                  fontStyle_actionPerformed();\r
+              }\r
+          });\r
+      label2.setAlignment(Label.RIGHT);\r
+      label2.setFont(new java.awt.Font("Verdana", 0, 11));\r
+      label2.setText("Size: ");\r
+      label3.setAlignment(Label.RIGHT);\r
+      label3.setFont(new java.awt.Font("Verdana", 0, 11));\r
+      label3.setText("Style: ");\r
+      fontName.setFont(new java.awt.Font("Verdana", 0, 11));\r
+      fontName.addItemListener(new java.awt.event.ItemListener() {\r
+              public void itemStateChanged(ItemEvent e) {\r
+                  fontName_actionPerformed();\r
+              }\r
+          });\r
+      ok.setFont(new java.awt.Font("Verdana", 0, 11));\r
+      ok.setLabel("OK");\r
+      ok.addActionListener(new java.awt.event.ActionListener() {\r
+              public void actionPerformed(ActionEvent e) {\r
+                  ok_actionPerformed();\r
+              }\r
+          });\r
+      cancel.setFont(new java.awt.Font("Verdana", 0, 11));\r
+      cancel.setLabel("Cancel");\r
+      cancel.addActionListener(new java.awt.event.ActionListener() {\r
+              public void actionPerformed(ActionEvent e) {\r
+                  cancel_actionPerformed();\r
+              }\r
+          });\r
+      this.setBackground(Color.white);\r
+      panel1.setLayout(borderLayout1);\r
+      panel2.setLayout(borderLayout3);\r
+      panel3.setLayout(borderLayout2);\r
+      panel5.setBackground(Color.white);\r
+      panel4.setBackground(Color.white);\r
+      panel1.setBackground(Color.white);\r
+      panel2.setBackground(Color.white);\r
+      panel3.setBackground(Color.white);\r
+      panel1.add(label1, BorderLayout.WEST);\r
+      panel1.add(fontName, BorderLayout.CENTER);\r
+      panel5.add(panel1, null);\r
+      panel5.add(panel3, null);\r
+      panel5.add(panel2, null);\r
+      panel2.add(label3, BorderLayout.WEST);\r
+      panel2.add(fontStyle, BorderLayout.CENTER);\r
+      panel3.add(label2, BorderLayout.WEST);\r
+      panel3.add(fontSize, BorderLayout.CENTER);\r
+      this.add(panel4, BorderLayout.SOUTH);\r
+      panel4.add(ok, null);\r
+      panel4.add(cancel, null);\r
+      this.add(panel5, BorderLayout.CENTER);\r
+  }\r
 \r
 }\r
index a277adb..9773019 100755 (executable)
@@ -74,13 +74,8 @@ public class IdCanvas
       gg.setColor(Color.black);\r
     }\r
 \r
-    String string = s.getName();\r
-    if (av.getShowFullId())\r
-    {\r
-      string = s.getDisplayId();\r
-    }\r
 \r
-    gg.drawString(string, 0,\r
+    gg.drawString( s.getDisplayId(av.getShowJVSuffix()), 0,\r
                   ((i - starty) * charHeight) + ypos +\r
                   charHeight - (charHeight / 5));\r
 \r
@@ -260,12 +255,9 @@ public class IdCanvas
                     av.charHeight);\r
 \r
         gg.setColor(currentTextColor);\r
-        String string = av.alignment.getSequenceAt(i).getName();\r
-        if (av.getShowFullId())\r
-        {\r
-          string = av.alignment.getSequenceAt(i).getDisplayId();\r
-        }\r
-        gg.drawString(string, 0,\r
+\r
+        gg.drawString(av.alignment.getSequenceAt(i)\r
+            .getDisplayId(av.getShowJVSuffix()), 0,\r
                       ((i - starty) * av.charHeight) +\r
                       av.charHeight - (av.charHeight / 5));\r
       }\r
index b6e6a2b..d159a4c 100755 (executable)
@@ -116,6 +116,8 @@ public class IdPanel
     //DEFAULT LINK IS FIRST IN THE LINK LIST\r
     int seq = av.getIndex(y);\r
     String id = av.getAlignment().getSequenceAt(seq).getName();\r
+    if (id.indexOf("|") > -1)\r
+        id = id.substring(id.lastIndexOf("|") + 1);\r
 \r
     String target = links.elementAt(0).toString();\r
     target = target.substring(0, target.indexOf("|"));\r
@@ -127,7 +129,8 @@ public class IdPanel
 \r
     try\r
     {\r
-      jalview.bin.JalviewLite.showURL(url, target);\r
+\r
+      alignPanel.alignFrame.showURL(url, target);\r
     }\r
     catch (Exception ex)\r
     {\r
index 7910f2d..23bfd09 100755 (executable)
@@ -39,7 +39,8 @@ public class OverviewPanel
 \r
   // Can set different properties in this seqCanvas than\r
   // main visible SeqCanvas\r
-  SeqCanvas overviewSeq;\r
+  SequenceRenderer sr;\r
+  //FeatureRenderer fr;\r
 \r
 \r
   Frame nullFrame;\r
@@ -52,9 +53,14 @@ public class OverviewPanel
     nullFrame = new Frame();\r
     nullFrame.addNotify();\r
 \r
-    overviewSeq = new SeqCanvas(av);\r
-    overviewSeq.isOverview = true;\r
-    overviewSeq.sr.renderGaps = false;\r
+\r
+    sr = new SequenceRenderer(av);\r
+    sr.graphics = nullFrame.getGraphics();\r
+    sr.renderGaps( false );\r
+    //fr = new FeatureRenderer(av);\r
+    //fr.transparency = ap.seqPanel.seqCanvas.getFeatureRenderer().transparency;\r
+    //fr.featuresDisplayed = ap.seqPanel.seqCanvas.getFeatureRenderer().featuresDisplayed;\r
+\r
 \r
 \r
     // scale the initial size of overviewpanel to shape of alignment\r
@@ -231,31 +237,40 @@ public class OverviewPanel
     float sampleCol = (float) alwidth / (float) width;\r
     float sampleRow = (float) alheight / (float) sequencesHeight;\r
 \r
+    int lastcol=-1, lastrow=-1;\r
+    Color color = Color.white;\r
     for (int col = 0; col < width; col++)\r
     {\r
       for (int row = 0; row < sequencesHeight; row++)\r
       {\r
-        overviewSeq.drawPanel(mg,\r
-                                        (int) (col * sampleCol),\r
-                                        (int) (col * sampleCol),\r
-                                        (int) (row * sampleRow),\r
-                                        (int) (row * sampleRow) + 1,\r
-                                        (int) (col * sampleCol),\r
-                                        (int) (row * sampleRow), 0);\r
-        mg.translate(0, 1);\r
+        if((int)(col*sampleCol) == lastcol && (int)(row*sampleRow)==lastrow)\r
+        {\r
+          mg.setColor(color);\r
+          mg.fillRect(col,row,1,1);\r
+          continue;\r
+        }\r
+\r
+        lastrow = (int)(row*sampleRow);\r
+        lastcol = (int)(col*sampleCol);\r
+\r
+        color = sr.findSequenceColour(av.alignment.getSequenceAt(lastrow), lastcol);\r
+\r
+        mg.setColor(color);\r
+        mg.fillRect(col,row,1,1);\r
 \r
         if (av.conservation != null)\r
+        {\r
+          mg.translate(col, sequencesHeight);\r
           ap.annotationPanel.drawGraph(mg, av.conservation,\r
                                        (int) (sampleCol) + 1,\r
                                        graphHeight,\r
                                        (int) (col * sampleCol),\r
                                        (int) (col * sampleCol) + 1);\r
-\r
+          mg.translate(-col, -sequencesHeight);\r
+        }\r
       }\r
-      mg.translate(0, -sequencesHeight);\r
-      mg.translate(1, 0);\r
+    }\r
 \r
-        }\r
     System.gc();\r
 \r
     resizing = false;\r
index 026ca09..0368d2a 100755 (executable)
@@ -26,10 +26,10 @@ import java.awt.event.*;
 \r
 import jalview.analysis.*;\r
 import jalview.datamodel.*;\r
-import jalview.jbappletgui.*;\r
+\r
 \r
 public class PCAPanel\r
-    extends GPCAPanel implements Runnable\r
+    extends Frame implements Runnable\r
 {\r
   PCA pca;\r
   int top;\r
@@ -40,6 +40,22 @@ public class PCAPanel
 \r
   public PCAPanel(AlignViewport av)\r
   {\r
+    try\r
+    {\r
+      jbInit();\r
+    }\r
+    catch (Exception e)\r
+    {\r
+      e.printStackTrace();\r
+    }\r
+\r
+    for (int i = 1; i < 8; i++)\r
+    {\r
+      xCombobox.addItem("dim " + i);\r
+      yCombobox.addItem("dim " + i);\r
+      zCombobox.addItem("dim " + i);\r
+    }\r
+\r
     this.av = av;\r
     if (av.getSelectionGroup()!=null && av.getSelectionGroup().getSize() > 3)\r
     {\r
@@ -170,5 +186,87 @@ public class PCAPanel
   {\r
     rc.showLabels( labels.getState() );\r
   }\r
+  Panel jPanel2 = new Panel();\r
+  Label jLabel1 = new Label();\r
+  Label jLabel2 = new Label();\r
+  Label jLabel3 = new Label();\r
+  protected Choice xCombobox = new Choice();\r
+  protected Choice yCombobox = new Choice();\r
+  protected Choice zCombobox = new Choice();\r
+  FlowLayout flowLayout1 = new FlowLayout();\r
+  BorderLayout borderLayout1 = new BorderLayout();\r
+  MenuBar menuBar1 = new MenuBar();\r
+  Menu menu1 = new Menu();\r
+  Menu menu2 = new Menu();\r
+  protected CheckboxMenuItem labels = new CheckboxMenuItem();\r
+  MenuItem values = new MenuItem();\r
+\r
+  private void jbInit()\r
+      throws Exception\r
+  {\r
+    this.setLayout(borderLayout1);\r
+    jPanel2.setLayout(flowLayout1);\r
+    jLabel1.setFont(new java.awt.Font("Verdana", 0, 12));\r
+    jLabel1.setText("x=");\r
+    jLabel2.setFont(new java.awt.Font("Verdana", 0, 12));\r
+    jLabel2.setText("y=");\r
+    jLabel3.setFont(new java.awt.Font("Verdana", 0, 12));\r
+    jLabel3.setText("z=");\r
+    jPanel2.setBackground(Color.white);\r
+    zCombobox.setFont(new java.awt.Font("Verdana", 0, 12));\r
+    zCombobox.addItemListener(new java.awt.event.ItemListener()\r
+    {\r
+      public void itemStateChanged(ItemEvent e)\r
+      {\r
+        zCombobox_actionPerformed(null);\r
+      }\r
+    });\r
+    yCombobox.setFont(new java.awt.Font("Verdana", 0, 12));\r
+    yCombobox.addItemListener(new java.awt.event.ItemListener()\r
+    {\r
+      public void itemStateChanged(ItemEvent e)\r
+      {\r
+        yCombobox_actionPerformed(null);\r
+      }\r
+    });\r
+    xCombobox.setFont(new java.awt.Font("Verdana", 0, 12));\r
+    xCombobox.addItemListener(new java.awt.event.ItemListener()\r
+    {\r
+      public void itemStateChanged(ItemEvent e)\r
+      {\r
+        xCombobox_actionPerformed(null);\r
+      }\r
+    });\r
+    this.setMenuBar(menuBar1);\r
+    menu1.setLabel("File");\r
+    menu2.setLabel("View");\r
+    labels.setLabel("Labels");\r
+    labels.addItemListener(new ItemListener()\r
+    {\r
+      public void itemStateChanged(ItemEvent itemEvent)\r
+      {\r
+        labels_itemStateChanged(itemEvent);\r
+      }\r
+    });\r
+    values.setLabel("Output Values...");\r
+    values.addActionListener(new ActionListener()\r
+    {\r
+      public void actionPerformed(ActionEvent actionEvent)\r
+      {\r
+        values_actionPerformed(actionEvent);\r
+      }\r
+    });\r
+    this.add(jPanel2, BorderLayout.SOUTH);\r
+    jPanel2.add(jLabel1, null);\r
+    jPanel2.add(xCombobox, null);\r
+    jPanel2.add(jLabel2, null);\r
+    jPanel2.add(yCombobox, null);\r
+    jPanel2.add(jLabel3, null);\r
+    jPanel2.add(zCombobox, null);\r
+    menuBar1.add(menu1);\r
+    menuBar1.add(menu2);\r
+    menu2.add(labels);\r
+    menu1.add(values);\r
+  }\r
 \r
 }\r
index d5243e3..910a206 100755 (executable)
@@ -25,17 +25,24 @@ import java.awt.event.*;
 \r
 import jalview.analysis.*;\r
 import jalview.datamodel.*;\r
-import jalview.jbappletgui.*;\r
+import java.awt.*;\r
 \r
 public class PairwiseAlignPanel\r
-    extends GPairwiseAlignPanel\r
+    extends Panel\r
 {\r
   Vector sequences = new Vector();\r
   AlignmentPanel ap;\r
 \r
   public PairwiseAlignPanel(AlignmentPanel ap)\r
   {\r
-    super();\r
+    try\r
+    {\r
+      jbInit();\r
+    }\r
+    catch (Exception e)\r
+    {\r
+      e.printStackTrace();\r
+  }\r
     this.ap = ap;\r
     float scores[][] = new float[ap.av.alignment.getHeight()][ap.av.alignment.\r
         getHeight()];\r
@@ -54,7 +61,7 @@ public class PairwiseAlignPanel
 \r
         as.calcScoreMatrix();\r
         as.traceAlignment();\r
-        as.printAlignment();\r
+        as.printAlignment(System.out);\r
         scores[i][j] = (float) as.getMaxScore() / (float) as.getASeq1().length;\r
         totscore = totscore + scores[i][j];\r
 \r
@@ -93,5 +100,27 @@ public class PairwiseAlignPanel
                                    "Pairwise Aligned Sequences");\r
 \r
   }\r
+  protected ScrollPane scrollPane = new ScrollPane();\r
+  protected TextArea textarea = new TextArea();\r
+  protected Button viewInEditorButton = new Button();\r
+  Panel jPanel1 = new Panel();\r
+  BorderLayout borderLayout1 = new BorderLayout();\r
+\r
+  private void jbInit() throws Exception {\r
+      this.setLayout(borderLayout1);\r
+      textarea.setFont(new java.awt.Font("Monospaced", 0, 12));\r
+      textarea.setText("");\r
+      viewInEditorButton.setFont(new java.awt.Font("Verdana", 0, 12));\r
+      viewInEditorButton.setLabel("View in alignment editor");\r
+      viewInEditorButton.addActionListener(new java.awt.event.ActionListener() {\r
+              public void actionPerformed(ActionEvent e) {\r
+                  viewInEditorButton_actionPerformed(e);\r
+              }\r
+          });\r
+      this.add(scrollPane, BorderLayout.CENTER);\r
+      scrollPane.add(textarea);\r
+      this.add(jPanel1, BorderLayout.SOUTH);\r
+      jPanel1.add(viewInEditorButton, null);\r
+  }\r
 \r
 }\r
index 8aed730..3e3691b 100755 (executable)
@@ -24,10 +24,8 @@ import java.util.*;
 import java.awt.event.*;\r
 \r
 import jalview.datamodel.*;\r
-import jalview.jbappletgui.*;\r
 \r
-public class RedundancyPanel\r
-    extends GSliderPanel\r
+public class RedundancyPanel extends SliderPanel\r
 {\r
   AlignmentPanel ap;\r
 \r
@@ -35,6 +33,8 @@ public class RedundancyPanel
 \r
   public RedundancyPanel(AlignmentPanel ap)\r
   {\r
+    super(ap, 0, false, null);\r
+\r
     this.ap = ap;\r
 \r
     label.setText("Enter the redundancy threshold");\r
index 5daa320..370de5f 100755 (executable)
@@ -36,6 +36,8 @@ public class RotatableCanvas
   RotatableMatrix idmat = new RotatableMatrix(3, 3);\r
   RotatableMatrix objmat = new RotatableMatrix(3, 3);\r
   RotatableMatrix rotmat = new RotatableMatrix(3, 3);\r
+  String tooltip;\r
+  int toolx, tooly;\r
 \r
   //RubberbandRectangle rubberband;\r
 \r
@@ -291,6 +293,10 @@ public class RotatableCanvas
     return getPreferredSize();\r
   }\r
 \r
+  public void update(Graphics g)\r
+  {\r
+    paint(g);\r
+  }\r
   public void paint(Graphics g)\r
   {\r
     if (points == null)\r
@@ -323,6 +329,12 @@ public class RotatableCanvas
         drawAxes(ig);\r
       }\r
 \r
+      if(tooltip!=null)\r
+      {\r
+        ig.setColor(Color.red);\r
+        ig.drawString(tooltip, toolx, tooly);\r
+      }\r
+\r
       g.drawImage(img, 0, 0, this);\r
     }\r
   }\r
@@ -389,14 +401,7 @@ public class RotatableCanvas
                      getName(),\r
                      x - 3, y - 4);\r
       }\r
-\r
     }\r
-//    //Now the rectangle\r
-//    if (rectx2 != -1 && recty2 != -1) {\r
-//      g.setColor(Color.white);\r
-//\r
-//      g.drawRect(rectx1,recty1,rectx2-rectx1,recty2-recty1);\r
-//    }\r
   }\r
 \r
   public Dimension minimumsize()\r
@@ -417,7 +422,6 @@ public class RotatableCanvas
 \r
   public void keyPressed(KeyEvent evt)\r
   {\r
-    requestFocus();\r
     if (evt.getKeyCode() == KeyEvent.VK_UP)\r
     {\r
       scalefactor = (float) (scalefactor * 1.1);\r
@@ -507,27 +511,26 @@ public class RotatableCanvas
     repaint();\r
   }\r
 \r
-  // private void fireSequenceSelectionEvent(Selection sel) {\r
-  //   controller.handleSequenceSelectionEvent(new SequenceSelectionEvent(this,sel));\r
-  //}\r
 \r
   public void mouseMoved(MouseEvent evt)\r
   {\r
-    // SequenceI found = findPoint(evt.getX(), evt.getY());\r
+     SequenceI found = findPoint(evt.getX(), evt.getY());\r
+     if(found==null)\r
+       tooltip = null;\r
+     else\r
+     {\r
+       tooltip = found.getName();\r
+       toolx = evt.getX();\r
+       tooly = evt.getY();\r
+     }\r
+     repaint();\r
   }\r
 \r
   public void mouseDragged(MouseEvent evt)\r
   {\r
     mx = evt.getX();\r
     my = evt.getY();\r
-    //Check if this is a rectangle drawing drag\r
-    if ( (evt.getModifiers() & InputEvent.BUTTON2_MASK) != 0)\r
-    {\r
-//      rectx2 = evt.getX();\r
-//      recty2 = evt.getY();\r
-    }\r
-    else\r
-    {\r
+\r
       rotmat.setIdentity();\r
 \r
       rotmat.rotate( (float) (my - omy), 'x');\r
@@ -557,8 +560,6 @@ public class RotatableCanvas
       omy = my;\r
 \r
       paint(this.getGraphics());\r
-    }\r
-\r
   }\r
 \r
   public void rectSelect(int x1, int y1, int x2, int y2)\r
@@ -614,26 +615,5 @@ public class RotatableCanvas
       return null;\r
     }\r
   }\r
-  /*  public boolean handleRubberbandEvent(RubberbandEvent evt) {\r
-      System.out.println("Rubberband handler called in RotatableCanvas with " +\r
-                         evt.getBounds());\r
-\r
-      Rubberband rb = (Rubberband)evt.getSource();\r
-\r
-      // Clear the current selection (instance variable)\r
-      //if ((rb.getModifiers() & Event.SHIFT_MASK) == 0) {\r
-      //   clearSelection();\r
-      //}\r
-\r
-      if (rb.getComponent() == this) {\r
-        Rectangle bounds = evt.getBounds();\r
-   rectSelect(bounds.x,bounds.y,bounds.x+bounds.width,bounds.y+bounds.height);\r
-      }\r
-\r
-      redrawneeded = true;\r
-      paint(this.getGraphics());\r
-\r
-      return true;\r
-    }*/\r
 \r
 }\r
index 1de9418..5d02825 100755 (executable)
@@ -43,7 +43,6 @@ public class SeqCanvas
 \r
   boolean fastPaint = false;\r
 \r
-  boolean isOverview = false;\r
 \r
   public SeqCanvas(AlignViewport av)\r
   {\r
@@ -51,9 +50,30 @@ public class SeqCanvas
     fr = new FeatureRenderer(av);\r
     sr = new SequenceRenderer(av);\r
     PaintRefresher.Register(this, av.alignment);\r
+  }\r
 \r
+  public AlignViewport getViewport()\r
+  {\r
+    return av;\r
+  }\r
+\r
+  public FeatureRenderer getFeatureRenderer()\r
+  {\r
+    return fr;\r
   }\r
 \r
+  MCview.AppletPDBCanvas pdbCanvas;\r
+  public SequenceRenderer getSequenceRenderer()\r
+  {\r
+    return sr;\r
+  }\r
+\r
+  public void setPDBCanvas(MCview.AppletPDBCanvas pc)\r
+  {\r
+    pdbCanvas = pc;\r
+  }\r
+\r
+\r
   void drawNorthScale(Graphics g, int startx, int endx, int ypos)\r
   {\r
     int scalestartx = startx - startx % 10 + 10;\r
@@ -254,6 +274,10 @@ public class SeqCanvas
 \r
     g.drawImage(img, 0, 0, this);\r
 \r
+    if (pdbCanvas != null)\r
+    {\r
+      pdbCanvas.updateSeqColours();\r
+    }\r
   }\r
 \r
   int LABEL_WEST, LABEL_EAST;\r
@@ -368,12 +392,12 @@ public class SeqCanvas
 \r
         if(av.showAnnotation)\r
         {\r
-          g.translate(0, cHeight + ypos);\r
+          g.translate(0, cHeight + ypos+4);\r
           if(annotations==null)\r
             annotations = new AnnotationPanel(av);\r
 \r
           annotations.drawComponent( g, startRes, endx + 1);\r
-          g.translate(0, -cHeight - ypos);\r
+          g.translate(0, -cHeight - ypos-4);\r
         }\r
         g.translate(-LABEL_WEST, 0);\r
 \r
@@ -447,7 +471,7 @@ public class SeqCanvas
       group = (SequenceGroup) groups.elementAt(0);\r
       groupIndex = 0;\r
     }\r
-    if (group != null && !isOverview)\r
+    if (group != null)\r
     {\r
         do\r
         {\r
@@ -473,10 +497,12 @@ public class SeqCanvas
                         group.sequences.contains(av.alignment.getSequenceAt(\r
                                 i)))\r
                 {\r
-                    if ((bottom == -1) &&\r
-                            !group.sequences.contains(\r
-                                av.alignment.getSequenceAt(i + 1)))\r
-                    {\r
+\r
+                    if (bottom == -1)\r
+                   {\r
+                     if(i == y2-1 || // Dont check for i+1 if on the bottom row\r
+                      !group.sequences.contains(av.alignment.getSequenceAt(i+1 )))\r
+\r
                         bottom = sy + av.charHeight;\r
                     }\r
 \r
index 9ed48b2..9030341 100755 (executable)
@@ -290,35 +290,38 @@ public class SeqPanel
       }\r
     }\r
 \r
-    ap.alignFrame.statusBar.setText(text.toString());\r
+    if(seqCanvas.pdbCanvas!=null && sequence==seqCanvas.pdbCanvas.sequence)\r
+    {\r
+      seqCanvas.pdbCanvas.highlightRes(sequence.findPosition(res));\r
+    }\r
+\r
 \r
     // use aa to see if the mouse pointer is on a\r
-    if (av.showSequenceFeatures)\r
+    if (av.showSequenceFeatures && sequence.getSequenceFeatures()!=null)\r
     {\r
       Vector features = sequence.getSequenceFeatures();\r
       Enumeration e = features.elements();\r
-      StringBuffer sbuffer = new StringBuffer();\r
+      text.append(" Sequence Feature: ");\r
 \r
       while (e.hasMoreElements())\r
       {\r
         SequenceFeature sf = (SequenceFeature) e.nextElement();\r
-        if (sf.getStart() <= sequence.findPosition(res) &&\r
+        if (sf.getBegin() <= sequence.findPosition(res) &&\r
             sf.getEnd() >= sequence.findPosition(res))\r
         {\r
-          if (sbuffer.length() > 0)\r
-          {\r
-            sbuffer.append("; ");\r
-          }\r
-          sbuffer.append(sf.getType() + " " + sf.getDescription());\r
+          text.append(sf.getDescription());\r
           if (sf.getStatus().length() > 0)\r
           {\r
-            sbuffer.append(" (" + sf.getStatus() + ")");\r
+            text.append(" (" + sf.getStatus() + ")");\r
           }\r
+          text.append("; ");\r
         }\r
 \r
       }\r
     }\r
 \r
+     ap.alignFrame.statusBar.setText(text.toString());\r
+\r
   }\r
 \r
   public void doMouseDragged(MouseEvent evt)\r
@@ -504,6 +507,9 @@ public class SeqPanel
     oldSeq = seq;\r
     startWrapBlock=wrappedBlock;\r
 \r
+    if(seq==-1)\r
+      return;\r
+\r
     SequenceI sequence = (Sequence) av.getAlignment().getSequenceAt(seq);\r
 \r
     if (sequence == null || res > sequence.getLength())\r
index c413588..c68e85c 100755 (executable)
@@ -44,11 +44,24 @@ public class SequenceRenderer
     renderGaps = b;\r
   }\r
 \r
-  public Color getResidueBoxColour(ColourSchemeI cs, SequenceI seq, int i)\r
+  public Color getResidueBoxColour(SequenceI seq, int i)\r
   {\r
-    getBoxColour(cs, seq, i);\r
+    allGroups = av.alignment.findAllGroups(seq);\r
+\r
+    if (inCurrentSequenceGroup(i))\r
+    {\r
+      if (currentSequenceGroup.getDisplayBoxes())\r
+      {\r
+        getBoxColour(currentSequenceGroup.cs, seq, i);\r
+      }\r
+    }\r
+    else if (av.getShowBoxes())\r
+    {\r
+        getBoxColour(av.globalColourScheme, seq, i);\r
+    }\r
+\r
     return resBoxColour;\r
-  }\r
+    }\r
 \r
   void getBoxColour(ColourSchemeI cs, SequenceI seq, int i)\r
   {\r
@@ -62,6 +75,14 @@ public class SequenceRenderer
     }\r
   }\r
 \r
+  Image offscreen;\r
+  public Color findSequenceColour(SequenceI seq, int i)\r
+  {\r
+    allGroups = av.alignment.findAllGroups(seq);\r
+    drawBoxes(seq, i,i, 0, 0, 1,1);\r
+    return resBoxColour;\r
+  }\r
+\r
   public void drawSequence(Graphics g, SequenceI seq, SequenceGroup[] sg,\r
                            int start, int end, int x1, int y1, int width,\r
                            int height)\r
index 3e23728..a53e9dd 100755 (executable)
@@ -25,11 +25,9 @@ import java.awt.*;
 import java.awt.event.*;\r
 \r
 import jalview.datamodel.*;\r
-import jalview.jbappletgui.*;\r
 import jalview.schemes.*;\r
 \r
-public class SliderPanel\r
-    extends GSliderPanel\r
+public class SliderPanel extends Panel\r
 {\r
   AlignmentPanel ap;\r
   boolean forConservation = true;\r
@@ -153,6 +151,11 @@ public class SliderPanel
   public SliderPanel(AlignmentPanel ap, int value, boolean forConserve,\r
                      ColourSchemeI cs)\r
   {\r
+    try {\r
+        jbInit();\r
+    } catch (Exception e) {\r
+        e.printStackTrace();\r
+      }\r
     this.ap = ap;\r
     this.cs = cs;\r
     forConservation = forConserve;\r
@@ -258,4 +261,76 @@ public class SliderPanel
     return Integer.parseInt(valueField.getText());\r
   }\r
 \r
+  // this is used for conservation colours, PID colours and redundancy threshold\r
+  protected Scrollbar slider = new Scrollbar();\r
+  protected TextField valueField = new TextField();\r
+  protected Label label = new Label();\r
+  Panel jPanel1 = new Panel();\r
+  Panel jPanel2 = new Panel();\r
+  protected Button applyButton = new Button();\r
+  protected Button undoButton = new Button();\r
+  FlowLayout flowLayout1 = new FlowLayout();\r
+  protected Checkbox allGroupsCheck = new Checkbox();\r
+  BorderLayout borderLayout1 = new BorderLayout();\r
+  BorderLayout borderLayout2 = new BorderLayout();\r
+  FlowLayout flowLayout2 = new FlowLayout();\r
+\r
+  private void jbInit() throws Exception {\r
+      this.setLayout(borderLayout2);\r
+\r
+      // slider.setMajorTickSpacing(10);\r
+      //  slider.setMinorTickSpacing(1);\r
+      //  slider.setPaintTicks(true);\r
+      slider.setBackground(Color.white);\r
+      slider.setFont(new java.awt.Font("Verdana", 0, 11));\r
+      slider.setOrientation(0);\r
+      valueField.setFont(new java.awt.Font("Verdana", 0, 11));\r
+      valueField.setText("      ");\r
+      valueField.addActionListener(new java.awt.event.ActionListener() {\r
+              public void actionPerformed(ActionEvent e) {\r
+                  valueField_actionPerformed(e);\r
+              }\r
+          });\r
+      label.setFont(new java.awt.Font("Verdana", 0, 11));\r
+      label.setText("set this label text");\r
+      jPanel1.setLayout(borderLayout1);\r
+      jPanel2.setLayout(flowLayout1);\r
+      applyButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
+      applyButton.setLabel("Apply");\r
+      applyButton.addActionListener(new java.awt.event.ActionListener() {\r
+              public void actionPerformed(ActionEvent e) {\r
+                  applyButton_actionPerformed(e);\r
+              }\r
+          });\r
+      undoButton.setEnabled(false);\r
+      undoButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
+      undoButton.setLabel("Undo");\r
+      undoButton.addActionListener(new java.awt.event.ActionListener() {\r
+              public void actionPerformed(ActionEvent e) {\r
+                  undoButton_actionPerformed(e);\r
+              }\r
+          });\r
+      allGroupsCheck.setEnabled(false);\r
+      allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11));\r
+      allGroupsCheck.setLabel("Apply threshold to all groups");\r
+      allGroupsCheck.setName("Apply to all Groups");\r
+      this.setBackground(Color.white);\r
+      this.setForeground(Color.black);\r
+      jPanel2.add(label, null);\r
+      jPanel2.add(applyButton, null);\r
+      jPanel2.add(undoButton, null);\r
+      jPanel2.add(allGroupsCheck);\r
+      jPanel1.add(valueField, java.awt.BorderLayout.EAST);\r
+      jPanel1.add(slider, java.awt.BorderLayout.CENTER);\r
+      this.add(jPanel1, java.awt.BorderLayout.SOUTH);\r
+      this.add(jPanel2, java.awt.BorderLayout.CENTER);\r
+  }\r
+\r
+  protected void applyButton_actionPerformed(ActionEvent e)\r
+  {\r
+  }\r
+\r
+  protected void undoButton_actionPerformed(ActionEvent e)\r
+  {\r
+  }\r
 }\r
index d4202c3..e3f6c3c 100755 (executable)
@@ -356,6 +356,7 @@ public class TreeCanvas
 \r
     g.setFont(font);\r
 \r
+\r
     FontMetrics fm = g.getFontMetrics(font);\r
 \r
     if (nameHash.size() == 0)\r
index 3e26a4b..99ad412 100755 (executable)
@@ -22,19 +22,17 @@ package jalview.appletgui;
 import java.util.*;\r
 \r
 import java.awt.event.*;\r
+import java.awt.*;\r
 \r
 import jalview.analysis.*;\r
 import jalview.datamodel.*;\r
 import jalview.io.*;\r
-import jalview.jbappletgui.*;\r
 \r
-public class TreePanel\r
-    extends GTreePanel\r
+public class TreePanel extends Frame\r
 {\r
   SequenceI[] seq;\r
   String type;\r
   String pwtype;\r
-  AlignmentPanel ap;\r
   int start;\r
   int end;\r
   TreeCanvas treeCanvas;\r
@@ -58,7 +56,16 @@ public class TreePanel
   public TreePanel(AlignViewport av, Vector seqVector, String type,\r
                    String pwtype, int s, int e)\r
   {\r
-    super();\r
+    try\r
+    {\r
+      jbInit();\r
+      this.setMenuBar(jMenuBar1);\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+      ex.printStackTrace();\r
+    }\r
+\r
     initTreePanel(av, seqVector, type, pwtype, s, e, null);\r
   }\r
 \r
@@ -74,7 +81,16 @@ public class TreePanel
   public TreePanel(AlignViewport av, Vector seqVector, NewickFile newtree,\r
                    String type, String pwtype)\r
   {\r
-    super();\r
+    try\r
+    {\r
+      jbInit();\r
+      this.setMenuBar(jMenuBar1);\r
+    }\r
+    catch (Exception e)\r
+    {\r
+      e.printStackTrace();\r
+    }\r
+\r
     initTreePanel(av, seqVector, type, pwtype, 0, seqVector.size(), newtree);\r
   }\r
 \r
@@ -151,7 +167,7 @@ public class TreePanel
   {\r
     jalview.io.NewickFile fout = new jalview.io.NewickFile(tree.getTopNode());\r
     String output = fout.print(false, true);\r
-    CutAndPasteTransfer cap = new CutAndPasteTransfer(false, ap.alignFrame.applet);\r
+    CutAndPasteTransfer cap = new CutAndPasteTransfer(false, null);\r
     cap.setText(output);\r
     java.awt.Frame frame = new java.awt.Frame();\r
     frame.add(cap);\r
@@ -192,4 +208,71 @@ public class TreePanel
     treeCanvas.setMarkPlaceholders(placeholdersMenu.getState());\r
   }\r
 \r
+  BorderLayout borderLayout1 = new BorderLayout();\r
+  protected ScrollPane scrollPane = new ScrollPane();\r
+  MenuBar jMenuBar1 = new MenuBar();\r
+  Menu jMenu2 = new Menu();\r
+  protected MenuItem fontSize = new MenuItem();\r
+  protected CheckboxMenuItem bootstrapMenu = new CheckboxMenuItem();\r
+  protected CheckboxMenuItem distanceMenu = new CheckboxMenuItem();\r
+  protected CheckboxMenuItem placeholdersMenu = new CheckboxMenuItem();\r
+  protected CheckboxMenuItem fitToWindow = new CheckboxMenuItem();\r
+  Menu fileMenu = new Menu();\r
+  MenuItem newickOutput = new MenuItem();\r
+\r
+  private void jbInit() throws Exception {\r
+      setLayout(borderLayout1);\r
+      this.setBackground(Color.white);\r
+      this.setFont(new java.awt.Font("Verdana", 0, 12));\r
+      jMenu2.setLabel("View");\r
+      fontSize.setLabel("Font...");\r
+      fontSize.addActionListener(new java.awt.event.ActionListener() {\r
+              public void actionPerformed(ActionEvent e) {\r
+                  fontSize_actionPerformed(e);\r
+              }\r
+          });\r
+      bootstrapMenu.setLabel("Show Bootstrap Values");\r
+      bootstrapMenu.addItemListener(new java.awt.event.ItemListener() {\r
+              public void itemStateChanged(ItemEvent e) {\r
+                  bootstrapMenu_actionPerformed(null);\r
+              }\r
+          });\r
+      distanceMenu.setLabel("Show Distances");\r
+      distanceMenu.addItemListener(new java.awt.event.ItemListener() {\r
+              public void itemStateChanged(ItemEvent e) {\r
+                  distanceMenu_actionPerformed(null);\r
+              }\r
+          });\r
+      placeholdersMenu.setLabel("Mark Unassociated Leaves");\r
+      placeholdersMenu.addItemListener(new java.awt.event.ItemListener() {\r
+              public void itemStateChanged(ItemEvent e) {\r
+                  placeholdersMenu_actionPerformed(null);\r
+              }\r
+          });\r
+      fitToWindow.setState(true);\r
+      fitToWindow.setLabel("Fit To Window");\r
+      fitToWindow.addItemListener(new java.awt.event.ItemListener() {\r
+              public void itemStateChanged(ItemEvent e) {\r
+                  fitToWindow_actionPerformed(null);\r
+              }\r
+          });\r
+      fileMenu.setLabel("File");\r
+      newickOutput.setLabel("Newick Format");\r
+      newickOutput.addActionListener(new ActionListener() {\r
+              public void actionPerformed(ActionEvent actionEvent) {\r
+                  newickOutput_actionPerformed(actionEvent);\r
+              }\r
+          });\r
+\r
+    add(scrollPane, BorderLayout.CENTER);\r
+      jMenuBar1.add(fileMenu);\r
+      jMenuBar1.add(jMenu2);\r
+      jMenu2.add(fitToWindow);\r
+      jMenu2.add(fontSize);\r
+      jMenu2.add(distanceMenu);\r
+      jMenu2.add(bootstrapMenu);\r
+      jMenu2.add(placeholdersMenu);\r
+    fileMenu.add(newickOutput);\r
+  }\r
+\r
 }\r
index 36df306..7cd0391 100755 (executable)
@@ -25,11 +25,10 @@ import java.awt.*;
 import java.awt.event.*;\r
 \r
 import jalview.datamodel.*;\r
-import jalview.jbappletgui.*;\r
 import jalview.schemes.*;\r
 \r
 public class UserDefinedColours\r
-    extends GUserDefinedColours\r
+    extends Panel\r
 {\r
 \r
   AlignmentPanel ap;\r
@@ -49,7 +48,11 @@ public class UserDefinedColours
 \r
   public UserDefinedColours(AlignmentPanel ap, SequenceGroup sg)\r
   {\r
-    super();\r
+    try {\r
+        jbInit();\r
+    } catch (Exception e) {\r
+        e.printStackTrace();\r
+      }\r
     frame = new Frame();\r
     frame.add(this);\r
     jalview.bin.JalviewLite.addFrame(frame, "User defined colours", 420, 345);\r
@@ -262,4 +265,136 @@ public class UserDefinedColours
     frame.setVisible(false);\r
   }\r
 \r
+\r
+  protected Panel buttonPanel = new Panel();\r
+  protected GridLayout gridLayout = new GridLayout();\r
+  Panel jPanel2 = new Panel();\r
+  protected Button okButton = new Button();\r
+  protected Button applyButton = new Button();\r
+  protected Button cancelButton = new Button();\r
+  protected Scrollbar rScroller = new Scrollbar();\r
+  Label label1 = new Label();\r
+  protected TextField rText = new TextField();\r
+  Label label4 = new Label();\r
+  protected Scrollbar gScroller = new Scrollbar();\r
+  protected TextField gText = new TextField();\r
+  Label label5 = new Label();\r
+  protected Scrollbar bScroller = new Scrollbar();\r
+  protected TextField bText = new TextField();\r
+  protected Panel target = new Panel();\r
+\r
+  private void jbInit() throws Exception {\r
+      this.setLayout(null);\r
+      buttonPanel.setLayout(gridLayout);\r
+      gridLayout.setColumns(6);\r
+      gridLayout.setRows(4);\r
+      okButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
+      okButton.setLabel("OK");\r
+      okButton.addActionListener(new java.awt.event.ActionListener() {\r
+              public void actionPerformed(ActionEvent e) {\r
+                  okButton_actionPerformed(e);\r
+              }\r
+          });\r
+      applyButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
+      applyButton.setLabel("Apply");\r
+      applyButton.addActionListener(new java.awt.event.ActionListener() {\r
+              public void actionPerformed(ActionEvent e) {\r
+                  applyButton_actionPerformed(e);\r
+              }\r
+          });\r
+      cancelButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
+      cancelButton.setLabel("Cancel");\r
+      cancelButton.addActionListener(new java.awt.event.ActionListener() {\r
+              public void actionPerformed(ActionEvent e) {\r
+                  cancelButton_actionPerformed(e);\r
+              }\r
+          });\r
+      this.setBackground(new Color(212, 208, 223));\r
+      jPanel2.setBounds(new Rectangle(0, 265, 400, 35));\r
+      buttonPanel.setBounds(new Rectangle(0, 123, 400, 142));\r
+      rScroller.setMaximum(256);\r
+      rScroller.setMinimum(0);\r
+      rScroller.setOrientation(0);\r
+      rScroller.setUnitIncrement(1);\r
+  rScroller.setVisibleAmount(1);\r
+  rScroller.setBounds(new Rectangle(36, 27, 119, 19));\r
+  rScroller.addAdjustmentListener(new java.awt.event.AdjustmentListener() {\r
+              public void adjustmentValueChanged(AdjustmentEvent e) {\r
+                  rScroller_adjustmentValueChanged(e);\r
+              }\r
+          });\r
+  label1.setAlignment(Label.RIGHT);\r
+  label1.setText("R");\r
+  label1.setBounds(new Rectangle(19, 30, 16, 15));\r
+  rText.setFont(new java.awt.Font("Dialog", Font.PLAIN, 10));\r
+  rText.setText("0        ");\r
+  rText.setBounds(new Rectangle(156, 27, 53, 19));\r
+  rText.addActionListener(new java.awt.event.ActionListener() {\r
+              public void actionPerformed(ActionEvent e) {\r
+                  rText_actionPerformed(e);\r
+              }\r
+          });\r
+  label4.setAlignment(Label.RIGHT);\r
+  label4.setText("G");\r
+  label4.setBounds(new Rectangle(15, 56, 20, 15));\r
+  gScroller.setMaximum(256);\r
+      gScroller.setMinimum(0);\r
+      gScroller.setOrientation(0);\r
+      gScroller.setUnitIncrement(1);\r
+  gScroller.setVisibleAmount(1);\r
+  gScroller.setBounds(new Rectangle(35, 52, 120, 20));\r
+  gScroller.addAdjustmentListener(new java.awt.event.AdjustmentListener() {\r
+              public void adjustmentValueChanged(AdjustmentEvent e) {\r
+                  gScroller_adjustmentValueChanged(e);\r
+              }\r
+          });\r
+  gText.setFont(new java.awt.Font("Dialog", Font.PLAIN, 10));\r
+  gText.setText("0        ");\r
+  gText.setBounds(new Rectangle(156, 52, 53, 20));\r
+  gText.addActionListener(new java.awt.event.ActionListener() {\r
+              public void actionPerformed(ActionEvent e) {\r
+                  gText_actionPerformed(e);\r
+              }\r
+          });\r
+  label5.setAlignment(Label.RIGHT);\r
+  label5.setText("B");\r
+  label5.setBounds(new Rectangle(14, 82, 20, 15));\r
+  bScroller.setMaximum(256);\r
+      bScroller.setMinimum(0);\r
+      bScroller.setOrientation(0);\r
+      bScroller.setUnitIncrement(1);\r
+  bScroller.setVisibleAmount(1);\r
+  bScroller.setBounds(new Rectangle(35, 78, 120, 20));\r
+  bScroller.addAdjustmentListener(new java.awt.event.AdjustmentListener() {\r
+              public void adjustmentValueChanged(AdjustmentEvent e) {\r
+                  bScroller_adjustmentValueChanged(e);\r
+              }\r
+          });\r
+  bText.setFont(new java.awt.Font("Dialog", Font.PLAIN, 10));\r
+  bText.setText("0        ");\r
+  bText.setBounds(new Rectangle(157, 78, 52, 20));\r
+  bText.addActionListener(new java.awt.event.ActionListener() {\r
+              public void actionPerformed(ActionEvent e) {\r
+                  bText_actionPerformed(e);\r
+              }\r
+          });\r
+  target.setBackground(Color.black);\r
+      target.setBounds(new Rectangle(229, 26, 134, 79));\r
+      this.add(jPanel2, null);\r
+      jPanel2.add(okButton, null);\r
+      jPanel2.add(applyButton, null);\r
+      jPanel2.add(cancelButton, null);\r
+      this.add(buttonPanel, null);\r
+  this.add(target, null);\r
+  this.add(gScroller);\r
+  this.add(rScroller);\r
+  this.add(bScroller);\r
+  this.add(label5);\r
+  this.add(label4);\r
+  this.add(label1);\r
+  this.add(gText);\r
+  this.add(rText);\r
+  this.add(bText);\r
+}\r
+\r
 }\r
index 2899abb..1a67c05 100755 (executable)
@@ -57,8 +57,11 @@ public class Jalview
         System.out.println("Usage: jalview -open [FILE] [OUTPUT_FORMAT] [OUTPUT_FILE]\n\n"\r
                            +"-nodisplay\tRun Jalview without User Interface.\n"\r
                            +"-props FILE\tUse the given Jalview properties file instead of users default.\n"\r
-                           +"-groups FILE\tUse the given file to mark groups on the alignment. \nGroups file is in the following tab delimited format\n"\r
-                           +"TEXT<tab>SEQUENCE_ID<tab>SEQUENCE_INDEX<tab>START_RESIDUE<tab>END_RESIDUE<tab>COLOUR\n"\r
+                           +"-groups FILE\tUse the given file to mark groups on the alignment."\r
+                           +"\nThe first lines of the groups file lists the GroupName and GroupColours"\r
+                           +" to be used in the alignment. Use the GROUPNAME label for each of your sequences. "\r
+                           +"\nGROUPNAME<tab>GROUPCOLOUR\n"\r
+                           +"TEXT<tab>SEQUENCE_ID<tab>SEQUENCE_INDEX<tab>START_RESIDUE<tab>END_RESIDUE<tab>GROUPNAME\n"\r
                            +"SequenceID is used in preference to SequenceIndex if both are provided.\n"\r
                            +"Enter ID_NOT_SPECIFIED for SEQUENCE_ID or -1 for SEQUENCE_INDEX if unknown.\n"\r
                            +"COLOUR can be hexadecimal RGB or 'red', 'blue' etc.\n\n"\r
index 1e94a0d..d5801df 100755 (executable)
@@ -40,18 +40,18 @@ public class JalviewLite extends Applet
 {\r
     static int lastFrameX = 200;\r
     static int lastFrameY = 200;\r
-    static Applet applet;\r
     boolean fileFound = true;\r
     String file = "No file";\r
     Button launcher = new Button("Start Jalview");\r
 \r
+    AlignFrame currentAlignFrame;\r
+\r
+\r
     /**\r
      * init method for Jalview Applet\r
      */\r
     public void init()\r
     {\r
-        applet = this;\r
-\r
         int r = 255;\r
         int g = 255;\r
         int b = 255;\r
@@ -73,22 +73,42 @@ public class JalviewLite extends Applet
             }\r
         }\r
 \r
+        param = getParameter("label");\r
+        if(param != null)\r
+          launcher.setLabel(param);\r
+\r
         this.setBackground(new Color(r, g, b));\r
 \r
-        file = getParameter("file");\r
 \r
+        param = getParameter("features");\r
+        if(param!=null)\r
+        {\r
+          if(param.indexOf("://")==-1)\r
+               param = getCodeBase() + param;\r
+        }\r
+        final String featuresFile = param;\r
+\r
+        file = getParameter("file");\r
+        final JalviewLite applet = this;\r
         if (file != null)\r
         {\r
             add(launcher);\r
-            file = applet.getCodeBase() + file;\r
+            if(file.indexOf("://")==-1)\r
+               file = getCodeBase() + file;\r
+\r
             launcher.addActionListener(new java.awt.event.ActionListener()\r
                 {\r
                     public void actionPerformed(ActionEvent e)\r
                     {\r
                         String format = jalview.io.IdentifyFile.Identify(file,\r
                                 "URL");\r
-                        LoadFile(file, "URL", format);\r
-                    }\r
+                        LoadingThread loader = new LoadingThread(file,\r
+                            "URL",\r
+                            format,\r
+                            featuresFile,\r
+                            applet);\r
+                        loader.start();\r
+                      }\r
                 });\r
         }\r
         else\r
@@ -98,6 +118,7 @@ public class JalviewLite extends Applet
         }\r
     }\r
 \r
+\r
     public static void main(String [] args)\r
     {\r
       if(args.length!=1)\r
@@ -106,9 +127,8 @@ public class JalviewLite extends Applet
         System.exit(1);\r
       }\r
 \r
-\r
       String format = jalview.io.IdentifyFile.Identify(args[0],"File");\r
-      SequenceI[] sequences = new FormatAdapter().readFile(args[0], "File", format);\r
+      SequenceI[] sequences = new AppletFormatAdapter().readFile(args[0], "File", format);\r
 \r
       if ( (sequences != null) && (sequences.length > 0))\r
       {\r
@@ -117,50 +137,6 @@ public class JalviewLite extends Applet
       }\r
     }\r
 \r
-    /**\r
-     * Displays the given URL in a new browser window\r
-     *\r
-     * @param url URL to display in browser window.\r
-     * <br>New window will be named "HELP_WINDOW"\r
-     */\r
-    public static void showURL(String url)\r
-    {\r
-      showURL(url, "HELP");\r
-    }\r
-\r
-      public static void showURL(String url, String target)\r
-      {\r
-        if(applet==null)\r
-        {\r
-          System.out.println("Not running as applet - no browser available.");\r
-        }\r
-        else\r
-        {\r
-          try\r
-          {\r
-            applet.getAppletContext().showDocument(new java.net.URL(url),\r
-                target);\r
-          }\r
-          catch (Exception ex)\r
-          {\r
-            ex.printStackTrace();\r
-          }\r
-        }\r
-      }\r
-\r
-\r
-    /**\r
-     * Starts a new LoadingThread for loading an alignment file\r
-     *\r
-     * @param file file name including full path to file\r
-     * @param protocol file or URL or paste\r
-     * @param format Fasta, Clustal, PFAM, MSF, PIR, BLC, Jalview\r
-     */\r
-    public void LoadFile(String file, String protocol, String format)\r
-    {\r
-        LoadingThread loader = new LoadingThread(file, protocol, format, this);\r
-        loader.start();\r
-    }\r
 \r
     /**\r
      * Initialises and displays a new java.awt.Frame\r
@@ -182,12 +158,36 @@ public class JalviewLite extends Applet
             {\r
                 public void windowClosing(WindowEvent e)\r
                 {\r
+                    lastFrameX -=40;\r
+                    lastFrameY-=40;\r
                     frame.dispose();\r
                 }\r
             });\r
         frame.setVisible(true);\r
     }\r
 \r
+    public String getAlignment(String format)\r
+    {\r
+      return getAlignment(format, "true");\r
+    }\r
+\r
+    public String getAlignment(String format, String suffix)\r
+    {\r
+      try\r
+      {\r
+        boolean seqlimits = suffix.equalsIgnoreCase("true");\r
+\r
+        String reply = new AppletFormatAdapter().formatSequences(format,\r
+            currentAlignFrame.viewport.getAlignment().getSequences(), seqlimits);\r
+        return reply;\r
+      }\r
+      catch (Exception ex)\r
+      {ex.printStackTrace();\r
+        return "Error retrieving alignment in " + format + " format. ";\r
+\r
+      }\r
+    }\r
+\r
     /**\r
      * This paints the background surrounding the "Launch Jalview button"\r
      * <br>\r
@@ -213,27 +213,54 @@ public class JalviewLite extends Applet
         String file;\r
         String protocol;\r
         String format;\r
-        JalviewLite jlapplet;\r
+        String featuresFile;\r
+        JalviewLite applet;\r
 \r
-        public LoadingThread(String file, String protocol, String format,\r
-            JalviewLite applet)\r
+        public LoadingThread(String file,\r
+                             String protocol,\r
+                             String format,\r
+                             String features,\r
+                             JalviewLite applet)\r
         {\r
             this.file = file;\r
             this.protocol = protocol;\r
             this.format = format;\r
-            this.jlapplet = applet;\r
+            featuresFile = features;\r
+            this.applet = applet;\r
         }\r
 \r
         public void run()\r
         {\r
             SequenceI[] sequences = null;\r
-            sequences = new FormatAdapter().readFile(file, protocol, format);\r
+            sequences = new AppletFormatAdapter().readFile(file, protocol, format);\r
 \r
             if ((sequences != null) && (sequences.length > 0))\r
             {\r
-                AlignFrame af = new AlignFrame(new Alignment(sequences),\r
-                        jlapplet, file);\r
-                af.statusBar.setText("Successfully loaded file " + file);\r
+                currentAlignFrame = new AlignFrame(new Alignment(sequences),\r
+                        applet, file);\r
+                currentAlignFrame.statusBar.setText("Successfully loaded file " + file);\r
+\r
+                if(featuresFile!=null)\r
+                  currentAlignFrame.parseFeaturesFile(featuresFile);\r
+\r
+                String pdbfile = applet.getParameter("PDBFILE");\r
+                if(pdbfile!=null)\r
+                {\r
+                  if(pdbfile.indexOf("://")==-1)\r
+                       pdbfile = getCodeBase() + pdbfile;\r
+\r
+                  String sequence = applet.getParameter("PDBSEQ");\r
+\r
+                  if(sequence!=null)\r
+                  {\r
+                    new MCview.AppletPDBViewer(pdbfile, "URL",\r
+                                               (Sequence)currentAlignFrame.getAlignViewport().getAlignment().findName(sequence),\r
+                                               currentAlignFrame.getSeqcanvas());\r
+\r
+\r
+                  }\r
+\r
+                }\r
             }\r
             else\r
             {\r
diff --git a/src/jalview/binding/Feature.java b/src/jalview/binding/Feature.java
new file mode 100755 (executable)
index 0000000..95d5192
--- /dev/null
@@ -0,0 +1,305 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.binding;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Feature.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Feature implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _begin\r
+     */\r
+    private int _begin;\r
+\r
+    /**\r
+     * keeps track of state for field: _begin\r
+     */\r
+    private boolean _has_begin;\r
+\r
+    /**\r
+     * Field _end\r
+     */\r
+    private int _end;\r
+\r
+    /**\r
+     * keeps track of state for field: _end\r
+     */\r
+    private boolean _has_end;\r
+\r
+    /**\r
+     * Field _type\r
+     */\r
+    private java.lang.String _type;\r
+\r
+    /**\r
+     * Field _description\r
+     */\r
+    private java.lang.String _description;\r
+\r
+    /**\r
+     * Field _status\r
+     */\r
+    private java.lang.String _status;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Feature() {\r
+        super();\r
+    } //-- jalview.binding.Feature()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method deleteBegin\r
+     * \r
+     */\r
+    public void deleteBegin()\r
+    {\r
+        this._has_begin= false;\r
+    } //-- void deleteBegin() \r
+\r
+    /**\r
+     * Method deleteEnd\r
+     * \r
+     */\r
+    public void deleteEnd()\r
+    {\r
+        this._has_end= false;\r
+    } //-- void deleteEnd() \r
+\r
+    /**\r
+     * Returns the value of field 'begin'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'begin'.\r
+     */\r
+    public int getBegin()\r
+    {\r
+        return this._begin;\r
+    } //-- int getBegin() \r
+\r
+    /**\r
+     * Returns the value of field 'description'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'description'.\r
+     */\r
+    public java.lang.String getDescription()\r
+    {\r
+        return this._description;\r
+    } //-- java.lang.String getDescription() \r
+\r
+    /**\r
+     * Returns the value of field 'end'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'end'.\r
+     */\r
+    public int getEnd()\r
+    {\r
+        return this._end;\r
+    } //-- int getEnd() \r
+\r
+    /**\r
+     * Returns the value of field 'status'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'status'.\r
+     */\r
+    public java.lang.String getStatus()\r
+    {\r
+        return this._status;\r
+    } //-- java.lang.String getStatus() \r
+\r
+    /**\r
+     * Returns the value of field 'type'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'type'.\r
+     */\r
+    public java.lang.String getType()\r
+    {\r
+        return this._type;\r
+    } //-- java.lang.String getType() \r
+\r
+    /**\r
+     * Method hasBegin\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasBegin()\r
+    {\r
+        return this._has_begin;\r
+    } //-- boolean hasBegin() \r
+\r
+    /**\r
+     * Method hasEnd\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasEnd()\r
+    {\r
+        return this._has_end;\r
+    } //-- boolean hasEnd() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'begin'.\r
+     * \r
+     * @param begin the value of field 'begin'.\r
+     */\r
+    public void setBegin(int begin)\r
+    {\r
+        this._begin = begin;\r
+        this._has_begin = true;\r
+    } //-- void setBegin(int) \r
+\r
+    /**\r
+     * Sets the value of field 'description'.\r
+     * \r
+     * @param description the value of field 'description'.\r
+     */\r
+    public void setDescription(java.lang.String description)\r
+    {\r
+        this._description = description;\r
+    } //-- void setDescription(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'end'.\r
+     * \r
+     * @param end the value of field 'end'.\r
+     */\r
+    public void setEnd(int end)\r
+    {\r
+        this._end = end;\r
+        this._has_end = true;\r
+    } //-- void setEnd(int) \r
+\r
+    /**\r
+     * Sets the value of field 'status'.\r
+     * \r
+     * @param status the value of field 'status'.\r
+     */\r
+    public void setStatus(java.lang.String status)\r
+    {\r
+        this._status = status;\r
+    } //-- void setStatus(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'type'.\r
+     * \r
+     * @param type the value of field 'type'.\r
+     */\r
+    public void setType(java.lang.String type)\r
+    {\r
+        this._type = type;\r
+    } //-- void setType(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.binding.Feature) Unmarshaller.unmarshal(jalview.binding.Feature.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/binding/FeatureSettings.java b/src/jalview/binding/FeatureSettings.java
new file mode 100755 (executable)
index 0000000..2ef3731
--- /dev/null
@@ -0,0 +1,274 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.binding;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import java.util.Enumeration;\r
+import java.util.Vector;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class FeatureSettings.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class FeatureSettings implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _settingList\r
+     */\r
+    private java.util.Vector _settingList;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public FeatureSettings() {\r
+        super();\r
+        _settingList = new Vector();\r
+    } //-- jalview.binding.FeatureSettings()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method addSetting\r
+     * \r
+     * \r
+     * \r
+     * @param vSetting\r
+     */\r
+    public void addSetting(jalview.binding.Setting vSetting)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _settingList.addElement(vSetting);\r
+    } //-- void addSetting(jalview.binding.Setting) \r
+\r
+    /**\r
+     * Method addSetting\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vSetting\r
+     */\r
+    public void addSetting(int index, jalview.binding.Setting vSetting)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _settingList.insertElementAt(vSetting, index);\r
+    } //-- void addSetting(int, jalview.binding.Setting) \r
+\r
+    /**\r
+     * Method enumerateSetting\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateSetting()\r
+    {\r
+        return _settingList.elements();\r
+    } //-- java.util.Enumeration enumerateSetting() \r
+\r
+    /**\r
+     * Method getSetting\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Setting\r
+     */\r
+    public jalview.binding.Setting getSetting(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _settingList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.binding.Setting) _settingList.elementAt(index);\r
+    } //-- jalview.binding.Setting getSetting(int) \r
+\r
+    /**\r
+     * Method getSetting\r
+     * \r
+     * \r
+     * \r
+     * @return Setting\r
+     */\r
+    public jalview.binding.Setting[] getSetting()\r
+    {\r
+        int size = _settingList.size();\r
+        jalview.binding.Setting[] mArray = new jalview.binding.Setting[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.binding.Setting) _settingList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.binding.Setting[] getSetting() \r
+\r
+    /**\r
+     * Method getSettingCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getSettingCount()\r
+    {\r
+        return _settingList.size();\r
+    } //-- int getSettingCount() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Method removeAllSetting\r
+     * \r
+     */\r
+    public void removeAllSetting()\r
+    {\r
+        _settingList.removeAllElements();\r
+    } //-- void removeAllSetting() \r
+\r
+    /**\r
+     * Method removeSetting\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Setting\r
+     */\r
+    public jalview.binding.Setting removeSetting(int index)\r
+    {\r
+        java.lang.Object obj = _settingList.elementAt(index);\r
+        _settingList.removeElementAt(index);\r
+        return (jalview.binding.Setting) obj;\r
+    } //-- jalview.binding.Setting removeSetting(int) \r
+\r
+    /**\r
+     * Method setSetting\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vSetting\r
+     */\r
+    public void setSetting(int index, jalview.binding.Setting vSetting)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _settingList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _settingList.setElementAt(vSetting, index);\r
+    } //-- void setSetting(int, jalview.binding.Setting) \r
+\r
+    /**\r
+     * Method setSetting\r
+     * \r
+     * \r
+     * \r
+     * @param settingArray\r
+     */\r
+    public void setSetting(jalview.binding.Setting[] settingArray)\r
+    {\r
+        //-- copy array\r
+        _settingList.removeAllElements();\r
+        for (int i = 0; i < settingArray.length; i++) {\r
+            _settingList.addElement(settingArray[i]);\r
+        }\r
+    } //-- void setSetting(jalview.binding.Setting) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.binding.FeatureSettings) Unmarshaller.unmarshal(jalview.binding.FeatureSettings.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/binding/Features.java b/src/jalview/binding/Features.java
new file mode 100755 (executable)
index 0000000..4706beb
--- /dev/null
@@ -0,0 +1,118 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.binding;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Features.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Features extends Feature \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Features() {\r
+        super();\r
+    } //-- jalview.binding.Features()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.binding.Features) Unmarshaller.unmarshal(jalview.binding.Features.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
index 751409f..ee55945 100755 (executable)
@@ -15,6 +15,8 @@ import java.io.IOException;
 import java.io.Reader;\r
 import java.io.Serializable;\r
 import java.io.Writer;\r
+import java.util.Enumeration;\r
+import java.util.Vector;\r
 import org.exolab.castor.xml.MarshalException;\r
 import org.exolab.castor.xml.Marshaller;\r
 import org.exolab.castor.xml.Unmarshaller;\r
@@ -73,6 +75,16 @@ public class JSeq implements java.io.Serializable {
      */\r
     private boolean _has_id;\r
 \r
+    /**\r
+     * Field _featuresList\r
+     */\r
+    private java.util.Vector _featuresList;\r
+\r
+    /**\r
+     * Field _pdbidsList\r
+     */\r
+    private java.util.Vector _pdbidsList;\r
+\r
 \r
       //----------------/\r
      //- Constructors -/\r
@@ -80,6 +92,8 @@ public class JSeq implements java.io.Serializable {
 \r
     public JSeq() {\r
         super();\r
+        _featuresList = new Vector();\r
+        _pdbidsList = new Vector();\r
     } //-- jalview.binding.JSeq()\r
 \r
 \r
@@ -88,6 +102,60 @@ public class JSeq implements java.io.Serializable {
     //-----------/\r
 \r
     /**\r
+     * Method addFeatures\r
+     * \r
+     * \r
+     * \r
+     * @param vFeatures\r
+     */\r
+    public void addFeatures(jalview.binding.Features vFeatures)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _featuresList.addElement(vFeatures);\r
+    } //-- void addFeatures(jalview.binding.Features) \r
+\r
+    /**\r
+     * Method addFeatures\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vFeatures\r
+     */\r
+    public void addFeatures(int index, jalview.binding.Features vFeatures)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _featuresList.insertElementAt(vFeatures, index);\r
+    } //-- void addFeatures(int, jalview.binding.Features) \r
+\r
+    /**\r
+     * Method addPdbids\r
+     * \r
+     * \r
+     * \r
+     * @param vPdbids\r
+     */\r
+    public void addPdbids(jalview.binding.Pdbids vPdbids)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _pdbidsList.addElement(vPdbids);\r
+    } //-- void addPdbids(jalview.binding.Pdbids) \r
+\r
+    /**\r
+     * Method addPdbids\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vPdbids\r
+     */\r
+    public void addPdbids(int index, jalview.binding.Pdbids vPdbids)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _pdbidsList.insertElementAt(vPdbids, index);\r
+    } //-- void addPdbids(int, jalview.binding.Pdbids) \r
+\r
+    /**\r
      * Method deleteColour\r
      * \r
      */\r
@@ -124,6 +192,30 @@ public class JSeq implements java.io.Serializable {
     } //-- void deleteStart() \r
 \r
     /**\r
+     * Method enumerateFeatures\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateFeatures()\r
+    {\r
+        return _featuresList.elements();\r
+    } //-- java.util.Enumeration enumerateFeatures() \r
+\r
+    /**\r
+     * Method enumeratePdbids\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumeratePdbids()\r
+    {\r
+        return _pdbidsList.elements();\r
+    } //-- java.util.Enumeration enumeratePdbids() \r
+\r
+    /**\r
      * Returns the value of field 'colour'.\r
      * \r
      * @return int\r
@@ -146,6 +238,54 @@ public class JSeq implements java.io.Serializable {
     } //-- int getEnd() \r
 \r
     /**\r
+     * Method getFeatures\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Features\r
+     */\r
+    public jalview.binding.Features getFeatures(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _featuresList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.binding.Features) _featuresList.elementAt(index);\r
+    } //-- jalview.binding.Features getFeatures(int) \r
+\r
+    /**\r
+     * Method getFeatures\r
+     * \r
+     * \r
+     * \r
+     * @return Features\r
+     */\r
+    public jalview.binding.Features[] getFeatures()\r
+    {\r
+        int size = _featuresList.size();\r
+        jalview.binding.Features[] mArray = new jalview.binding.Features[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.binding.Features) _featuresList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.binding.Features[] getFeatures() \r
+\r
+    /**\r
+     * Method getFeaturesCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getFeaturesCount()\r
+    {\r
+        return _featuresList.size();\r
+    } //-- int getFeaturesCount() \r
+\r
+    /**\r
      * Returns the value of field 'id'.\r
      * \r
      * @return int\r
@@ -157,6 +297,54 @@ public class JSeq implements java.io.Serializable {
     } //-- int getId() \r
 \r
     /**\r
+     * Method getPdbids\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Pdbids\r
+     */\r
+    public jalview.binding.Pdbids getPdbids(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _pdbidsList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.binding.Pdbids) _pdbidsList.elementAt(index);\r
+    } //-- jalview.binding.Pdbids getPdbids(int) \r
+\r
+    /**\r
+     * Method getPdbids\r
+     * \r
+     * \r
+     * \r
+     * @return Pdbids\r
+     */\r
+    public jalview.binding.Pdbids[] getPdbids()\r
+    {\r
+        int size = _pdbidsList.size();\r
+        jalview.binding.Pdbids[] mArray = new jalview.binding.Pdbids[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.binding.Pdbids) _pdbidsList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.binding.Pdbids[] getPdbids() \r
+\r
+    /**\r
+     * Method getPdbidsCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getPdbidsCount()\r
+    {\r
+        return _pdbidsList.size();\r
+    } //-- int getPdbidsCount() \r
+\r
+    /**\r
      * Returns the value of field 'start'.\r
      * \r
      * @return int\r
@@ -262,6 +450,54 @@ public class JSeq implements java.io.Serializable {
     } //-- void marshal(org.xml.sax.ContentHandler) \r
 \r
     /**\r
+     * Method removeAllFeatures\r
+     * \r
+     */\r
+    public void removeAllFeatures()\r
+    {\r
+        _featuresList.removeAllElements();\r
+    } //-- void removeAllFeatures() \r
+\r
+    /**\r
+     * Method removeAllPdbids\r
+     * \r
+     */\r
+    public void removeAllPdbids()\r
+    {\r
+        _pdbidsList.removeAllElements();\r
+    } //-- void removeAllPdbids() \r
+\r
+    /**\r
+     * Method removeFeatures\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Features\r
+     */\r
+    public jalview.binding.Features removeFeatures(int index)\r
+    {\r
+        java.lang.Object obj = _featuresList.elementAt(index);\r
+        _featuresList.removeElementAt(index);\r
+        return (jalview.binding.Features) obj;\r
+    } //-- jalview.binding.Features removeFeatures(int) \r
+\r
+    /**\r
+     * Method removePdbids\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Pdbids\r
+     */\r
+    public jalview.binding.Pdbids removePdbids(int index)\r
+    {\r
+        java.lang.Object obj = _pdbidsList.elementAt(index);\r
+        _pdbidsList.removeElementAt(index);\r
+        return (jalview.binding.Pdbids) obj;\r
+    } //-- jalview.binding.Pdbids removePdbids(int) \r
+\r
+    /**\r
      * Sets the value of field 'colour'.\r
      * \r
      * @param colour the value of field 'colour'.\r
@@ -284,6 +520,40 @@ public class JSeq implements java.io.Serializable {
     } //-- void setEnd(int) \r
 \r
     /**\r
+     * Method setFeatures\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vFeatures\r
+     */\r
+    public void setFeatures(int index, jalview.binding.Features vFeatures)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _featuresList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _featuresList.setElementAt(vFeatures, index);\r
+    } //-- void setFeatures(int, jalview.binding.Features) \r
+\r
+    /**\r
+     * Method setFeatures\r
+     * \r
+     * \r
+     * \r
+     * @param featuresArray\r
+     */\r
+    public void setFeatures(jalview.binding.Features[] featuresArray)\r
+    {\r
+        //-- copy array\r
+        _featuresList.removeAllElements();\r
+        for (int i = 0; i < featuresArray.length; i++) {\r
+            _featuresList.addElement(featuresArray[i]);\r
+        }\r
+    } //-- void setFeatures(jalview.binding.Features) \r
+\r
+    /**\r
      * Sets the value of field 'id'.\r
      * \r
      * @param id the value of field 'id'.\r
@@ -295,6 +565,40 @@ public class JSeq implements java.io.Serializable {
     } //-- void setId(int) \r
 \r
     /**\r
+     * Method setPdbids\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vPdbids\r
+     */\r
+    public void setPdbids(int index, jalview.binding.Pdbids vPdbids)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _pdbidsList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _pdbidsList.setElementAt(vPdbids, index);\r
+    } //-- void setPdbids(int, jalview.binding.Pdbids) \r
+\r
+    /**\r
+     * Method setPdbids\r
+     * \r
+     * \r
+     * \r
+     * @param pdbidsArray\r
+     */\r
+    public void setPdbids(jalview.binding.Pdbids[] pdbidsArray)\r
+    {\r
+        //-- copy array\r
+        _pdbidsList.removeAllElements();\r
+        for (int i = 0; i < pdbidsArray.length; i++) {\r
+            _pdbidsList.addElement(pdbidsArray[i]);\r
+        }\r
+    } //-- void setPdbids(jalview.binding.Pdbids) \r
+\r
+    /**\r
      * Sets the value of field 'start'.\r
      * \r
      * @param start the value of field 'start'.\r
index 4ac40d5..cbb50d5 100755 (executable)
@@ -60,6 +60,11 @@ public class JalviewModelSequence implements java.io.Serializable {
      */\r
     private java.util.Vector _treeList;\r
 \r
+    /**\r
+     * Field _featureSettings\r
+     */\r
+    private jalview.binding.FeatureSettings _featureSettings;\r
+\r
 \r
       //----------------/\r
      //- Constructors -/\r
@@ -275,6 +280,17 @@ public class JalviewModelSequence implements java.io.Serializable {
     } //-- java.util.Enumeration enumerateViewport() \r
 \r
     /**\r
+     * Returns the value of field 'featureSettings'.\r
+     * \r
+     * @return FeatureSettings\r
+     * @return the value of field 'featureSettings'.\r
+     */\r
+    public jalview.binding.FeatureSettings getFeatureSettings()\r
+    {\r
+        return this._featureSettings;\r
+    } //-- jalview.binding.FeatureSettings getFeatureSettings() \r
+\r
+    /**\r
      * Method getJGroup\r
      * \r
      * \r
@@ -681,6 +697,16 @@ public class JalviewModelSequence implements java.io.Serializable {
     } //-- jalview.binding.Viewport removeViewport(int) \r
 \r
     /**\r
+     * Sets the value of field 'featureSettings'.\r
+     * \r
+     * @param featureSettings the value of field 'featureSettings'.\r
+     */\r
+    public void setFeatureSettings(jalview.binding.FeatureSettings featureSettings)\r
+    {\r
+        this._featureSettings = featureSettings;\r
+    } //-- void setFeatureSettings(jalview.binding.FeatureSettings) \r
+\r
+    /**\r
      * Method setJGroup\r
      * \r
      * \r
diff --git a/src/jalview/binding/JalviewModelSequence2.java b/src/jalview/binding/JalviewModelSequence2.java
deleted file mode 100755 (executable)
index 2cfd72c..0000000
+++ /dev/null
@@ -1,319 +0,0 @@
-/*\r
- * This class was automatically generated with\r
- * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
- * Schema.\r
- * $Id$\r
- */\r
-package jalview.binding;\r
-\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-\r
-import org.xml.sax.ContentHandler;\r
-\r
-//---------------------------------/\r
-//- Imported classes and packages -/\r
-//---------------------------------/\r
-import java.io.IOException;\r
-import java.io.Reader;\r
-import java.io.Serializable;\r
-import java.io.Writer;\r
-\r
-import java.util.Enumeration;\r
-import java.util.Vector;\r
-\r
-\r
-/**\r
- * Class JalviewModelSequence2.\r
- *\r
- * @version $Revision$ $Date$\r
- */\r
-public class JalviewModelSequence2 implements java.io.Serializable\r
-{\r
-    //--------------------------/\r
-    //- Class/Member Variables -/\r
-    //--------------------------/\r
-\r
-    /**\r
-     * Field _items\r
-     */\r
-    private java.util.Vector _items;\r
-\r
-    //----------------/\r
-    //- Constructors -/\r
-    //----------------/\r
-    public JalviewModelSequence2()\r
-    {\r
-        super();\r
-        _items = new Vector();\r
-    }\r
-\r
-    //-- jalview.binding.JalviewModelSequence2()\r
-    //-----------/\r
-\r
-    /**\r
-     * DOCUMENT ME!\r
-     *\r
-     * @param vJalviewModelSequence2Item DOCUMENT ME!\r
-     *\r
-     * @throws java.lang.IndexOutOfBoundsException DOCUMENT ME!\r
-     */\r
-    public void addJalviewModelSequence2Item(\r
-        jalview.binding.JalviewModelSequence2Item vJalviewModelSequence2Item)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
-        _items.addElement(vJalviewModelSequence2Item);\r
-    }\r
-\r
-    //-- void addJalviewModelSequence2Item(jalview.binding.JalviewModelSequence2Item) \r
-\r
-    /**\r
-     * Method addJalviewModelSequence2Item\r
-     *\r
-     *\r
-     *\r
-     * @param index\r
-     * @param vJalviewModelSequence2Item\r
-     */\r
-    public void addJalviewModelSequence2Item(int index,\r
-        jalview.binding.JalviewModelSequence2Item vJalviewModelSequence2Item)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
-        _items.insertElementAt(vJalviewModelSequence2Item, index);\r
-    }\r
-\r
-    //-- void addJalviewModelSequence2Item(int, jalview.binding.JalviewModelSequence2Item) \r
-\r
-    /**\r
-     * Method enumerateJalviewModelSequence2Item\r
-     *\r
-     *\r
-     *\r
-     * @return Enumeration\r
-     */\r
-    public java.util.Enumeration enumerateJalviewModelSequence2Item()\r
-    {\r
-        return _items.elements();\r
-    }\r
-\r
-    //-- java.util.Enumeration enumerateJalviewModelSequence2Item() \r
-\r
-    /**\r
-     * Method getJalviewModelSequence2Item\r
-     *\r
-     *\r
-     *\r
-     * @param index\r
-     * @return JalviewModelSequence2Item\r
-     */\r
-    public jalview.binding.JalviewModelSequence2Item getJalviewModelSequence2Item(\r
-        int index) throws java.lang.IndexOutOfBoundsException\r
-    {\r
-        //-- check bounds for index\r
-        if ((index < 0) || (index > _items.size()))\r
-        {\r
-            throw new IndexOutOfBoundsException();\r
-        }\r
-\r
-        return (jalview.binding.JalviewModelSequence2Item) _items.elementAt(index);\r
-    }\r
-\r
-    //-- jalview.binding.JalviewModelSequence2Item getJalviewModelSequence2Item(int) \r
-\r
-    /**\r
-     * Method getJalviewModelSequence2Item\r
-     *\r
-     *\r
-     *\r
-     * @return JalviewModelSequence2Item\r
-     */\r
-    public jalview.binding.JalviewModelSequence2Item[] getJalviewModelSequence2Item()\r
-    {\r
-        int size = _items.size();\r
-        jalview.binding.JalviewModelSequence2Item[] mArray = new jalview.binding.JalviewModelSequence2Item[size];\r
-\r
-        for (int index = 0; index < size; index++)\r
-        {\r
-            mArray[index] = (jalview.binding.JalviewModelSequence2Item) _items.elementAt(index);\r
-        }\r
-\r
-        return mArray;\r
-    }\r
-\r
-    //-- jalview.binding.JalviewModelSequence2Item[] getJalviewModelSequence2Item() \r
-\r
-    /**\r
-     * Method getJalviewModelSequence2ItemCount\r
-     *\r
-     *\r
-     *\r
-     * @return int\r
-     */\r
-    public int getJalviewModelSequence2ItemCount()\r
-    {\r
-        return _items.size();\r
-    }\r
-\r
-    //-- int getJalviewModelSequence2ItemCount() \r
-\r
-    /**\r
-     * Method isValid\r
-     *\r
-     *\r
-     *\r
-     * @return boolean\r
-     */\r
-    public boolean isValid()\r
-    {\r
-        try\r
-        {\r
-            validate();\r
-        }\r
-        catch (org.exolab.castor.xml.ValidationException vex)\r
-        {\r
-            return false;\r
-        }\r
-\r
-        return true;\r
-    }\r
-\r
-    //-- boolean isValid() \r
-\r
-    /**\r
-     * Method marshal\r
-     *\r
-     *\r
-     *\r
-     * @param out\r
-     */\r
-    public void marshal(java.io.Writer out)\r
-        throws org.exolab.castor.xml.MarshalException, \r
-            org.exolab.castor.xml.ValidationException\r
-    {\r
-        Marshaller.marshal(this, out);\r
-    }\r
-\r
-    //-- void marshal(java.io.Writer) \r
-\r
-    /**\r
-     * Method marshal\r
-     *\r
-     *\r
-     *\r
-     * @param handler\r
-     */\r
-    public void marshal(org.xml.sax.ContentHandler handler)\r
-        throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
-            org.exolab.castor.xml.ValidationException\r
-    {\r
-        Marshaller.marshal(this, handler);\r
-    }\r
-\r
-    //-- void marshal(org.xml.sax.ContentHandler) \r
-\r
-    /**\r
-     * Method removeAllJalviewModelSequence2Item\r
-     *\r
-     */\r
-    public void removeAllJalviewModelSequence2Item()\r
-    {\r
-        _items.removeAllElements();\r
-    }\r
-\r
-    //-- void removeAllJalviewModelSequence2Item() \r
-\r
-    /**\r
-     * Method removeJalviewModelSequence2Item\r
-     *\r
-     *\r
-     *\r
-     * @param index\r
-     * @return JalviewModelSequence2Item\r
-     */\r
-    public jalview.binding.JalviewModelSequence2Item removeJalviewModelSequence2Item(\r
-        int index)\r
-    {\r
-        java.lang.Object obj = _items.elementAt(index);\r
-        _items.removeElementAt(index);\r
-\r
-        return (jalview.binding.JalviewModelSequence2Item) obj;\r
-    }\r
-\r
-    //-- jalview.binding.JalviewModelSequence2Item removeJalviewModelSequence2Item(int) \r
-\r
-    /**\r
-     * Method setJalviewModelSequence2Item\r
-     *\r
-     *\r
-     *\r
-     * @param index\r
-     * @param vJalviewModelSequence2Item\r
-     */\r
-    public void setJalviewModelSequence2Item(int index,\r
-        jalview.binding.JalviewModelSequence2Item vJalviewModelSequence2Item)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
-        //-- check bounds for index\r
-        if ((index < 0) || (index > _items.size()))\r
-        {\r
-            throw new IndexOutOfBoundsException();\r
-        }\r
-\r
-        _items.setElementAt(vJalviewModelSequence2Item, index);\r
-    }\r
-\r
-    //-- void setJalviewModelSequence2Item(int, jalview.binding.JalviewModelSequence2Item) \r
-\r
-    /**\r
-     * Method setJalviewModelSequence2Item\r
-     *\r
-     *\r
-     *\r
-     * @param jalviewModelSequence2ItemArray\r
-     */\r
-    public void setJalviewModelSequence2Item(\r
-        jalview.binding.JalviewModelSequence2Item[] jalviewModelSequence2ItemArray)\r
-    {\r
-        //-- copy array\r
-        _items.removeAllElements();\r
-\r
-        for (int i = 0; i < jalviewModelSequence2ItemArray.length; i++)\r
-        {\r
-            _items.addElement(jalviewModelSequence2ItemArray[i]);\r
-        }\r
-    }\r
-\r
-    //-- void setJalviewModelSequence2Item(jalview.binding.JalviewModelSequence2Item) \r
-\r
-    /**\r
-     * Method unmarshal\r
-     *\r
-     *\r
-     *\r
-     * @param reader\r
-     * @return Object\r
-     */\r
-    public static java.lang.Object unmarshal(java.io.Reader reader)\r
-        throws org.exolab.castor.xml.MarshalException, \r
-            org.exolab.castor.xml.ValidationException\r
-    {\r
-        return (jalview.binding.JalviewModelSequence2) Unmarshaller.unmarshal(jalview.binding.JalviewModelSequence2.class,\r
-            reader);\r
-    }\r
-\r
-    //-- java.lang.Object unmarshal(java.io.Reader) \r
-\r
-    /**\r
-     * Method validate\r
-     *\r
-     */\r
-    public void validate() throws org.exolab.castor.xml.ValidationException\r
-    {\r
-        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
-        validator.validate(this);\r
-    }\r
-\r
-    //-- void validate() \r
-}\r
diff --git a/src/jalview/binding/JalviewModelSequence2Item.java b/src/jalview/binding/JalviewModelSequence2Item.java
deleted file mode 100755 (executable)
index 6e54565..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-/*\r
- * This class was automatically generated with\r
- * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
- * Schema.\r
- * $Id$\r
- */\r
-\r
-package jalview.binding;\r
-\r
-//---------------------------------/\r
-//- Imported classes and packages -/\r
-//---------------------------------/\r
-\r
-import java.util.*;\r
-\r
-/**\r
- * Class JalviewModelSequence2Item.\r
- *\r
- * @version $Revision$ $Date$\r
- */\r
-public class JalviewModelSequence2Item\r
-    implements java.io.Serializable\r
-{\r
-\r
-  //--------------------------/\r
-  //- Class/Member Variables -/\r
-  //--------------------------/\r
-\r
-  /**\r
-   * Field _userColourSchemeList\r
-   */\r
-  private java.util.Vector _userColourSchemeList;\r
-\r
-  //----------------/\r
-  //- Constructors -/\r
-  //----------------/\r
-\r
-  public JalviewModelSequence2Item()\r
-  {\r
-    super();\r
-    _userColourSchemeList = new Vector();\r
-  } //-- jalview.binding.JalviewModelSequence2Item()\r
-\r
-  //-----------/\r
-  //- Methods -/\r
-  //-----------/\r
-\r
-  /**\r
-   * Method addUserColourScheme\r
-   *\r
-   *\r
-   *\r
-   * @param vUserColourScheme\r
-   */\r
-  public void addUserColourScheme(jalview.binding.UserColourScheme\r
-                                  vUserColourScheme)\r
-      throws java.lang.IndexOutOfBoundsException\r
-  {\r
-    _userColourSchemeList.addElement(vUserColourScheme);\r
-  } //-- void addUserColourScheme(jalview.binding.UserColourScheme)\r
-\r
-  /**\r
-   * Method addUserColourScheme\r
-   *\r
-   *\r
-   *\r
-   * @param index\r
-   * @param vUserColourScheme\r
-   */\r
-  public void addUserColourScheme(int index,\r
-                                  jalview.binding.UserColourScheme\r
-                                  vUserColourScheme)\r
-      throws java.lang.IndexOutOfBoundsException\r
-  {\r
-    _userColourSchemeList.insertElementAt(vUserColourScheme, index);\r
-  } //-- void addUserColourScheme(int, jalview.binding.UserColourScheme)\r
-\r
-  /**\r
-   * Method enumerateUserColourScheme\r
-   *\r
-   *\r
-   *\r
-   * @return Enumeration\r
-   */\r
-  public java.util.Enumeration enumerateUserColourScheme()\r
-  {\r
-    return _userColourSchemeList.elements();\r
-  } //-- java.util.Enumeration enumerateUserColourScheme()\r
-\r
-  /**\r
-   * Method getUserColourScheme\r
-   *\r
-   *\r
-   *\r
-   * @param index\r
-   * @return UserColourScheme\r
-   */\r
-  public jalview.binding.UserColourScheme getUserColourScheme(int index)\r
-      throws java.lang.IndexOutOfBoundsException\r
-  {\r
-    //-- check bounds for index\r
-    if ( (index < 0) || (index > _userColourSchemeList.size()))\r
-    {\r
-      throw new IndexOutOfBoundsException();\r
-    }\r
-\r
-    return (jalview.binding.UserColourScheme) _userColourSchemeList.elementAt(\r
-        index);\r
-  } //-- jalview.binding.UserColourScheme getUserColourScheme(int)\r
-\r
-  /**\r
-   * Method getUserColourScheme\r
-   *\r
-   *\r
-   *\r
-   * @return UserColourScheme\r
-   */\r
-  public jalview.binding.UserColourScheme[] getUserColourScheme()\r
-  {\r
-    int size = _userColourSchemeList.size();\r
-    jalview.binding.UserColourScheme[] mArray = new jalview.binding.\r
-        UserColourScheme[size];\r
-    for (int index = 0; index < size; index++)\r
-    {\r
-      mArray[index] = (jalview.binding.UserColourScheme) _userColourSchemeList.\r
-          elementAt(index);\r
-    }\r
-    return mArray;\r
-  } //-- jalview.binding.UserColourScheme[] getUserColourScheme()\r
-\r
-  /**\r
-   * Method getUserColourSchemeCount\r
-   *\r
-   *\r
-   *\r
-   * @return int\r
-   */\r
-  public int getUserColourSchemeCount()\r
-  {\r
-    return _userColourSchemeList.size();\r
-  } //-- int getUserColourSchemeCount()\r
-\r
-  /**\r
-   * Method removeAllUserColourScheme\r
-   *\r
-   */\r
-  public void removeAllUserColourScheme()\r
-  {\r
-    _userColourSchemeList.removeAllElements();\r
-  } //-- void removeAllUserColourScheme()\r
-\r
-  /**\r
-   * Method removeUserColourScheme\r
-   *\r
-   *\r
-   *\r
-   * @param index\r
-   * @return UserColourScheme\r
-   */\r
-  public jalview.binding.UserColourScheme removeUserColourScheme(int index)\r
-  {\r
-    java.lang.Object obj = _userColourSchemeList.elementAt(index);\r
-    _userColourSchemeList.removeElementAt(index);\r
-    return (jalview.binding.UserColourScheme) obj;\r
-  } //-- jalview.binding.UserColourScheme removeUserColourScheme(int)\r
-\r
-  /**\r
-   * Method setUserColourScheme\r
-   *\r
-   *\r
-   *\r
-   * @param index\r
-   * @param vUserColourScheme\r
-   */\r
-  public void setUserColourScheme(int index,\r
-                                  jalview.binding.UserColourScheme\r
-                                  vUserColourScheme)\r
-      throws java.lang.IndexOutOfBoundsException\r
-  {\r
-    //-- check bounds for index\r
-    if ( (index < 0) || (index > _userColourSchemeList.size()))\r
-    {\r
-      throw new IndexOutOfBoundsException();\r
-    }\r
-    _userColourSchemeList.setElementAt(vUserColourScheme, index);\r
-  } //-- void setUserColourScheme(int, jalview.binding.UserColourScheme)\r
-\r
-  /**\r
-   * Method setUserColourScheme\r
-   *\r
-   *\r
-   *\r
-   * @param userColourSchemeArray\r
-   */\r
-  public void setUserColourScheme(jalview.binding.UserColourScheme[]\r
-                                  userColourSchemeArray)\r
-  {\r
-    //-- copy array\r
-    _userColourSchemeList.removeAllElements();\r
-    for (int i = 0; i < userColourSchemeArray.length; i++)\r
-    {\r
-      _userColourSchemeList.addElement(userColourSchemeArray[i]);\r
-    }\r
-  } //-- void setUserColourScheme(jalview.binding.UserColourScheme)\r
-\r
-}\r
diff --git a/src/jalview/binding/Pdbentry.java b/src/jalview/binding/Pdbentry.java
new file mode 100755 (executable)
index 0000000..7e0ae30
--- /dev/null
@@ -0,0 +1,326 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.binding;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import java.util.Enumeration;\r
+import java.util.Vector;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Pdbentry.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Pdbentry implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _id\r
+     */\r
+    private java.lang.String _id;\r
+\r
+    /**\r
+     * Field _type\r
+     */\r
+    private java.lang.String _type;\r
+\r
+    /**\r
+     * Field _items\r
+     */\r
+    private java.util.Vector _items;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Pdbentry() {\r
+        super();\r
+        _items = new Vector();\r
+    } //-- jalview.binding.Pdbentry()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method addPdbentryItem\r
+     * \r
+     * \r
+     * \r
+     * @param vPdbentryItem\r
+     */\r
+    public void addPdbentryItem(jalview.binding.PdbentryItem vPdbentryItem)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _items.addElement(vPdbentryItem);\r
+    } //-- void addPdbentryItem(jalview.binding.PdbentryItem) \r
+\r
+    /**\r
+     * Method addPdbentryItem\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vPdbentryItem\r
+     */\r
+    public void addPdbentryItem(int index, jalview.binding.PdbentryItem vPdbentryItem)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _items.insertElementAt(vPdbentryItem, index);\r
+    } //-- void addPdbentryItem(int, jalview.binding.PdbentryItem) \r
+\r
+    /**\r
+     * Method enumeratePdbentryItem\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumeratePdbentryItem()\r
+    {\r
+        return _items.elements();\r
+    } //-- java.util.Enumeration enumeratePdbentryItem() \r
+\r
+    /**\r
+     * Returns the value of field 'id'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'id'.\r
+     */\r
+    public java.lang.String getId()\r
+    {\r
+        return this._id;\r
+    } //-- java.lang.String getId() \r
+\r
+    /**\r
+     * Method getPdbentryItem\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return PdbentryItem\r
+     */\r
+    public jalview.binding.PdbentryItem getPdbentryItem(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _items.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.binding.PdbentryItem) _items.elementAt(index);\r
+    } //-- jalview.binding.PdbentryItem getPdbentryItem(int) \r
+\r
+    /**\r
+     * Method getPdbentryItem\r
+     * \r
+     * \r
+     * \r
+     * @return PdbentryItem\r
+     */\r
+    public jalview.binding.PdbentryItem[] getPdbentryItem()\r
+    {\r
+        int size = _items.size();\r
+        jalview.binding.PdbentryItem[] mArray = new jalview.binding.PdbentryItem[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.binding.PdbentryItem) _items.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.binding.PdbentryItem[] getPdbentryItem() \r
+\r
+    /**\r
+     * Method getPdbentryItemCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getPdbentryItemCount()\r
+    {\r
+        return _items.size();\r
+    } //-- int getPdbentryItemCount() \r
+\r
+    /**\r
+     * Returns the value of field 'type'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'type'.\r
+     */\r
+    public java.lang.String getType()\r
+    {\r
+        return this._type;\r
+    } //-- java.lang.String getType() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Method removeAllPdbentryItem\r
+     * \r
+     */\r
+    public void removeAllPdbentryItem()\r
+    {\r
+        _items.removeAllElements();\r
+    } //-- void removeAllPdbentryItem() \r
+\r
+    /**\r
+     * Method removePdbentryItem\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return PdbentryItem\r
+     */\r
+    public jalview.binding.PdbentryItem removePdbentryItem(int index)\r
+    {\r
+        java.lang.Object obj = _items.elementAt(index);\r
+        _items.removeElementAt(index);\r
+        return (jalview.binding.PdbentryItem) obj;\r
+    } //-- jalview.binding.PdbentryItem removePdbentryItem(int) \r
+\r
+    /**\r
+     * Sets the value of field 'id'.\r
+     * \r
+     * @param id the value of field 'id'.\r
+     */\r
+    public void setId(java.lang.String id)\r
+    {\r
+        this._id = id;\r
+    } //-- void setId(java.lang.String) \r
+\r
+    /**\r
+     * Method setPdbentryItem\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vPdbentryItem\r
+     */\r
+    public void setPdbentryItem(int index, jalview.binding.PdbentryItem vPdbentryItem)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _items.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _items.setElementAt(vPdbentryItem, index);\r
+    } //-- void setPdbentryItem(int, jalview.binding.PdbentryItem) \r
+\r
+    /**\r
+     * Method setPdbentryItem\r
+     * \r
+     * \r
+     * \r
+     * @param pdbentryItemArray\r
+     */\r
+    public void setPdbentryItem(jalview.binding.PdbentryItem[] pdbentryItemArray)\r
+    {\r
+        //-- copy array\r
+        _items.removeAllElements();\r
+        for (int i = 0; i < pdbentryItemArray.length; i++) {\r
+            _items.addElement(pdbentryItemArray[i]);\r
+        }\r
+    } //-- void setPdbentryItem(jalview.binding.PdbentryItem) \r
+\r
+    /**\r
+     * Sets the value of field 'type'.\r
+     * \r
+     * @param type the value of field 'type'.\r
+     */\r
+    public void setType(java.lang.String type)\r
+    {\r
+        this._type = type;\r
+    } //-- void setType(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.binding.Pdbentry) Unmarshaller.unmarshal(jalview.binding.Pdbentry.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/binding/PdbentryItem.java b/src/jalview/binding/PdbentryItem.java
new file mode 100755 (executable)
index 0000000..d797520
--- /dev/null
@@ -0,0 +1,197 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.binding;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.Serializable;\r
+import java.util.Enumeration;\r
+import java.util.Vector;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+\r
+/**\r
+ * Class PdbentryItem.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class PdbentryItem implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _propertyList\r
+     */\r
+    private java.util.Vector _propertyList;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public PdbentryItem() {\r
+        super();\r
+        _propertyList = new Vector();\r
+    } //-- jalview.binding.PdbentryItem()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method addProperty\r
+     * \r
+     * \r
+     * \r
+     * @param vProperty\r
+     */\r
+    public void addProperty(jalview.binding.Property vProperty)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _propertyList.addElement(vProperty);\r
+    } //-- void addProperty(jalview.binding.Property) \r
+\r
+    /**\r
+     * Method addProperty\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vProperty\r
+     */\r
+    public void addProperty(int index, jalview.binding.Property vProperty)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _propertyList.insertElementAt(vProperty, index);\r
+    } //-- void addProperty(int, jalview.binding.Property) \r
+\r
+    /**\r
+     * Method enumerateProperty\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateProperty()\r
+    {\r
+        return _propertyList.elements();\r
+    } //-- java.util.Enumeration enumerateProperty() \r
+\r
+    /**\r
+     * Method getProperty\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Property\r
+     */\r
+    public jalview.binding.Property getProperty(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _propertyList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.binding.Property) _propertyList.elementAt(index);\r
+    } //-- jalview.binding.Property getProperty(int) \r
+\r
+    /**\r
+     * Method getProperty\r
+     * \r
+     * \r
+     * \r
+     * @return Property\r
+     */\r
+    public jalview.binding.Property[] getProperty()\r
+    {\r
+        int size = _propertyList.size();\r
+        jalview.binding.Property[] mArray = new jalview.binding.Property[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.binding.Property) _propertyList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.binding.Property[] getProperty() \r
+\r
+    /**\r
+     * Method getPropertyCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getPropertyCount()\r
+    {\r
+        return _propertyList.size();\r
+    } //-- int getPropertyCount() \r
+\r
+    /**\r
+     * Method removeAllProperty\r
+     * \r
+     */\r
+    public void removeAllProperty()\r
+    {\r
+        _propertyList.removeAllElements();\r
+    } //-- void removeAllProperty() \r
+\r
+    /**\r
+     * Method removeProperty\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Property\r
+     */\r
+    public jalview.binding.Property removeProperty(int index)\r
+    {\r
+        java.lang.Object obj = _propertyList.elementAt(index);\r
+        _propertyList.removeElementAt(index);\r
+        return (jalview.binding.Property) obj;\r
+    } //-- jalview.binding.Property removeProperty(int) \r
+\r
+    /**\r
+     * Method setProperty\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vProperty\r
+     */\r
+    public void setProperty(int index, jalview.binding.Property vProperty)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _propertyList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _propertyList.setElementAt(vProperty, index);\r
+    } //-- void setProperty(int, jalview.binding.Property) \r
+\r
+    /**\r
+     * Method setProperty\r
+     * \r
+     * \r
+     * \r
+     * @param propertyArray\r
+     */\r
+    public void setProperty(jalview.binding.Property[] propertyArray)\r
+    {\r
+        //-- copy array\r
+        _propertyList.removeAllElements();\r
+        for (int i = 0; i < propertyArray.length; i++) {\r
+            _propertyList.addElement(propertyArray[i]);\r
+        }\r
+    } //-- void setProperty(jalview.binding.Property) \r
+\r
+}\r
diff --git a/src/jalview/binding/Pdbids.java b/src/jalview/binding/Pdbids.java
new file mode 100755 (executable)
index 0000000..4875b8b
--- /dev/null
@@ -0,0 +1,118 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.binding;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Pdbids.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Pdbids extends Pdbentry \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Pdbids() {\r
+        super();\r
+    } //-- jalview.binding.Pdbids()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.binding.Pdbids) Unmarshaller.unmarshal(jalview.binding.Pdbids.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/binding/Property.java b/src/jalview/binding/Property.java
new file mode 100755 (executable)
index 0000000..c0a1cdd
--- /dev/null
@@ -0,0 +1,173 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.binding;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Property.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Property implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _name\r
+     */\r
+    private java.lang.String _name;\r
+\r
+    /**\r
+     * Field _value\r
+     */\r
+    private java.lang.String _value;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Property() {\r
+        super();\r
+    } //-- jalview.binding.Property()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Returns the value of field 'name'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'name'.\r
+     */\r
+    public java.lang.String getName()\r
+    {\r
+        return this._name;\r
+    } //-- java.lang.String getName() \r
+\r
+    /**\r
+     * Returns the value of field 'value'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'value'.\r
+     */\r
+    public java.lang.String getValue()\r
+    {\r
+        return this._value;\r
+    } //-- java.lang.String getValue() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'name'.\r
+     * \r
+     * @param name the value of field 'name'.\r
+     */\r
+    public void setName(java.lang.String name)\r
+    {\r
+        this._name = name;\r
+    } //-- void setName(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'value'.\r
+     * \r
+     * @param value the value of field 'value'.\r
+     */\r
+    public void setValue(java.lang.String value)\r
+    {\r
+        this._value = value;\r
+    } //-- void setValue(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.binding.Property) Unmarshaller.unmarshal(jalview.binding.Property.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/binding/Setting.java b/src/jalview/binding/Setting.java
new file mode 100755 (executable)
index 0000000..7b56676
--- /dev/null
@@ -0,0 +1,253 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.binding;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Setting.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Setting implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _type\r
+     */\r
+    private java.lang.String _type;\r
+\r
+    /**\r
+     * Field _colour\r
+     */\r
+    private int _colour;\r
+\r
+    /**\r
+     * keeps track of state for field: _colour\r
+     */\r
+    private boolean _has_colour;\r
+\r
+    /**\r
+     * Field _display\r
+     */\r
+    private boolean _display;\r
+\r
+    /**\r
+     * keeps track of state for field: _display\r
+     */\r
+    private boolean _has_display;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Setting() {\r
+        super();\r
+    } //-- jalview.binding.Setting()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method deleteColour\r
+     * \r
+     */\r
+    public void deleteColour()\r
+    {\r
+        this._has_colour= false;\r
+    } //-- void deleteColour() \r
+\r
+    /**\r
+     * Method deleteDisplay\r
+     * \r
+     */\r
+    public void deleteDisplay()\r
+    {\r
+        this._has_display= false;\r
+    } //-- void deleteDisplay() \r
+\r
+    /**\r
+     * Returns the value of field 'colour'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'colour'.\r
+     */\r
+    public int getColour()\r
+    {\r
+        return this._colour;\r
+    } //-- int getColour() \r
+\r
+    /**\r
+     * Returns the value of field 'display'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'display'.\r
+     */\r
+    public boolean getDisplay()\r
+    {\r
+        return this._display;\r
+    } //-- boolean getDisplay() \r
+\r
+    /**\r
+     * Returns the value of field 'type'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'type'.\r
+     */\r
+    public java.lang.String getType()\r
+    {\r
+        return this._type;\r
+    } //-- java.lang.String getType() \r
+\r
+    /**\r
+     * Method hasColour\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasColour()\r
+    {\r
+        return this._has_colour;\r
+    } //-- boolean hasColour() \r
+\r
+    /**\r
+     * Method hasDisplay\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasDisplay()\r
+    {\r
+        return this._has_display;\r
+    } //-- boolean hasDisplay() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'colour'.\r
+     * \r
+     * @param colour the value of field 'colour'.\r
+     */\r
+    public void setColour(int colour)\r
+    {\r
+        this._colour = colour;\r
+        this._has_colour = true;\r
+    } //-- void setColour(int) \r
+\r
+    /**\r
+     * Sets the value of field 'display'.\r
+     * \r
+     * @param display the value of field 'display'.\r
+     */\r
+    public void setDisplay(boolean display)\r
+    {\r
+        this._display = display;\r
+        this._has_display = true;\r
+    } //-- void setDisplay(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'type'.\r
+     * \r
+     * @param type the value of field 'type'.\r
+     */\r
+    public void setType(java.lang.String type)\r
+    {\r
+        this._type = type;\r
+    } //-- void setType(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.binding.Setting) Unmarshaller.unmarshal(jalview.binding.Setting.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
index ac8f47a..338294b 100755 (executable)
@@ -29,40 +29,30 @@ import java.util.*;
  */\r
 public class Alignment implements AlignmentI\r
 {\r
+    protected Alignment dataset;\r
     protected Vector sequences;\r
     protected Vector groups = new Vector();\r
     protected Vector superGroup = new Vector();\r
     protected char gapCharacter = '-';\r
-    protected boolean isNucleotide = true;\r
-\r
+    protected int type = NUCLEOTIDE;\r
+    public static final int PROTEIN = 0;\r
+    public static final int NUCLEOTIDE = 1;\r
 \r
     /** DOCUMENT ME!! */\r
     public AlignmentAnnotation[] annotations;\r
 \r
-    /** DOCUMENT ME!! */\r
-    public boolean featuresAdded = false;\r
-\r
     /** Make an alignment from an array of Sequences.\r
      *\r
      * @param sequences\r
      */\r
     public Alignment(SequenceI[] seqs)\r
     {\r
-        int i=0, iSize = seqs.length, j, jSize;\r
-        while(isNucleotide && i<iSize)\r
-        {\r
-            jSize = seqs[i].getLength();\r
-            for(j=0; j<jSize; j++)\r
-            {\r
-              if(!jalview.schemes.ResidueProperties.nucleotideHash.containsKey(seqs[i].getSequence(j, j+1))\r
-              && !jalview.util.Comparison.isGap(seqs[i].getSequence().charAt(j)))\r
-              {\r
-                isNucleotide = false;\r
-                break;\r
-              }\r
-            }\r
-            i++;\r
-        }\r
+        int i=0;\r
+\r
+        if( jalview.util.Comparison.isNucleotide(seqs))\r
+          type = NUCLEOTIDE;\r
+        else\r
+          type = PROTEIN;\r
 \r
         sequences = new Vector();\r
 \r
@@ -464,11 +454,9 @@ public class Alignment implements AlignmentI
 \r
         while (i < sequences.size())\r
         {\r
-            SequenceI s = getSequenceAt(i);\r
-\r
-            if (s.getName().equals(name))\r
+            if (getSequenceAt(i).getName().equals(name))\r
             {\r
-                return s;\r
+                return getSequenceAt(i);\r
             }\r
 \r
             i++;\r
@@ -477,25 +465,6 @@ public class Alignment implements AlignmentI
         return null;\r
     }\r
 \r
-    /**    */\r
-    public SequenceI findbyDisplayId(String name)\r
-    {\r
-        int i = 0;\r
-\r
-        while (i < sequences.size())\r
-        {\r
-            SequenceI s = getSequenceAt(i);\r
-\r
-            if (s.getDisplayId().equals(name))\r
-            {\r
-                return s;\r
-            }\r
-\r
-            i++;\r
-        }\r
-\r
-        return null;\r
-    }\r
 \r
     /**    */\r
     public int findIndex(SequenceI s)\r
@@ -676,6 +645,7 @@ public class Alignment implements AlignmentI
             aSize = annotations.length + 1;\r
         }\r
 \r
+\r
         AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize];\r
         int i = 0;\r
 \r
@@ -704,11 +674,53 @@ public class Alignment implements AlignmentI
 \r
     public void setNucleotide(boolean b)\r
     {\r
-      isNucleotide = b;\r
+      if(b)\r
+        type = NUCLEOTIDE;\r
+      else\r
+        type = PROTEIN;\r
     }\r
 \r
     public boolean isNucleotide()\r
     {\r
-      return isNucleotide;\r
+      if(type==NUCLEOTIDE)\r
+        return true;\r
+      else\r
+        return false;\r
     }\r
+\r
+    public void setDataset(Alignment data)\r
+    {\r
+      if(dataset==null && data==null)\r
+      {\r
+        // Create a new dataset for this alignment.\r
+        // Can only be done once, if dataset is not null\r
+        // This will not be performed\r
+        Sequence[] seqs = new Sequence[getHeight()];\r
+        for (int i = 0; i < getHeight(); i++)\r
+        {\r
+\r
+          seqs[i] = new Sequence(getSequenceAt(i).getName(),\r
+                                 AlignSeq.extractGaps(\r
+                                     jalview.util.Comparison.GapChars,\r
+                                     getSequenceAt(i).getSequence()\r
+                                 ),\r
+                                 getSequenceAt(i).getStart(),\r
+                                 getSequenceAt(i).getEnd());\r
+\r
+          getSequenceAt(i).setDatasetSequence(seqs[i]);\r
+        }\r
+\r
+        dataset = new Alignment(seqs);\r
+      }\r
+      else if(dataset==null && data!=null)\r
+      {\r
+        dataset = data;\r
+      }\r
+    }\r
+\r
+    public Alignment getDataset()\r
+    {\r
+      return dataset;\r
+    }\r
+\r
 }\r
index 4399b39..2a39847 100755 (executable)
@@ -125,14 +125,6 @@ public interface AlignmentI
      */\r
     public SequenceI findName(String name);\r
 \r
-    /**\r
-     * Finds sequence in alignment using full displayId as query.\r
-     *\r
-     * @param name displayId, ie <em>NAME/25-100</em>\r
-     *\r
-     * @return Sequence matching query, if found. If not found returns null.\r
-     */\r
-    public SequenceI findbyDisplayId(String name);\r
 \r
     /**\r
      * Finds index of a given sequence in the alignment.\r
@@ -304,4 +296,10 @@ public interface AlignmentI
      */\r
     public void setNucleotide(boolean b);\r
 \r
+\r
+    public Alignment getDataset();\r
+\r
+    public void setDataset(Alignment dataset);\r
+\r
+\r
 }\r
diff --git a/src/jalview/datamodel/DBRefEntry.java b/src/jalview/datamodel/DBRefEntry.java
new file mode 100755 (executable)
index 0000000..75e0cc8
--- /dev/null
@@ -0,0 +1,23 @@
+package jalview.datamodel;\r
+\r
+public class DBRefEntry\r
+{\r
+  String source, version, accessionId;\r
+\r
+  public DBRefEntry(String source, String version, String accessionId)\r
+  {\r
+    this.source = source;\r
+    this.version = version;\r
+    this.accessionId = accessionId;\r
+  }\r
+\r
+  public String getSource()\r
+  {    return source; }\r
+\r
+  public String getVersion()\r
+  { return version; }\r
+\r
+  public String getAccessionId()\r
+  { return accessionId; }\r
+\r
+}\r
diff --git a/src/jalview/datamodel/PDBEntry.java b/src/jalview/datamodel/PDBEntry.java
new file mode 100755 (executable)
index 0000000..9e651fb
--- /dev/null
@@ -0,0 +1,36 @@
+package jalview.datamodel;\r
+\r
+import java.util.*;\r
+public class PDBEntry\r
+{\r
+  String type;\r
+  String id;\r
+  Hashtable properties;\r
+\r
+  public PDBEntry()\r
+  {  }\r
+\r
+  public void setType(String type)\r
+  { this.type = type; }\r
+\r
+  public String getType()\r
+  { return type; }\r
+\r
+  public void setId(String id)\r
+  { this.id = id; }\r
+\r
+  public String getId()\r
+  { return id; }\r
+\r
+  public void setProperty(Hashtable property)\r
+  {\r
+    this.properties = property;\r
+  }\r
+\r
+  public Hashtable getProperty()\r
+  {\r
+    return properties;\r
+  }\r
+\r
+\r
+}\r
diff --git a/src/jalview/datamodel/Provenance.java b/src/jalview/datamodel/Provenance.java
new file mode 100755 (executable)
index 0000000..e52c855
--- /dev/null
@@ -0,0 +1,26 @@
+package jalview.datamodel;\r
+import java.util.*;\r
+\r
+public class Provenance\r
+{\r
+  Vector entries = new Vector();\r
+  public Provenance()\r
+  {\r
+\r
+  }\r
+\r
+  public ProvenanceEntry[] getEntries()\r
+  {\r
+    ProvenanceEntry [] ret = new ProvenanceEntry[entries.size()];\r
+    for(int i=0; i<entries.size(); i++)\r
+       ret[i] = (ProvenanceEntry)entries.elementAt(i);\r
+    return ret;\r
+  }\r
+\r
+  public void addEntry(String user, String action, java.util.Date date, String id)\r
+  {\r
+    entries.addElement( new ProvenanceEntry(user,action,date,id));\r
+  }\r
+\r
+}\r
+\r
diff --git a/src/jalview/datamodel/ProvenanceEntry.java b/src/jalview/datamodel/ProvenanceEntry.java
new file mode 100755 (executable)
index 0000000..df8e8e9
--- /dev/null
@@ -0,0 +1,23 @@
+package jalview.datamodel;\r
+\r
+public class ProvenanceEntry\r
+{\r
+    String user, action, id;\r
+    java.util.Date date;\r
+    public ProvenanceEntry(String u, String a, java.util.Date d, String i)\r
+    {\r
+      user = u; action = a; date = d; id = i;\r
+    }\r
+\r
+    public String getUser()\r
+    {return user;}\r
+\r
+    public String getAction()\r
+    {return action;}\r
+\r
+    public java.util.Date getDate()\r
+    {return date;}\r
+\r
+    public String getID()\r
+    {return id;}\r
+}\r
index d30003d..80dfda5 100755 (executable)
@@ -31,17 +31,20 @@ import java.util.*;
  */\r
 public class Sequence implements SequenceI\r
 {\r
-    protected String name;\r
-    protected String sequence;\r
-    protected String description;\r
-    protected int start;\r
-    protected int end;\r
-    protected String displayId;\r
-    protected Color color = Color.white;\r
-    String pdbId;\r
+    SequenceI datasetSequence;\r
+    String name;\r
+    String sequence;\r
+    String description;\r
+    int start;\r
+    int end;\r
+    Color color = Color.white;\r
+    Vector pdbIds;\r
+    String vamsasId;\r
+    Vector dbrefs;\r
+\r
 \r
     /** DOCUMENT ME!! */\r
-    public Vector sequenceFeatures = new Vector();\r
+    public Vector sequenceFeatures;\r
 \r
     /**\r
      * Creates a new Sequence object.\r
@@ -58,6 +61,30 @@ public class Sequence implements SequenceI
       this.start = start;\r
       this.end = end;\r
 \r
+      parseId();\r
+\r
+      checkValidRange();\r
+    }\r
+\r
+    static com.stevesoft.pat.Regex limitrx = new com.stevesoft.pat.Regex(\r
+                        "[/][0-9]{1,}[-][0-9]{1,}$");\r
+    static com.stevesoft.pat.Regex endrx = new com.stevesoft.pat.Regex(\r
+                        "[0-9]{1,}$");\r
+\r
+    void parseId()\r
+    {\r
+        // Does sequence have the /start-end signiature?\r
+         if(limitrx.search(name))\r
+         {\r
+            name = limitrx.left();\r
+            endrx.search(limitrx.stringMatched());\r
+            setStart( Integer.parseInt( limitrx.stringMatched().substring(1,endrx.matchedFrom()-1 )));\r
+            setEnd(   Integer.parseInt( endrx.stringMatched() ));\r
+         }\r
+    }\r
+\r
+    void checkValidRange()\r
+    {\r
       if (end < 1)\r
       {\r
         int endRes = 0;\r
@@ -78,7 +105,6 @@ public class Sequence implements SequenceI
         this.end = endRes;\r
       }\r
 \r
-        setDisplayId();\r
     }\r
 \r
     /**\r
@@ -89,7 +115,7 @@ public class Sequence implements SequenceI
      */\r
     public Sequence(String name, String sequence)\r
     {\r
-        this(name, sequence, 1, sequence.length());\r
+        this(name, sequence, 1, -1);\r
     }\r
 \r
     /**\r
@@ -112,6 +138,14 @@ public class Sequence implements SequenceI
         sequenceFeatures = v;\r
     }\r
 \r
+    public void addSequenceFeature(SequenceFeature sf)\r
+    {\r
+      if(sequenceFeatures==null)\r
+        sequenceFeatures = new Vector();\r
+\r
+      sequenceFeatures.addElement(sf);\r
+    }\r
+\r
     /**\r
      * DOCUMENT ME!\r
      *\r
@@ -122,14 +156,22 @@ public class Sequence implements SequenceI
         return sequenceFeatures;\r
     }\r
 \r
+    public void addPDBId(PDBEntry entry)\r
+    {\r
+      if(pdbIds == null)\r
+        pdbIds = new Vector();\r
+\r
+      pdbIds.addElement(entry);\r
+    }\r
+\r
     /**\r
      * DOCUMENT ME!\r
      *\r
      * @param id DOCUMENT ME!\r
      */\r
-    public void setPDBId(String id)\r
+    public void setPDBId(Vector id)\r
     {\r
-        pdbId = id;\r
+        pdbIds = id;\r
     }\r
 \r
     /**\r
@@ -137,9 +179,9 @@ public class Sequence implements SequenceI
      *\r
      * @return DOCUMENT ME!\r
      */\r
-    public String getPDBId()\r
+    public Vector getPDBId()\r
     {\r
-        return pdbId;\r
+        return pdbIds;\r
     }\r
 \r
     /**\r
@@ -147,17 +189,15 @@ public class Sequence implements SequenceI
      *\r
      * @return DOCUMENT ME!\r
      */\r
-    public String getDisplayId()\r
+    public String getDisplayId(boolean jvsuffix)\r
     {\r
-        return displayId;\r
-    }\r
+      StringBuffer result = new StringBuffer(name);\r
+      if (jvsuffix)\r
+      {\r
+        result.append("/" + start + "-" + end);\r
+      }\r
 \r
-    /**\r
-     * DOCUMENT ME!\r
-     */\r
-    public void setDisplayId()\r
-    {\r
-        displayId = name + "/" + start + "-" + end;\r
+      return result.toString();\r
     }\r
 \r
     /**\r
@@ -167,8 +207,8 @@ public class Sequence implements SequenceI
      */\r
     public void setName(String name)\r
     {\r
-        this.name = name;\r
-        setDisplayId();\r
+      this.name = name;\r
+      this.parseId();\r
     }\r
 \r
     /**\r
@@ -178,7 +218,7 @@ public class Sequence implements SequenceI
      */\r
     public String getName()\r
     {\r
-        return this.name;\r
+       return this.name;\r
     }\r
 \r
     /**\r
@@ -189,7 +229,6 @@ public class Sequence implements SequenceI
     public void setStart(int start)\r
     {\r
         this.start = start;\r
-        setDisplayId();\r
     }\r
 \r
     /**\r
@@ -210,7 +249,6 @@ public class Sequence implements SequenceI
     public void setEnd(int end)\r
     {\r
         this.end = end;\r
-        setDisplayId();\r
     }\r
 \r
     /**\r
@@ -241,6 +279,7 @@ public class Sequence implements SequenceI
     public void setSequence(String seq)\r
     {\r
         this.sequence = seq;\r
+        checkValidRange();\r
     }\r
 \r
     /**\r
@@ -331,9 +370,7 @@ public class Sequence implements SequenceI
 \r
         while ((i < sequence.length()) && (j <= end) && (j <= pos))\r
         {\r
-            char c = sequence.charAt(i);\r
-\r
-            if (!jalview.util.Comparison.isGap((c)))\r
+            if (!jalview.util.Comparison.isGap(sequence.charAt(i)))\r
             {\r
                 j++;\r
             }\r
@@ -366,9 +403,7 @@ public class Sequence implements SequenceI
 \r
         while ((j < i) && (j < sequence.length()))\r
         {\r
-            char c = sequence.charAt(j);\r
-\r
-            if (!jalview.util.Comparison.isGap((c)))\r
+            if (!jalview.util.Comparison.isGap((sequence.charAt(j))))\r
             {\r
                 pos++;\r
             }\r
@@ -501,4 +536,42 @@ public class Sequence implements SequenceI
     {\r
         return color;\r
     }\r
+\r
+    public String getVamsasId()\r
+    {\r
+      return vamsasId;\r
+    }\r
+\r
+    public void setVamsasId(String id)\r
+    {\r
+      vamsasId = id;\r
+    }\r
+\r
+    public void setDBRef(Vector dbref)\r
+    {\r
+      dbrefs = dbref;\r
+    }\r
+    public Vector getDBRef()\r
+    {\r
+      return dbrefs;\r
+    }\r
+\r
+    public void addDBRef(DBRefEntry entry)\r
+    {\r
+      if(dbrefs == null)\r
+        dbrefs = new Vector();\r
+\r
+      dbrefs.addElement(entry);\r
+    }\r
+\r
+    public void setDatasetSequence(SequenceI seq)\r
+    {\r
+      datasetSequence = seq;\r
+    }\r
+\r
+    public SequenceI getDatasetSequence()\r
+    {\r
+      return datasetSequence;\r
+    }\r
+\r
 }\r
index 5bf4e88..1adff25 100755 (executable)
@@ -26,48 +26,54 @@ package jalview.datamodel;
  */\r
 public class SequenceFeature\r
 {\r
+    int position;\r
     int begin;\r
     int end;\r
     String type;\r
     String description;\r
     String status;\r
 \r
-    /**\r
-     * Creates a new SequenceFeature object.\r
-     */\r
     public SequenceFeature()\r
+    {}\r
+\r
+    public SequenceFeature(String type, String desc, String status, int begin, int end)\r
     {\r
+      this.type = type;\r
+      this.description = desc;\r
+      this.status = status;\r
+      this.position = begin;\r
+      this.begin = begin;\r
+      this.end = end;\r
     }\r
 \r
-    /**\r
-     * Creates a new SequenceFeature object.\r
-     *\r
-     * @param type DOCUMENT ME!\r
-     * @param start DOCUMENT ME!\r
-     * @param end DOCUMENT ME!\r
-     * @param description DOCUMENT ME!\r
-     * @param status DOCUMENT ME!\r
-     */\r
-    public SequenceFeature(String type, int start, int end, String description,\r
-        String status)\r
+    public int getPosition()\r
     {\r
-        this.type = type;\r
-        this.begin = start;\r
-        this.end = end;\r
-        this.description = description;\r
-        this.status = status;\r
+      return position;\r
     }\r
 \r
+    public void setPosition(int pos)\r
+    {\r
+      position = pos;\r
+      begin = pos;\r
+      end = pos;\r
+    }\r
+\r
+\r
     /**\r
      * DOCUMENT ME!\r
      *\r
      * @return DOCUMENT ME!\r
      */\r
-    public int getStart()\r
+    public int getBegin()\r
     {\r
         return begin;\r
     }\r
 \r
+    public void setBegin(int start)\r
+    {\r
+      this.begin = start;\r
+    }\r
+\r
     /**\r
      * DOCUMENT ME!\r
      *\r
@@ -78,6 +84,11 @@ public class SequenceFeature
         return end;\r
     }\r
 \r
+    public void setEnd(int end)\r
+    {\r
+      this.end = end;\r
+    }\r
+\r
     /**\r
      * DOCUMENT ME!\r
      *\r
@@ -88,6 +99,11 @@ public class SequenceFeature
         return type;\r
     }\r
 \r
+    public void setType(String type)\r
+    {\r
+      this.type = type;\r
+    }\r
+\r
     /**\r
      * DOCUMENT ME!\r
      *\r
@@ -98,6 +114,11 @@ public class SequenceFeature
         return description;\r
     }\r
 \r
+    public void setDescription(String desc)\r
+    {\r
+      description = desc;\r
+    }\r
+\r
     /**\r
      * DOCUMENT ME!\r
      *\r
@@ -108,42 +129,9 @@ public class SequenceFeature
         return status;\r
     }\r
 \r
-    /*\r
-          <xs:enumeration value="active site" />\r
-         <xs:enumeration value="binding site" />\r
-         <xs:enumeration value="calcium-binding region" />\r
-         <xs:enumeration value="chain" />\r
-         <xs:enumeration value="cross-link" />\r
-         <xs:enumeration value="disulfide bond" />\r
-         <xs:enumeration value="DNA-binding region" />\r
-         <xs:enumeration value="domain" />\r
-         <xs:enumeration value="glycosylation site" />\r
-         <xs:enumeration value="helix" />\r
-         <xs:enumeration value="initiator methionine" />\r
-         <xs:enumeration value="lipid moiety-binding region" />\r
-         <xs:enumeration value="metal ion-binding site" />\r
-         <xs:enumeration value="modified residue" />\r
-         <xs:enumeration value="mutagenesis site" />\r
-         <xs:enumeration value="non-consecutive residues" />\r
-         <xs:enumeration value="non-terminal residue" />\r
-         <xs:enumeration value="nucleotide phosphate-binding region" />\r
-         <xs:enumeration value="peptide" />\r
-         <xs:enumeration value="propeptide" />\r
-         <xs:enumeration value="repeat" />\r
-         <xs:enumeration value="selenocysteine" />\r
-         <xs:enumeration value="sequence conflict" />\r
-         <xs:enumeration value="sequence variant" />\r
-         <xs:enumeration value="signal peptide" />\r
-         <xs:enumeration value="similar" />\r
-         <xs:enumeration value="site" />\r
-         <xs:enumeration value="splice variant" />\r
-         <xs:enumeration value="strand" />\r
-         <xs:enumeration value="thioether bond" />\r
-         <xs:enumeration value="thiolester bond" />\r
-         <xs:enumeration value="transit peptide" />\r
-         <xs:enumeration value="transmembrane region" />\r
-         <xs:enumeration value="turn" />\r
-         <xs:enumeration value="unsure residue" />\r
-         <xs:enumeration value="zinc finger region" />\r
-     */\r
+    public void setStatus(String status)\r
+    {\r
+      this.status = status;\r
+    }\r
+\r
 }\r
index b7c9197..82d38b4 100755 (executable)
@@ -45,6 +45,7 @@ public interface SequenceI
      */\r
     public String getName();\r
 \r
+\r
     /**\r
      * DOCUMENT ME!\r
      *\r
@@ -64,7 +65,7 @@ public interface SequenceI
      *\r
      * @return DOCUMENT ME!\r
      */\r
-    public String getDisplayId();\r
+    public String getDisplayId(boolean jvsuffix);\r
 \r
     /**\r
      * DOCUMENT ME!\r
@@ -224,12 +225,30 @@ public interface SequenceI
      *\r
      * @param id DOCUMENT ME!\r
      */\r
-    public void setPDBId(String id);\r
+    public void setPDBId(Vector ids);\r
 \r
     /**\r
      * DOCUMENT ME!\r
      *\r
      * @return DOCUMENT ME!\r
      */\r
-    public String getPDBId();\r
+    public Vector getPDBId();\r
+\r
+    public void addPDBId(PDBEntry entry);\r
+\r
+    public String getVamsasId();\r
+\r
+    public void setVamsasId(String id);\r
+\r
+    public void setDBRef(Vector dbs);\r
+\r
+    public Vector getDBRef();\r
+\r
+    public void addDBRef(DBRefEntry entry);\r
+\r
+    public void addSequenceFeature(SequenceFeature sf);\r
+\r
+    public void setDatasetSequence(SequenceI seq);\r
+\r
+    public SequenceI getDatasetSequence();\r
 }\r
diff --git a/src/jalview/datamodel/UniprotEntry.java b/src/jalview/datamodel/UniprotEntry.java
new file mode 100755 (executable)
index 0000000..0c5e314
--- /dev/null
@@ -0,0 +1,74 @@
+package jalview.datamodel;\r
+\r
+import java.util.*;\r
+\r
+public class UniprotEntry\r
+{\r
+\r
+  UniprotSequence sequence;\r
+  Vector name;\r
+  Vector accession;\r
+  Vector feature;\r
+  Vector dbrefs;\r
+  Vector proteinName;\r
+\r
+  public void setAccession(Vector items)\r
+  {\r
+    accession = items;\r
+  }\r
+\r
+  public void setFeature(Vector items)\r
+  {\r
+       feature = items;\r
+   }\r
+\r
+   public Vector getFeature() {\r
+       return feature;\r
+   }\r
+\r
+\r
+   public Vector getAccession()\r
+   {\r
+     return accession;\r
+   }\r
+\r
+   public void setProteinName(Vector items)\r
+   {\r
+     proteinName = items;\r
+   }\r
+\r
+   public Vector getProteinName()\r
+   {\r
+     return proteinName;\r
+   }\r
+\r
+  public void setName(Vector na)\r
+  {\r
+    name = na;\r
+  }\r
+  public Vector getName()\r
+  {\r
+    return name;\r
+  }\r
+\r
+  public UniprotSequence getUniprotSequence()\r
+  {\r
+    return sequence;\r
+  }\r
+\r
+  public void setUniprotSequence(UniprotSequence seq)\r
+  {\r
+    sequence = seq;\r
+  }\r
+\r
+  public Vector getDbReference()\r
+  {\r
+    return dbrefs;\r
+  }\r
+\r
+  public void setDbReference(Vector dbref)\r
+  {\r
+   this.dbrefs = dbref;\r
+  }\r
+\r
+}\r
diff --git a/src/jalview/datamodel/UniprotFile.java b/src/jalview/datamodel/UniprotFile.java
new file mode 100755 (executable)
index 0000000..5acb300
--- /dev/null
@@ -0,0 +1,15 @@
+package jalview.datamodel;\r
+import java.util.Vector;\r
+\r
+public class UniprotFile\r
+{\r
+  Vector _items;\r
+\r
+  public void setUniprotEntries(Vector items) {\r
+       _items = items;\r
+   }\r
+\r
+   public Vector getUniprotEntries() {\r
+       return _items;\r
+   }\r
+}\r
diff --git a/src/jalview/datamodel/UniprotSequence.java b/src/jalview/datamodel/UniprotSequence.java
new file mode 100755 (executable)
index 0000000..9233889
--- /dev/null
@@ -0,0 +1,24 @@
+package jalview.datamodel;\r
+\r
+public class UniprotSequence\r
+{\r
+    /**\r
+   * internal content storage\r
+   */\r
+  private java.lang.String _content = "";\r
+\r
+  public void setContent(String seq)\r
+  {\r
+    StringBuffer sb = new StringBuffer();\r
+    for(int i=0; i<seq.length(); i++)\r
+      if(seq.charAt(i)!=' ')\r
+      {\r
+        sb.append(seq.charAt(i));\r
+      }\r
+    _content = sb.toString();\r
+  }\r
+\r
+  public String getContent()\r
+  { return _content; }\r
+\r
+}\r
index d22dc12..f933961 100755 (executable)
@@ -39,6 +39,7 @@ public abstract class AlignFile extends FileParse
     Vector headers;\r
     long start;\r
     long end;\r
+    boolean jvSuffix = true;\r
 \r
     /**\r
      * Creates a new AlignFile object.\r
@@ -149,4 +150,45 @@ public abstract class AlignFile extends FileParse
      * Print out in alignment file format the Sequences in the seqs Vector.\r
      */\r
     public abstract String print();\r
+\r
+    public void addJVSuffix(boolean b)\r
+    {\r
+      jvSuffix = b;\r
+    }\r
+\r
+    /**\r
+     * A general parser for ids.\r
+     *\r
+     * @String id Id to be parsed\r
+     */\r
+    Sequence parseId(String id)\r
+    {\r
+      Sequence seq = null;\r
+      id = id.trim();\r
+      int space = id.indexOf(" ");\r
+      if(space>-1)\r
+      {\r
+        seq = new Sequence(id.substring(0, space),"");\r
+        seq.setDescription(id.substring(space+1));\r
+      }\r
+      else\r
+      {\r
+        seq = new Sequence(id, "");\r
+      }\r
+\r
+      return seq;\r
+    }\r
+\r
+    /**\r
+     * Creates the output id.\r
+     * Adds prefix Uniprot format source|id\r
+     * And suffix Jalview /start-end\r
+     *\r
+     * @String id Id to be parsed\r
+     */\r
+    String printId(SequenceI seq)\r
+    {\r
+     return seq.getDisplayId(jvSuffix);\r
+    }\r
+\r
 }\r
diff --git a/src/jalview/io/AppletFormatAdapter.java b/src/jalview/io/AppletFormatAdapter.java
new file mode 100755 (executable)
index 0000000..f8b809e
--- /dev/null
@@ -0,0 +1,184 @@
+    /*\r
+    * Jalview - A Sequence Alignment Editor and Viewer\r
+    * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+    *\r
+    * This program is free software; you can redistribute it and/or\r
+    * modify it under the terms of the GNU General Public License\r
+    * as published by the Free Software Foundation; either version 2\r
+    * of the License, or (at your option) any later version.\r
+    *\r
+    * This program is distributed in the hope that it will be useful,\r
+    * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+    * GNU General Public License for more details.\r
+    *\r
+    * You should have received a copy of the GNU General Public License\r
+    * along with this program; if not, write to the Free Software\r
+    * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+    */\r
+    package jalview.io;\r
+\r
+    import jalview.datamodel.*;\r
+\r
+    import java.util.Vector;\r
+\r
+\r
+    /**\r
+     * DOCUMENT ME!\r
+     *\r
+     * @author $author$\r
+     * @version $Revision$\r
+     */\r
+    public class AppletFormatAdapter\r
+    {\r
+        /** DOCUMENT ME!! */\r
+        public static final Vector formats = new Vector();\r
+\r
+        static\r
+        {\r
+            formats.addElement("BLC");\r
+            formats.addElement("CLUSTAL");\r
+            formats.addElement("FASTA");\r
+            formats.addElement("MSF");\r
+            formats.addElement("PileUp");\r
+            formats.addElement("PIR");\r
+            formats.addElement("PFAM");\r
+        }\r
+\r
+        AlignFile afile = null;\r
+\r
+        /**\r
+         * DOCUMENT ME!\r
+         *\r
+         * @param inFile DOCUMENT ME!\r
+         * @param type DOCUMENT ME!\r
+         * @param format DOCUMENT ME!\r
+         *\r
+         * @return DOCUMENT ME!\r
+         */\r
+        public SequenceI[] readFile(String inFile, String type, String format)\r
+        {\r
+            try\r
+            {\r
+                if (format.equals("FASTA"))\r
+                {\r
+                    afile = new FastaFile(inFile, type);\r
+                }\r
+                else if (format.equals("MSF"))\r
+                {\r
+                    afile = new MSFfile(inFile, type);\r
+                }\r
+                else if (format.equals("PileUp"))\r
+                {\r
+                    afile = new PileUpfile(inFile, type);\r
+                }\r
+                else if (format.equals("CLUSTAL"))\r
+                {\r
+                    afile = new ClustalFile(inFile, type);\r
+                }\r
+                else if (format.equals("BLC"))\r
+                {\r
+                    afile = new BLCFile(inFile, type);\r
+                }\r
+                else if (format.equals("PIR"))\r
+                {\r
+                    afile = new PIRFile(inFile, type);\r
+                }\r
+                else if (format.equals("PFAM"))\r
+                {\r
+                    afile = new PfamFile(inFile, type);\r
+                }\r
+\r
+                return afile.getSeqsAsArray();\r
+            }\r
+            catch (Exception e)\r
+            {\r
+              System.err.println("Failed to read alignment using the '" + format +\r
+                                 "' reader.\n"+e);\r
+\r
+              // Finally test if the user has pasted just the sequence, no id\r
+              if(type.equalsIgnoreCase("Paste"))\r
+              {\r
+                try{\r
+                  // Possible sequence is just residues with no label\r
+                  afile = new FastaFile(">UNKNOWN\n" + inFile, "Paste");\r
+                  return afile.getSeqsAsArray();\r
+                }catch(Exception ex)\r
+                {\r
+                  System.err.println("Failed to read alignment using the 'FASTA' reader.\n"+e);\r
+                  ex.printStackTrace();\r
+                }\r
+\r
+              }\r
+            }\r
+\r
+            return null;\r
+        }\r
+\r
+\r
+        /**\r
+         * DOCUMENT ME!\r
+         *\r
+         * @param format DOCUMENT ME!\r
+         * @param seqs DOCUMENT ME!\r
+         *\r
+         * @return DOCUMENT ME!\r
+         */\r
+        public String formatSequences(String format,\r
+                                      Vector seqs,\r
+                                      boolean jvsuffix)\r
+        {\r
+            SequenceI[] s = new SequenceI[seqs.size()];\r
+\r
+            for (int i = 0; i < seqs.size(); i++)\r
+                s[i] = (SequenceI) seqs.elementAt(i);\r
+\r
+            try\r
+            {\r
+                AlignFile afile = null;\r
+\r
+                if (format.equalsIgnoreCase("FASTA"))\r
+                {\r
+                    afile = new FastaFile();\r
+                }\r
+                else if (format.equalsIgnoreCase("MSF"))\r
+                {\r
+                    afile = new MSFfile();\r
+                }\r
+                else if (format.equalsIgnoreCase("PileUp"))\r
+                {\r
+                    afile = new PileUpfile();\r
+                }\r
+                else if (format.equalsIgnoreCase("CLUSTAL"))\r
+                {\r
+                    afile = new ClustalFile();\r
+                }\r
+                else if (format.equalsIgnoreCase("BLC"))\r
+                {\r
+                    afile = new BLCFile();\r
+                }\r
+                else if (format.equalsIgnoreCase("PIR"))\r
+                {\r
+                    afile = new PIRFile();\r
+                }\r
+                else if (format.equalsIgnoreCase("PFAM"))\r
+                {\r
+                    afile = new PfamFile();\r
+                }\r
+\r
+                afile.addJVSuffix(jvsuffix);\r
+\r
+                afile.setSeqs(s);\r
+\r
+                return afile.print();\r
+            }\r
+            catch (Exception e)\r
+            {\r
+                System.err.println("Failed to write alignment as a '" + format +\r
+                    "' file\n");\r
+                e.printStackTrace();\r
+            }\r
+\r
+            return null;\r
+        }\r
+    }\r
index 0edcb63..a7cc1ea 100755 (executable)
@@ -105,60 +105,19 @@ public class BLCFile extends AlignFile
 \r
                 if (abracket > -1)\r
                 {\r
-                    if (line.indexOf(" ") > -1) //\r
-                    {\r
-                        ///Colur it be this format?\r
-                        //>54402046         0             1   137   137:\r
-                        // or this??\r
-                        //     1   >L1H14       30539  343\r
-                        try\r
-                        {\r
-                            ids.addElement(line.substring(abracket + 1,\r
-                                    line.indexOf(" ", abracket + 1)));\r
-\r
-                            // remove p Value\r
-                            line = line.substring(abracket + 1);\r
-                            line = line.substring(line.indexOf(" ") + 1);\r
-                            line = line.trim();\r
-                            line = line.substring(line.indexOf(" ") + 1);\r
-                            line = line.trim();\r
-\r
-                            int value = Integer.parseInt(line.substring(0,\r
-                                        line.indexOf(" ")));\r
-                            starts.addElement(value + "");\r
-                            line = line.substring(line.indexOf(" ") + 1);\r
-                            line = line.trim();\r
-                            value = Integer.parseInt(line.substring(0,\r
-                                        line.indexOf(" ")));\r
-                            ends.addElement(value + "");\r
-                        }\r
-                        catch (Exception ex)\r
-                        {\r
-                            System.err.println("Error during blockfile read.");\r
-                            ex.printStackTrace();\r
-                            starts.addElement("1");\r
-                            ends.addElement("-1");\r
-                        }\r
-                    }\r
-                    else\r
-                    {\r
-                        if (line.indexOf("/") > -1)\r
-                        {\r
-                            ids.addElement(line.substring(abracket + 1,\r
-                                    line.indexOf("/")));\r
-                            line = line.substring(line.indexOf("/") + 1);\r
-                            starts.addElement(line.substring(0,\r
-                                    line.indexOf("-")));\r
-                            ends.addElement(line.substring(line.indexOf("-") +\r
-                                    1));\r
-                        }\r
-                        else\r
-                        {\r
-                            ids.addElement(line.substring(abracket + 1));\r
-                            starts.addElement("1");\r
-                            ends.addElement("-1");\r
-                        }\r
-                    }\r
+                  if (line.indexOf(" ") > -1) //\r
+                  {\r
+                    line = line.substring(abracket + 1,\r
+                                          line.indexOf(" ", abracket + 1));\r
+                  }\r
+                  else\r
+                    line = line.substring(abracket+1);\r
+\r
+\r
+                  Sequence seq = parseId(line);\r
+                  ids.addElement(seq.getName());\r
+                  starts.addElement(seq.getStart() + "");\r
+                  ends.addElement(seq.getEnd() + "");\r
                 }\r
             }\r
             while (!idsFound);\r
@@ -217,17 +176,22 @@ public class BLCFile extends AlignFile
      *\r
      * @return DOCUMENT ME!\r
      */\r
-    public static String print(SequenceI[] s)\r
+    public String print(SequenceI[] s)\r
     {\r
         StringBuffer out = new StringBuffer();\r
-\r
+        /**\r
+         * A general parser for ids. Will look for dbrefs in\r
+         * Uniprot format source|id\r
+         * And also Jalview /start-end\r
+         *\r
+         * @String id Id to be parsed\r
+     */\r
         int i = 0;\r
         int max = -1;\r
 \r
         while ((i < s.length) && (s[i] != null))\r
         {\r
-            out.append(">" + s[i].getName() + "/" + s[i].getStart() + "-" +\r
-                s[i].getEnd() + "\n");\r
+            out.append(">" + printId(s[i]) +"\n");\r
 \r
             if (s[i].getSequence().length() > max)\r
             {\r
index 71e86b3..e72e0df 100755 (executable)
@@ -27,7 +27,6 @@ import jalview.util.*;
 public class ClustalFile\r
     extends AlignFile\r
 {\r
-  Vector ids;\r
 \r
   public ClustalFile()\r
   {\r
@@ -47,7 +46,6 @@ public class ClustalFile
   public void initData()\r
   {\r
     super.initData();\r
-    ids = new Vector();\r
   }\r
 \r
   public void parse()\r
@@ -57,8 +55,9 @@ public class ClustalFile
 \r
     Vector headers = new Vector();\r
     Hashtable seqhash = new Hashtable();\r
-\r
-    String line;\r
+    StringBuffer tempseq;\r
+    String line, id;\r
+    StringTokenizer str;\r
 \r
     try\r
     {\r
@@ -66,14 +65,13 @@ public class ClustalFile
       {\r
         if (line.indexOf(" ") != 0)\r
         {\r
-          StringTokenizer str = new StringTokenizer(line, " ");\r
-          String id = "";\r
+          str = new StringTokenizer(line, " ");\r
 \r
           if (str.hasMoreTokens())\r
           {\r
             id = str.nextToken();\r
 \r
-            if (id.equals("CLUSTAL"))\r
+            if (id.equalsIgnoreCase("CLUSTAL"))\r
             {\r
               flag = true;\r
             }\r
@@ -81,8 +79,6 @@ public class ClustalFile
             {\r
               if (flag)\r
               {\r
-                StringBuffer tempseq;\r
-\r
                 if (seqhash.containsKey(id))\r
                 {\r
                   tempseq = (StringBuffer) seqhash.get(id);\r
@@ -105,6 +101,8 @@ public class ClustalFile
               }\r
             }\r
           }\r
+          else\r
+            flag = true;\r
         }\r
       }\r
     }\r
@@ -121,9 +119,6 @@ public class ClustalFile
       //Add sequences to the hash\r
       for (i = 0; i < headers.size(); i++)\r
       {\r
-        int start = 1;\r
-        int end = -1;\r
-\r
         if (seqhash.get(headers.elementAt(i)) != null)\r
         {\r
           if (maxLength < seqhash.get(headers.elementAt(i)).toString()\r
@@ -133,40 +128,8 @@ public class ClustalFile
                 .length();\r
           }\r
 \r
-          String head = headers.elementAt(i).toString();\r
-\r
-          if (head.indexOf("/") > 0)\r
-          {\r
-            StringTokenizer st = new StringTokenizer(head, "/");\r
-\r
-            if (st.countTokens() == 2)\r
-            {\r
-              ids.addElement(st.nextToken());\r
-\r
-              String tmp = st.nextToken();\r
-              st = new StringTokenizer(tmp, "-");\r
-\r
-              if (st.countTokens() == 2)\r
-              {\r
-                start = Integer.valueOf(st.nextToken())\r
-                    .intValue();\r
-                end = Integer.valueOf(st.nextToken()).intValue();\r
-              }\r
-            }\r
-            else\r
-            {\r
-              ids.addElement(headers.elementAt(i));\r
-            }\r
-          }\r
-          else\r
-          {\r
-            ids.addElement(headers.elementAt(i));\r
-          }\r
-\r
-          Sequence newSeq = new Sequence(ids.elementAt(i).toString(),\r
-                                         seqhash.get(headers.elementAt(i).\r
-              toString())\r
-                                         .toString(), start, end);\r
+          Sequence newSeq = parseId(headers.elementAt(i).toString());\r
+          newSeq.setSequence( seqhash.get(headers.elementAt(i).toString()).toString() );\r
 \r
           seqs.addElement(newSeq);\r
         }\r
@@ -185,7 +148,7 @@ public class ClustalFile
     return print(getSeqsAsArray());\r
   }\r
 \r
-  public static String print(SequenceI[] s)\r
+  public String print(SequenceI[] s)\r
   {\r
     StringBuffer out = new StringBuffer("CLUSTAL\n\n");\r
 \r
@@ -196,8 +159,7 @@ public class ClustalFile
 \r
     while ( (i < s.length) && (s[i] != null))\r
     {\r
-      String tmp = s[i].getName() + "/" + s[i].getStart() + "-" +\r
-          s[i].getEnd();\r
+      String tmp = printId(s[i]);\r
 \r
       if (s[i].getSequence().length() > max)\r
       {\r
@@ -228,8 +190,7 @@ public class ClustalFile
 \r
       while ( (j < s.length) && (s[j] != null))\r
       {\r
-        out.append(new Format("%-" + maxid + "s").form(s[j].getName() +\r
-            "/" + s[j].getStart() + "-" + s[j].getEnd()) + " ");\r
+        out.append(new Format("%-" + maxid + "s").form( printId(s[j]) + " "));\r
 \r
         int start = i * len;\r
         int end = start + len;\r
index eebbfc8..0012ffe 100755 (executable)
@@ -18,6 +18,8 @@
 */\r
 package jalview.io;\r
 \r
+import java.io.*;\r
+\r
 import org.apache.axis.AxisFault;\r
 import org.apache.axis.client.*;\r
 import org.apache.axis.encoding.XMLType;\r
@@ -118,6 +120,46 @@ public class EBIFetchClient
         }\r
     }\r
 \r
+    public static void main (String [] args)\r
+    {\r
+      EBIFetchClient ebi = new EBIFetchClient();\r
+      String[] result = ebi.fetchData("uniprot:25K89D_SARPE;G6PblobD_HUMAN",\r
+                           "xml", null);\r
+\r
+     try{\r
+       java.io.PrintWriter out = new java.io.PrintWriter(\r
+      new java.io.FileWriter("out.xml"));\r
+\r
+\r
+       for(int i=0; i<result.length; i++)\r
+       {\r
+         out.println(result[i]);\r
+       }\r
+       out.close();\r
+     }catch(Exception ex){ex.printStackTrace();}\r
+\r
+    }\r
+\r
+\r
+    public File fetchDataAsFile(String ids, String f, String s)\r
+    {\r
+      String [] data = fetchData(ids, f, s);\r
+      File outFile = null;\r
+      try{\r
+        outFile = File.createTempFile("jalview", ".xml");\r
+        outFile.deleteOnExit();\r
+        PrintWriter out = new PrintWriter(new FileOutputStream(outFile));\r
+        int index=0;\r
+        while( index < data.length )\r
+        {\r
+          out.println(data[index]);\r
+          index++;\r
+        }\r
+        out.close();\r
+      }catch(Exception ex){}\r
+      return outFile;\r
+    }\r
+\r
     /**\r
      * DOCUMENT ME!\r
      *\r
index 757bb57..37c96f6 100755 (executable)
 */\r
 package jalview.io;\r
 \r
-import jalview.analysis.*;\r
-\r
 import jalview.datamodel.*;\r
 \r
 import java.io.*;\r
 \r
-import java.util.*;\r
-\r
 \r
 /**\r
  * DOCUMENT ME!\r
@@ -72,154 +68,48 @@ public class FastaFile extends AlignFile
      */\r
     public void parse() throws IOException\r
     {\r
-        String id = "";\r
-        StringBuffer seq = new StringBuffer();\r
+        StringBuffer sb = new StringBuffer();\r
         int count = 0;\r
 \r
-        int sstart = 0;\r
-        int send = 0;\r
-\r
         String line;\r
+        Sequence seq = null;\r
 \r
         while ((line = nextLine()) != null)\r
         {\r
             if (line.length() > 0)\r
             {\r
-                // Do we have an id line?\r
-                // JBPNote - this code needs to be standardised to EBI/whatever for the\r
-                // >dbref/dbref/dbref|refid1|refid2|refid3 'human-readable' style of naming (should it really exist)\r
-                if (line.substring(0, 1).equals(">"))\r
+                if (line.charAt(0)=='>')\r
                 {\r
                     if (count != 0)\r
                     {\r
-                        if (sstart != 0)\r
-                        {\r
-                            seqs.addElement(new Sequence(id, seq.toString(),\r
-                                    sstart, send));\r
-                        }\r
-                        else\r
-                        {\r
-                            seqs.addElement(new Sequence(id, seq.toString(), 1,\r
-                                    seq.length()));\r
-                        }\r
+                       seq.setSequence(sb.toString());\r
+                       seqs.addElement(seq);\r
                     }\r
 \r
-                    count++;\r
-\r
-                    StringTokenizer str = new StringTokenizer(line, " ");\r
-\r
-                    id = str.nextToken();\r
-                    id = id.substring(1);\r
-\r
-                    com.stevesoft.pat.Regex dbId = new com.stevesoft.pat.Regex(\r
-                            "[A-Za-z-]+/?[A-Za-z-]+\\|(\\w+)\\|(.+)");\r
-\r
-                    // JBPNote At the moment - we don't get rid of the friendly names but this\r
-                    // behaviour is probably wrong in the long run.\r
-                    if (dbId.search(id))\r
-                    {\r
-                        String dbid = dbId.stringMatched(1);\r
-                        String idname = dbId.stringMatched(2);\r
-\r
-                        if ((idname.length() > 0) &&\r
-                                (idname.indexOf("_") > -1))\r
-                        {\r
-                            id = idname; // use the friendly name - apparently no dbid\r
-                        }\r
-                        else if (dbid.length() > 1)\r
-                        {\r
-                            id = dbid; // ignore the friendly name - we lose uniprot accession ID otherwise\r
-                        }\r
-                    }\r
-\r
-                    if (id.indexOf("/") > 0)\r
-                    {\r
-                        StringTokenizer st = new StringTokenizer(id, "/");\r
-\r
-                        if (st.countTokens() == 2)\r
-                        {\r
-                            id = st.nextToken();\r
-\r
-                            String tmp = st.nextToken();\r
+                    seq = parseId(line.substring(1));\r
 \r
-                            st = new StringTokenizer(tmp, "-");\r
-\r
-                            if (st.countTokens() == 2)\r
-                            {\r
-                                sstart = Integer.valueOf(st.nextToken())\r
-                                                .intValue();\r
-                                send = Integer.valueOf(st.nextToken()).intValue();\r
-                            }\r
-                        }\r
-                    }\r
-\r
-                    seq = new StringBuffer();\r
+                    count++;\r
+                    sb = new StringBuffer();\r
                 }\r
                 else\r
                 {\r
-                    seq = seq.append(line);\r
+                    sb.append(line);\r
                 }\r
             }\r
         }\r
 \r
         if (count > 0)\r
         {\r
-            if (!isValidProteinSequence(seq.toString().toUpperCase()))\r
+            if (!isValidProteinSequence(sb.toString().toUpperCase()))\r
             {\r
                 throw new IOException("Invalid protein sequence");\r
             }\r
 \r
-            if (sstart != 0)\r
-            {\r
-                seqs.addElement(new Sequence(id, seq.toString().toUpperCase(),\r
-                        sstart, send));\r
-            }\r
-            else\r
-            {\r
-                seqs.addElement(new Sequence(id, seq.toString().toUpperCase(),\r
-                        1, seq.length()));\r
-            }\r
+            seq.setSequence(sb.toString());\r
+            seqs.addElement(seq);\r
         }\r
     }\r
 \r
-    /**\r
-     * DOCUMENT ME!\r
-     *\r
-     * @param s DOCUMENT ME!\r
-     *\r
-     * @return DOCUMENT ME!\r
-     */\r
-    public static String print(SequenceI[] s)\r
-    {\r
-        return print(s, 72);\r
-    }\r
-\r
-    /**\r
-     * DOCUMENT ME!\r
-     *\r
-     * @param s DOCUMENT ME!\r
-     * @param len DOCUMENT ME!\r
-     *\r
-     * @return DOCUMENT ME!\r
-     */\r
-    public static String print(SequenceI[] s, int len)\r
-    {\r
-        return print(s, len, true);\r
-    }\r
-\r
-    /**\r
-     * DOCUMENT ME!\r
-     *\r
-     * @param s DOCUMENT ME!\r
-     * @param len DOCUMENT ME!\r
-     * @param gaps DOCUMENT ME!\r
-     *\r
-     * @return DOCUMENT ME!\r
-     */\r
-    public static String print(SequenceI[] s, int len, boolean gaps)\r
-    {\r
-        return print(s, len, gaps, true);\r
-    }\r
 \r
     /**\r
      * DOCUMENT ME!\r
@@ -231,43 +121,34 @@ public class FastaFile extends AlignFile
      *\r
      * @return DOCUMENT ME!\r
      */\r
-    public static String print(SequenceI[] s, int len, boolean gaps,\r
-        boolean displayId)\r
+    public String print(SequenceI[] s)\r
     {\r
+        int len = 72;\r
         StringBuffer out = new StringBuffer();\r
         int i = 0;\r
 \r
         while ((i < s.length) && (s[i] != null))\r
         {\r
-            String seq = "";\r
-\r
-            if (gaps)\r
-            {\r
-                seq = s[i].getSequence();\r
-            }\r
-            else\r
-            {\r
-                seq = AlignSeq.extractGaps("-. ", s[i].getSequence());\r
-            }\r
+            out.append(">" + printId(s[i]));\r
+            if(s[i].getDescription()!=null)\r
+              out.append(" "+s[i].getDescription());\r
 \r
-            // used to always put this here: + "/" + s[i].getStart() + "-" + s[i].getEnd() +\r
-            out.append(">" +\r
-                ((displayId) ? s[i].getDisplayId() : s[i].getName()) + "\n");\r
+            out.append("\n");\r
 \r
-            int nochunks = (seq.length() / len) + 1;\r
+            int nochunks = (s[i].getLength() / len) + 1;\r
 \r
             for (int j = 0; j < nochunks; j++)\r
             {\r
                 int start = j * len;\r
                 int end = start + len;\r
 \r
-                if (end < seq.length())\r
+                if (end < s[i].getLength())\r
                 {\r
-                    out.append(seq.substring(start, end) + "\n");\r
+                    out.append(s[i].getSequence(start, end) + "\n");\r
                 }\r
-                else if (start < seq.length())\r
+                else if (start < s[i].getLength())\r
                 {\r
-                    out.append(seq.substring(start) + "\n");\r
+                    out.append(s[i].getSequence(start, s[i].getLength()) + "\n");\r
                 }\r
             }\r
 \r
index 61c2331..0c8554a 100755 (executable)
@@ -29,79 +29,8 @@ import java.util.Vector;
  * @author $author$\r
  * @version $Revision$\r
  */\r
-public class FormatAdapter\r
+public class FormatAdapter extends AppletFormatAdapter\r
 {\r
-    /** DOCUMENT ME!! */\r
-    public static final Vector formats = new Vector();\r
-\r
-    static\r
-    {\r
-        formats.addElement("FASTA");\r
-        formats.addElement("MSF");\r
-        formats.addElement("PileUp");\r
-        formats.addElement("CLUSTAL");\r
-        formats.addElement("BLC");\r
-        formats.addElement("PIR");\r
-        formats.addElement("PFAM");\r
-    }\r
-\r
-    AlignFile afile = null;\r
-\r
-    /**\r
-     * DOCUMENT ME!\r
-     *\r
-     * @param inFile DOCUMENT ME!\r
-     * @param type DOCUMENT ME!\r
-     * @param format DOCUMENT ME!\r
-     *\r
-     * @return DOCUMENT ME!\r
-     */\r
-    public SequenceI[] readFile(String inFile, String type, String format)\r
-    {\r
-        try\r
-        {\r
-            if (format.equals("FASTA"))\r
-            {\r
-                afile = new FastaFile(inFile, type);\r
-            }\r
-            else if (format.equals("MSF"))\r
-            {\r
-                afile = new MSFfile(inFile, type);\r
-            }\r
-            else if (format.equals("PileUp"))\r
-            {\r
-                afile = new PileUpfile(inFile, type);\r
-            }\r
-            else if (format.equals("CLUSTAL"))\r
-            {\r
-                afile = new ClustalFile(inFile, type);\r
-            }\r
-            else if (format.equals("BLC"))\r
-            {\r
-                afile = new BLCFile(inFile, type);\r
-            }\r
-            else if (format.equals("PIR"))\r
-            {\r
-                afile = new PIRFile(inFile, type);\r
-            }\r
-            else if (format.equals("PFAM"))\r
-            {\r
-                afile = new PfamFile(inFile, type);\r
-            }\r
-\r
-            return afile.getSeqsAsArray();\r
-        }\r
-        catch (Exception e)\r
-        {\r
-            System.err.println("Failed to read alignment using the '" + format +\r
-                "' reader.");\r
-            e.printStackTrace();\r
-        }\r
-\r
-        return null;\r
-    }\r
-\r
-\r
     /**\r
      * DOCUMENT ME!\r
      *\r
@@ -124,30 +53,44 @@ public class FormatAdapter
             if (format.equalsIgnoreCase("FASTA"))\r
             {\r
                 afile = new FastaFile();\r
+                afile.addJVSuffix(\r
+                    jalview.bin.Cache.getDefault("FASTA_JVSUFFIX", true));\r
             }\r
             else if (format.equalsIgnoreCase("MSF"))\r
             {\r
-                afile = new MSFfile();\r
+              afile = new MSFfile();\r
+              afile.addJVSuffix(\r
+                  jalview.bin.Cache.getDefault("MSF_JVSUFFIX", true));\r
             }\r
             else if (format.equalsIgnoreCase("PileUp"))\r
             {\r
                 afile = new PileUpfile();\r
+                afile.addJVSuffix(\r
+                    jalview.bin.Cache.getDefault("PILEUP_JVSUFFIX", true));\r
             }\r
             else if (format.equalsIgnoreCase("CLUSTAL"))\r
             {\r
                 afile = new ClustalFile();\r
+                afile.addJVSuffix(\r
+                    jalview.bin.Cache.getDefault("CLUSTAL_JVSUFFIX", true));\r
             }\r
             else if (format.equalsIgnoreCase("BLC"))\r
             {\r
                 afile = new BLCFile();\r
+                afile.addJVSuffix(\r
+                    jalview.bin.Cache.getDefault("BLC_JVSUFFIX", true));\r
             }\r
             else if (format.equalsIgnoreCase("PIR"))\r
             {\r
                 afile = new PIRFile();\r
+                afile.addJVSuffix(\r
+                    jalview.bin.Cache.getDefault("PIR_JVSUFFIX", true));\r
             }\r
             else if (format.equalsIgnoreCase("PFAM"))\r
             {\r
                 afile = new PfamFile();\r
+                afile.addJVSuffix(\r
+                    jalview.bin.Cache.getDefault("PFAM_JVSUFFIX", true));\r
             }\r
 \r
             afile.setSeqs(s);\r
index 201ff0c..beb8829 100755 (executable)
@@ -24,18 +24,19 @@ import java.awt.*;
 \r
 import jalview.datamodel.*;\r
 import jalview.gui.*;\r
-import jalview.schemes.*;\r
 \r
 public class HTMLOutput\r
 {\r
   AlignViewport av;\r
   SequenceRenderer sr;\r
+  FeatureRenderer fr;\r
   Color color;\r
 \r
-  public HTMLOutput(AlignViewport av)\r
+  public HTMLOutput(AlignViewport av, SequenceRenderer sr, FeatureRenderer fr)\r
   {\r
     this.av = av;\r
-    sr = new SequenceRenderer(av);\r
+    this.sr = sr;\r
+    this.fr = fr;\r
 \r
     JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
         getProperty(\r
@@ -110,9 +111,7 @@ public class HTMLOutput
         "<table border=\"0\"  cellpadding=\"0\" cellspacing=\"0\">\n");\r
 \r
     //////////////\r
-    SequenceGroup[] groups;\r
     SequenceI seq;\r
-    ColourSchemeI cs = null;\r
     AlignmentI alignment = av.getAlignment();\r
 \r
     // draws the top row, the measure rule\r
@@ -132,40 +131,26 @@ public class HTMLOutput
     for (i = 0; i < alignment.getHeight(); i++)\r
     {\r
       seq = alignment.getSequenceAt(i);\r
-      groups = alignment.findAllGroups(seq);\r
 \r
-      if (av.getShowFullId())\r
-      {\r
-        out.println("<tr><td nowrap>" + seq.getDisplayId() +\r
-                    "&nbsp;&nbsp;</td>");\r
-      }\r
-      else\r
-      {\r
-        out.println("<tr><td nowrap>" + seq.getName() +\r
+      String id = seq.getDisplayId(av.getShowJVSuffix());\r
+\r
+      out.println("<tr><td nowrap>" + id +\r
                     "&nbsp;&nbsp;</td>");\r
-      }\r
+\r
 \r
       for (int res = 0; res < seq.getLength(); res++)\r
       {\r
-        cs = av.getGlobalColourScheme();\r
-\r
-        if (groups != null)\r
+        if (!jalview.util.Comparison.isGap(seq.getCharAt(res)))\r
         {\r
-          for (int k = 0; k < groups.length; k++)\r
-          {\r
-            if ( (groups[k].getStartRes() <= res) &&\r
-                (groups[k].getEndRes() >= res))\r
-            {\r
-              cs = groups[k].cs;\r
+          color = sr.getResidueBoxColour(seq, res);\r
 \r
-              break;\r
-            }\r
-          }\r
+          color = fr.findFeatureColour(color, seq, res);\r
         }\r
+        else\r
+            color = Color.white;\r
 \r
-        color = sr.getResidueBoxColour(cs, seq, res);\r
 \r
-        if (color.getRGB() < -1)\r
+       if (color.getRGB() < -1)\r
         {\r
           out.println("<td bgcolor=\"#" +\r
                       jalview.util.Format.getHexString(color) + "\">" +\r
@@ -190,9 +175,7 @@ public class HTMLOutput
     ////////////////////////////////////\r
     /// How many sequences and residues can we fit on a printable page?\r
     AlignmentI al = av.getAlignment();\r
-    SequenceGroup[] groups;\r
     SequenceI seq;\r
-    ColourSchemeI cs = null;\r
     String r;\r
     String g;\r
     String b;\r
@@ -211,54 +194,59 @@ public class HTMLOutput
         endRes = al.getWidth();\r
       }\r
 \r
-      out.println("<tr>");\r
-      out.println("<td colspan=\"6\">&nbsp;</td>");\r
-\r
-      for (int i = startRes + 10; i < endRes; i += 10)\r
+      if(av.getScaleAboveWrapped())\r
       {\r
-        out.println("<td colspan=\"9\">" + i + "<br>|</td><td></td>");\r
-      }\r
+        out.println("<tr>");\r
 \r
-      // out.println("<td colspan=\"3\"></td><td colspan=\"3\">" + i +\r
-      //             "<br>|</td>");\r
-      out.println("</tr>");\r
+        if (av.getScaleLeftWrapped())\r
+          out.println("<td colspan=\"7\">&nbsp;</td>");\r
+        else\r
+          out.println("<td colspan=\"6\">&nbsp;</td>");\r
+\r
+\r
+        for (int i = startRes + 10; i < endRes; i += 10)\r
+        {\r
+          out.println("<td colspan=\"9\">" + i + "<br>|</td><td></td>");\r
+        }\r
+\r
+        out.println("</tr>");\r
+      }\r
 \r
+      int startPos, endPos;\r
       for (int s = 0; s < al.getHeight(); s++)\r
       {\r
         out.println("<tr>");\r
         seq = al.getSequenceAt(s);\r
-        groups = al.findAllGroups(seq);\r
 \r
-        if (av.getShowFullId())\r
-        {\r
-          out.println("<td nowrap>" + seq.getDisplayId() +\r
+        startPos = seq.findPosition( startRes );\r
+        endPos =   seq.findPosition( endRes )-1;\r
+\r
+        String id = seq.getDisplayId(av.getShowJVSuffix());\r
+\r
+        out.println("<td nowrap>" + id +\r
                       "&nbsp;&nbsp;</td>");\r
-        }\r
-        else\r
+\r
+\r
+        if(av.getScaleLeftWrapped())\r
         {\r
-          out.println("<td nowrap>" + seq.getName() +\r
+          if(startPos > seq.getEnd() || endPos==0)\r
+            out.println("<td nowrap>&nbsp;</td>");\r
+          else\r
+            out.println("<td nowrap>" + startPos +\r
                       "&nbsp;&nbsp;</td>");\r
         }\r
 \r
+\r
         for (int res = startRes; res < endRes; res++)\r
         {\r
-          cs = av.getGlobalColourScheme();\r
-\r
-          if (groups != null)\r
+          if (!jalview.util.Comparison.isGap(seq.getCharAt(res)))\r
           {\r
-            for (int k = 0; k < groups.length; k++)\r
-            {\r
-              if ( (groups[k].getStartRes() <= res) &&\r
-                  (groups[k].getEndRes() >= res))\r
-              {\r
-                cs = groups[k].cs;\r
+            color = sr.getResidueBoxColour(seq, res);\r
 \r
-                break;\r
-              }\r
-            }\r
+            color = fr.findFeatureColour(color, seq, res);\r
           }\r
-\r
-          color = sr.getResidueBoxColour(cs, seq, res);\r
+          else\r
+            color = Color.white;\r
 \r
           if (color.getRGB() < -1)\r
           {\r
@@ -290,8 +278,25 @@ public class HTMLOutput
           {\r
             out.println("<td>" + seq.getCharAt(res) + "</td>");\r
           }\r
+\r
+\r
+        }\r
+\r
+        if(av.getScaleRightWrapped() &&\r
+           endRes < startRes + av.getWrappedWidth())\r
+        {\r
+         out.println("<td colspan=\""+ (startRes+av.getWrappedWidth()-endRes) +"\">"\r
+                     +"&nbsp;&nbsp;</td>");\r
+       }\r
+\r
+\r
+        if(av.getScaleRightWrapped() && startPos<endPos)\r
+        {\r
+          out.println("<td nowrap>&nbsp;" + endPos +\r
+                      "&nbsp;&nbsp;</td>");\r
         }\r
 \r
+\r
         out.println("</tr>");\r
       }\r
 \r
index 729a860..f4beccb 100755 (executable)
@@ -110,7 +110,7 @@ public class IdentifyFile
                     // could be BLC file, read next line to confirm\r
                     data = reader.readLine();\r
 \r
-                    if (data.indexOf(">") > -1)\r
+                    if (data.indexOf(">") > -1 || data.indexOf("*") >-1 )\r
                     {\r
                         reply = "BLC";\r
                     }\r
index 2cef0fe..179204e 100755 (executable)
@@ -155,30 +155,11 @@ public class MSFfile extends AlignFile
                     maxLength = head.length();\r
                 }\r
 \r
-                if (head.indexOf("/") > 0)\r
-                {\r
-                    StringTokenizer st = new StringTokenizer(head, "/");\r
-\r
-                    if (st.countTokens() == 2)\r
-                    {\r
-                        head = st.nextToken();\r
-\r
-                        String tmp = st.nextToken();\r
-                        st = new StringTokenizer(tmp, "-");\r
-\r
-                        if (st.countTokens() == 2)\r
-                        {\r
-                            start = Integer.valueOf(st.nextToken()).intValue();\r
-                            end = Integer.valueOf(st.nextToken()).intValue();\r
-                        }\r
-                    }\r
-                }\r
-\r
-\r
                 // Replace ~ with a sensible gap character\r
                 seq = seq.replace('~', '-');\r
 \r
-                Sequence newSeq = new Sequence(head, seq, start, end);\r
+                Sequence newSeq = parseId(head);\r
+                newSeq.setSequence(seq);\r
 \r
                 seqs.addElement(newSeq);\r
             }\r
@@ -197,7 +178,7 @@ public class MSFfile extends AlignFile
      *\r
      * @return DOCUMENT ME!\r
      */\r
-    public static int checkSum(String seq)\r
+    public int checkSum(String seq)\r
     {\r
         int check = 0;\r
         String sequence = seq.toUpperCase();\r
@@ -223,17 +204,6 @@ public class MSFfile extends AlignFile
         return check % 10000;\r
     }\r
 \r
-    /**\r
-     * DOCUMENT ME!\r
-     *\r
-     * @param s DOCUMENT ME!\r
-     *\r
-     * @return DOCUMENT ME!\r
-     */\r
-    public static String print(SequenceI[] s)\r
-    {\r
-        return print(s, false);\r
-    }\r
 \r
     /**\r
      * DOCUMENT ME!\r
@@ -243,9 +213,11 @@ public class MSFfile extends AlignFile
      *\r
      * @return DOCUMENT ME!\r
      */\r
-    public static String print(SequenceI[] seqs, boolean is_NA)\r
+    public String print(SequenceI[] seqs)\r
     {\r
 \r
+      boolean is_NA = jalview.util.Comparison.isNucleotide(seqs);\r
+\r
       SequenceI [] s = new SequenceI[seqs.length];\r
 \r
         StringBuffer out = new StringBuffer("!!" + (is_NA ? "NA" : "AA") +\r
@@ -265,7 +237,7 @@ public class MSFfile extends AlignFile
           {\r
             if (sb.charAt(ii) == '.')\r
             {\r
-              sb.replace(ii, ii + 1, "~");\r
+              sb.setCharAt(ii, '~');\r
             }\r
             else\r
               break;\r
@@ -275,7 +247,7 @@ public class MSFfile extends AlignFile
           {\r
             if (sb.charAt(ii) == '.')\r
             {\r
-              sb.replace(ii, ii + 1, "~");\r
+              sb.setCharAt(ii,'~');\r
             }\r
             else\r
               break;\r
@@ -317,9 +289,7 @@ public class MSFfile extends AlignFile
         while ((i < s.length) && (s[i] != null))\r
         {\r
 \r
-            nameBlock[i] = new String("  Name: " + s[i].getName()\r
-                                      + "/" + s[i].getStart() + "-" + s[i].getEnd()\r
-                                      +" ");\r
+            nameBlock[i] = new String("  Name: " + printId(s[i])+" ");\r
 \r
             idBlock[i] = new String("Len: " +\r
                     maxLenpad.form(s[i].getSequence().length()) + "  Check: " +\r
@@ -373,11 +343,9 @@ public class MSFfile extends AlignFile
 \r
             while ((j < s.length) && (s[j] != null))\r
             {\r
-                String name = s[j].getName();\r
-              //  out.append(new Format("%-" + maxid + "s").form(name)+ " ");\r
+                String name = printId( s[j] );\r
 \r
-                out.append(new Format("%-" + maxid + "s").form(name\r
-                   + "/" + s[j].getStart() + "-" + s[j].getEnd()) + " ");\r
+                out.append(new Format("%-" + maxid + "s").form(name+" "));\r
 \r
 \r
                 for (int k = 0; k < 5; k++)\r
index 65890a9..d4b818b 100755 (executable)
@@ -48,9 +48,6 @@ public class PIRFile
   {\r
     try\r
     {\r
-      String id;\r
-      String start;\r
-      String end;\r
       StringBuffer sequence;\r
       String line = null;\r
 \r
@@ -62,31 +59,11 @@ public class PIRFile
           continue;\r
         }\r
 \r
-        id = "No id";\r
-        start = "1";\r
-        end = "-1";\r
-\r
-        try\r
-        {\r
-          int slashIndex = line.indexOf("/");\r
-          if(slashIndex!=-1)\r
-          {\r
-            id = line.substring(line.indexOf(";") + 1, line.indexOf("/"));\r
-            line = line.substring(line.indexOf("/") + 1);\r
-            start = line.substring(0, line.indexOf("-"));\r
-            end = line.substring(line.indexOf("-") + 1);\r
-          }\r
-          else\r
-          {\r
-            id = line.substring(line.indexOf(";")+1);\r
-          }\r
-        }\r
-        catch (Exception ex)\r
-        {    }// Default id, start and end unchanged\r
+        Sequence newSeq = parseId(line.substring(line.indexOf(";") + 1));\r
 \r
         sequence = new StringBuffer();\r
 \r
-        line = nextLine(); // this is the title line\r
+        newSeq.setDescription(nextLine()); // this is the title line\r
 \r
         boolean starFound = false;\r
 \r
@@ -108,9 +85,7 @@ public class PIRFile
         {\r
           sequence.setLength(sequence.length() - 1);\r
 \r
-          Sequence newSeq = new Sequence(id, sequence.toString(),\r
-                                         Integer.parseInt(start),\r
-                                         Integer.parseInt(end));\r
+          newSeq.setSequence(sequence.toString());\r
           seqs.addElement(newSeq);\r
         }\r
       }\r
@@ -126,41 +101,27 @@ public class PIRFile
     return print(getSeqsAsArray());\r
   }\r
 \r
-  public static String print(SequenceI[] s)\r
-  {\r
-    return print(s, 72, true);\r
-  }\r
-\r
-  public static String print(SequenceI[] s, int len)\r
-  {\r
-    return print(s, len, true);\r
-  }\r
-\r
-  public static String print(SequenceI[] s, int len, boolean gaps)\r
+  public String print(SequenceI[] s)\r
   {\r
+    boolean is_NA = jalview.util.Comparison.isNucleotide(s);\r
+    int len = 72;\r
     StringBuffer out = new StringBuffer();\r
     int i = 0;\r
 \r
     while ( (i < s.length) && (s[i] != null))\r
     {\r
-      String seq = "";\r
+      String seq = s[i].getSequence();\r
+      seq = seq + "*";\r
 \r
-      if (gaps)\r
-      {\r
-        seq = s[i].getSequence() + "*";\r
-      }\r
+      out.append(">P1;" + printId(s[i]) + "\n");\r
+\r
+      if(s[i].getDescription()!=null)\r
+        out.append(s[i].getDescription()+"\n");\r
       else\r
       {\r
-        seq = AlignSeq.extractGaps(s[i].getSequence(), "-");\r
-        seq = AlignSeq.extractGaps(seq, ".");\r
-        seq = AlignSeq.extractGaps(seq, " ");\r
-        seq = seq + "*";\r
+        out.append(s[i].getName()+" "+ (s[i].getEnd() - s[i].getStart() + 1));\r
+        out.append( is_NA ? " bases\n" : " residues\n");\r
       }\r
-\r
-      out.append(">P1;" + s[i].getName() + "/" + s[i].getStart() + "-" +\r
-                 s[i].getEnd() + "\n");\r
-      out.append(" Dummy title\n");\r
-\r
       int nochunks = (seq.length() / len) + 1;\r
 \r
       for (int j = 0; j < nochunks; j++)\r
index 9a6ca54..ec52bac 100755 (executable)
@@ -27,7 +27,6 @@ import jalview.util.*;
 public class PfamFile\r
     extends AlignFile\r
 {\r
-  Vector ids;\r
 \r
   public PfamFile()\r
   {\r
@@ -47,7 +46,6 @@ public class PfamFile
   public void initData()\r
   {\r
     super.initData();\r
-    ids = new Vector();\r
   }\r
 \r
   public void parse()\r
@@ -113,45 +111,11 @@ public class PfamFile
               .length();\r
         }\r
 \r
-        String head = headers.elementAt(i).toString();\r
-        int start = 1;\r
-        int end = -1;\r
 \r
-        if (head.indexOf("/") > 0)\r
-        {\r
-          StringTokenizer st = new StringTokenizer(head, "/");\r
-\r
-          if (st.countTokens() == 2)\r
-          {\r
-            ids.addElement(st.nextToken());\r
-\r
-            String tmp = st.nextToken();\r
-            st = new StringTokenizer(tmp, "-");\r
-\r
-            if (st.countTokens() == 2)\r
-            {\r
-              start = Integer.valueOf(st.nextToken()).intValue();\r
-              end = Integer.valueOf(st.nextToken()).intValue();\r
-            }\r
-          }\r
-          else\r
-          {\r
-            ids.addElement(headers.elementAt(i));\r
-          }\r
-        }\r
-        else\r
-        {\r
-          ids.addElement(headers.elementAt(i));\r
-        }\r
-\r
-        Sequence newSeq = null;\r
-\r
-        newSeq = new Sequence(ids.elementAt(i).toString(),\r
-                              seqhash.get(headers.elementAt(i).toString())\r
-                              .toString(), start, end);\r
+        Sequence newSeq = parseId(headers.elementAt(i).toString());\r
+        newSeq.setSequence( seqhash.get(headers.elementAt(i).toString()).toString());\r
         seqs.addElement(newSeq);\r
 \r
-\r
         if (!isValidProteinSequence(newSeq.getSequence()))\r
         {\r
           throw new IOException(\r
@@ -166,7 +130,7 @@ public class PfamFile
     }\r
   }\r
 \r
-  public static String print(SequenceI[] s)\r
+  public String print(SequenceI[] s)\r
   {\r
     StringBuffer out = new StringBuffer("");\r
 \r
@@ -177,8 +141,7 @@ public class PfamFile
 \r
     while ( (i < s.length) && (s[i] != null))\r
     {\r
-      String tmp = s[i].getName() + "/" + s[i].getStart() + "-" +\r
-          s[i].getEnd();\r
+      String tmp = printId(s[i]);\r
 \r
       if (s[i].getSequence().length() > max)\r
       {\r
@@ -202,8 +165,7 @@ public class PfamFile
 \r
     while ( (j < s.length) && (s[j] != null))\r
     {\r
-      out.append(new Format("%-" + maxid + "s").form(s[j].getName() +\r
-          "/" + s[j].getStart() + "-" + s[j].getEnd()) + " ");\r
+      out.append(new Format("%-" + maxid + "s").form( printId(s[j])+" "));\r
 \r
       out.append(s[j].getSequence() + "\n");\r
       j++;\r
index 8c8a3ea..c945fd5 100755 (executable)
@@ -30,170 +30,53 @@ package jalview.io;
  *\r
  **/\r
 import java.io.*;\r
-import java.util.*;\r
 \r
 import jalview.datamodel.*;\r
 import jalview.util.*;\r
 \r
-public class PileUpfile\r
-    extends AlignFile\r
+public class PileUpfile  extends MSFfile\r
 {\r
-  public PileUpfile()\r
-  {\r
-  }\r
-\r
-  public PileUpfile(String inStr)\r
-  {\r
-    super(inStr);\r
-  }\r
 \r
-  public PileUpfile(String inFile, String type)\r
-      throws IOException\r
-  {\r
-    super(inFile, type);\r
-  }\r
-\r
-  public void parse()\r
-  {\r
-    int i = 0;\r
-    boolean seqFlag = false;\r
-    String key = new String();\r
-    Vector headers = new Vector();\r
-    Hashtable seqhash = new Hashtable();\r
-    String line;\r
-\r
-    try\r
+    /**\r
+     * Creates a new MSFfile object.\r
+     */\r
+    public PileUpfile()\r
     {\r
-      while ( (line = nextLine()) != null)\r
-      {\r
-        StringTokenizer str = new StringTokenizer(line);\r
-\r
-        while (str.hasMoreTokens())\r
-        {\r
-          String inStr = str.nextToken();\r
-\r
-          //If line has header information add to the headers vector\r
-          if (inStr.indexOf("Name:") != -1)\r
-          {\r
-            key = str.nextToken();\r
-            headers.addElement(key);\r
-          }\r
-\r
-          //if line has // set SeqFlag to 1 so we know sequences are coming\r
-          if (inStr.indexOf("//") != -1)\r
-          {\r
-            seqFlag = true;\r
-          }\r
-\r
-          //Process lines as sequence lines if seqFlag is set\r
-          if ( (inStr.indexOf("//") == -1) && (seqFlag == true))\r
-          {\r
-            //seqeunce id is the first field\r
-            key = inStr;\r
-\r
-            StringBuffer tempseq;\r
-\r
-            //Get sequence from hash if it exists\r
-            if (seqhash.containsKey(key))\r
-            {\r
-              tempseq = (StringBuffer) seqhash.get(key);\r
-            }\r
-            else\r
-            {\r
-              tempseq = new StringBuffer();\r
-              seqhash.put(key, tempseq);\r
-            }\r
-\r
-            //loop through the rest of the words\r
-            while (str.hasMoreTokens())\r
-            {\r
-              //append the word to the sequence\r
-              tempseq.append(str.nextToken());\r
-            }\r
-          }\r
-        }\r
-      }\r
     }\r
-    catch (IOException e)\r
+    /**\r
+     * Creates a new MSFfile object.\r
+     *\r
+     * @param inStr DOCUMENT ME!\r
+     */\r
+    public PileUpfile(String inStr)\r
     {\r
-      System.err.println("Exception parsing PileUpfile " + e);\r
-      e.printStackTrace();\r
+        super(inStr);\r
     }\r
 \r
-    this.noSeqs = headers.size();\r
-\r
-    //Add sequences to the hash\r
-    for (i = 0; i < headers.size(); i++)\r
+    /**\r
+     * Creates a new MSFfile object.\r
+     *\r
+     * @param inFile DOCUMENT ME!\r
+     * @param type DOCUMENT ME!\r
+     *\r
+     * @throws IOException DOCUMENT ME!\r
+     */\r
+    public PileUpfile(String inFile, String type) throws IOException\r
     {\r
-      if (seqhash.get(headers.elementAt(i)) != null)\r
-      {\r
-        String head = headers.elementAt(i).toString();\r
-        String seq = seqhash.get(head).toString();\r
-\r
-        int start = 1;\r
-        int end = -1;\r
-\r
-        if (maxLength < head.length())\r
-        {\r
-          maxLength = head.length();\r
-        }\r
-\r
-        if (head.indexOf("/") > 0)\r
-        {\r
-          StringTokenizer st = new StringTokenizer(head, "/");\r
-\r
-          if (st.countTokens() == 2)\r
-          {\r
-            head = st.nextToken();\r
-\r
-            String tmp = st.nextToken();\r
-            st = new StringTokenizer(tmp, "-");\r
-\r
-            if (st.countTokens() == 2)\r
-            {\r
-              start = Integer.valueOf(st.nextToken()).intValue();\r
-              end = Integer.valueOf(st.nextToken()).intValue();\r
-            }\r
-          }\r
-        }\r
-\r
-        Sequence newSeq = new Sequence(head, seq, start, end);\r
-\r
-        seqs.addElement(newSeq);\r
-      }\r
-      else\r
-      {\r
-        System.err.println(\r
-            "PileUpfile Parser: Can't find sequence for " +\r
-            headers.elementAt(i));\r
-      }\r
+        super(inFile, type);\r
     }\r
-  }\r
-\r
-  public static int checkSum(String seq)\r
+   /**\r
+   * DOCUMENT ME!\r
+   *\r
+   * @return DOCUMENT ME!\r
+   */\r
+  public String print()\r
   {\r
-\r
-    int check = 0;\r
-\r
-    String sequence = seq.toUpperCase();\r
-\r
-    for (int i = 0; i < sequence.length(); i++)\r
-    {\r
-        if (i < sequence.length())\r
-        {\r
-          int value = sequence.charAt(i);\r
-          if (value != -1)\r
-          {\r
-            check += (i % 57 + 1) * value;\r
-          }\r
-        }\r
-\r
-    }\r
-\r
-    return check % 10000;\r
+      return print(getSeqsAsArray());\r
   }\r
 \r
-  public static String print(SequenceI[] s)\r
+\r
+  public  String print(SequenceI[] s)\r
   {\r
     StringBuffer out = new StringBuffer("PileUp\n\n");\r
 \r
@@ -217,8 +100,7 @@ public class PileUpfile
     while ( (i < s.length) && (s[i] != null))\r
     {\r
       String seq = s[i].getSequence();\r
-      out.append(" Name: " + s[i].getName() +\r
-                   "/" + s[i].getStart() + "-" + s[i].getEnd() +\r
+      out.append(" Name: " + printId(s[i]) +\r
                  " oo  Len:  " +\r
                  s[i].getSequence().length() + "  Check:  " + checksums[i] +\r
                  "  Weight:  1.00\n");\r
@@ -259,11 +141,9 @@ public class PileUpfile
 \r
       while ( (j < s.length) && (s[j] != null))\r
       {\r
-        String name = s[j].getName();\r
-       // out.append(new Format("%-" + maxid + "s").form(name) + " ");\r
+        String name = printId(s[j]);\r
 \r
-         out.append(new Format("%-" + maxid + "s").form(name\r
-          + "/" + s[j].getStart() + "-" + s[j].getEnd()) + " ");\r
+         out.append(new Format("%-" + maxid + "s").form(name + " "));\r
 \r
         for (int k = 0; k < 5; k++)\r
         {\r
@@ -309,9 +189,4 @@ public class PileUpfile
 \r
     return out.toString();\r
   }\r
-\r
-  public String print()\r
-  {\r
-    return print(getSeqsAsArray());\r
-  }\r
 }\r
index 94713ea..d980b0a 100755 (executable)
@@ -26,6 +26,12 @@ import java.io.*;
 \r
 import java.util.*;\r
 \r
+import org.exolab.castor.mapping.Mapping;\r
+\r
+import org.exolab.castor.xml.*;\r
+import jalview.analysis.AlignSeq;\r
+\r
+\r
 \r
 /**\r
  * DOCUMENT ME!\r
@@ -35,527 +41,299 @@ import java.util.*;
  */\r
 public class SequenceFeatureFetcher implements Runnable\r
 {\r
-    AlignmentI align;\r
-    AlignmentPanel ap;\r
-    ArrayList unknownSequences;\r
-    CutAndPasteTransfer output = new CutAndPasteTransfer();\r
-    StringBuffer sbuffer = new StringBuffer();\r
-\r
-    /**\r
-     * Creates a new SequenceFeatureFetcher object.\r
-     *\r
-     * @param align DOCUMENT ME!\r
-     * @param ap DOCUMENT ME!\r
-     */\r
-    public SequenceFeatureFetcher(AlignmentI align, AlignmentPanel ap)\r
-    {\r
-        unknownSequences = new ArrayList();\r
-        this.align = align;\r
-        this.ap = ap;\r
-\r
-        Thread thread = new Thread(this);\r
-        thread.start();\r
-    }\r
-\r
-    /**\r
-     * DOCUMENT ME!\r
-     */\r
-    public void run()\r
-    {\r
-        RandomAccessFile out = null;\r
-\r
-        try\r
-        {\r
-            String cache = System.getProperty("user.home") +\r
-                "/.jalview.uniprot.xml";\r
-\r
-            File test = new File(cache);\r
-\r
-            if (!test.exists())\r
-            {\r
-                out = new RandomAccessFile(cache, "rw");\r
-                out.writeBytes("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");\r
-                out.writeBytes("<UNIPROT_CACHE>\n");\r
-            }\r
-            else\r
-            {\r
-                out = new RandomAccessFile(cache, "rw");\r
-\r
-                // open exisiting cache and remove </UNIPROT_CACHE> from the end\r
-                long lastLine = 0;\r
-                String data;\r
-\r
-                while ((data = out.readLine()) != null)\r
-                {\r
-                    if (data.indexOf("</entry>") > -1)\r
-                    {\r
-                        lastLine = out.getFilePointer();\r
-                    }\r
-                }\r
-\r
-                out.seek(lastLine);\r
-            }\r
-\r
-            int seqIndex = 0;\r
-            Vector sequences = align.getSequences();\r
 \r
-            while (seqIndex < sequences.size())\r
-            {\r
-                ArrayList ids = new ArrayList();\r
+  AlignmentI align;\r
+  AlignmentI dataset;\r
+  AlignmentPanel ap;\r
+  ArrayList unknownSequences;\r
+  CutAndPasteTransfer output = new CutAndPasteTransfer();\r
+  StringBuffer sbuffer = new StringBuffer();\r
+  boolean uniprotFlag = false;\r
 \r
-                for (int i = 0; (seqIndex < sequences.size()) && (i < 50);\r
-                        seqIndex++, i++)\r
-                {\r
-                    SequenceI sequence = (SequenceI) sequences.get(seqIndex);\r
-                    ids.add(sequence.getName());\r
-                }\r
+  public SequenceFeatureFetcher()\r
+  {}\r
 \r
-                tryLocalCacheFirst(ids, align);\r
+  public Vector getUniprotEntries(File file)\r
+  {\r
 \r
-                if (ids.size() > 0)\r
-                {\r
-                    StringBuffer remainingIds = new StringBuffer("uniprot:");\r
+    UniprotFile uni = new UniprotFile();\r
+    try\r
+    {\r
+      // 1. Load the mapping information from the file\r
+      Mapping map = new Mapping(uni.getClass().getClassLoader());\r
+      java.net.URL url = getClass().getResource("/uniprot_mapping.xml");\r
+      map.loadMapping(url);\r
 \r
-                    for (int i = 0; i < ids.size(); i++)\r
-                        remainingIds.append(ids.get(i) + ";");\r
+      // 2. Unmarshal the data\r
+      Unmarshaller unmar = new Unmarshaller();\r
+      unmar.setIgnoreExtraElements(true);\r
+      unmar.setMapping(map);\r
+      uni = (UniprotFile) unmar.unmarshal(new FileReader(file));\r
 \r
-                    EBIFetchClient ebi = new EBIFetchClient();\r
-                    String[] result = ebi.fetchData(remainingIds.toString(),\r
-                            "xml", null);\r
+    }\r
+    catch (Exception e)\r
+    {\r
+      System.out.println("Error getUniprotEntries() "+e);\r
+    }\r
+    return uni.getUniprotEntries();\r
+  }\r
+\r
+  /**\r
+   * Creates a new SequenceFeatureFetcher object.\r
+   *\r
+   * @param align DOCUMENT ME!\r
+   * @param ap DOCUMENT ME!\r
+   */\r
+  public SequenceFeatureFetcher(AlignmentI align, AlignmentPanel ap)\r
+  {\r
+    unknownSequences = new ArrayList();\r
+    this.align = align;\r
+    this.dataset = align.getDataset();\r
+    this.ap = ap;\r
+\r
+    Thread thread = new Thread(this);\r
+    thread.start();\r
+  }\r
+\r
+  /**\r
+   * DOCUMENT ME!\r
+   */\r
+  public void run()\r
+  {\r
+    try\r
+    {\r
+      int seqIndex = 0;\r
+      Vector sequences = dataset.getSequences();\r
 \r
-                    if (result != null)\r
-                    {\r
-                        ReadUniprotFile(result, out, align);\r
-                    }\r
-                }\r
-            }\r
+      while (seqIndex < sequences.size())\r
+      {\r
+        Vector ids = new Vector();\r
 \r
-            if (out != null)\r
+        for (int i = 0; (seqIndex < sequences.size()) && (i < 50);\r
+             seqIndex++, i++)\r
+        {\r
+          Sequence sequence = (Sequence) sequences.get(seqIndex);\r
+          if(sequence.getSequenceFeatures()==null)\r
+          {\r
+            if (!ids.contains(sequence.getName()))\r
             {\r
-                out.writeBytes("</UNIPROT_CACHE>\n");\r
-                out.close();\r
+              ids.add(sequence.getName());\r
+              unknownSequences.add(sequence);\r
             }\r
-        }\r
-        catch (Exception ex)\r
-        {\r
-            ex.printStackTrace();\r
+          }\r
         }\r
 \r
-        findMissingIds(align);\r
-\r
-        if (sbuffer.length() > 0)\r
+        ///////////////////////////////////\r
+        ///READ FROM EBI\r
+        if (ids.size() > 0)\r
         {\r
-            output.setText(\r
-                "Your sequences have been matched to Uniprot. Some of the ids have been\n" +\r
-                "altered, most likely the start/end residue will have been updated.\n" +\r
-                "Save your alignment to maintain the updated id.\n\n" +\r
-                sbuffer.toString());\r
-            Desktop.addInternalFrame(output, "Sequence names updated ", 600, 300);\r
+          StringBuffer remainingIds = new StringBuffer("uniprot:");\r
+          for (int i = 0; i < ids.size(); i++)\r
+           {\r
+             if(ids.get(i).toString().indexOf("|")>-1)\r
+             {\r
+               remainingIds.append(ids.get(i).toString().substring(\r
+                   ids.get(i).toString().lastIndexOf("|") + 1));\r
+               uniprotFlag = true;\r
+             }\r
+             remainingIds.append(ids.get(i) + ";");\r
+           }\r
+          EBIFetchClient ebi = new EBIFetchClient();\r
+          File file = ebi.fetchDataAsFile(remainingIds.toString(),\r
+                                          "xml", "raw");\r
+\r
+\r
+\r
+          if (file != null)\r
+          {\r
+            ReadUniprotFile(file, ids);\r
+          }\r
         }\r
+      }\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+      ex.printStackTrace();\r
+    }\r
 \r
-        if (unknownSequences.size() > 0)\r
-        {\r
-            //ignore for now!!!!!!!!!!\r
-            //  WSWUBlastClient blastClient = new WSWUBlastClient(align, unknownSequences);\r
-        }\r
+    if (sbuffer.length() > 0)\r
+    {\r
+      output.setText(\r
+          "Your sequences have been matched to Uniprot. Some of the ids have been\n" +\r
+          "altered, most likely the start/end residue will have been updated.\n" +\r
+          "Save your alignment to maintain the updated id.\n\n" +\r
+          sbuffer.toString());\r
+      Desktop.addInternalFrame(output, "Sequence names updated ", 600, 300);\r
+      // The above is the dataset, we must now find out the index\r
+      // of the viewed sequence\r
 \r
-        jalview.gui.PaintRefresher.Refresh(null, align);\r
     }\r
 \r
-    /**\r
-     * DOCUMENT ME!\r
-     *\r
-     * @param result DOCUMENT ME!\r
-     * @param out DOCUMENT ME!\r
-     * @param align DOCUMENT ME!\r
-     */\r
-    void ReadUniprotFile(String[] result, RandomAccessFile out, AlignmentI align)\r
-    {\r
-        SequenceI sequence = null;\r
-        Vector features = null;\r
-        String type;\r
-        String description;\r
-        String status;\r
-        String start;\r
-        String end;\r
-        String pdb = null;\r
-\r
-        for (int r = 0; r < result.length; r++)\r
-        {\r
-            if ((sequence == null) && (result[r].indexOf("<name>") > -1))\r
-            {\r
-                long filePointer = 0;\r
-\r
-                if (out != null)\r
-                {\r
-                    try\r
-                    {\r
-                        filePointer = out.getFilePointer();\r
-                        out.writeBytes("<entry>\n");\r
-                    }\r
-                    catch (Exception ex)\r
-                    {\r
-                    }\r
-                }\r
-\r
-                String seqName = parseElement(result[r], "<name>", out);\r
-                sequence = align.findName(seqName);\r
-\r
-                if (sequence == null)\r
-                {\r
-                    sequence = align.findName(seqName.substring(0,\r
-                                seqName.indexOf('_')));\r
-\r
-                    if (sequence != null)\r
-                    {\r
-                        sbuffer.append("changing " + sequence.getName() +\r
-                            " to " + seqName + "\n");\r
-                        sequence.setName(seqName);\r
-                    }\r
-                }\r
-\r
-                if (sequence == null)\r
-                {\r
-                    sbuffer.append("UNIPROT updated suggestion is " +\r
-                        result[r] + "\n");\r
-                    sequence = align.findName(result[r]);\r
-\r
-                    // this entry has been suggested by ebi.\r
-                    // doesn't match id in alignment file\r
-                    try\r
-                    {\r
-                        out.setLength(filePointer);\r
-                    }\r
-                    catch (Exception ex)\r
-                    {\r
-                    }\r
-\r
-                    // now skip to next entry\r
-                    while (result[r].indexOf("</entry>") == -1)\r
-                        r++;\r
-                }\r
-\r
-                features = new Vector();\r
-                type = "";\r
-                start = "0";\r
-                end = "0";\r
-                description = "";\r
-                status = "";\r
-                pdb = "";\r
-            }\r
+    promptBeforeBlast();\r
 \r
-            if (sequence == null)\r
-            {\r
-                continue;\r
-            }\r
+  }\r
 \r
-            if (result[r].indexOf("<property type=\"pdb accession\"") > -1)\r
-            {\r
-                pdb = parseValue(result[r], "value=", out);\r
-                sequence.setPDBId(pdb);\r
-            }\r
 \r
-            if (result[r].indexOf("feature type") > -1)\r
-            {\r
-                type = parseValue(result[r], "type=", out);\r
-                description = parseValue(result[r], "description=", null);\r
-                status = parseValue(result[r], "status=", null);\r
-\r
-                while (result[r].indexOf("position") == -1)\r
-                {\r
-                    r++; //<location>\r
-                }\r
-\r
-                // r++;\r
-                if (result[r].indexOf("begin") > -1)\r
-                {\r
-                    start = parseValue(result[r], "position=", out);\r
-                    end = parseValue(result[++r], "position=", out);\r
-                }\r
-                else\r
-                {\r
-                    start = parseValue(result[r], "position=", out);\r
-                    end = parseValue(result[r], "position=", null);\r
-                }\r
-\r
-                int sstart = Integer.parseInt(start);\r
-                int eend = Integer.parseInt(end);\r
-\r
-                if (out != null)\r
-                {\r
-                    try\r
-                    {\r
-                        out.writeBytes("</feature>\n");\r
-                    }\r
-                    catch (Exception ex)\r
-                    {\r
-                    }\r
-                }\r
-\r
-                SequenceFeature sf = new SequenceFeature(type, sstart, eend,\r
-                        description, status);\r
-                features.add(sf);\r
-            }\r
+  void promptBeforeBlast()\r
+   {\r
+     // This must be outside the run() body as java 1.5\r
+     // will not return any value from the OptionPane to the expired thread.\r
+      if (unknownSequences.size() > 0)\r
+      {\r
+        int reply = javax.swing.JOptionPane.showConfirmDialog(\r
+            Desktop.desktop, "Couldn't find a match for "+unknownSequences.size()+" sequences."\r
+                +"\nPerform blast for unknown sequences?",\r
+                    "Blast for Unidentified Sequences",\r
+                     javax.swing.JOptionPane.YES_NO_OPTION, javax.swing.JOptionPane.QUESTION_MESSAGE);\r
 \r
-            if (result[r].indexOf("<sequence length=") > -1)\r
-            {\r
-                StringBuffer seqString = new StringBuffer();\r
-\r
-                if (out != null)\r
-                {\r
-                    try\r
-                    {\r
-                        out.writeBytes(result[r] + "\n");\r
-                    }\r
-                    catch (Exception ex)\r
-                    {\r
-                    }\r
-                }\r
-\r
-                while (result[++r].indexOf("</sequence>") == -1)\r
-                {\r
-                    seqString.append(result[r]);\r
-\r
-                    if (out != null)\r
-                    {\r
-                        try\r
-                        {\r
-                            out.writeBytes(result[r] + "\n");\r
-                        }\r
-                        catch (Exception ex)\r
-                        {\r
-                        }\r
-                    }\r
-                }\r
-\r
-                if (out != null)\r
-                {\r
-                    try\r
-                    {\r
-                        out.writeBytes(result[r] + "\n");\r
-                    }\r
-                    catch (Exception ex)\r
-                    {\r
-                    }\r
-                }\r
-\r
-                StringBuffer nonGapped = new StringBuffer();\r
-\r
-                for (int i = 0; i < sequence.getSequence().length(); i++)\r
-                {\r
-                    if (!jalview.util.Comparison.isGap(sequence.getCharAt(i)))\r
-                    {\r
-                        nonGapped.append(sequence.getCharAt(i));\r
-                    }\r
-                }\r
-\r
-                int absStart = seqString.toString().indexOf(nonGapped.toString());\r
-\r
-                if (absStart == -1)\r
-                {\r
-                    unknownSequences.add(sequence.getName());\r
-                    features = null;\r
-                    sbuffer.append(sequence.getName() +\r
-                        " SEQUENCE NOT %100 MATCH \n");\r
-\r
-                    continue;\r
-                }\r
-\r
-                int absEnd = absStart + nonGapped.toString().length();\r
-                absStart += 1;\r
-\r
-                if ((absStart != sequence.getStart()) ||\r
-                        (absEnd != sequence.getEnd()))\r
-                {\r
-                    sbuffer.append("Updated: " + sequence.getName() + " " +\r
-                        sequence.getStart() + "/" + sequence.getEnd() +\r
-                        "  to  " + absStart + "/" + absEnd + "\n");\r
-                }\r
-\r
-                sequence.setStart(absStart);\r
-                sequence.setEnd(absEnd);\r
-            }\r
+        if(reply == javax.swing.JOptionPane.YES_OPTION)\r
+         new WSWUBlastClient(ap, align, unknownSequences);\r
+      }\r
 \r
-            if (result[r].indexOf("</entry>") > -1)\r
-            {\r
-                if (features != null)\r
-                {\r
-                    sequence.setSequenceFeatures(features);\r
-                }\r
-\r
-                features = null;\r
-                sequence = null;\r
-\r
-                if (out != null)\r
-                {\r
-                    try\r
-                    {\r
-                        out.writeBytes("</entry>\n");\r
-                    }\r
-                    catch (Exception ex)\r
-                    {\r
-                    }\r
-                }\r
-            }\r
-        }\r
-    }\r
 \r
-    /**\r
-     * DOCUMENT ME!\r
-     *\r
-     * @param align DOCUMENT ME!\r
-     */\r
-    void findMissingIds(AlignmentI align)\r
-    {\r
-        String data;\r
-        ArrayList cachedIds = new ArrayList();\r
+    ap.repaint();\r
+  }\r
 \r
-        try\r
-        {\r
-            if(jalview.bin.Cache.getProperty("UNIPROT_CACHE")==null)\r
-              return;\r
+  /**\r
+   * DOCUMENT ME!\r
+   *\r
+   * @param result DOCUMENT ME!\r
+   * @param out DOCUMENT ME!\r
+   * @param align DOCUMENT ME!\r
+   */\r
+  void ReadUniprotFile(File file, Vector ids)\r
+  {\r
+    if(!file.exists())\r
+      return;\r
 \r
-            BufferedReader in = new BufferedReader(new FileReader(\r
-                        jalview.bin.Cache.getProperty("UNIPROT_CACHE")));\r
+    SequenceI sequence = null;\r
 \r
-            while ((data = in.readLine()) != null)\r
-            {\r
-                if (data.indexOf("name") > -1)\r
-                {\r
-                    String name = parseElement(data, "<name>", null);\r
-                    cachedIds.add(name);\r
-                }\r
-            }\r
-        }\r
-        catch (Exception ex)\r
+    Vector entries = getUniprotEntries(file);\r
+\r
+    int i, iSize = entries==null?0:entries.size();\r
+    UniprotEntry entry;\r
+    for (i = 0; i < iSize; i++)\r
+    {\r
+      entry = (UniprotEntry) entries.elementAt(i);\r
+      String idmatch = entry.getAccession().elementAt(0).toString();\r
+      sequence = dataset.findName(idmatch);\r
+\r
+      if (sequence == null)\r
+      {\r
+        //Sequence maybe Name, not Accession\r
+        idmatch = entry.getName().elementAt(0).toString();\r
+        sequence = dataset.findName(idmatch);\r
+      }\r
+\r
+      if(sequence!=null)\r
+        ids.remove(sequence.getName());\r
+\r
+      else  if (sequence == null && uniprotFlag)\r
+      {\r
+          sequence = dataset.findName("UniProt/Swiss-Prot|"+entry.getAccession().elementAt(0)+"|"+idmatch);\r
+          ids.remove(idmatch);\r
+      }\r
+\r
+      if(sequence ==null)\r
+      {\r
+        System.out.println(idmatch+" not found");\r
+        continue;\r
+      }\r
+\r
+      unknownSequences.remove(sequence);\r
+\r
+      String nonGapped = AlignSeq.extractGaps("-. ", sequence.getSequence());\r
+\r
+      int absStart = entry.getUniprotSequence().getContent().indexOf(\r
+          nonGapped.toString());\r
+\r
+      if (absStart == -1)\r
+      {\r
+        // Is UniprotSequence contained in dataset sequence?\r
+        absStart = nonGapped.toString().indexOf(entry.getUniprotSequence().getContent());\r
+        if(absStart == -1)\r
         {\r
-            ex.printStackTrace();\r
-        }\r
+          unknownSequences.add(sequence.getName());\r
+          sbuffer.append(sequence.getName() +\r
+                         " SEQUENCE NOT %100 MATCH \n");\r
 \r
-        for (int i = 0; i < align.getHeight(); i++)\r
-            if (!cachedIds.contains(align.getSequenceAt(i).getName()))\r
+          continue;\r
+        }\r
+        else\r
+        {\r
+          if(entry.getFeature()!=null)\r
+          {\r
+            Enumeration e = entry.getFeature().elements();\r
+            while (e.hasMoreElements())\r
             {\r
-                unknownSequences.add(align.getSequenceAt(i).getName());\r
+              SequenceFeature sf = (SequenceFeature) e.nextElement();\r
+              sf.setBegin(sf.getBegin() + absStart + 1);\r
+              sf.setEnd(sf.getEnd() + absStart + 1);\r
             }\r
-    }\r
+          }\r
 \r
-    /**\r
-     * DOCUMENT ME!\r
-     *\r
-     * @param ids DOCUMENT ME!\r
-     * @param align DOCUMENT ME!\r
-     */\r
-    void tryLocalCacheFirst(ArrayList ids, AlignmentI align)\r
-    {\r
-        ArrayList cacheData = new ArrayList();\r
+          sbuffer.append(sequence.getName() +\r
+                         " HAS "+absStart+" PREFIXED RESIDUES COMPARED TO UNIPROT - ANY SEQUENCE FEATURES"\r
+                        +" HAVE BEEN ADJUSTED ACCORDINGLY \n");\r
+          absStart = 0;\r
+        }\r
 \r
-        try\r
-        {\r
-            if(jalview.bin.Cache.getProperty("UNIPROT_CACHE")==null)\r
-              return;\r
+      }\r
 \r
-            BufferedReader in = new BufferedReader(new FileReader(\r
-                        jalview.bin.Cache.getProperty("UNIPROT_CACHE")));\r
+      int absEnd = absStart + nonGapped.toString().length();\r
+      absStart += 1;\r
 \r
-            // read through cache file, if the cache has sequences we're looking for\r
-            // add the lines to a new String array, Readthis new array and\r
-            // make sure we remove the ids from the list to retrieve from EBI\r
-            String data;\r
+      Enumeration e = entry.getDbReference().elements();\r
+      Vector onlyPdbEntries = new Vector();\r
+      while(e.hasMoreElements())\r
+      {\r
+        PDBEntry pdb = (PDBEntry)e.nextElement();\r
+        if(!pdb.getType().equals("PDB"))\r
+          continue;\r
 \r
-            while ((data = in.readLine()) != null)\r
-            {\r
-                if (data.indexOf("name") > -1)\r
-                {\r
-                    String name = parseElement(data, "<name>", null);\r
-\r
-                    if (ids.contains(name))\r
-                    {\r
-                        cacheData.add("<entry>");\r
-                        cacheData.add(data);\r
-\r
-                        while (data.indexOf("</entry>") == -1)\r
-                        {\r
-                            data = in.readLine();\r
-                            cacheData.add(data);\r
-                        }\r
-\r
-                        cacheData.add(data);\r
-\r
-                        ids.remove(name);\r
-                    }\r
-                }\r
-            }\r
-        }\r
-        catch (Exception ex)\r
-        {\r
-            ex.printStackTrace();\r
-        }\r
+        onlyPdbEntries.addElement(pdb);\r
+      }\r
 \r
-        String[] localData = new String[cacheData.size()];\r
-        cacheData.toArray(localData);\r
+      sequence.setPDBId(onlyPdbEntries);\r
+      sequence.setSequenceFeatures(entry.getFeature());\r
+      sequence.setStart(absStart);\r
+      sequence.setEnd(absEnd);\r
 \r
-        if ((localData != null) && (localData.length > 0))\r
-        {\r
-            ReadUniprotFile(localData, null, align);\r
-        }\r
-    }\r
 \r
-    /**\r
-     * DOCUMENT ME!\r
-     *\r
-     * @param line DOCUMENT ME!\r
-     * @param tag DOCUMENT ME!\r
-     * @param out DOCUMENT ME!\r
-     *\r
-     * @return DOCUMENT ME!\r
-     */\r
-    String parseValue(String line, String tag, RandomAccessFile out)\r
-    {\r
-        if (out != null)\r
+      int n = 0;\r
+      SequenceI seq2;\r
+      while (n < align.getHeight())\r
+      {\r
+        //This loop enables multiple sequences with the same\r
+        //id to have features added and seq limits updated\r
+        seq2 = align.getSequenceAt(n);\r
+        if (seq2.getName().equals(idmatch))\r
         {\r
-            try\r
-            {\r
-                out.writeBytes(line + "\n");\r
-            }\r
-            catch (Exception ex)\r
-            {\r
-            }\r
-        }\r
 \r
-        int index = line.indexOf(tag) + tag.length() + 1;\r
+          nonGapped = AlignSeq.extractGaps("-. ", seq2.getSequence());\r
 \r
-        if (index == tag.length())\r
-        {\r
-            return "";\r
-        }\r
+          absStart = sequence.getSequence().indexOf(nonGapped);\r
+          absEnd = absStart + nonGapped.toString().length() - 1;\r
 \r
-        return line.substring(index, line.indexOf("\"", index + 1));\r
-    }\r
+          // This is the Viewd alignment sequences\r
+          // No need to tell the user of the dataset updates\r
+          if ( (seq2.getStart() != absStart+sequence.getStart())\r
+             || (seq2.getEnd() != absEnd+sequence.getStart()))\r
+          {\r
+            sbuffer.append("Updated: " + seq2.getName() + " " +\r
+                           seq2.getStart() + "/" + seq2.getEnd() +\r
+                           "  to  " + (absStart + sequence.getStart()) + "/" +\r
+                           (absEnd + sequence.getStart()) + "\n");\r
 \r
-    /**\r
-     * DOCUMENT ME!\r
-     *\r
-     * @param line DOCUMENT ME!\r
-     * @param tag DOCUMENT ME!\r
-     * @param out DOCUMENT ME!\r
-     *\r
-     * @return DOCUMENT ME!\r
-     */\r
-    String parseElement(String line, String tag, RandomAccessFile out)\r
-    {\r
-        if (out != null)\r
-        {\r
-            try\r
-            {\r
-                out.writeBytes(line + "\n");\r
-            }\r
-            catch (Exception ex)\r
-            {\r
-            }\r
+            seq2.setStart(absStart + sequence.getStart());\r
+            seq2.setEnd(absEnd + sequence.getStart());\r
+          }\r
         }\r
 \r
-        int index = line.indexOf(tag) + tag.length();\r
-\r
-        return line.substring(index, line.indexOf("</"));\r
+        n++;\r
+      }\r
     }\r
+  }\r
 }\r
+\r
+\r
index c221d07..0906d12 100755 (executable)
@@ -29,7 +29,9 @@ import java.util.*;
 import javax.swing.*;\r
 \r
 import javax.xml.namespace.QName;\r
+import jalview.analysis.AlignSeq;\r
 \r
+import uk.ac.ebi.www.*;\r
 \r
 /**\r
  * DOCUMENT ME!\r
@@ -39,38 +41,39 @@ import javax.xml.namespace.QName;
  */\r
 public class WSWUBlastClient\r
 {\r
+    AlignmentPanel ap;\r
+    AlignmentI al;\r
     CutAndPasteTransfer output = new CutAndPasteTransfer();\r
     int jobsRunning = 0;\r
 \r
+    Vector suggestedIds = new Vector();\r
     /**\r
      * Creates a new WSWUBlastClient object.\r
      *\r
      * @param al DOCUMENT ME!\r
      * @param ids DOCUMENT ME!\r
      */\r
-    public WSWUBlastClient(AlignmentI al, ArrayList ids)\r
+    public WSWUBlastClient(AlignmentPanel ap, AlignmentI al, ArrayList ids)\r
     {\r
+        this.ap = ap;\r
+        this.al = al;\r
         output.setText(\r
-            "To display sequence features an exact Uniprot id with 100% sequence identity match must be entered." +\r
-            "\nIn order to display these features, try changing the names of your sequences to the ids suggested below.");\r
+            "To display sequence features an exact Uniprot id with 100% sequence identity match must be entered."\r
+            +"\nIn order to display these features, try changing the names of your sequences to the ids suggested below."\r
+            +"\n\nRunning WSWUBlast at EBI."\r
+            +"\nPlease quote Pillai S., Silventoinen V., Kallio K., Senger M., Sobhany S., Tate J., Velankar S., Golovin A., Henrick K., Rice P., Stoehr P., Lopez R."\r
+            +"\nSOAP-based services provided by the European Bioinformatics Institute."\r
+            +"\nNucleic Acids Res. 33(1):W25-W28 (2005));");\r
+\r
         Desktop.addInternalFrame(output,\r
             "BLASTing for unidentified sequences ", 800, 300);\r
 \r
         for (int i = 0; i < ids.size(); i++)\r
         {\r
-            SequenceI sequence = al.findName(ids.get(i).toString());\r
-            StringBuffer nonGapped = new StringBuffer();\r
-\r
-            for (int n = 0; n < sequence.getSequence().length(); n++)\r
-            {\r
-                if (!jalview.util.Comparison.isGap(sequence.getCharAt(n)))\r
-                {\r
-                    nonGapped.append(sequence.getCharAt(n));\r
-                }\r
-            }\r
+            Sequence sequence = (Sequence)ids.get(i);\r
+            System.out.println(sequence.getName());\r
 \r
-            BlastThread thread = new BlastThread(ids.get(i).toString(),\r
-                    nonGapped.toString());\r
+            BlastThread thread = new BlastThread(sequence);\r
             thread.start();\r
             jobsRunning++;\r
         }\r
@@ -79,50 +82,100 @@ public class WSWUBlastClient
         thread.start();\r
     }\r
 \r
+\r
     /**\r
      * DOCUMENT ME!\r
      *\r
      * @param id1 DOCUMENT ME!\r
      * @param res DOCUMENT ME!\r
      */\r
-    void parseResult(String id1, String res)\r
+    void parseResult(Sequence seq, String res)\r
     {\r
         StringTokenizer st = new StringTokenizer(res, "\n");\r
         String data;\r
         String id2;\r
         int maxFound = 90;\r
-        StringBuffer buffer = new StringBuffer("\n\n" + id1 + " :");\r
+        StringBuffer buffer = new StringBuffer("\n\n" + seq.getName() + " :");\r
 \r
         while (st.hasMoreTokens())\r
         {\r
             data = st.nextToken();\r
 \r
-            if (data.indexOf("database=\"uniprot\" id=") > -1)\r
+            if (data.indexOf(">UNIPROT") > -1)\r
             {\r
-                int index = data.indexOf("database=\"uniprot\" id=") + 23;\r
-                id2 = data.substring(index, data.indexOf("\"", index));\r
+                int index = data.indexOf(">UNIPROT") + 9;\r
+                id2 = data.substring(index, data.indexOf(" ", index));\r
 \r
-                while (data.indexOf("</alignment>") == -1)\r
+                boolean identitiesFound = false;\r
+                while (!identitiesFound)\r
                 {\r
                     data = st.nextToken();\r
 \r
-                    if (data.indexOf("<identity>") > -1)\r
+                    if (data.indexOf("Identities") > -1)\r
                     {\r
-                        int value = Integer.parseInt(data.substring(data.indexOf(\r
-                                        "<identity>") + 10,\r
-                                    data.indexOf("</identity>")));\r
+                       identitiesFound = true;\r
+\r
+                       int value = Integer.parseInt(data.substring(data.indexOf(\r
+                           "(") + 1,\r
+                                                                   data.indexOf("%")));\r
 \r
                         if (value >= maxFound)\r
                         {\r
                             maxFound = value;\r
                             buffer.append(" " + id2 + " " + value + "%; ");\r
+                            suggestedIds.addElement( new Object[]{seq, id2});\r
                         }\r
                     }\r
                 }\r
             }\r
         }\r
 \r
-        output.setText(output.getText() + buffer.toString());\r
+        output.appendText(buffer.toString());\r
+    }\r
+\r
+    void updateIds()\r
+    {\r
+        // This must be outside the run() body as java 1.5\r
+     // will not return any value from the OptionPane to the expired thread.\r
+      int reply = JOptionPane.showConfirmDialog(\r
+          Desktop.desktop, "Automatically update suggested ids?",\r
+          "Auto replace sequence ids", JOptionPane.YES_NO_OPTION);\r
+\r
+      if (reply == JOptionPane.YES_OPTION)\r
+      {\r
+        Enumeration keys = suggestedIds.elements();\r
+        while(keys.hasMoreElements())\r
+        {\r
+          Object [] object = (Object[])keys.nextElement();\r
+\r
+          Sequence oldseq = (Sequence)object[0];\r
+\r
+          oldseq.setName( object[1].toString() );\r
+\r
+          // Oldseq is actually in the dataset, we must find the\r
+          // Visible seq and change its name also.\r
+          for (int i = 0; i < al.getHeight(); i++)\r
+          {\r
+            if (al.getSequenceAt(i).getDatasetSequence() == oldseq)\r
+            {\r
+              al.getSequenceAt(i).setName(oldseq.getName());\r
+              break;\r
+            }\r
+          }\r
+\r
+          Vector entries = oldseq.getDBRef();\r
+          if (entries != null)\r
+          {\r
+            DBRefEntry entry = (DBRefEntry) entries.elementAt(0);\r
+            oldseq.addDBRef(new jalview.datamodel.\r
+                                                 DBRefEntry("UNIPROT",\r
+                "0",\r
+                entry.getAccessionId()));\r
+          }\r
+        }\r
+      }\r
+      ap.repaint();\r
+\r
     }\r
 \r
     class ImageTwirler extends Thread\r
@@ -163,20 +216,24 @@ public class WSWUBlastClient
                 {\r
                 }\r
             }\r
+\r
+            if (jobsRunning == 0)\r
+            {\r
+              updateIds();\r
+            }\r
         }\r
     }\r
 \r
     class BlastThread extends Thread\r
     {\r
-        String sequence;\r
-        String seqid;\r
+        Sequence sequence;\r
         String jobid;\r
         boolean jobComplete = false;\r
 \r
-        BlastThread(String id, String sequence)\r
+        BlastThread(Sequence sequence)\r
         {\r
-            this.sequence = sequence;\r
-            seqid = id;\r
+          System.out.println("blasting for: "+sequence.getName());\r
+          this.sequence = sequence;\r
         }\r
 \r
         public void run()\r
@@ -187,27 +244,23 @@ public class WSWUBlastClient
             {\r
                 try\r
                 {\r
-                    Call call = (Call) new Service().createCall();\r
-                    call.setTargetEndpointAddress(new java.net.URL(\r
-                            "http://www.ebi.ac.uk/cgi-bin/webservices/WSWUBlast"));\r
-                    call.setOperationName(new QName("WSWUBlast", "polljob"));\r
-\r
-                    String result = (String) call.invoke(new Object[]\r
-                            {\r
-                                jobid, "xml"\r
-                            });\r
-\r
-                    if ((result.indexOf("JOB PENDING") == -1) &&\r
-                            (result.indexOf("JOB RUNNING") == -1))\r
-                    {\r
-                        parseResult(seqid, result);\r
-                        jobComplete = true;\r
-                        jobsRunning--;\r
-                    }\r
-\r
-                    Thread.sleep(5000);\r
-\r
-                    // System.out.println("WSWuBlastClient: I'm alive "+seqid+" "+jobid); // log.debug\r
+                  WSWUBlastService service =  new WSWUBlastServiceLocator();\r
+                  WSWUBlast wublast = service.getWSWUBlast();\r
+                  WSFile[] results = wublast.getResults(jobid);\r
+\r
+                  if(results!=null)\r
+                  {\r
+                      String result = new String(wublast.poll(jobid, "tooloutput"));\r
+                      parseResult(sequence, result);\r
+                      jobComplete = true;\r
+                      jobsRunning--;\r
+                  }\r
+                  else\r
+                  {\r
+                    Thread.sleep(10000);\r
+                    System.out.println("WSWuBlastClient: I'm alive " +\r
+                                       sequence.getName() + " " + jobid); // log.debug\r
+                  }\r
                 }\r
                 catch (Exception ex)\r
                 {\r
@@ -217,38 +270,36 @@ public class WSWUBlastClient
 \r
         void StartJob()\r
         {\r
-            HashMap params = new HashMap();\r
-            params.put("database", "uniprot");\r
-            params.put("sensitivity", "low");\r
-            params.put("sort", "totalscore");\r
-            params.put("matrix", "pam10");\r
-            params.put("program", "blastp");\r
-            params.put("alignments", "5");\r
-            params.put("outformat", "xml");\r
-            params.put("searchtype", "1");\r
-\r
-            byte[] seqbytes = sequence.getBytes();\r
+          InputParams params = new InputParams();\r
+\r
+          params.setProgram("blastp");\r
+          params.setDatabase("uniprot");\r
+          params.setMatrix("pam10");\r
+\r
+          params.setNumal(5);\r
+          params.setSensitivity("low");\r
+          params.setSort("totalscore");\r
+          params.setOutformat("txt");\r
+          params.setAsync(true);\r
 \r
             try\r
             {\r
-                Call call = (Call) new Service().createCall();\r
-                call.setTargetEndpointAddress(new java.net.URL(\r
-                        "http://www.ebi.ac.uk/cgi-bin/webservices/WSWUBlast"));\r
-                call.setOperationName(new QName("WSWUBlast", "doWUBlast"));\r
-\r
-                String result = (String) call.invoke(new Object[]\r
-                        {\r
-                            params, seqbytes\r
-                        });\r
-                jobid = result;\r
-                System.out.println(\r
-                    "http://www.ebi.ac.uk/cgi-bin/webservices/WSWUBlast JobId '" +\r
-                    jobid + "'");\r
+              Data inputs[] = new Data[1];\r
+              Data input= new Data();\r
+              input.setType("sequence");\r
+              input.setContent(AlignSeq.extractGaps("-. ",sequence.getSequence()));\r
+              inputs[0]=input;\r
+\r
+              WSWUBlastService service = new WSWUBlastServiceLocator();\r
+              WSWUBlast wublast = service.getWSWUBlast();\r
+              jobid = wublast.runWUBlast(params, inputs);\r
             }\r
             catch (Exception exp)\r
             {\r
-                System.err.println("WSWUBlastClient error:\n" + exp.toString());\r
-                exp.printStackTrace();\r
+              jobComplete = true;\r
+              jobsRunning--;\r
+              System.err.println("WSWUBlastClient error:\n" + exp.toString());\r
+              exp.printStackTrace();\r
             }\r
         }\r
     }\r
index ddb2bcd..bb69a54 100755 (executable)
@@ -21,7 +21,6 @@ package jalview.jbgui;
 import java.awt.*;\r
 import java.awt.event.*;\r
 import javax.swing.*;\r
-import javax.swing.event.*;\r
 \r
 import jalview.schemes.*;\r
 \r
@@ -99,7 +98,7 @@ public class GAlignFrame
   public JCheckBoxMenuItem applyToAllGroups = new JCheckBoxMenuItem();\r
   JMenuItem createPNG = new JMenuItem();\r
   protected JMenuItem font = new JMenuItem();\r
-  public JCheckBoxMenuItem fullSeqId = new JCheckBoxMenuItem();\r
+  public JCheckBoxMenuItem seqLimits = new JCheckBoxMenuItem();\r
   JMenuItem epsFile = new JMenuItem();\r
   JMenuItem LoadtreeMenuItem = new JMenuItem();\r
   public JCheckBoxMenuItem scaleAbove = new JCheckBoxMenuItem();\r
@@ -113,6 +112,11 @@ public class GAlignFrame
   JMenu jMenu2 = new JMenu();\r
   JMenuItem padGapsMenuitem = new JMenuItem();\r
   protected ButtonGroup colours = new ButtonGroup();\r
+  JMenuItem vamsasStore = new JMenuItem();\r
+  protected JCheckBoxMenuItem showTranslation = new JCheckBoxMenuItem();\r
+  //protected JTabbedPane tabbedPane = new JTabbedPane();\r
+  public JMenuItem featureSettings = new JMenuItem();\r
+  JMenuItem fetchSequence = new JMenuItem();\r
 \r
   public GAlignFrame()\r
   {\r
@@ -471,21 +475,6 @@ public class GAlignFrame
     });\r
     this.getContentPane().setLayout(borderLayout1);\r
     alignFrameMenuBar.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    alignFrameMenuBar.addAncestorListener(new AncestorListener()\r
-    {\r
-      public void ancestorAdded(AncestorEvent event)\r
-      {\r
-        alignFrameMenuBar_ancestorAdded(event);\r
-      }\r
-\r
-      public void ancestorRemoved(AncestorEvent event)\r
-      {\r
-      }\r
-\r
-      public void ancestorMoved(AncestorEvent event)\r
-      {\r
-      }\r
-    });\r
     statusBar.setBackground(Color.white);\r
     statusBar.setFont(new java.awt.Font("Verdana", 0, 11));\r
     statusBar.setBorder(BorderFactory.createLineBorder(Color.black));\r
@@ -822,13 +811,14 @@ public class GAlignFrame
         font_actionPerformed(e);\r
       }\r
     });\r
-    fullSeqId.setText("Show Full Sequence ID");\r
-    fullSeqId.setState( jalview.bin.Cache.getDefault("SHOW_FULL_ID",true));\r
-    fullSeqId.addActionListener(new java.awt.event.ActionListener()\r
+\r
+    seqLimits.setText("Show Sequence Limits");\r
+    seqLimits.setState( jalview.bin.Cache.getDefault("SHOW_JVSUFFIX",true));\r
+    seqLimits.addActionListener(new java.awt.event.ActionListener()\r
     {\r
       public void actionPerformed(ActionEvent e)\r
       {\r
-        fullSeqId_actionPerformed(e);\r
+        seqLimit_actionPerformed(e);\r
       }\r
     });\r
     epsFile.setText("EPS");\r
@@ -906,6 +896,49 @@ public class GAlignFrame
         padGapsMenuitem_actionPerformed(e);\r
       }\r
     });\r
+    vamsasStore.setVisible(false);\r
+    vamsasStore.setText("VAMSAS store");\r
+    vamsasStore.addActionListener(new ActionListener()\r
+    {\r
+      public void actionPerformed(ActionEvent e)\r
+      {\r
+        vamsasStore_actionPerformed(e);\r
+      }\r
+    });\r
+    showTranslation.setText("Translate cDNA");\r
+    showTranslation.addActionListener(new ActionListener()\r
+    {\r
+      public void actionPerformed(ActionEvent e)\r
+      {\r
+        showTranslation_actionPerformed(e);\r
+      }\r
+    });\r
+\r
+   /* tabbedPane.addChangeListener(new ChangeListener()\r
+        {\r
+          public void stateChanged(ChangeEvent ece)\r
+          {\r
+\r
+            tabSelected();\r
+          }\r
+        });*/\r
+    featureSettings.setEnabled(false);\r
+    featureSettings.setText("Feature Settings...");\r
+    featureSettings.addActionListener(new ActionListener()\r
+    {\r
+      public void actionPerformed(ActionEvent e)\r
+      {\r
+        featureSettings_actionPerformed(e);\r
+      }\r
+    });\r
+    fetchSequence.setText("Fetch Sequence...");\r
+    fetchSequence.addActionListener(new ActionListener()\r
+    {\r
+      public void actionPerformed(ActionEvent e)\r
+      {\r
+        fetchSequence_actionPerformed(e);\r
+      }\r
+    });\r
     alignFrameMenuBar.add(fileMenu);\r
     alignFrameMenuBar.add(editMenu);\r
     alignFrameMenuBar.add(searchMenu);\r
@@ -913,6 +946,8 @@ public class GAlignFrame
     alignFrameMenuBar.add(colourMenu);\r
     alignFrameMenuBar.add(calculateMenu);\r
     alignFrameMenuBar.add(webService);\r
+    fileMenu.add(fetchSequence);\r
+    fileMenu.add(vamsasStore);\r
     fileMenu.add(saveAlignmentMenu);\r
     fileMenu.add(jMenu2);\r
     fileMenu.add(outputTextboxMenu);\r
@@ -944,7 +979,7 @@ public class GAlignFrame
     viewMenu.add(font);\r
     viewMenu.addSeparator();\r
     viewMenu.add(wrapMenuItem);\r
-    viewMenu.add(fullSeqId);\r
+    viewMenu.add(seqLimits);\r
     viewMenu.add(scaleAbove);\r
     viewMenu.add(scaleLeft);\r
     viewMenu.add(scaleRight);\r
@@ -953,7 +988,9 @@ public class GAlignFrame
     viewMenu.add(colourTextMenuItem);\r
     viewMenu.add(renderGapsMenuItem);\r
     viewMenu.add(annotationPanelMenuItem);\r
+    viewMenu.addSeparator();\r
     viewMenu.add(sequenceFeatures);\r
+    viewMenu.add(featureSettings);\r
     viewMenu.addSeparator();\r
     viewMenu.add(overviewMenuItem);\r
     colourMenu.add(applyToAllGroups);\r
@@ -981,9 +1018,12 @@ public class GAlignFrame
     calculateMenu.addSeparator();\r
     calculateMenu.add(pairwiseAlignmentMenuItem);\r
     calculateMenu.add(PCAMenuItem);\r
+    calculateMenu.addSeparator();\r
+    calculateMenu.add(showTranslation);\r
     webServiceNoServices=new JMenuItem("<No Services>");\r
     webService.add(webServiceNoServices);\r
     this.getContentPane().add(statusBar, BorderLayout.SOUTH);\r
+  //  this.getContentPane().add(tabbedPane, java.awt.BorderLayout.CENTER);\r
     jMenu1.add(pasteNew);\r
     jMenu1.add(pasteThis);\r
     sort.add(sortIDMenuItem);\r
@@ -1110,10 +1150,6 @@ public class GAlignFrame
   {\r
   }\r
 \r
-  protected void clustalAlignMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-  }\r
-\r
   protected void clustalColour_actionPerformed(ActionEvent e)\r
   {\r
   }\r
@@ -1226,10 +1262,16 @@ public class GAlignFrame
   {\r
   }\r
 \r
-  protected void fullSeqId_actionPerformed(ActionEvent e)\r
+  protected void seqLimit_actionPerformed(ActionEvent e)\r
   {\r
   }\r
 \r
+  public void seqDBRef_actionPerformed(ActionEvent e)\r
+  {\r
+\r
+  }\r
+\r
+\r
   public void createEPS(java.io.File f)\r
   {\r
   }\r
@@ -1262,27 +1304,44 @@ public class GAlignFrame
   {\r
   }\r
 \r
-  protected void preferences_actionPerformed(ActionEvent e)\r
+\r
+\r
+  protected void saveAlignmentMenu_actionPerformed(ActionEvent e)\r
+  {\r
+  }\r
+\r
+  protected void padGapsMenuitem_actionPerformed(ActionEvent e)\r
   {\r
   }\r
 \r
-  protected void msaAlignMenuItem_actionPerformed(ActionEvent e)\r
+\r
+  public void vamsasStore_actionPerformed(ActionEvent e)\r
   {\r
+\r
   }\r
 \r
-  protected void alignFrameMenuBar_ancestorAdded(AncestorEvent event)\r
+  public void vamsasLoad_actionPerformed(ActionEvent e)\r
   {\r
+\r
   }\r
 \r
-  protected void saveAlignmentMenu_actionPerformed(ActionEvent e)\r
+  public void showTranslation_actionPerformed(ActionEvent e)\r
   {\r
+\r
   }\r
 \r
-  protected void padGapsMenuitem_actionPerformed(ActionEvent e)\r
+  public void tabSelected()\r
+  {\r
+\r
+  }\r
+\r
+  public void featureSettings_actionPerformed(ActionEvent e)\r
   {\r
+\r
   }\r
 \r
-  protected void ClustalRealign_actionPerformed(ActionEvent e)\r
+  public void fetchSequence_actionPerformed(ActionEvent e)\r
   {\r
+\r
   }\r
 }\r
index 65ef8dc..5505e69 100755 (executable)
@@ -48,8 +48,10 @@ public class GDesktop extends JFrame
     JMenuItem saveState = new JMenuItem();\r
     JMenuItem loadState = new JMenuItem();\r
     JMenu jMenu1 = new JMenu();\r
+  JMenuItem vamsasLoad = new JMenuItem();\r
+  JMenuItem inputSequence = new JMenuItem();\r
 \r
-    /**\r
+  /**\r
      * Creates a new GDesktop object.\r
      */\r
     public GDesktop()\r
@@ -158,13 +160,31 @@ public class GDesktop extends JFrame
             });\r
         jMenu1.setMnemonic('I');\r
         jMenu1.setText("Input Alignment");\r
-        DesktopMenubar.add(FileMenu);\r
+    vamsasLoad.setText("Vamsas");\r
+    vamsasLoad.setVisible(false);\r
+    vamsasLoad.addActionListener(new ActionListener()\r
+    {\r
+      public void actionPerformed(ActionEvent e)\r
+      {\r
+        vamsasLoad_actionPerformed(e);\r
+      }\r
+    });\r
+    inputSequence.setText("Fetch Sequence...");\r
+    inputSequence.addActionListener(new ActionListener()\r
+    {\r
+      public void actionPerformed(ActionEvent e)\r
+      {\r
+        inputSequence_actionPerformed(e);\r
+      }\r
+    });\r
+    DesktopMenubar.add(FileMenu);\r
         DesktopMenubar.add(toolsMenu);\r
         DesktopMenubar.add(HelpMenu);\r
         DesktopMenubar.add(windowMenu);\r
         FileMenu.addSeparator();\r
         FileMenu.add(jMenu1);\r
-        FileMenu.addSeparator();\r
+    FileMenu.add(inputSequence);\r
+    FileMenu.addSeparator();\r
         FileMenu.add(saveState);\r
         FileMenu.add(loadState);\r
         FileMenu.addSeparator();\r
@@ -175,7 +195,8 @@ public class GDesktop extends JFrame
         jMenu1.add(inputLocalFileMenuItem);\r
         jMenu1.add(inputURLMenuItem);\r
         jMenu1.add(inputTextboxMenuItem);\r
-    }\r
+    jMenu1.add(vamsasLoad);\r
+  }\r
 \r
     /**\r
      * DOCUMENT ME!\r
@@ -273,4 +294,14 @@ public class GDesktop extends JFrame
     public void loadJalviewAlign_actionPerformed(ActionEvent e)\r
     {\r
     }\r
+\r
+  public void vamsasLoad_actionPerformed(ActionEvent e)\r
+  {\r
+\r
+  }\r
+\r
+  public void inputSequence_actionPerformed(ActionEvent e)\r
+  {\r
+\r
+  }\r
 }\r
index 50c4cf5..2001efd 100755 (executable)
@@ -42,8 +42,7 @@ public class GPreferences extends JPanel
     BorderLayout borderLayout1 = new BorderLayout();\r
     protected JCheckBox quality = new JCheckBox();\r
     JPanel visualTab = new JPanel();\r
-    protected JCheckBox fullID = new JCheckBox();\r
-    protected JCheckBox fullScreen = new JCheckBox();\r
+  protected JCheckBox fullScreen = new JCheckBox();\r
     protected JCheckBox conservation = new JCheckBox();\r
     protected JCheckBox identity = new JCheckBox();\r
     protected JCheckBox annotations = new JCheckBox();\r
@@ -79,6 +78,7 @@ public class GPreferences extends JPanel
   protected JCheckBox useProxy = new JCheckBox();\r
   JPanel jPanel1 = new JPanel();\r
   TitledBorder titledBorder1 = new TitledBorder("Proxy Server");\r
+  TitledBorder titledBorder2 = new TitledBorder("File Output");\r
   GridBagLayout gridBagLayout2 = new GridBagLayout();\r
   GridBagLayout gridBagLayout1 = new GridBagLayout();\r
   GridBagLayout gridBagLayout3 = new GridBagLayout();\r
@@ -90,6 +90,19 @@ public class GPreferences extends JPanel
   JPanel exportTab = new JPanel();\r
   JLabel epsLabel = new JLabel();\r
   protected JComboBox epsRendering = new JComboBox();\r
+  JLabel jLabel1 = new JLabel();\r
+  protected  JCheckBox blcjv = new JCheckBox();\r
+  protected  JCheckBox pileupjv = new JCheckBox();\r
+  protected  JCheckBox clustaljv = new JCheckBox();\r
+  protected  JCheckBox msfjv = new JCheckBox();\r
+  protected  JCheckBox fastajv = new JCheckBox();\r
+  protected  JCheckBox pfamjv = new JCheckBox();\r
+  FlowLayout flowLayout1 = new FlowLayout();\r
+  protected  JCheckBox pirjv = new JCheckBox();\r
+  JPanel jPanel11 = new JPanel();\r
+  Font verdana11 = new java.awt.Font("Verdana", Font.PLAIN, 11);\r
+  protected JCheckBox seqLimit = new JCheckBox();\r
+  GridLayout gridLayout3 = new GridLayout();\r
   /**\r
      * Creates a new GPreferences object.\r
      */\r
@@ -130,36 +143,31 @@ public class GPreferences extends JPanel
                 }\r
             });\r
         quality.setEnabled(false);\r
-        quality.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+        quality.setFont(verdana11);\r
         quality.setHorizontalAlignment(SwingConstants.RIGHT);\r
         quality.setHorizontalTextPosition(SwingConstants.LEFT);\r
         quality.setSelected(true);\r
         quality.setText("Quality");\r
     visualTab.setBorder(new TitledBorder("Open new alignment"));\r
     visualTab.setLayout(null);\r
-        fullID.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-        fullID.setHorizontalAlignment(SwingConstants.RIGHT);\r
-        fullID.setHorizontalTextPosition(SwingConstants.LEFT);\r
-    fullID.setMargin(new Insets(4, 2, 2, 0));\r
-    fullID.setText("Full Sequence ID");\r
-    fullScreen.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+    fullScreen.setFont(verdana11);\r
         fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);\r
         fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);\r
     fullScreen.setMargin(new Insets(2, 2, 2, 0));\r
     fullScreen.setText("Maximise Window");\r
     conservation.setEnabled(false);\r
-        conservation.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+        conservation.setFont(verdana11);\r
         conservation.setHorizontalAlignment(SwingConstants.RIGHT);\r
         conservation.setHorizontalTextPosition(SwingConstants.LEFT);\r
         conservation.setSelected(true);\r
         conservation.setText("Conservation");\r
     identity.setEnabled(false);\r
-        identity.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+        identity.setFont(verdana11);\r
         identity.setHorizontalAlignment(SwingConstants.RIGHT);\r
         identity.setHorizontalTextPosition(SwingConstants.LEFT);\r
         identity.setSelected(true);\r
         identity.setText("Consensus");\r
-    annotations.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+    annotations.setFont(verdana11);\r
         annotations.setHorizontalAlignment(SwingConstants.RIGHT);\r
         annotations.setHorizontalTextPosition(SwingConstants.LEFT);\r
     annotations.setMargin(new Insets(2, 4, 2, 0));\r
@@ -172,32 +180,32 @@ public class GPreferences extends JPanel
                     annotations_actionPerformed(e);\r
                 }\r
             });\r
-        gapLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+        gapLabel.setFont(verdana11);\r
         gapLabel.setHorizontalAlignment(SwingConstants.RIGHT);\r
         gapLabel.setText("Gap Symbol ");\r
-    colour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-        colour.setBounds(new Rectangle(148, 171, 154, 21));\r
-        colourLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+    colour.setFont(verdana11);\r
+        colour.setBounds(new Rectangle(170, 170, 155, 21));\r
+        colourLabel.setFont(verdana11);\r
         colourLabel.setHorizontalAlignment(SwingConstants.RIGHT);\r
         colourLabel.setText("Colour ");\r
-    fontLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+    fontLabel.setFont(verdana11);\r
         fontLabel.setHorizontalAlignment(SwingConstants.RIGHT);\r
         fontLabel.setText("Font ");\r
-    fontSizeCB.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+    fontSizeCB.setFont(verdana11);\r
         fontSizeCB.setBounds(new Rectangle(317, 111, 49, 21));\r
-        fontStyleCB.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+        fontStyleCB.setFont(verdana11);\r
         fontStyleCB.setBounds(new Rectangle(365, 111, 70, 21));\r
-        fontNameCB.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-        fontNameCB.setBounds(new Rectangle(148, 111, 169, 21));\r
-        gapSymbolCB.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-        gapSymbolCB.setBounds(new Rectangle(148, 141, 67, 21));\r
+        fontNameCB.setFont(verdana11);\r
+        fontNameCB.setBounds(new Rectangle(170, 111, 147, 21));\r
+        gapSymbolCB.setFont(verdana11);\r
+        gapSymbolCB.setBounds(new Rectangle(170, 141, 69, 21));\r
         startupCheckbox.setText("Open file");\r
-    startupCheckbox.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+    startupCheckbox.setFont(verdana11);\r
         startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);\r
         startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);\r
         startupCheckbox.setSelected(true);\r
-        startupFileTextfield.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-        startupFileTextfield.setBounds(new Rectangle(148, 232, 302, 20));\r
+        startupFileTextfield.setFont(verdana11);\r
+        startupFileTextfield.setBounds(new Rectangle(170, 232, 271, 20));\r
         startupFileTextfield.addMouseListener(new MouseAdapter()\r
             {\r
                 public void mouseClicked(MouseEvent e)\r
@@ -212,16 +220,16 @@ public class GPreferences extends JPanel
      connectTab.setLayout(gridBagLayout3);\r
     serverLabel.setText("Address");\r
     serverLabel.setHorizontalAlignment(SwingConstants.RIGHT);\r
-    serverLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-    proxyServerTB.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-    proxyPortTB.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-    portLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+    serverLabel.setFont(verdana11);\r
+    proxyServerTB.setFont(verdana11);\r
+    proxyPortTB.setFont(verdana11);\r
+    portLabel.setFont(verdana11);\r
     portLabel.setHorizontalAlignment(SwingConstants.RIGHT);\r
     portLabel.setText("Port");\r
     browserLabel.setFont(new java.awt.Font("SansSerif", 0, 11));\r
     browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);\r
     browserLabel.setText("Default Browser (Unix)");\r
-    defaultBrowser.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+    defaultBrowser.setFont(verdana11);\r
     defaultBrowser.setText("");\r
     newLink.setText("New");\r
     newLink.addActionListener(new java.awt.event.ActionListener() {\r
@@ -268,7 +276,7 @@ public class GPreferences extends JPanel
     linkNameList.setFont(new java.awt.Font("Verdana", Font.ITALIC, 11));\r
     linkNameList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
     linkPanel2.setLayout(borderLayout3);\r
-    linkURLList.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+    linkURLList.setFont(verdana11);\r
     linkURLList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
 \r
     defaultBrowser.addMouseListener(new MouseAdapter()\r
@@ -281,7 +289,7 @@ public class GPreferences extends JPanel
             }\r
       }\r
     });\r
-    useProxy.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+    useProxy.setFont(verdana11);\r
     useProxy.setHorizontalAlignment(SwingConstants.RIGHT);\r
     useProxy.setHorizontalTextPosition(SwingConstants.LEADING);\r
     useProxy.setText("Use a proxy server");\r
@@ -294,43 +302,76 @@ public class GPreferences extends JPanel
     });\r
     jPanel1.setBorder(titledBorder1);\r
     jPanel1.setLayout(gridBagLayout1);\r
-    sortby.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-    sortby.setBounds(new Rectangle(148, 200, 302, 21));\r
-    sortLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+    sortby.setFont(verdana11);\r
+    sortby.setBounds(new Rectangle(170, 200, 155, 21));\r
+    sortLabel.setFont(verdana11);\r
     sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);\r
     sortLabel.setText("Sort by ");\r
-    jPanel2.setBounds(new Rectangle(7, 17, 138, 242));\r
+    jPanel2.setBounds(new Rectangle(7, 17, 158, 242));\r
     jPanel2.setLayout(gridLayout2);\r
     gridLayout2.setRows(8);\r
-    jPanel3.setBounds(new Rectangle(147, 46, 274, 26));\r
+    jPanel3.setBounds(new Rectangle(168, 47, 274, 26));\r
     exportTab.setLayout(null);\r
-    epsLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+    epsLabel.setFont(verdana11);\r
     epsLabel.setHorizontalAlignment(SwingConstants.RIGHT);\r
     epsLabel.setText("EPS Rendering Style");\r
-    epsLabel.setBounds(new Rectangle(3, 47, 134, 21));\r
-    epsRendering.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-    epsRendering.setBounds(new Rectangle(145, 47, 286, 21));\r
+    epsLabel.setBounds(new Rectangle(9, 31, 140, 24));\r
+    epsRendering.setFont(verdana11);\r
+    epsRendering.setBounds(new Rectangle(154, 34, 187, 21));\r
+    jLabel1.setFont(verdana11);\r
+    jLabel1.setHorizontalAlignment(SwingConstants.CENTER);\r
+    jLabel1.setText("Append /start-end (/15-380)");\r
+    jLabel1.setFont(verdana11);\r
+    fastajv.setFont(verdana11);\r
+    fastajv.setHorizontalAlignment(SwingConstants.LEFT);\r
+    clustaljv.setText("Clustal     ");\r
+    blcjv.setText("BLC     ");\r
+    fastajv.setText("Fasta     ");\r
+    msfjv.setText("MSF     ");\r
+    pfamjv.setText("PFAM     ");\r
+    pileupjv.setText("Pileup     ");\r
+    msfjv.setFont(verdana11);\r
+    msfjv.setHorizontalAlignment(SwingConstants.LEFT);\r
+    pirjv.setText("PIR     ");\r
+    jPanel11.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+    jPanel11.setBorder(titledBorder2);\r
+    jPanel11.setBounds(new Rectangle(30, 72, 196, 182));\r
+    jPanel11.setLayout(gridLayout3);\r
+    blcjv.setFont(verdana11);\r
+    blcjv.setHorizontalAlignment(SwingConstants.LEFT);\r
+    clustaljv.setFont(verdana11);\r
+    clustaljv.setHorizontalAlignment(SwingConstants.LEFT);\r
+    pfamjv.setFont(verdana11);\r
+    pfamjv.setHorizontalAlignment(SwingConstants.LEFT);\r
+    pileupjv.setFont(verdana11);\r
+    pileupjv.setHorizontalAlignment(SwingConstants.LEFT);\r
+    pirjv.setFont(verdana11);\r
+    pirjv.setHorizontalAlignment(SwingConstants.LEFT);\r
+    seqLimit.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+    seqLimit.setHorizontalAlignment(SwingConstants.RIGHT);\r
+    seqLimit.setHorizontalTextPosition(SwingConstants.LEADING);\r
+    seqLimit.setText("Full Sequence Id");\r
+    gridLayout3.setRows(8);\r
     jPanel2.add(fullScreen);\r
     jPanel2.add(annotations);\r
-    jPanel2.add(fullID);\r
+    jPanel2.add(seqLimit);\r
     jPanel2.add(fontLabel);\r
     jPanel2.add(gapLabel);\r
     jPanel2.add(colourLabel);\r
     jPanel2.add(sortLabel);\r
     jPanel2.add(startupCheckbox);\r
+    visualTab.add(gapSymbolCB);\r
+    visualTab.add(colour);\r
     visualTab.add(jPanel3);\r
     jPanel3.add(conservation);\r
-    jPanel3.add(quality);\r
     jPanel3.add(identity);\r
+    jPanel3.add(quality);\r
     visualTab.add(sortby);\r
-    visualTab.add(colour);\r
     visualTab.add(startupFileTextfield);\r
     visualTab.add(fontNameCB);\r
     visualTab.add(fontSizeCB);\r
     visualTab.add(fontStyleCB);\r
-    visualTab.add(gapSymbolCB);\r
     visualTab.add(jPanel2);\r
-\r
     linkPanel.add(editLinkButtons, BorderLayout.EAST);\r
     editLinkButtons.add(newLink, null);\r
     editLinkButtons.add(editLink, null);\r
@@ -370,8 +411,6 @@ public class GPreferences extends JPanel
         , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,\r
         new Insets(15, 0, 0, 15), 307, 1));\r
 \r
-    exportTab.add(epsLabel);\r
-    exportTab.add(epsRendering);\r
 \r
     jPanel1.add(useProxy, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0\r
                                                  , GridBagConstraints.WEST,\r
@@ -383,8 +422,19 @@ public class GPreferences extends JPanel
         gapSymbolCB.setRenderer(dlcr);\r
 \r
     tabbedPane.add(visualTab, "Visual");\r
-    tabbedPane.add(connectTab, "Connections");\r
-    tabbedPane.add(exportTab, "Export");\r
+    tabbedPane.add(connectTab,"Connections");\r
+    tabbedPane.add(exportTab, "Output");\r
+    jPanel11.add(jLabel1);\r
+    jPanel11.add(blcjv);\r
+    jPanel11.add(clustaljv);\r
+    jPanel11.add(fastajv);\r
+    jPanel11.add(msfjv);\r
+    jPanel11.add(pfamjv);\r
+    jPanel11.add(pileupjv);\r
+    jPanel11.add(pirjv);\r
+    exportTab.add(epsLabel);\r
+    exportTab.add(epsRendering);\r
+    exportTab.add(jPanel11);\r
   }\r
 \r
     /**\r
index 4301a75..a70920c 100755 (executable)
@@ -41,7 +41,6 @@ public class GTreePanel
   JMenuItem epsTree = new JMenuItem();\r
   JMenu saveAsMenu = new JMenu();\r
   JMenuItem textbox = new JMenuItem();\r
-\r
   public GTreePanel()\r
   {\r
     try\r
@@ -203,4 +202,9 @@ public class GTreePanel
   public void textbox_actionPerformed(ActionEvent e)\r
   {\r
   }\r
+\r
+  public void fullid_actionPerformed(ActionEvent e)\r
+  {\r
+\r
+  }\r
 }\r
index 4906eb7..d25707f 100755 (executable)
@@ -1135,20 +1135,6 @@ public class ResidueProperties
     propHash.put("polar", polar);\r
   }\r
 \r
-  public static Hashtable chainColours = new Hashtable();\r
-\r
-  static\r
-  {\r
-    chainColours.put("A", Color.red);\r
-    chainColours.put("B", Color.orange);\r
-    chainColours.put("C", Color.yellow);\r
-    chainColours.put("D", Color.green);\r
-    chainColours.put("E", Color.cyan);\r
-    chainColours.put("F", Color.blue);\r
-    chainColours.put("G", Color.magenta);\r
-    chainColours.put("H", Color.pink);\r
-  }\r
-\r
   private ResidueProperties()\r
   {\r
   }\r
@@ -1234,7 +1220,7 @@ public class ResidueProperties
       String key = (String) e.nextElement();\r
       Vector tmp = (Vector) codonHash.get(key);\r
 \r
-      if (tmp.contains(codon))\r
+      if (tmp.contains(codon.toUpperCase()))\r
       {\r
         return key;\r
       }\r
@@ -1242,9 +1228,4 @@ public class ResidueProperties
 \r
     return null;\r
   }\r
-\r
-  public static Hashtable getChainColours()\r
-  {\r
-    return chainColours;\r
-  }\r
 }\r
index 9a86696..e48c0ca 100755 (executable)
@@ -29,215 +29,246 @@ import jalview.datamodel.*;
  */\r
 public class Comparison\r
 {\r
-    /** DOCUMENT ME!! */\r
-    public static String GapChars = " .-";\r
-\r
-    /**\r
-     * DOCUMENT ME!\r
-     *\r
-     * @param ii DOCUMENT ME!\r
-     * @param jj DOCUMENT ME!\r
-     *\r
-     * @return DOCUMENT ME!\r
-     */\r
-    public static float compare(SequenceI ii, SequenceI jj)\r
+  /** DOCUMENT ME!! */\r
+  public static String GapChars = " .-";\r
+\r
+  /**\r
+   * DOCUMENT ME!\r
+   *\r
+   * @param ii DOCUMENT ME!\r
+   * @param jj DOCUMENT ME!\r
+   *\r
+   * @return DOCUMENT ME!\r
+   */\r
+  public static float compare(SequenceI ii, SequenceI jj)\r
+  {\r
+    return Comparison.compare(ii, jj, 0, ii.getLength() - 1);\r
+  }\r
+\r
+  /**\r
+   * this was supposed to be an ungapped pid calculation\r
+   * @param ii SequenceI\r
+   * @param jj SequenceI\r
+   * @param start int\r
+   * @param end int\r
+   * @return float\r
+   */\r
+  public static float compare(SequenceI ii, SequenceI jj, int start, int end)\r
+  {\r
+    String si = ii.getSequence();\r
+    String sj = jj.getSequence();\r
+\r
+    int ilen = si.length() - 1;\r
+    int jlen = sj.length() - 1;\r
+\r
+    while (jalview.util.Comparison.isGap(si.charAt(start + ilen)))\r
     {\r
-        return Comparison.compare(ii, jj, 0, ii.getLength() - 1);\r
+      ilen--;\r
     }\r
 \r
-    /**\r
-     * this was supposed to be an ungapped pid calculation\r
-     * @param ii SequenceI\r
-     * @param jj SequenceI\r
-     * @param start int\r
-     * @param end int\r
-     * @return float\r
-     */\r
-    public static float compare(SequenceI ii, SequenceI jj, int start, int end)\r
+    while (jalview.util.Comparison.isGap(sj.charAt(start + jlen)))\r
     {\r
-        String si = ii.getSequence();\r
-        String sj = jj.getSequence();\r
+      jlen--;\r
+    }\r
 \r
-        int ilen = si.length() - 1;\r
-        int jlen = sj.length() - 1;\r
+    int count = 0;\r
+    int match = 0;\r
+    float pid = -1;\r
 \r
-        while (jalview.util.Comparison.isGap(si.charAt(start + ilen)))\r
-        {\r
-            ilen--;\r
-        }\r
-\r
-        while (jalview.util.Comparison.isGap(sj.charAt(start + jlen)))\r
+    if (ilen > jlen)\r
+    {\r
+      for (int j = 0; j < jlen; j++)\r
+      {\r
+        if (si.substring(start + j, start + j + 1).equals(sj.substring(start +\r
+            j, start + j + 1)))\r
         {\r
-            jlen--;\r
+          match++;\r
         }\r
 \r
-        int count = 0;\r
-        int match = 0;\r
-        float pid = -1;\r
+        count++;\r
+      }\r
 \r
-        if (ilen > jlen)\r
-        {\r
-            for (int j = 0; j < jlen; j++)\r
-            {\r
-                if (si.substring(start + j, start + j + 1).equals(sj.substring(start +\r
-                                j, start + j + 1)))\r
-                {\r
-                    match++;\r
-                }\r
-\r
-                count++;\r
-            }\r
-\r
-            pid = (float) match / (float) ilen * 100;\r
-        }\r
-        else\r
+      pid = (float) match / (float) ilen * 100;\r
+    }\r
+    else\r
+    {\r
+      for (int j = 0; j < jlen; j++)\r
+      {\r
+        if (si.substring(start + j, start + j + 1).equals(sj.substring(start +\r
+            j, start + j + 1)))\r
         {\r
-            for (int j = 0; j < jlen; j++)\r
-            {\r
-                if (si.substring(start + j, start + j + 1).equals(sj.substring(start +\r
-                                j, start + j + 1)))\r
-                {\r
-                    match++;\r
-                }\r
-\r
-                count++;\r
-            }\r
-\r
-            pid = (float) match / (float) jlen * 100;\r
+          match++;\r
         }\r
 \r
-        return pid;\r
+        count++;\r
+      }\r
+\r
+      pid = (float) match / (float) jlen * 100;\r
     }\r
 \r
-    /**\r
-     * this is a gapped PID calculation\r
-     *\r
-     * @param s1 SequenceI\r
-     * @param s2 SequenceI\r
-     * @return float\r
-     */\r
-    public static float PID(SequenceI s1, SequenceI s2)\r
+    return pid;\r
+  }\r
+\r
+  /**\r
+   * this is a gapped PID calculation\r
+   *\r
+   * @param s1 SequenceI\r
+   * @param s2 SequenceI\r
+   * @return float\r
+   */\r
+  public static float PID(SequenceI s1, SequenceI s2)\r
+  {\r
+    int len;\r
+\r
+    if (s1.getSequence().length() > s2.getSequence().length())\r
     {\r
-        int len;\r
+      len = s1.getSequence().length();\r
+    }\r
+    else\r
+    {\r
+      len = s2.getSequence().length();\r
+    }\r
 \r
-        if (s1.getSequence().length() > s2.getSequence().length())\r
-        {\r
-            len = s1.getSequence().length();\r
-        }\r
-        else\r
+    int bad = 0;\r
+\r
+    for (int i = 0; i < len; i++)\r
+    {\r
+      char chr1;\r
+      char chr2;\r
+\r
+      if (i < s1.getSequence().length())\r
+      {\r
+        chr1 = Character.toUpperCase(s1.getSequence().charAt(i));\r
+      }\r
+      else\r
+      {\r
+        chr1 = '.';\r
+      }\r
+\r
+      if (i < s2.getSequence().length())\r
+      {\r
+        chr2 = Character.toUpperCase(s2.getSequence().charAt(i));\r
+      }\r
+      else\r
+      {\r
+        chr2 = '.';\r
+      }\r
+\r
+      if (! (jalview.util.Comparison.isGap(chr1)) &&\r
+          ! (jalview.util.Comparison.isGap(chr2)))\r
+      {\r
+        if (chr1 != chr2)\r
         {\r
-            len = s2.getSequence().length();\r
+          bad++;\r
         }\r
+      }\r
+    }\r
 \r
-        int bad = 0;\r
+    return ( (float) 100 * (len - bad)) / len;\r
+  }\r
 \r
-        for (int i = 0; i < len; i++)\r
-        {\r
-            char chr1;\r
-            char chr2;\r
-\r
-            if (i < s1.getSequence().length())\r
-            {\r
-                chr1 = Character.toUpperCase(s1.getSequence().charAt(i));\r
-            }\r
-            else\r
-            {\r
-                chr1 = '.';\r
-            }\r
-\r
-            if (i < s2.getSequence().length())\r
-            {\r
-                chr2 = Character.toUpperCase(s2.getSequence().charAt(i));\r
-            }\r
-            else\r
-            {\r
-                chr2 = '.';\r
-            }\r
-\r
-            if (!(jalview.util.Comparison.isGap(chr1)) &&\r
-                    !(jalview.util.Comparison.isGap(chr2)))\r
-            {\r
-                if (chr1 != chr2)\r
-                {\r
-                    bad++;\r
-                }\r
-            }\r
-        }\r
+  // Another pid with region specification\r
+  public static float PID(SequenceI s1, SequenceI s2, int start, int end)\r
+  {\r
+    int len;\r
 \r
-        return ((float) 100 * (len - bad)) / len;\r
+    if (s1.getSequence().length() > s2.getSequence().length())\r
+    {\r
+      len = s1.getSequence().length();\r
+    }\r
+    else\r
+    {\r
+      len = s2.getSequence().length();\r
     }\r
 \r
-    // Another pid with region specification\r
-    public static float PID(SequenceI s1, SequenceI s2, int start, int end)\r
+    if (end < len)\r
     {\r
-        int len;\r
+      len = end;\r
+    }\r
 \r
-        if (s1.getSequence().length() > s2.getSequence().length())\r
-        {\r
-            len = s1.getSequence().length();\r
-        }\r
-        else\r
-        {\r
-            len = s2.getSequence().length();\r
-        }\r
+    if (len < start)\r
+    {\r
+      start = len - 1; // we just use a single residue for the difference\r
+    }\r
 \r
-        if (end < len)\r
-        {\r
-            len = end;\r
-        }\r
+    int bad = 0;\r
 \r
-        if (len < start)\r
+    for (int i = start; i < len; i++)\r
+    {\r
+      char chr1;\r
+      char chr2;\r
+\r
+      if (i < s1.getSequence().length())\r
+      {\r
+        chr1 = Character.toUpperCase(s1.getSequence().charAt(i));\r
+      }\r
+      else\r
+      {\r
+        chr1 = '.';\r
+      }\r
+\r
+      if (i < s2.getSequence().length())\r
+      {\r
+        chr2 = Character.toUpperCase(s2.getSequence().charAt(i));\r
+      }\r
+      else\r
+      {\r
+        chr2 = '.';\r
+      }\r
+\r
+      if (! (jalview.util.Comparison.isGap(chr1)) &&\r
+          ! (jalview.util.Comparison.isGap(chr2)))\r
+      {\r
+        if (chr1 != chr2)\r
         {\r
-            start = len - 1; // we just use a single residue for the difference\r
+          bad++;\r
         }\r
+      }\r
+    }\r
 \r
-        int bad = 0;\r
-\r
-        for (int i = start; i < len; i++)\r
+    return ( (float) 100 * (len - bad)) / len;\r
+  }\r
+\r
+  /**\r
+   * DOCUMENT ME!\r
+   *\r
+   * @param c DOCUMENT ME!\r
+   *\r
+   * @return DOCUMENT ME!\r
+   */\r
+  public static boolean isGap(char c)\r
+  {\r
+    return (c == '-' || c == '.' || c == ' ') ? true : false;\r
+  }\r
+\r
+  public static boolean isNucleotide(SequenceI [] seqs)\r
+  {\r
+    int i = 0, iSize = seqs.length, j, jSize;\r
+    float nt = 0, aa = 0;\r
+    char c;\r
+    while (i < iSize)\r
+    {\r
+      jSize = seqs[i].getLength();\r
+      for (j = 0; j < jSize; j++)\r
+      {\r
+        c = seqs[i].getCharAt(j);\r
+        if ('a' <= c && c <= 'z')\r
+          c -= ('a' - 'A');\r
+\r
+        if (c == 'A' || c == 'G' || c == 'C' || c == 'T' || c == 'U')\r
+          nt++;\r
+        else if (!jalview.util.Comparison.isGap( seqs[i].getCharAt(j)))\r
         {\r
-            char chr1;\r
-            char chr2;\r
-\r
-            if (i < s1.getSequence().length())\r
-            {\r
-                chr1 = Character.toUpperCase(s1.getSequence().charAt(i));\r
-            }\r
-            else\r
-            {\r
-                chr1 = '.';\r
-            }\r
-\r
-            if (i < s2.getSequence().length())\r
-            {\r
-                chr2 = Character.toUpperCase(s2.getSequence().charAt(i));\r
-            }\r
-            else\r
-            {\r
-                chr2 = '.';\r
-            }\r
-\r
-            if (!(jalview.util.Comparison.isGap(chr1)) &&\r
-                    !(jalview.util.Comparison.isGap(chr2)))\r
-            {\r
-                if (chr1 != chr2)\r
-                {\r
-                    bad++;\r
-                }\r
-            }\r
+          aa++;\r
         }\r
-\r
-        return ((float) 100 * (len - bad)) / len;\r
+      }\r
+      i++;\r
     }\r
 \r
-    /**\r
-     * DOCUMENT ME!\r
-     *\r
-     * @param c DOCUMENT ME!\r
-     *\r
-     * @return DOCUMENT ME!\r
-     */\r
-    public static boolean isGap(char c)\r
-    {\r
-        return (  c=='-' || c=='.' || c==' ' ) ? true : false;\r
-    }\r
+    if ( (nt / (nt + aa)) > 0.85f)\r
+      return true;\r
+    else\r
+      return false;\r
+\r
+  }\r
 }\r
diff --git a/src/jalview/util/ImageMaker.java b/src/jalview/util/ImageMaker.java
new file mode 100755 (executable)
index 0000000..02427f2
--- /dev/null
@@ -0,0 +1,165 @@
+package jalview.util;\r
+\r
+import java.awt.event.ActionEvent;\r
+import java.awt.RenderingHints;\r
+import javax.imageio.ImageIO;\r
+import org.jibble.epsgraphics.EpsGraphics2D;\r
+import jalview.gui.EPSOptions;\r
+import java.awt.Graphics2D;\r
+import java.io.*;\r
+import java.awt.image.BufferedImage;\r
+import java.awt.Graphics;\r
+import jalview.io.*;\r
+import java.awt.*;\r
+\r
+\r
+public class ImageMaker\r
+{\r
+  public static final int EPS = 0;\r
+  public static final int PNG = 1;\r
+  int type = -1;\r
+\r
+  EpsGraphics2D pg;\r
+  Graphics graphics;\r
+  FileOutputStream out;\r
+  BufferedImage bi;\r
+\r
+  public ImageMaker(Component parent, int type, String title,\r
+                           int width, int height, File file, String EPStitle)\r
+  {\r
+    this.type = type;\r
+\r
+    if (file == null)\r
+    {\r
+      JalviewFileChooser chooser;\r
+      chooser = type == EPS ? getEPSChooser() : getPNGChooser();\r
+\r
+      chooser.setFileView(new jalview.io.JalviewFileView());\r
+      chooser.setDialogTitle(title);\r
+      chooser.setToolTipText("Save");\r
+\r
+      int value = chooser.showSaveDialog(parent);\r
+\r
+      if (value == jalview.io.JalviewFileChooser.APPROVE_OPTION)\r
+      {\r
+        jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
+                                      chooser.getSelectedFile().getParent());\r
+\r
+        file = chooser.getSelectedFile();\r
+      }\r
+    }\r
+\r
+    try\r
+    {\r
+      out = new FileOutputStream(file);\r
+\r
+      if (type == EPS)\r
+        setupEPS(width, height, EPStitle);\r
+      else\r
+        setupPNG(width, height);\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+      System.out.println("Error creating " + (type == EPS ? "EPS" : "PNG") +\r
+                         " file.");\r
+    }\r
+  }\r
+\r
+  public Graphics getGraphics()\r
+  {\r
+    return graphics;\r
+  }\r
+\r
+\r
+  void setupPNG(int width, int height)\r
+  {\r
+        bi = new BufferedImage(width, height,\r
+                BufferedImage.TYPE_INT_RGB);\r
+        graphics  = bi.getGraphics();\r
+        Graphics2D ig2 = (Graphics2D) graphics;\r
+        ig2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
+                                 RenderingHints.VALUE_ANTIALIAS_ON);\r
+  }\r
+\r
+  public void writeImage()\r
+  {\r
+    try{\r
+      switch(type)\r
+      {\r
+        case EPS:\r
+          pg.flush();\r
+          pg.close();\r
+          break;\r
+        case PNG:\r
+          ImageIO.write(bi, "png", out);\r
+          out.close();\r
+          break;\r
+      }\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+        ex.printStackTrace();\r
+    }\r
+  }\r
+\r
+  void setupEPS(int width, int height, String title)\r
+  {\r
+    boolean accurateText = true;\r
+\r
+    String renderStyle = jalview.bin.Cache.getDefault("EPS_RENDERING",\r
+        "Prompt each time");\r
+\r
+    // If we need to prompt, and if the GUI is visible then\r
+    // Prompt for EPS rendering style\r
+    if (renderStyle.equalsIgnoreCase("Prompt each time")\r
+        && !\r
+        (System.getProperty("java.awt.headless") != null\r
+         && System.getProperty("java.awt.headless").equals("true")))\r
+    {\r
+      EPSOptions eps = new EPSOptions();\r
+      renderStyle = eps.getValue();\r
+\r
+      if (renderStyle == null || eps.cancelled)\r
+        return;\r
+    }\r
+\r
+    if (renderStyle.equalsIgnoreCase("text"))\r
+    {\r
+      accurateText = false;\r
+    }\r
+\r
+    try   {\r
+      pg = new EpsGraphics2D(title, out, 0, 0, width,\r
+                                           height);\r
+      Graphics2D ig2 = (Graphics2D) pg;\r
+      ig2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
+                           RenderingHints.VALUE_ANTIALIAS_ON);\r
+\r
+      pg.setAccurateTextMode(accurateText);\r
+\r
+      graphics = pg;\r
+    }\r
+    catch (Exception ex) {  }\r
+  }\r
+\r
+\r
+  JalviewFileChooser getPNGChooser()\r
+  {\r
+    return new jalview.io.JalviewFileChooser(jalview.bin.Cache.getProperty(\r
+        "LAST_DIRECTORY"), new String[]\r
+                                             {"png"},\r
+                                             new String[]\r
+                                             {"Portable network graphics"},\r
+                                             "Portable network graphics");\r
+  }\r
+\r
+  JalviewFileChooser getEPSChooser()\r
+  {\r
+    return new jalview.io.JalviewFileChooser(jalview.bin.Cache.getProperty(\r
+        "LAST_DIRECTORY"), new String[]\r
+                                             {"eps"},\r
+                                             new String[]\r
+                                             {"Encapsulated Postscript"},\r
+                                             "Encapsulated Postscript");\r
+  }\r
+}\r
index fdf0cec..4cb8aee 100755 (executable)
@@ -173,7 +173,8 @@ public class JPredClient
                                                 msf[0].getSequence()));\r
 \r
       this.msa = new vamsas.objects.simple.Msfalignment();\r
-      msa.setMsf(jalview.io.PileUpfile.print(msf));\r
+      jalview.io.PileUpfile pileup = new jalview.io.PileUpfile();\r
+      msa.setMsf(pileup.print(msf));\r
     }\r
 \r
     public void run()\r
index 6d46e4b..479f22f 100755 (executable)
@@ -57,7 +57,7 @@ public class MsaWSClient
    */\r
 \r
   public MsaWSClient(ext.vamsas.ServiceHandle sh, String altitle, SequenceI[] msa,\r
-                     boolean submitGaps, boolean preserveOrder)\r
+                     boolean submitGaps, boolean preserveOrder, Alignment seqdataset)\r
   {\r
 \r
     if (!sh.getAbstractName().equals("MsaWS"))\r
@@ -81,13 +81,13 @@ public class MsaWSClient
 \r
        return;\r
      }\r
-    startMsaWSClient(altitle, msa, submitGaps, preserveOrder);\r
+    startMsaWSClient(altitle, msa, submitGaps, preserveOrder, seqdataset);\r
 \r
   }\r
 \r
 \r
   private void startMsaWSClient(String altitle, SequenceI[] msa,\r
-                     boolean submitGaps, boolean preserveOrder)\r
+                     boolean submitGaps, boolean preserveOrder, Alignment seqdataset)\r
   {\r
     if (!locateWebService())\r
     {\r
@@ -99,7 +99,7 @@ public class MsaWSClient
 \r
     MsaWSThread musclethread = new MsaWSThread(WebServiceName +\r
                                                " alignment of " + altitle, msa,\r
-                                               submitGaps, preserveOrder);\r
+                                               submitGaps, preserveOrder, seqdataset);\r
     wsInfo.setthisService(musclethread);\r
     musclethread.start();\r
   }\r
@@ -145,20 +145,22 @@ public class MsaWSClient
     vamsas.objects.simple.SequenceSet seqs = new vamsas.objects.simple.\r
         SequenceSet();\r
     Hashtable SeqNames = null;\r
-    boolean submitGaps = false; // and always store and recover sequence order\r
+    boolean submitGaps = false; // pass sequences including gaps to alignment service\r
     boolean preserveOrder = true; // and always store and recover sequence order\r
     String jobId;\r
     String alTitle; // name which will be used to form new alignment window.\r
     int allowedServerExceptions = 3; // thread dies if too many exceptions.\r
     boolean jobComplete = false;\r
 \r
+    Alignment dataset; // dataset to which the new alignment will be associated.\r
+\r
     MsaWSThread(String title, SequenceI[] msa, boolean subgaps,\r
-                boolean presorder)\r
+                boolean presorder, Alignment seqset)\r
     {\r
       alTitle = title;\r
       submitGaps = subgaps;\r
       preserveOrder = presorder;\r
-\r
+      dataset = seqset;\r
       OutputHeader = wsInfo.getProgressText();\r
       SeqNames = new Hashtable();\r
 \r
@@ -467,7 +469,9 @@ public class MsaWSClient
           jalview.analysis.SeqsetUtils.deuniquify(SeqNames, seqs);\r
 \r
           Alignment al = new Alignment(seqs);\r
-\r
+          if (dataset!=null) {\r
+            al.setDataset(dataset);\r
+          }\r
           // TODO: JBPNote Should also rename the query sequence sometime...\r
           AlignFrame af = new AlignFrame(al);\r
           af.addSortByOrderMenuItem(ServiceName + " Ordering",\r