git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-1919 Added improvement to ensure consistence of annotations parsed via JmolParser...
[jalview.git]
/
src
/
jalview
/
ext
/
jmol
/
JalviewJmolBinding.java
diff --git
a/src/jalview/ext/jmol/JalviewJmolBinding.java
b/src/jalview/ext/jmol/JalviewJmolBinding.java
index
ed0b950
..
2ccf118
100644
(file)
--- a/
src/jalview/ext/jmol/JalviewJmolBinding.java
+++ b/
src/jalview/ext/jmol/JalviewJmolBinding.java
@@
-28,6
+28,7
@@
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
import jalview.io.AppletFormatAdapter;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
import jalview.io.AppletFormatAdapter;
+import jalview.io.StructureFile;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.ResidueProperties;
import jalview.structure.AtomSpec;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.ResidueProperties;
import jalview.structure.AtomSpec;
@@
-56,18
+57,12
@@
import org.jmol.api.JmolStatusListener;
import org.jmol.api.JmolViewer;
import org.jmol.c.CBK;
import org.jmol.script.T;
import org.jmol.api.JmolViewer;
import org.jmol.c.CBK;
import org.jmol.script.T;
-import org.jmol.viewer.JC;
import org.jmol.viewer.Viewer;
public abstract class JalviewJmolBinding extends AAStructureBindingModel
implements JmolStatusListener, JmolSelectionListener,
ComponentListener
{
import org.jmol.viewer.Viewer;
public abstract class JalviewJmolBinding extends AAStructureBindingModel
implements JmolStatusListener, JmolSelectionListener,
ComponentListener
{
- /*
- * state flag used to check if the Jmol viewer's paint method can be called
- */
- private boolean finishedInit = false;
-
boolean allChainsSelected = false;
/*
boolean allChainsSelected = false;
/*
@@
-174,12
+169,9
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
public void closeViewer()
{
public void closeViewer()
{
- viewer.acm.setModeMouse(JC.MOUSE_NONE);
// remove listeners for all structures in viewer
getSsm().removeStructureViewerListener(this, this.getPdbFile());
// remove listeners for all structures in viewer
getSsm().removeStructureViewerListener(this, this.getPdbFile());
- // and shut down jmol
- viewer.evalStringQuiet("zap");
- viewer.setJmolStatusListener(null);
+ viewer.dispose();
lastCommand = null;
viewer = null;
releaseUIResources();
lastCommand = null;
viewer = null;
releaseUIResources();
@@
-236,10
+228,9
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
public void superposeStructures(AlignmentI alignment, int refStructure,
ColumnSelection hiddenCols)
{
public void superposeStructures(AlignmentI alignment, int refStructure,
ColumnSelection hiddenCols)
{
- superposeStructures(new AlignmentI[]
- { alignment }, new int[]
- { refStructure }, new ColumnSelection[]
- { hiddenCols });
+ superposeStructures(new AlignmentI[] { alignment },
+ new int[] { refStructure },
+ new ColumnSelection[] { hiddenCols });
}
/**
}
/**
@@
-259,8
+250,17
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
public void superposeStructures(AlignmentI[] _alignment,
int[] _refStructure, ColumnSelection[] _hiddenCols)
{
public void superposeStructures(AlignmentI[] _alignment,
int[] _refStructure, ColumnSelection[] _hiddenCols)
{
+ while (viewer.isScriptExecuting())
+ {
+ try
+ {
+ Thread.sleep(10);
+ } catch (InterruptedException i)
+ {
+ }
+ ;
+ }
String[] files = getPdbFile();
String[] files = getPdbFile();
-
if (!waitForFileLoad(files))
{
return;
if (!waitForFileLoad(files))
{
return;
@@
-272,7
+272,7
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
String nSeconds = " ";
if (files.length > 10)
{
String nSeconds = " ";
if (files.length > 10)
{
- nSeconds = " 0.00001 ";
+ nSeconds = " 0.005 ";
}
else
{
}
else
{
@@
-281,7
+281,7
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
}
// see JAL-1345 - should really automatically turn off the animation for
// large numbers of structures, but Jmol doesn't seem to allow that.
}
// see JAL-1345 - should really automatically turn off the animation for
// large numbers of structures, but Jmol doesn't seem to allow that.
- nSeconds = " ";
+ // nSeconds = " ";
// union of all aligned positions are collected together.
for (int a = 0; a < _alignment.length; a++)
{
// union of all aligned positions are collected together.
for (int a = 0; a < _alignment.length; a++)
{
@@
-454,8
+454,7
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
+ selectioncom.toString() + "); cartoons; ");
// selcom.append("; ribbons; ");
String cmdString = command.toString();
+ selectioncom.toString() + "); cartoons; ");
// selcom.append("; ribbons; ");
String cmdString = command.toString();
- System.out
-.println("Superimpose command(s):\n" + cmdString);
+ System.out.println("Superimpose command(s):\n" + cmdString);
evalStateCommand(cmdString);
}
evalStateCommand(cmdString);
}
@@
-478,7
+477,6
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
jmolHistory(false);
if (lastCommand == null || !lastCommand.equals(command))
{
jmolHistory(false);
if (lastCommand == null || !lastCommand.equals(command))
{
- System.out.println(command);
viewer.evalStringQuiet(command + "\n");
}
jmolHistory(true);
viewer.evalStringQuiet(command + "\n");
}
jmolHistory(true);
@@
-513,7
+511,8
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
}
AlignmentI alignment = alignmentv.getAlignment();
}
AlignmentI alignment = alignmentv.getAlignment();
- for (jalview.structure.StructureMappingcommandSet cpdbbyseq : getColourBySequenceCommands(files, sr, fr, alignment))
+ for (jalview.structure.StructureMappingcommandSet cpdbbyseq : getColourBySequenceCommands(
+ files, sr, fr, alignment))
{
for (String cbyseq : cpdbbyseq.commands)
{
{
for (String cbyseq : cpdbbyseq.commands)
{
@@
-533,10
+532,8
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
String[] files, SequenceRenderer sr, FeatureRenderer fr,
AlignmentI alignment)
{
String[] files, SequenceRenderer sr, FeatureRenderer fr,
AlignmentI alignment)
{
- return JmolCommands
- .getColourBySequenceCommand(getSsm(), files, getSequence(), sr,
- fr,
- alignment);
+ return JmolCommands.getColourBySequenceCommand(getSsm(), files,
+ getSequence(), sr, fr, alignment);
}
/**
}
/**
@@
-552,6
+549,7
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
System.out.println("JMOL CREATE IMAGE");
}
System.out.println("JMOL CREATE IMAGE");
}
+ @Override
public String createImage(String fileName, String type,
Object textOrBytes, int quality)
{
public String createImage(String fileName, String type,
Object textOrBytes, int quality)
{
@@
-559,6
+557,7
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
return null;
}
return null;
}
+ @Override
public String eval(String strEval)
{
// System.out.println(strEval);
public String eval(String strEval)
{
// System.out.println(strEval);
@@
-569,11
+568,13
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
// End StructureListener
// //////////////////////////
// End StructureListener
// //////////////////////////
+ @Override
public float[][] functionXY(String functionName, int x, int y)
{
return null;
}
public float[][] functionXY(String functionName, int x, int y)
{
return null;
}
+ @Override
public float[][][] functionXYZ(String functionName, int nx, int ny, int nz)
{
// TODO Auto-generated method stub
public float[][][] functionXYZ(String functionName, int nx, int ny, int nz)
{
// TODO Auto-generated method stub
@@
-589,8
+590,7
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
}
// TODO: verify atomIndex is selecting correct model.
// return new Color(viewer.getAtomArgb(atomIndex)); Jmol 12.2.4
}
// TODO: verify atomIndex is selecting correct model.
// return new Color(viewer.getAtomArgb(atomIndex)); Jmol 12.2.4
- int colour = viewer.ms.at[atomIndex]
- .atomPropertyInt(T.color);
+ int colour = viewer.ms.at[atomIndex].atomPropertyInt(T.color);
return new Color(colour);
}
return new Color(colour);
}
@@
-668,6
+668,7
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
// applet path with docroot - discard as format won't match pdbfile
mset[0] = m;
}
// applet path with docroot - discard as format won't match pdbfile
mset[0] = m;
}
+ _modelFileNameMap[0] = 0; // filename index for first model is always 0.
}
int j = 1;
for (int i = 1; i < mset.length; i++)
}
int j = 1;
for (int i = 1; i < mset.length; i++)
@@
-737,6
+738,11
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
{
if (atoms != null)
{
{
if (atoms != null)
{
+ if (resetLastRes.length() > 0)
+ {
+ viewer.evalStringQuiet(resetLastRes.toString());
+ resetLastRes.setLength(0);
+ }
for (AtomSpec atom : atoms)
{
highlightAtom(atom.getAtomIndex(), atom.getPdbResNum(),
for (AtomSpec atom : atoms)
{
highlightAtom(atom.getAtomIndex(), atom.getPdbResNum(),
@@
-768,17
+774,10
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
}
jmolHistory(false);
}
jmolHistory(false);
- // if (!pdbfile.equals(pdbentry.getFile()))
- // return;
- if (resetLastRes.length() > 0)
- {
- viewer.evalStringQuiet(resetLastRes.toString());
- }
StringBuilder cmd = new StringBuilder(64);
cmd.append("select " + pdbResNum); // +modelNum
StringBuilder cmd = new StringBuilder(64);
cmd.append("select " + pdbResNum); // +modelNum
- resetLastRes.setLength(0);
resetLastRes.append("select " + pdbResNum); // +modelNum
cmd.append(":");
resetLastRes.append("select " + pdbResNum); // +modelNum
cmd.append(":");
@@
-887,8
+886,7
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
pdbfilename = modelFileNames[_mp];
if (pdbfilename == null)
{
pdbfilename = modelFileNames[_mp];
if (pdbfilename == null)
{
- pdbfilename = new File(
- viewer.ms.getModelFileName(mnumber))
+ pdbfilename = new File(viewer.ms.getModelFileName(mnumber))
.getAbsolutePath();
}
.getAbsolutePath();
}
@@
-943,7
+941,7
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
String mdlString = "";
if ((p = strInfo.indexOf(":")) > -1)
{
String mdlString = "";
if ((p = strInfo.indexOf(":")) > -1)
{
- picked += strInfo.substring(p + 1, strInfo.indexOf("."));
+ picked += strInfo.substring(p, strInfo.indexOf("."));
}
if ((p = strInfo.indexOf("/")) > -1)
}
if ((p = strInfo.indexOf("/")) > -1)
@@
-1120,7
+1118,7
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
{
String fileName = modelfilenames[modelnum];
boolean foundEntry = false;
{
String fileName = modelfilenames[modelnum];
boolean foundEntry = false;
- MCview.PDBfile pdb = null;
+ StructureFile pdb = null;
String pdbfile = null;
// model was probably loaded inline - so check the pdb file hashcode
if (loadedInline)
String pdbfile = null;
// model was probably loaded inline - so check the pdb file hashcode
if (loadedInline)
@@
-1131,8
+1129,8
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
pdbfile = viewer.getData("" + (1 + _modelFileNameMap[modelnum])
+ ".0", "PDB");
}
pdbfile = viewer.getData("" + (1 + _modelFileNameMap[modelnum])
+ ".0", "PDB");
}
- // search pdbentries and sequences to find correct pdbentry for this
- // model
+ // search pdbentries and sequences to find correct pdbentry for this
+ // model
for (int pe = 0; pe < getPdbCount(); pe++)
{
boolean matches = false;
for (int pe = 0; pe < getPdbCount(); pe++)
{
boolean matches = false;
@@
-1143,7
+1141,7
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
{
pdb = getSsm().setMapping(getSequence()[pe], getChains()[pe],
pdbfile, AppletFormatAdapter.PASTE);
{
pdb = getSsm().setMapping(getSequence()[pe], getChains()[pe],
pdbfile, AppletFormatAdapter.PASTE);
- getPdbEntry(modelnum).setFile("INLINE" + pdb.id);
+ getPdbEntry(modelnum).setFile("INLINE" + pdb.getId());
matches = true;
foundEntry = true;
}
matches = true;
foundEntry = true;
}
@@
-1182,10
+1180,10
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
if (matches)
{
// add an entry for every chain in the model
if (matches)
{
// add an entry for every chain in the model
- for (int i = 0; i < pdb.chains.size(); i++)
+ for (int i = 0; i < pdb.getChains().size(); i++)
{
{
- String chid = new String(pdb.id + ":"
- + pdb.chains.elementAt(i).id);
+ String chid = new String(pdb.getId() + ":"
+ + pdb.getChains().elementAt(i).id);
chainFile.put(chid, fileName);
chainNames.addElement(chid);
}
chainFile.put(chid, fileName);
chainNames.addElement(chid);
}
@@
-1217,7
+1215,7
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
// }
if (!isLoadingFromArchive())
{
// }
if (!isLoadingFromArchive())
{
- viewer.evalStringQuiet("model 0; select backbone;restrict;cartoon;wireframe off;spacefill off");
+ viewer.evalStringQuiet("model *; select backbone;restrict;cartoon;wireframe off;spacefill off");
}
// register ourselves as a listener and notify the gui that it needs to
// update itself.
}
// register ourselves as a listener and notify the gui that it needs to
// update itself.
@@
-1265,6
+1263,7
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
*/
public abstract void sendConsoleMessage(String strStatus);
*/
public abstract void sendConsoleMessage(String strStatus);
+ @Override
public void setCallbackFunction(String callbackType,
String callbackFunction)
{
public void setCallbackFunction(String callbackType,
String callbackFunction)
{
@@
-1402,16
+1401,6
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
return null;
}
return null;
}
- public boolean isFinishedInit()
- {
- return finishedInit;
- }
-
- public void setFinishedInit(boolean finishedInit)
- {
- this.finishedInit = finishedInit;
- }
-
/**
*
*/
/**
*
*/
@@
-1466,4
+1455,3
@@
public abstract class JalviewJmolBinding extends AAStructureBindingModel
showConsole(false);
}
}
showConsole(false);
}
}
-