notes re JAL-623 and JAL-583, new api methods for adding several structure/seq mappin...
authorjprocter <Jim Procter>
Tue, 31 Aug 2010 16:18:55 +0000 (16:18 +0000)
committerjprocter <Jim Procter>
Tue, 31 Aug 2010 16:18:55 +0000 (16:18 +0000)
src/jalview/appletgui/AlignFrame.java
src/jalview/appletgui/AppletJmol.java
src/jalview/bin/JalviewLite.java

index adb0da5..c5f37fd 100755 (executable)
@@ -166,10 +166,10 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     boolean featuresFile = false;
     try
     {
-      featuresFile = new jalview.io.FeaturesFile(file, type).parse(
-              viewport.alignment, alignPanel.seqPanel.seqCanvas
-                      .getFeatureRenderer().featureColours, featureLinks,
-              true);
+      featuresFile = new jalview.io.FeaturesFile(file, type)
+              .parse(viewport.alignment,
+                      alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureColours,
+                      featureLinks, true);
     } catch (Exception ex)
     {
       ex.printStackTrace();
@@ -846,8 +846,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     else if (source == clustalColour)
     {
       abovePIDThreshold.setState(false);
-      changeColour(new ClustalxColourScheme(viewport.alignment
-              .getSequences(), viewport.alignment.getWidth()));
+      changeColour(new ClustalxColourScheme(
+              viewport.alignment.getSequences(),
+              viewport.alignment.getWidth()));
     }
     else if (source == zappoColour)
     {
@@ -973,10 +974,10 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);
     Frame frame = new Frame();
     frame.add(cap);
-    jalview.bin.JalviewLite.addFrame(frame, "Alignment output - "
-            + e.getActionCommand(), 600, 500);
-    cap.setText(new AppletFormatAdapter().formatSequences(e
-            .getActionCommand(), viewport.getAlignment(),
+    jalview.bin.JalviewLite.addFrame(frame,
+            "Alignment output - " + e.getActionCommand(), 600, 500);
+    cap.setText(new AppletFormatAdapter().formatSequences(
+            e.getActionCommand(), viewport.getAlignment(),
             viewport.showJVSuffix));
   }
 
@@ -1033,13 +1034,15 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     String features;
     if (format.equalsIgnoreCase("Jalview"))
     {
-      features = new FeaturesFile().printJalviewFormat(viewport.alignment
-              .getSequencesArray(), getDisplayedFeatureCols());
+      features = new FeaturesFile().printJalviewFormat(
+              viewport.alignment.getSequencesArray(),
+              getDisplayedFeatureCols());
     }
     else
     {
-      features = new FeaturesFile().printGFFFormat(viewport.alignment
-              .getSequencesArray(), getDisplayedFeatureCols());
+      features = new FeaturesFile().printGFFFormat(
+              viewport.alignment.getSequencesArray(),
+              getDisplayedFeatureCols());
     }
 
     if (displayTextbox)
@@ -1071,9 +1074,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     if (viewport.applet.getParameter("annotations") != null)
     {
       url.append("&annotations=");
-      url
-              .append(appendProtocol(viewport.applet
-                      .getParameter("annotations")));
+      url.append(appendProtocol(viewport.applet.getParameter("annotations")));
     }
 
     if (viewport.applet.getParameter("jnetfile") != null)
@@ -1612,8 +1613,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 
     viewport.setEndSeq(viewport.alignment.getHeight());
     viewport.alignment.getWidth();
-    viewport.firePropertyChange("alignment", null, viewport.alignment
-            .getSequences());
+    viewport.firePropertyChange("alignment", null,
+            viewport.alignment.getSequences());
 
   }
 
@@ -1677,8 +1678,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     if (viewport.getSelectionGroup() != null)
     {
       SequenceGroup[] gps = jalview.analysis.Grouping.makeGroupsFrom(
-              viewport.getSequenceSelection(), viewport.getAlignmentView(
-                      true).getSequenceStrings(viewport.getGapCharacter()),
+              viewport.getSequenceSelection(),
+              viewport.getAlignmentView(true).getSequenceStrings(
+                      viewport.getGapCharacter()),
               viewport.alignment.getGroups());
       viewport.alignment.deleteAllGroups();
       viewport.sequenceColours = null;
@@ -1689,8 +1691,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
         // gps[g].setShowunconserved(viewport.getShowUnconserved());
         gps[g].setshowSequenceLogo(viewport.isShowSequenceLogo());
         viewport.alignment.addGroup(gps[g]);
-        Color col = new Color((int) (Math.random() * 255), (int) (Math
-                .random() * 255), (int) (Math.random() * 255));
+        Color col = new Color((int) (Math.random() * 255),
+                (int) (Math.random() * 255), (int) (Math.random() * 255));
         col = col.brighter();
         for (Enumeration sq = gps[g].getSequences(null).elements(); sq
                 .hasMoreElements(); viewport.setSequenceColour(
@@ -1927,9 +1929,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
       {
         if (!viewport.alignment.getAlignmentAnnotation()[i].autoCalculated)
         {
-          newal
-                  .addAnnotation(viewport.alignment
-                          .getAlignmentAnnotation()[i]);
+          newal.addAnnotation(viewport.alignment.getAlignmentAnnotation()[i]);
         }
       }
     }
@@ -1938,8 +1938,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 
     newaf.viewport.sequenceSetID = alignPanel.av.getSequenceSetId();
     PaintRefresher.Register(alignPanel, alignPanel.av.getSequenceSetId());
-    PaintRefresher.Register(newaf.alignPanel, newaf.alignPanel.av
-            .getSequenceSetId());
+    PaintRefresher.Register(newaf.alignPanel,
+            newaf.alignPanel.av.getSequenceSetId());
 
     PaintRefresher.Register(newaf.alignPanel.idPanel.idCanvas,
             newaf.alignPanel.av.getSequenceSetId());
@@ -2118,8 +2118,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 
         Alignment al = (Alignment) viewport.alignment;
         Conservation c = new Conservation("All",
-                ResidueProperties.propHash, 3, al.getSequences(), 0, al
-                        .getWidth() - 1);
+                ResidueProperties.propHash, 3, al.getSequences(), 0,
+                al.getWidth() - 1);
 
         c.calculate();
         c.verdict(false, viewport.ConsPercGaps);
@@ -2154,8 +2154,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
         }
         if (cs instanceof ClustalxColourScheme)
         {
-          sg.cs = new ClustalxColourScheme(sg
-                  .getSequences(viewport.hiddenRepSequences), sg.getWidth());
+          sg.cs = new ClustalxColourScheme(
+                  sg.getSequences(viewport.hiddenRepSequences),
+                  sg.getWidth());
         }
         else
         {
@@ -2174,9 +2175,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
                 || cs instanceof Blosum62ColourScheme)
         {
           sg.cs.setThreshold(threshold, viewport.getIgnoreGapsConsensus());
-          sg.cs.setConsensus(AAFrequency.calculate(sg
-                  .getSequences(viewport.hiddenRepSequences), 0, sg
-                  .getWidth()));
+          sg.cs.setConsensus(AAFrequency.calculate(
+                  sg.getSequences(viewport.hiddenRepSequences), 0,
+                  sg.getWidth()));
         }
         else
         {
@@ -2186,8 +2187,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
         if (viewport.getConservationSelected())
         {
           Conservation c = new Conservation("Group",
-                  ResidueProperties.propHash, 3, sg
-                          .getSequences(viewport.hiddenRepSequences), 0,
+                  ResidueProperties.propHash, 3,
+                  sg.getSequences(viewport.hiddenRepSequences), 0,
                   viewport.alignment.getWidth() - 1);
           c.calculate();
           c.verdict(false, viewport.ConsPercGaps);
@@ -2219,8 +2220,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     if (viewport.getAbovePIDThreshold()
             && viewport.globalColourScheme != null)
     {
-      SliderPanel.setPIDSliderSource(alignPanel, viewport
-              .getGlobalColourScheme(), "Background");
+      SliderPanel.setPIDSliderSource(alignPanel,
+              viewport.getGlobalColourScheme(), "Background");
       SliderPanel.showPIDSlider();
     }
   }
@@ -2283,7 +2284,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
   {
     SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
     AlignmentSorter.sortByLength(viewport.getAlignment());
-    addHistoryItem(new OrderCommand("Length Sort", oldOrder, viewport.alignment));
+    addHistoryItem(new OrderCommand("Length Sort", oldOrder,
+            viewport.alignment));
     alignPanel.paintAlignment(true);
   }
 
@@ -2516,28 +2518,23 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
         g.setFont(new Font("Helvetica", Font.BOLD, 12));
         g.drawString("Build date: " + builddate, x, y += fh);
         g.setFont(new Font("Helvetica", Font.PLAIN, 12));
-        g
-                .drawString(
-                        "Authors:  Andrew Waterhouse, Jim Procter, Michele Clamp, James Cuff, Steve Searle,",
-                        x, y += fh * 1.5);
+        g.drawString(
+                "Authors:  Andrew Waterhouse, Jim Procter, Michele Clamp, James Cuff, Steve Searle,",
+                x, y += fh * 1.5);
         g.drawString("David Martin & Geoff Barton.", x + 50, y += fh);
-        g
-                .drawString(
-                        "Development managed by The Barton Group, University of Dundee, Scotland, UK.",
-                        x, y += fh);
-        g
-                .drawString(
-                        "For help, see the FAQ at www.jalview.org and/or join the jalview-discuss@jalview.org mailing list",
-                        x, y += fh);
+        g.drawString(
+                "Development managed by The Barton Group, University of Dundee, Scotland, UK.",
+                x, y += fh);
+        g.drawString(
+                "For help, see the FAQ at www.jalview.org and/or join the jalview-discuss@jalview.org mailing list",
+                x, y += fh);
         g.drawString("If  you use Jalview, please cite:", x, y += fh + 8);
-        g
-                .drawString(
-                        "Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)",
-                        x, y += fh);
-        g
-                .drawString(
-                        "Jalview Version 2 - a multiple sequence alignment editor and analysis workbench",
-                        x, y += fh);
+        g.drawString(
+                "Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)",
+                x, y += fh);
+        g.drawString(
+                "Jalview Version 2 - a multiple sequence alignment editor and analysis workbench",
+                x, y += fh);
         g.drawString("Bioinformatics doi: 10.1093/bioinformatics/btp033",
                 x, y += fh);
       }
@@ -2581,13 +2578,16 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
         {
           System.out.println("Show url: " + url);
         }
-        if (url.indexOf("javascript:")==0)
+        if (url.indexOf("javascript:") == 0)
         {
           // no target for the javascript context
-          viewport.applet.getAppletContext().showDocument(new java.net.URL(url));
-        } else{
           viewport.applet.getAppletContext().showDocument(
-                new java.net.URL(url), target);
+                  new java.net.URL(url));
+        }
+        else
+        {
+          viewport.applet.getAppletContext().showDocument(
+                  new java.net.URL(url), target);
         }
       } catch (Exception ex)
       {
@@ -3166,9 +3166,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
       viewport.applet.setLayout(new BorderLayout());
       viewport.applet.add(embeddedMenu, BorderLayout.NORTH);
       viewport.applet.add(statusBar, BorderLayout.SOUTH);
-      alignPanel.setSize(viewport.applet.getSize().width, viewport.applet
-              .getSize().height
-              - embeddedMenu.HEIGHT - statusBar.HEIGHT);
+      alignPanel.setSize(viewport.applet.getSize().width,
+              viewport.applet.getSize().height - embeddedMenu.HEIGHT
+                      - statusBar.HEIGHT);
       viewport.applet.add(alignPanel, BorderLayout.CENTER);
       viewport.applet.validate();
     }
@@ -3197,7 +3197,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
    * this does not open a new Jmol window, or modify the display of the
    * structures in the original jmol window. Note
    * 
-   * @param viewer JmolViewer instance
+   * @param viewer
+   *          JmolViewer instance
    * @param sequenceIds
    *          - sequence Ids to search for associations
    * This method doesn't work. See http://issues.jalview.org/browse/JAL-621
@@ -3248,37 +3249,38 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     return jmv;
     
   }
-  **/
+   **/
   public boolean addPdbFile(String sequenceId, String pdbEntryString,
           String pdbFile)
   {
     SequenceI toaddpdb = viewport.getAlignment().findName(sequenceId);
-    boolean needtoadd=false;
-    if (toaddpdb!=null)
+    boolean needtoadd = false;
+    if (toaddpdb != null)
     {
       Vector pdbe = toaddpdb.getPDBId();
       PDBEntry pdbentry = null;
-      if (pdbe!=null && pdbe.size()>0)
+      if (pdbe != null && pdbe.size() > 0)
       {
-        for (int pe=0,peSize=pdbe.size(); pe<peSize; pe++)
+        for (int pe = 0, peSize = pdbe.size(); pe < peSize; pe++)
         {
           pdbentry = (PDBEntry) pdbe.elementAt(pe);
-          if (!pdbentry.getId().equals(pdbEntryString) && !pdbentry.getFile().equals(pdbFile))
+          if (!pdbentry.getId().equals(pdbEntryString)
+                  && !pdbentry.getFile().equals(pdbFile))
           {
             pdbentry = null;
           }
           else
           {
-              continue;
+            continue;
           }
         }
       }
-      if (pdbentry==null)
+      if (pdbentry == null)
       {
         pdbentry = new PDBEntry();
         pdbentry.setId(pdbEntryString);
         pdbentry.setFile(pdbFile);
-        needtoadd=true; // add this new entry to sequence.
+        needtoadd = true; // add this new entry to sequence.
       }
       // resolve data source
       // TODO: this code should be a refactored to an io package
@@ -3290,53 +3292,105 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
       if (needtoadd)
       {
         // make a note of the access mode and add
+        if (pdbentry.getProperty()==null)
+          {pdbentry.setProperty(new Hashtable());}
         pdbentry.getProperty().put("protocol", protocol);
         toaddpdb.addPDBId(pdbentry);
       }
     }
     return true;
   }
-
-  public void newStructureView(JalviewLite applet, PDBEntry pdb, SequenceI[] seqs,
-          String[] chains, String protocol)
+  private Object[] cleanSeqChainArrays(SequenceI[] seqs, String[] chains)
   {
-    if (seqs!=null)
+    if (seqs != null)
     {
-      Vector sequences=new Vector();
-     for (int i=0;i<seqs.length;i++) {
-       if (seqs[i]!=null)
-       {
-         sequences.addElement(seqs[i]);
-       }
-     }
-     seqs = new SequenceI[sequences.size()];
-     for (int i=0,isize=sequences.size(); i<isize; i++)
-     {
-       seqs[i] = (SequenceI) sequences.elementAt(i);
-     }
+      Vector sequences = new Vector();
+      for (int i = 0; i < seqs.length; i++)
+      {
+        if (seqs[i] != null)
+        {
+          sequences.addElement(new Object[] { seqs[i], (chains!=null) ? chains[i] : null});
+        }
+      }
+      seqs = new SequenceI[sequences.size()];
+      chains = new String[sequences.size()];
+      for (int i = 0, isize = sequences.size(); i < isize; i++)
+      {
+        Object[] oj = (Object[]) sequences.elementAt(i);
+
+        seqs[i] = (SequenceI) oj[0];
+        chains[i] = (String) oj[1];
+      }
     }
-    if (seqs==null || seqs.length==0)
+    return new Object[] { seqs, chains};
+
+  }
+  public void newStructureView(JalviewLite applet, PDBEntry pdb,
+          SequenceI[] seqs, String[] chains, String protocol)
+  {
+    // Scrub any null sequences from the array
+    Object[] sqch = cleanSeqChainArrays(seqs, chains);
+    seqs = (SequenceI[]) sqch[0];
+    chains = (String[]) sqch[1];
+    if (seqs == null || seqs.length == 0)
     {
-      System.err.println("JalviewLite.AlignFrame:newStructureView: No sequence to bind structure to.");
+      System.err
+              .println("JalviewLite.AlignFrame:newStructureView: No sequence to bind structure to.");
     }
-    if (protocol==null || protocol.trim().length()==0 || protocol.equals("null"))
+    if (protocol == null || protocol.trim().length() == 0
+            || protocol.equals("null"))
     {
       protocol = (String) pdb.getProperty().get("protocol");
-      if (protocol==null)
+      if (protocol == null)
       {
-        System.err.println("Couldn't work out protocol to open structure: "+pdb.getId());
+        System.err.println("Couldn't work out protocol to open structure: "
+                + pdb.getId());
         return;
       }
     }
+    if (applet.isAlignPdbStructures() && applet.jmolAvailable)
+    {
+      // can only do alignments with Jmol
+      // find the last jmol window assigned to this alignment
+      jalview.appletgui.AppletJmol ajm = null, tajm;
+      Vector jmols = applet
+              .getAppletWindow(jalview.appletgui.AppletJmol.class);
+      for (int i = 0, iSize = jmols.size(); i < iSize; i++)
+      {
+        tajm = (jalview.appletgui.AppletJmol) jmols.elementAt(i);
+        if (tajm.ap.alignFrame == this)
+        {
+          ajm = tajm;
+          break;
+        }
+      }
+      if (ajm!=null)
+      {
+        System.err.println("Incremental adding and aligning structure to existing Jmol view not yet implemented.");
+        // try and add the pdb structure
+        // ajm.addS
+        ajm = null;
+      }
+    }
+    // otherwise, create a new window
     if (applet.jmolAvailable)
     {
-      new jalview.appletgui.AppletJmol(pdb, seqs, chains,
-              alignPanel, protocol);
+      new jalview.appletgui.AppletJmol(pdb, seqs, chains, alignPanel,
+              protocol);
       applet.lastFrameX += 40;
       applet.lastFrameY += 40;
     }
     else
-      new MCview.AppletPDBViewer(pdb, seqs, chains,
-              alignPanel, protocol);
+    {
+      new MCview.AppletPDBViewer(pdb, seqs, chains, alignPanel, protocol);
+    }
+
+  }
+
+  public void alignedStructureView(JalviewLite applet, PDBEntry[] pdb,
+          SequenceI[][] seqs, String[][] chains, String[] protocols)
+  {
+    // TODO Auto-generated method stub
+    System.err.println("Aligned Structure View: Not yet implemented.");
   }
 }
index 3707cfa..e45bd28 100644 (file)
@@ -98,7 +98,19 @@ public class AppletJmol extends EmbmenuFrame implements
    * datasource protocol for access to PDBEntry
    */
   String protocol = null;
-
+  /**
+   * Load a bunch of pdb entries associated with sequences in the alignment and display them - aligning them if necessary.
+   * @param pdbentries each pdb file (at least one needed)
+   * @param boundseqs each set of sequences for each pdb file (must match number of pdb files)
+   * @param boundchains the target pdb chain corresponding with each sequence associated with each pdb file (may be null at any level)
+   * @param align true/false
+   * @param ap associated alignment
+   * @param protocol how to get pdb data
+   */
+  public AppletJmol(PDBEntry[] pdbentries, SequenceI[][] boundseqs, String[][] boundchains, boolean align, AlignmentPanel ap, String protocol)
+  {
+    throw new Error("Not yet implemented.");
+  }
   public AppletJmol(PDBEntry pdbentry, SequenceI[] seq, String[] chains,
           AlignmentPanel ap, String protocol)
   {
@@ -203,12 +215,18 @@ public class AppletJmol extends EmbmenuFrame implements
         closeViewer();
       }
     });
-
+    if (pdbentry.getProperty()==null)
+    {
+      pdbentry.setProperty(new Hashtable());
+      pdbentry.getProperty().put("protocol", protocol);
+    }
     if (pdbentry.getFile() != null)
     {
       // import structure data from pdbentry.getFile based on given protocol
       if (protocol.equals(AppletFormatAdapter.PASTE))
       {
+        // TODO: JAL-623 : correctly record file contents for matching up later
+        // pdbentry.getProperty().put("pdbfilehash",""+pdbentry.getFile().hashCode());
         loadInline(pdbentry.getFile());
       }
       else if (protocol.equals(AppletFormatAdapter.FILE)
@@ -276,7 +294,7 @@ public class AppletJmol extends EmbmenuFrame implements
   public void loadInline(String string)
   {
     loadedInline = true;
-    jmb.viewer.openStringInline(string);
+    jmb.loadInline(string);
   }
 
   void setChainMenuItems(Vector chains)
index 0e77f02..7bf1a5f 100755 (executable)
@@ -19,6 +19,7 @@ package jalview.bin;
 
 import jalview.api.SequenceStructureBinding;
 import jalview.appletgui.AlignFrame;
+import jalview.appletgui.AppletJmol;
 import jalview.appletgui.EmbmenuFrame;
 import jalview.appletgui.FeatureSettings;
 import jalview.datamodel.Alignment;
@@ -34,6 +35,7 @@ import jalview.io.JnetAnnotationMaker;
 import java.applet.Applet;
 import java.awt.Button;
 import java.awt.Color;
+import java.awt.Component;
 import java.awt.Font;
 import java.awt.Frame;
 import java.awt.Graphics;
@@ -332,6 +334,8 @@ public class JalviewLite extends Applet
 
   public boolean jmolAvailable = false;
 
+  private boolean alignPdbStructures=false;
+
   public static boolean debug = false;
 
   static String builddate = null, version = null;
@@ -896,7 +900,11 @@ public class JalviewLite extends Applet
             ex.printStackTrace();
           }
         }
-
+        /*
+         * <param name="alignpdbfiles" value="false/true"/>
+         * Undocumented for 2.6 - related to JAL-434
+         */
+        applet.setAlignPdbStructures(getDefaultParameter("alignpdbfiles",false));
         /*
          * <param name="PDBfile" value="1gaq.txt PDB|1GAQ|1GAQ|A PDB|1GAQ|1GAQ|B
          * PDB|1GAQ|1GAQ|C">
@@ -905,8 +913,10 @@ public class JalviewLite extends Applet
          * 
          * <param name="PDBfile3" value="1q0o Q45135_9MICO">
          */
-
+        
         int pdbFileCount = 0;
+        // Accumulate pdbs here if they are heading for the same view (if alignPdbStructures is true)
+        Vector pdbs=new Vector();
         do
         {
           if (pdbFileCount > 0)
@@ -998,16 +1008,35 @@ public class JalviewLite extends Applet
                   }
                 }
               }
-
-              newAlignFrame.newStructureView(applet, pdb, seqs, chains,
+              
+              if (!alignPdbStructures) {
+                newAlignFrame.newStructureView(applet, pdb, seqs, chains,
                       protocol);
-
+              } else {
+                pdbs.add(new Object[] { pdb, seqs, chains, new String(protocol)});
+              }
             }
           }
 
           pdbFileCount++;
         } while (pdbFileCount < 10);
-
+        if (pdbs.size()>0)
+        {
+          SequenceI[][] seqs = new SequenceI[pdbs.size()][];
+          PDBEntry[] pdb = new PDBEntry[pdbs.size()];
+          String[][] chains = new String[pdbs.size()][];
+          String[] protocols = new String[pdbs.size()];
+          for (int pdbsi=0,pdbsiSize=pdbs.size(); pdbsi<pdbsiSize;pdbsi++)
+          {
+            Object[] o = (Object[]) pdbs.elementAt(pdbsi);
+            pdb[pdbsi] = (PDBEntry) o[0];
+            seqs[pdbsi] = (SequenceI[]) o[1];
+            chains[pdbsi] = (String[]) o[2];
+            protocols[pdbsi] = (String) o[3];
+          }
+          newAlignFrame.alignedStructureView(applet, pdb, seqs, chains, protocols);
+          
+        }
         // ///////////////////////////
         // modify display of features
         //
@@ -1325,6 +1354,37 @@ public class JalviewLite extends Applet
     return alFrame.addPdbFile(sequenceId, pdbEntryString, pdbFile);
   }
 
+  protected void setAlignPdbStructures(boolean alignPdbStructures)
+  {
+    this.alignPdbStructures = alignPdbStructures;
+  }
+
+  public boolean isAlignPdbStructures()
+  {
+    return alignPdbStructures;
+  }
+
+  /**
+   * get all components associated with the applet of the given type 
+   * @param class1
+   * @return
+   */
+  public Vector getAppletWindow(Class class1)
+  {
+    Vector wnds = new Vector();
+    Component[] cmp = getComponents();
+    if (cmp!=null)
+    {
+    for (int i=0;i<cmp.length;i++)
+    {
+      if (class1.isAssignableFrom(cmp[i].getClass()))
+      {
+        wnds.addElement(cmp);
+      }
+    }}
+    return wnds;
+  }
+
 
   /**
    * bind structures in a viewer to any matching sequences in an alignFrame (use