private Map<String, String> chainFile;
- private StringBuffer eval = new StringBuffer();
-
public String fileLoadingError;
/*
private boolean loadedInline;
/**
+ * current set of model filenames loaded
+ */
+ String[] modelFileNames = null;
+
+ String lastMousedOverAtomSpec;
+
+ private List<String> lastReply;
+
+ /**
* Open a PDB structure file in Chimera and set up mappings from Jalview.
*
* We check if the PDB model id is already loaded in Chimera, if so don't
}
/**
- * current set of model filenames loaded
- */
- String[] modelFileNames = null;
-
-
- StringBuffer resetLastRes = new StringBuffer();
-
- private List<String> lastReply;
-
- /**
* Constructor
*
* @param ssm
public abstract SequenceRenderer getSequenceRenderer(
AlignmentViewPanel alignment);
- // jmol/ssm only
+ /**
+ * Construct and send a command to highlight an atom.
+ *
+ * <pre>
+ * Done by generating a command like (to 'highlight' position 44)
+ * ~select #0:43.C;select #0:44.C
+ * Note this removes the selection from the previous position.
+ * </pre>
+ */
public void highlightAtom(int atomIndex, int pdbResNum, String chain,
String pdbfile)
{
List<ChimeraModel> cms = chimeraMaps.get(pdbfile);
if (cms != null)
{
- int mdlNum = cms.get(0).getModelNumber();
-
- viewerCommandHistory(false);
- // viewer.stopListening();
- if (resetLastRes.length() > 0)
+ StringBuilder sb = new StringBuilder();
+ sb.append(" #" + cms.get(0).getModelNumber());
+ sb.append(":" + pdbResNum);
+ if (!chain.equals(" "))
{
- eval.setLength(0);
- eval.append(resetLastRes.toString() + ";");
+ sb.append("." + chain);
}
+ String atomSpec = sb.toString();
- eval.append("display "); // +modelNum
-
- resetLastRes.setLength(0);
- resetLastRes.append("~display ");
+ StringBuilder command = new StringBuilder(32);
+ if (lastMousedOverAtomSpec != null)
{
- eval.append(" #" + (mdlNum));
- resetLastRes.append(" #" + (mdlNum));
+ command.append("~select " + lastMousedOverAtomSpec + ";");
}
- // complete select string
-
- eval.append(":" + pdbResNum);
- resetLastRes.append(":" + pdbResNum);
- if (!chain.equals(" "))
+ viewerCommandHistory(false);
+ String cmd = command.toString();
+ cmd = "select " + atomSpec;
+ if (cmd.length() > 0)
{
- eval.append("." + chain);
- resetLastRes.append("." + chain);
+ viewer.sendChimeraCommand(cmd, false);
}
-
- viewer.sendChimeraCommand(eval.toString(), false);
viewerCommandHistory(true);
- // viewer.startListening();
+ this.lastMousedOverAtomSpec = atomSpec;
}
}
return chainNames;
}
-}
\ No newline at end of file
+}