// / TODO: check if protocol is needed to be set, and if chains are
// autodiscovered.
jmb = new AppJmolBinding(this, new PDBEntry[]
- { pdbentry }, seq, null, null);
+ { pdbentry }, new SequenceI[][] { seq }, null, null);
jmb.setLoadingFromArchive(true);
this.ap = ap;
{
if (topJmol.jmb.pdbentry[pe].getFile().equals(alreadyMapped))
{
- topJmol.jmb.addSequence(seq);
+ topJmol.jmb.addSequence(pe, seq);
break;
}
}
}
}
// /////////////////////////////////
+ // Check if there are other Jmol views involving this alignment
+ // and prompt user about adding this molecule to one of them
+ Vector existingViews = getJmolsFor(ap);
+ if (existingViews.size()>0)
+ {
+ Enumeration jm = existingViews.elements();
+ while (jm.hasMoreElements()) {
+ AppJmol topJmol = (AppJmol) jm.nextElement();
+ // TODO: highlight topJmol in view somehow
+ int option = JOptionPane
+ .showInternalConfirmDialog(
+ Desktop.desktop, "Do you want to add "+
+ pdbentry.getId()+" to the view called\n'"+topJmol.getTitle()
+ + "'\n",
+ "Align to existing structure view"
+ , JOptionPane.YES_NO_OPTION);
+ if (option == JOptionPane.YES_OPTION)
+ {
+ topJmol.jmb.addStructure(pdbentry, seq, chains,true);
+ return;
+ }
+ }
+ }
+ // /////////////////////////////////
jmb = new AppJmolBinding(this, new PDBEntry[]
- { pdbentry }, seq, null, null);
+ { pdbentry }, new SequenceI[][]{seq}, null, null);
this.ap = ap;
setSize(400, 400); // probably should be a configurable/dynamic default here
}
+ private Vector getJmolsFor(AlignmentPanel ap2)
+ {
+ Vector otherJmols= new Vector();
+ // Now this AppJmol is mapped to new sequences. We must add them to
+ // the exisiting array
+ JInternalFrame[] frames = Desktop.instance.getAllFrames();
+
+ for (int i = 0; i < frames.length; i++)
+ {
+ if (frames[i] instanceof AppJmol)
+ {
+ AppJmol topJmol = ((AppJmol) frames[i]);
+ if (topJmol.ap==ap2)
+ {
+ otherJmols.addElement(topJmol);
+ }
+ }
+ }
+ return otherJmols;
+ }
+
void initJmol(String command)
{
jmb.setFinishedInit(false);
}
setChainMenuItems(jmb.chainNames);
jmb.colourBySequence(ap.av.getShowSequenceFeatures(), ap.av.alignment);
-
+
this.setTitle(jmb.getViewerTitle());
+ if (jmb.getPdbFile().length>1 && jmb.sequence.length>1) {
+ jmolActionMenu.setVisible(true);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see jalview.jbgui.GStructureViewer#alignStructs_actionPerformed(java.awt.event.ActionEvent)
+ */
+ @Override
+ protected void alignStructs_actionPerformed(ActionEvent actionEvent)
+ {
+
+ try {
+ jmb.superposeStructures(ap.av.getAlignment(), -1, ap.av.getColumnSelection());
+ } catch (Exception e)
+ {
+ Cache.log.info("Couldn't align structures in alignframe "+ap.alignFrame.getTitle(),e);
+
+ }
}
public void setJalviewColourScheme(ColourSchemeI ucs)