/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
- * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
CheckboxMenuItem seqColour = new CheckboxMenuItem("By Sequence", true);
+ CheckboxMenuItem jmolColour = new CheckboxMenuItem("Using Jmol", false);
+
MenuItem chain = new MenuItem("By Chain");
MenuItem charge = new MenuItem("Charge & Cysteine");
RenderPanel renderPanel;
AlignmentPanel ap;
+ ArrayList _aps = new ArrayList();
String fileLoadingError;
* 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
+ * 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)
+ 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)
{
this.ap = ap;
- jmb = new AppletJmolBinding(this, new PDBEntry[]
- { pdbentry }, new SequenceI[][]{seq}, new String[][]{ chains }, protocol);
+ jmb = new AppletJmolBinding(this, ap.getStructureSelectionManager(), new PDBEntry[]
+ { pdbentry }, new SequenceI[][]
+ { seq }, new String[][]
+ { chains }, protocol);
jmb.setColourBySequence(true);
if (pdbentry.getId() == null || pdbentry.getId().length() < 1)
{
}
String alreadyMapped = StructureSelectionManager
- .getStructureSelectionManager().alreadyMappedToFile(
+ .getStructureSelectionManager(ap.av.applet).alreadyMappedToFile(
pdbentry.getId());
MCview.PDBfile reader = null;
if (alreadyMapped != null)
{
- reader = StructureSelectionManager.getStructureSelectionManager()
+ reader = StructureSelectionManager.getStructureSelectionManager(ap.av.applet)
.setMapping(seq, chains, pdbentry.getFile(), protocol);
// PROMPT USER HERE TO ADD TO NEW OR EXISTING VIEW?
// FOR NOW, LETS JUST OPEN A NEW WINDOW
hydro.addActionListener(this);
chain.addActionListener(this);
seqColour.addItemListener(this);
+ jmolColour.addItemListener(this);
zappo.addActionListener(this);
taylor.addActionListener(this);
helix.addActionListener(this);
turn.addActionListener(this);
buried.addActionListener(this);
user.addActionListener(this);
-
+
jmolHelp.addActionListener(this);
coloursMenu.add(seqColour);
coloursMenu.add(turn);
coloursMenu.add(buried);
coloursMenu.add(user);
-
+ coloursMenu.add(jmolColour);
helpMenu.add(jmolHelp);
this.setLayout(new BorderLayout());
scriptWindow = new Panel();
scriptWindow.setVisible(false);
// this.add(scriptWindow, BorderLayout.SOUTH);
-
+
try
{
- jmb.allocateViewer(renderPanel, true, ap.av.applet.getName()+"_jmol_",
- ap.av.applet.getDocumentBase(), ap.av.applet.getCodeBase(),
- "-applet", scriptWindow, null);
+ jmb.allocateViewer(renderPanel, true, ap.av.applet.getName()
+ + "_jmol_", ap.av.applet.getDocumentBase(),
+ ap.av.applet.getCodeBase(), "-applet", scriptWindow, null);
} catch (Exception e)
{
System.err
closeViewer();
}
});
- if (pdbentry.getProperty()==null)
+ if (pdbentry.getProperty() == null)
{
pdbentry.setProperty(new Hashtable());
pdbentry.getProperty().put("protocol", protocol);
frame.add(cap);
StringBuffer sb = new StringBuffer();
- try {
- for (int s = 0; s < jmb.pdbentry.length; s++)
+ try
{
- sb.append(StructureSelectionManager.getStructureSelectionManager()
- .printMapping(jmb.pdbentry[s].getFile()));
- sb.append("\n");
- }
- cap.setText(sb.toString());
- }
- catch (OutOfMemoryError ex)
+ for (int s = 0; s < jmb.pdbentry.length; s++)
+ {
+ sb.append(jmb.printMapping(
+ jmb.pdbentry[s].getFile()));
+ sb.append("\n");
+ }
+ cap.setText(sb.toString());
+ } catch (OutOfMemoryError ex)
{
frame.dispose();
- System.err.println("Out of memory when trying to create dialog box with sequence-structure mapping.");
+ System.err
+ .println("Out of memory when trying to create dialog box with sequence-structure mapping.");
return;
}
jalview.bin.JalviewLite.addFrame(frame, "PDB - Sequence Mapping",
}
/**
- * tick or untick the seqColour menu entry depending upon if it was selected
+ * tick or untick the seqColour menu entry or jmoColour entry depending upon if it was selected
* or not.
*
* @param itm
*/
private void setEnabled(MenuItem itm)
{
+ jmolColour.setState(itm == jmolColour);
seqColour.setState(itm == seqColour);
jmb.setColourBySequence(itm == seqColour);
}
public void itemStateChanged(ItemEvent evt)
{
+ if (evt.getSource() == jmolColour)
+ {
+ setEnabled(jmolColour);
+ jmb.setColourBySequence(false);
+ } else
if (evt.getSource() == seqColour)
{
setEnabled(seqColour);
- jmb.colourBySequence(ap.av.getShowSequenceFeatures(), ap.av.alignment);
+ jmb.colourBySequence(ap.av.getShowSequenceFeatures(), ap);
}
else if (!allChainsSelected)
centerViewer();
public void updateColours(Object source)
{
AlignmentPanel ap = (AlignmentPanel) source;
- jmb.colourBySequence(ap.av.getShowSequenceFeatures(), ap.av.alignment);
+ jmb.colourBySequence(ap.av.getShowSequenceFeatures(), ap);
}
public void updateTitleAndMenus()
return;
}
setChainMenuItems(jmb.chainNames);
- jmb.colourBySequence(ap.av.getShowSequenceFeatures(), ap.av.alignment);
+ jmb.colourBySequence(ap.av.getShowSequenceFeatures(), ap);
setTitle(jmb.getViewerTitle());
}
{
}
}
- Panel splitPane=null;
+
+ Panel splitPane = null;
+
public void showConsole(boolean showConsole)
{
if (showConsole)
{
remove(renderPanel);
splitPane = new Panel();
-
- splitPane.setLayout(new java.awt.GridLayout(2,1));
+
+ splitPane.setLayout(new java.awt.GridLayout(2, 1));
splitPane.add(renderPanel);
splitPane.add(scriptWindow);
scriptWindow.setVisible(true);
this.add(splitPane, BorderLayout.CENTER);
splitPane.setVisible(true);
splitPane.validate();
- } else {
+ }
+ else
+ {
scriptWindow.setVisible(false);
remove(splitPane);
add(renderPanel, BorderLayout.CENTER);
- splitPane=null;
+ splitPane = null;
}
validate();
}
{
jmb.setJalviewColourScheme(ucs);
}
+
+ public AlignmentPanel getAlignmentPanelFor(AlignmentI alignment)
+ {
+ for (int i=0;i<_aps.size();i++)
+ {
+ if (((AlignmentPanel)_aps.get(i)).av.getAlignment()==alignment)
+ {
+ return ((AlignmentPanel)_aps.get(i));
+ }
+ }
+ return ap;
+ }
}