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;
chimera = null;
chimeraListenerThreads = null;
currentModelsMap = new HashMap<Integer, ChimeraModel>();
-
+
}
public List<ChimeraModel> getChimeraModels(String modelName)
}
return values;
}
- private volatile boolean busy=false;
+
+ private volatile boolean busy = false;
+
/**
* Send a command to Chimera.
*
}
while (busy)
{
- try {
+ try
+ {
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);
logger.warn("Unable to execute command: " + text);
logger.warn("Exiting...");
clearOnChimeraExit();
- busy=false;
+ busy = false;
return null;
}
if (!reply)
{
- busy=false;
+ busy = false;
return null;
}
List<String> rsp = chimeraListenerThreads.getResponse(command);
- busy=false;
+ busy = false;
return rsp;
}
return structureManager;
}
+ public boolean isBusy()
+ {
+ return busy;
+ }
+
}
if (cmd.length() > 0)
cmd.setLength(cmd.length() - 4);
evalStateCommand("~display #*; ~ribbon #*; ribbon " + cmd + ";focus "
- + cmd);
+ + cmd,false);
}
public void closeViewer()
// 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;"
- + "select LYS,ARG;color blue;select CYS;color yellow");
+ + "select LYS,ARG;color blue;select CYS;color yellow", false);
}
/**
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();
// 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]);
}
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;
{
molsel.append((run ? "" : ":") + lpos);
molsel.append(chainCd);
- // molsel.append("} {");
- // molsel.append(",");
+ molsel.append(",");
}
}
else
{
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("|");
+ selectioncom.append("| ");
}
}
else
{
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++)
{
+ 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("@"+atomS[(s == 0 ? pdbfnum : refStructure)]); // match on backbone alpha/polyphosphate
}
}
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());
-
- evalStateCommand(command.toString());
+ allComs.append("~display all; chain @CA|P; ribbon "
+ + selectioncom.toString() + ";"+command.toString());
+ // selcom.append("; ribbons; ");
}
}
if (selectioncom.length() > 0)
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());
+ evalStateCommand(allComs.toString(),false);
}
+
}
private void checkLaunched()
}
}
- public void evalStateCommand(final String command)
+ public void evalStateCommand(final String command, boolean resp)
{
viewerCommandHistory(false);
checkLaunched();
// @Override
// public void run()
// {
- lastReply = viewer.sendChimeraCommand(command, true);
+ lastReply = viewer.sendChimeraCommand(command, resp);
if (debug)
{
log("Response from command ('" + command + "') was:\n"
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;
int mdlNum = cms.get(0).getModelNumber();
viewerCommandHistory(false);
- viewer.stopListening();
+ // viewer.stopListening();
if (resetLastRes.length() > 0)
{
eval.setLength(0);
viewer.sendChimeraCommand(eval.toString(), false);
viewerCommandHistory(true);
- viewer.startListening();
+ // viewer.startListening();
}
}
+ col.getGreen() + "," + col.getBlue() + "];");
}
- evalStateCommand(command.toString());
+ evalStateCommand(command.toString(),false);
viewerCommandHistory(true);
}