/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
- * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
+ * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
AppJmol jmol;
// This must have been loaded, is it still visible?
JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+ String matchedFile=null;
for (int f = frames.length - 1; f > -1; f--)
{
if (frames[f] instanceof AppJmol)
jmol = (AppJmol) frames[f];
if (!jmol.pdbentry.getId().equals(entry.getId())
&& !(entry.getId().length()>4
- && entry.getId().startsWith(jmol.pdbentry.getId())))
+ && entry.getId().toLowerCase().startsWith(jmol.pdbentry.getId().toLowerCase())))
continue;
-
+ matchedFile = jmol.pdbentry.getFile(); // record the file so we can get at it if the ID match is ambiguous (e.g. 1QIP==1qipA)
StructureState state = new StructureState();
state.setVisible(true);
state.setXpos(jmol.getX());
}
}
- if (entry.getFile() != null)
+ if (matchedFile!=null || entry.getFile() != null )
{
- pdb.setFile(entry.getFile());
+ if (entry.getFile()!=null)
+ {
+ // use entry's file
+ matchedFile = entry.getFile();
+ }
+ pdb.setFile(matchedFile); // entry.getFile());
if (pdbfiles == null)
{
pdbfiles = new Vector();
pdbfiles.addElement(entry.getId());
try
{
- File file = new File(entry.getFile());
+ File file = new File(matchedFile);
if (file.exists() && jout != null)
{
byte[] data = new byte[(int) file.length()];
.getHeight(), tree.getXpos(), tree.getYpos());
if (tree.getId() != null)
{
-
+ // perhaps bind the tree id to something ?
}
}
else
{
// update local tree attributes ?
+ // TODO: should check if tp has been manipulated by user - if so its settings shouldn't be modified
tp.setTitle(tree.getTitle());
tp.setBounds(new Rectangle(tree.getXpos(), tree.getYpos(), tree
.getWidth(), tree.getHeight()));
}
}
}
- Desktop.desktop.getComponentAt(x, y);
-
+ // Probably don't need to do this anymore...
+ // Desktop.desktop.getComponentAt(x, y);
+ // TODO: NOW: check that this recovers the PDB file correctly.
String pdbFile = loadPDBFile(jprovider, ids[p].getId());
jalview.datamodel.SequenceI[] seq = new jalview.datamodel.SequenceI[]
{
// create a new Jmol window
String state = ids[p].getStructureState(s).getContent();
-
- StringBuffer newFileLoc = new StringBuffer(state.substring(
+ StringBuffer newFileLoc=null;
+ if (state.indexOf("load")>-1) {
+ newFileLoc = new StringBuffer(state.substring(
0, state.indexOf("\"", state.indexOf("load")) + 1));
newFileLoc.append(jpdb.getFile());
newFileLoc.append(state.substring(state.indexOf("\"", state
.indexOf("load \"") + 6)));
-
- new AppJmol(pdbFile, ids[p].getId(), seq, af.alignPanel,
- newFileLoc.toString(), new java.awt.Rectangle(x, y,
+ } else {
+ System.err.println("Ignoring incomplete Jmol state for PDB "+ids[p].getId());
+
+ newFileLoc = new StringBuffer(state);
+ newFileLoc.append("; load \"");
+ newFileLoc.append(jpdb.getFile());
+ newFileLoc.append("\";");
+ }
+
+ if (newFileLoc!=null) {
+ new AppJmol(pdbFile, ids[p].getId(), seq, af.alignPanel,
+ newFileLoc.toString(), new java.awt.Rectangle(x, y,
width, height), sviewid);
+ }
}
else
SequenceI[] dsseqs = new SequenceI[dseqs.size()];
dseqs.copyInto(dsseqs);
ds = new jalview.datamodel.Alignment(dsseqs);
+ debug("Created new dataset "+vamsasSet.getDatasetId()+" for alignment "+System.identityHashCode(al));
addDatasetRef(vamsasSet.getDatasetId(), ds);
}
// set the dataset for the newly imported alignment.
}
}
+ private void debug(String string)
+ {
+ debug(string,null);
+ }
+ private void debug(String msg, Exception e)
+ {
+ if (Cache.log != null)
+ {
+ if (e != null)
+ {
+ Cache.log.debug(msg, e);
+ }
+ else
+ {
+ Cache.log.debug(msg);
+ }
+ }
+ else
+ {
+ System.err.println("Warning: " + msg);
+ if (e != null)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
/**
* set the object to ID mapping tables used to write/recover objects and XML
* ID strings for the jalview project. If external tables are provided then