git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8fae74e
)
JAL-1333 more superposition debugging and deadlock avoidance
author
j.procter@dundee.ac.uk
<jprocter@jims-mbp-2.home>
Tue, 22 Jul 2014 18:37:34 +0000
(19:37 +0100)
committer
j.procter@dundee.ac.uk
<jprocter@jims-mbp-2.home>
Tue, 22 Jul 2014 18:37:34 +0000
(19:37 +0100)
src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java
patch
|
blob
|
history
src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java
patch
|
blob
|
history
src/jalview/gui/ChimeraViewFrame.java
patch
|
blob
|
history
diff --git
a/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java
b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java
index
95ea0d7
..
c0b3a39
100644
(file)
--- a/
src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java
+++ b/
src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java
@@
-21,13
+21,13
@@
import ext.edu.ucsf.rbvi.strucviz2.port.ListenerThreads;
public class ChimeraManager
{
public class ChimeraManager
{
- static private Process chimera;
+ private Process chimera;
- static private ListenerThreads chimeraListenerThreads;
+ private ListenerThreads chimeraListenerThreads;
- static private Map<Integer, ChimeraModel> currentModelsMap;
+ private Map<Integer, ChimeraModel> currentModelsMap;
- private static Logger logger = LoggerFactory
+ private Logger logger = LoggerFactory
.getLogger(ext.edu.ucsf.rbvi.strucviz2.ChimeraManager.class);
private StructureManager structureManager;
.getLogger(ext.edu.ucsf.rbvi.strucviz2.ChimeraManager.class);
private StructureManager structureManager;
@@
-38,7
+38,7
@@
public class ChimeraManager
chimera = null;
chimeraListenerThreads = null;
currentModelsMap = new HashMap<Integer, ChimeraModel>();
chimera = null;
chimeraListenerThreads = null;
currentModelsMap = new HashMap<Integer, ChimeraModel>();
-
+
}
public List<ChimeraModel> getChimeraModels(String modelName)
}
public List<ChimeraModel> getChimeraModels(String modelName)
@@
-627,7
+627,9
@@
public class ChimeraManager
}
return values;
}
}
return values;
}
- private volatile boolean busy=false;
+
+ private volatile boolean busy = false;
+
/**
* Send a command to Chimera.
*
/**
* Send a command to Chimera.
*
@@
-647,11
+649,15
@@
public class ChimeraManager
}
while (busy)
{
}
while (busy)
{
- try {
+ try
+ {
Thread.sleep(25);
Thread.sleep(25);
- } catch (InterruptedException q) {};
+ } catch (InterruptedException q)
+ {
+ }
+ ;
}
}
- busy=true;
+ busy = true;
chimeraListenerThreads.clearResponse(command);
String text = command.concat("\n");
// System.out.println("send command to chimera: " + text);
chimeraListenerThreads.clearResponse(command);
String text = command.concat("\n");
// System.out.println("send command to chimera: " + text);
@@
-667,16
+673,16
@@
public class ChimeraManager
logger.warn("Unable to execute command: " + text);
logger.warn("Exiting...");
clearOnChimeraExit();
logger.warn("Unable to execute command: " + text);
logger.warn("Exiting...");
clearOnChimeraExit();
- busy=false;
+ busy = false;
return null;
}
if (!reply)
{
return null;
}
if (!reply)
{
- busy=false;
+ busy = false;
return null;
}
List<String> rsp = chimeraListenerThreads.getResponse(command);
return null;
}
List<String> rsp = chimeraListenerThreads.getResponse(command);
- busy=false;
+ busy = false;
return rsp;
}
return rsp;
}
@@
-685,4
+691,9
@@
public class ChimeraManager
return structureManager;
}
return structureManager;
}
+ public boolean isBusy()
+ {
+ return busy;
+ }
+
}
}
diff --git
a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java
b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java
index
5fc3a6f
..
fcf89af
100644
(file)
--- a/
src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java
+++ b/
src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java
@@
-326,7
+326,7
@@
public abstract class JalviewChimeraBinding extends
if (cmd.length() > 0)
cmd.setLength(cmd.length() - 4);
evalStateCommand("~display #*; ~ribbon #*; ribbon " + cmd + ";focus "
if (cmd.length() > 0)
cmd.setLength(cmd.length() - 4);
evalStateCommand("~display #*; ~ribbon #*; ribbon " + cmd + ";focus "
- + cmd);
+ + cmd,false);
}
public void closeViewer()
}
public void closeViewer()
@@
-353,14
+353,14
@@
public abstract class JalviewChimeraBinding extends
// TODO: colour by chain should colour each chain distinctly across all
// visible models
// TODO: http://issues.jalview.org/browse/JAL-628
// TODO: colour by chain should colour each chain distinctly across all
// visible models
// TODO: http://issues.jalview.org/browse/JAL-628
- evalStateCommand("select *;color chain");
+ evalStateCommand("select *;color chain",false);
}
public void colourByCharge()
{
colourBySequence = false;
evalStateCommand("colour *;color white;select ASP,GLU;color red;"
}
public void colourByCharge()
{
colourBySequence = false;
evalStateCommand("colour *;color white;select ASP,GLU;color red;"
- + "select LYS,ARG;color blue;select CYS;color yellow");
+ + "select LYS,ARG;color blue;select CYS;color yellow", false);
}
/**
}
/**
@@
-408,7
+408,7
@@
public abstract class JalviewChimeraBinding extends
int[] _refStructure, ColumnSelection[] _hiddenCols)
{
assert (_alignment.length == _refStructure.length && _alignment.length != _hiddenCols.length);
int[] _refStructure, ColumnSelection[] _hiddenCols)
{
assert (_alignment.length == _refStructure.length && _alignment.length != _hiddenCols.length);
-
+ StringBuffer allComs = new StringBuffer(); // whole shebang for superposition
String[] files = getPdbFile();
// check to see if we are still waiting for Jmol files
long starttime = System.currentTimeMillis();
String[] files = getPdbFile();
// check to see if we are still waiting for Jmol files
long starttime = System.currentTimeMillis();
@@
-483,6
+483,7
@@
public abstract class JalviewChimeraBinding extends
// reference structure - all others are superposed in it
String[] targetC = new String[files.length];
String[] chainNames = new String[files.length];
// reference structure - all others are superposed in it
String[] targetC = new String[files.length];
String[] chainNames = new String[files.length];
+ String[] atomS = new String[files.length];
for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
{
StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]);
for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
{
StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]);
@@
-550,6
+551,7
@@
public abstract class JalviewChimeraBinding extends
}
chainNames[pdbfnum] = mapping[m].getPdbId()
+ targetC[pdbfnum];
}
chainNames[pdbfnum] = mapping[m].getPdbId()
+ targetC[pdbfnum];
+ atomS[pdbfnum] = asp.getRNA()!=null ? "P" : "CA";
// move on to next pdb file
s = sequence[pdbfnum].length;
break;
// move on to next pdb file
s = sequence[pdbfnum].length;
break;
@@
-590,8
+592,7
@@
public abstract class JalviewChimeraBinding extends
{
molsel.append((run ? "" : ":") + lpos);
molsel.append(chainCd);
{
molsel.append((run ? "" : ":") + lpos);
molsel.append(chainCd);
- // molsel.append("} {");
- // molsel.append(",");
+ molsel.append(",");
}
}
else
}
}
else
@@
-620,12
+621,11
@@
public abstract class JalviewChimeraBinding extends
{
selcom[pdbfnum] = molsel.toString();
selectioncom.append("#" + pdbfnum);
{
selcom[pdbfnum] = molsel.toString();
selectioncom.append("#" + pdbfnum);
- selectioncom.append(selcom[pdbfnum].substring(1,
- selcom[pdbfnum].length() - 1));
+ selectioncom.append(selcom[pdbfnum]);
selectioncom.append(" ");
if (pdbfnum < files.length - 1)
{
selectioncom.append(" ");
if (pdbfnum < files.length - 1)
{
- selectioncom.append("|");
+ selectioncom.append("| ");
}
}
else
}
}
else
@@
-641,24
+641,29
@@
public abstract class JalviewChimeraBinding extends
{
continue;
}
{
continue;
}
- command.append("match ");
+ if (command.length()>0)
+ {
+ command.append(";");
+ }
+ command.append("match");
// form the matched pair strings
for (int s = 0; s < 2; s++)
{
// form the matched pair strings
for (int s = 0; s < 2; s++)
{
+ command.append(" #"+(s == 0 ? pdbfnum : refStructure)+".1");
+ // note - need to select on first model, otherwise it all goes wrong!
command.append(selcom[(s == 0 ? pdbfnum : refStructure)]);
command.append(selcom[(s == 0 ? pdbfnum : refStructure)]);
+ command.append("@"+atomS[(s == 0 ? pdbfnum : refStructure)]); // match on backbone alpha/polyphosphate
}
}
if (selectioncom.length() > 0)
{
System.out.println("Select regions:\n" + selectioncom.toString());
}
}
if (selectioncom.length() > 0)
{
System.out.println("Select regions:\n" + selectioncom.toString());
- evalStateCommand("~display *; trace *; ribbons "
- + selectioncom.toString() + "");
- // selcom.append("; ribbons; ");
System.out
.println("Superimpose command(s):\n" + command.toString());
System.out
.println("Superimpose command(s):\n" + command.toString());
-
- evalStateCommand(command.toString());
+ allComs.append("~display all; chain @CA|P; ribbon "
+ + selectioncom.toString() + ";"+command.toString());
+ // selcom.append("; ribbons; ");
}
}
if (selectioncom.length() > 0)
}
}
if (selectioncom.length() > 0)
@@
-668,10
+673,12
@@
public abstract class JalviewChimeraBinding extends
selectioncom.setLength(selectioncom.length() - 1);
}
System.out.println("Select regions:\n" + selectioncom.toString());
selectioncom.setLength(selectioncom.length() - 1);
}
System.out.println("Select regions:\n" + selectioncom.toString());
- evalStateCommand("~display *; trace *; ribbons "
+ allComs.append("; ~display all; chain @CA|P; ribbon "
+ selectioncom.toString() + "");
// evalStateCommand("select *; backbone; select "+selcom.toString()+"; cartoons; center "+selcom.toString());
+ selectioncom.toString() + "");
// evalStateCommand("select *; backbone; select "+selcom.toString()+"; cartoons; center "+selcom.toString());
+ evalStateCommand(allComs.toString(),false);
}
}
+
}
private void checkLaunched()
}
private void checkLaunched()
@@
-686,7
+693,7
@@
public abstract class JalviewChimeraBinding extends
}
}
}
}
- public void evalStateCommand(final String command)
+ public void evalStateCommand(final String command, boolean resp)
{
viewerCommandHistory(false);
checkLaunched();
{
viewerCommandHistory(false);
checkLaunched();
@@
-697,7
+704,7
@@
public abstract class JalviewChimeraBinding extends
// @Override
// public void run()
// {
// @Override
// public void run()
// {
- lastReply = viewer.sendChimeraCommand(command, true);
+ lastReply = viewer.sendChimeraCommand(command, resp);
if (debug)
{
log("Response from command ('" + command + "') was:\n"
if (debug)
{
log("Response from command ('" + command + "') was:\n"
@@
-748,10
+755,23
@@
public abstract class JalviewChimeraBinding extends
alignment))
for (String cbyseq : cpdbbyseq.commands)
{
alignment))
for (String cbyseq : cpdbbyseq.commands)
{
- evalStateCommand(cbyseq);
+ waitForChimera();
+ evalStateCommand(cbyseq, false);
+ waitForChimera();
}
}
}
}
+ private void waitForChimera()
+ {
+ while (viewer.isBusy())
+ {
+ try {
+ Thread.sleep(15);
+ } catch (InterruptedException q)
+ {}
+ }
+ }
+
public boolean isColourBySequence()
{
return colourBySequence;
public boolean isColourBySequence()
{
return colourBySequence;
@@
-899,7
+919,7
@@
public abstract class JalviewChimeraBinding extends
int mdlNum = cms.get(0).getModelNumber();
viewerCommandHistory(false);
int mdlNum = cms.get(0).getModelNumber();
viewerCommandHistory(false);
- viewer.stopListening();
+ // viewer.stopListening();
if (resetLastRes.length() > 0)
{
eval.setLength(0);
if (resetLastRes.length() > 0)
{
eval.setLength(0);
@@
-926,7
+946,7
@@
public abstract class JalviewChimeraBinding extends
viewer.sendChimeraCommand(eval.toString(), false);
viewerCommandHistory(true);
viewer.sendChimeraCommand(eval.toString(), false);
viewerCommandHistory(true);
- viewer.startListening();
+ // viewer.startListening();
}
}
}
}
@@
-1198,7
+1218,7
@@
public abstract class JalviewChimeraBinding extends
+ col.getGreen() + "," + col.getBlue() + "];");
}
+ col.getGreen() + "," + col.getBlue() + "];");
}
- evalStateCommand(command.toString());
+ evalStateCommand(command.toString(),false);
viewerCommandHistory(true);
}
viewerCommandHistory(true);
}
diff --git
a/src/jalview/gui/ChimeraViewFrame.java
b/src/jalview/gui/ChimeraViewFrame.java
index
815957f
..
10082eb
100644
(file)
--- a/
src/jalview/gui/ChimeraViewFrame.java
+++ b/
src/jalview/gui/ChimeraViewFrame.java
@@
-586,7
+586,7
@@
public class ChimeraViewFrame extends GStructureViewer implements Runnable,
{
command = "";
}
{
command = "";
}
- jmb.evalStateCommand(command);
+ jmb.evalStateCommand(command, false);
jmb.setFinishedInit(true);
}
jmb.setFinishedInit(true);
}
@@
-845,13
+845,13
@@
public class ChimeraViewFrame extends GStructureViewer implements Runnable,
// do superposition if asked to
if (alignAddedStructures)
{
// do superposition if asked to
if (alignAddedStructures)
{
- javax.swing.SwingUtilities.invokeLater(new Runnable()
+ new Thread(new Runnable()
{
public void run()
{
alignStructs_withAllAlignPanels();
}
{
public void run()
{
alignStructs_withAllAlignPanels();
}
- });
+ }).start();
alignAddedStructures = false;
}
addingStructures = false;
alignAddedStructures = false;
}
addingStructures = false;