String fileLoadingError;\r
boolean loadedInline;\r
PDBEntry pdbentry;\r
+ boolean colourBySequence = true;\r
\r
public AppletJmol(PDBEntry pdbentry,\r
SequenceI[] seq,\r
&& scriptWindow.isVisible())\r
{\r
viewer.evalString(inputLine.getText());\r
-\r
- history.append("\n"+inputLine.getText());\r
-\r
+ history.append("\n$ "+inputLine.getText());\r
inputLine.setText("");\r
}\r
\r
FeatureRenderer fr;\r
public void colourBySequence(AlignmentPanel ap)\r
{\r
+ if(!colourBySequence)\r
+ return;\r
+\r
+\r
StructureMapping[] mapping = ssm.getMapping(pdbentry.getFile());\r
\r
if (mapping.length < 1)\r
\r
StringBuffer command = new StringBuffer();\r
\r
+ int lastPos = -1;\r
for (int s = 0; s < sequence.length; s++)\r
{\r
for (int m = 0; m < mapping.length; m++)\r
int pos = mapping[m].getPDBResNum(\r
sequence[s].findPosition(r));\r
\r
- if (pos < 1)\r
+ if (pos < 1 || pos==lastPos)\r
+ continue;\r
+\r
+ lastPos = pos;\r
+\r
+ Color col = sr.getResidueBoxColour(sequence[s], r);\r
+\r
+ if (showFeatures)\r
+ col = fr.findFeatureColour(col, sequence[s], r);\r
+\r
+ if (command.toString().endsWith(":" + mapping[m].getChain()+\r
+ ";color["\r
+ + col.getRed() + ","\r
+ + col.getGreen() + ","\r
+ + col.getBlue() + "]"))\r
+ {\r
+ command = condenseCommand(command.toString(), pos);\r
continue;\r
+ }\r
\r
command.append(";select " + pos);\r
\r
command.append(":" + mapping[m].getChain());\r
}\r
\r
- Color col = sr.getResidueBoxColour(sequence[s], r);\r
-\r
- if (showFeatures)\r
- col = fr.findFeatureColour(col, sequence[s], r);\r
-\r
- command.append("; color ["\r
- + col.getRed() + ","\r
- + col.getGreen() + ","\r
- + col.getBlue() + "]");\r
+ command.append(";color["\r
+ + col.getRed() + ","\r
+ + col.getGreen() + ","\r
+ + col.getBlue() + "]");\r
\r
}\r
+ break;\r
}\r
}\r
}\r
viewer.evalStringQuiet(command.toString());\r
}\r
\r
+ StringBuffer condenseCommand(String command, int pos)\r
+ {\r
+\r
+ StringBuffer sb = new StringBuffer(command.substring(0, command.lastIndexOf("select")+7));\r
+\r
+ command = command.substring(sb.length());\r
+\r
+ String start;\r
+\r
+ if (command.indexOf("-") > -1)\r
+ {\r
+ start = command.substring(0,command.indexOf("-"));\r
+ }\r
+ else\r
+ {\r
+ start = command.substring(0, command.indexOf(":"));\r
+ }\r
+\r
+ sb.append(start+"-"+pos+command.substring(command.indexOf(":")));\r
+\r
+ return sb;\r
+ }\r
+\r
/////////////////////////////////\r
//JmolStatusListener\r
\r
}\r
\r
public void createImage(String file, String type, int quality)\r
- {\r
- System.out.println("JMOL CREATE IMAGE");\r
- }\r
+ {}\r
\r
public void setCallbackFunction(String callbackType,\r
String callbackFunction)\r
pdbentry.getFile(),\r
AppletFormatAdapter.PASTE);\r
pdbentry.setFile("INLINE"+pdb.id);\r
-\r
}\r
else\r
{\r
\r
public void sendConsoleMessage(String strStatus)\r
{\r
- // if (scriptWindow != null)\r
- // scriptWindow.sendConsoleMessage(strStatus);\r
+ if(history!=null && strStatus!=null\r
+ && !strStatus.equals("Script completed"))\r
+ {\r
+ history.append("\n"+strStatus);\r
+ }\r
}\r
\r
public void notifyScriptTermination(String strStatus, int msWalltime)\r
{\r
- // if (scriptWindow != null)\r
- // scriptWindow.notifyScriptTermination(strStatus, msWalltime);\r
+ // if (scriptWindow != null)\r
+ // scriptWindow.notifyScriptTermination(strStatus, msWalltime);\r
}\r
\r
public void handlePopupMenu(int x, int y)\r