/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2b1)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
import java.awt.Color;
import java.util.ArrayList;
-import java.util.Enumeration;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
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
}
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 command : cpdbbyseq.commands)
{
String[] files, SequenceRenderer sr, FeatureRenderer fr,
AlignmentI alignment)
{
- return ChimeraCommands
- .getColourBySequenceCommand(getSsm(), files, getSequence(), sr,
- fr,
- alignment);
+ return ChimeraCommands.getColourBySequenceCommand(getSsm(), files,
+ getSequence(), sr, fr, alignment);
}
/**
}
}
-
+
// End StructureListener
// //////////////////////////
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("~show " + lastMousedOverAtomSpec + ";");
}
- // complete select string
-
- eval.append(":" + pdbResNum);
- resetLastRes.append(":" + pdbResNum);
- if (!chain.equals(" "))
+ viewerCommandHistory(false);
+ command.append("show ").append(atomSpec);
+ String cmd = command.toString();
+ 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;
}
- String res;
int index;
Color col;
// Chimera expects RBG values in the range 0-1
final double normalise = 255D;
viewerCommandHistory(false);
// TODO: Switch between nucleotide or aa selection expressions
- Enumeration en = ResidueProperties.aa3Hash.keys();
StringBuilder command = new StringBuilder(128);
command.append("color white;");
- while (en.hasMoreElements())
+ for (String res : ResidueProperties.aa3Hash.keySet())
{
- res = en.nextElement().toString();
- index = ((Integer) ResidueProperties.aa3Hash.get(res)).intValue();
+ index = ResidueProperties.aa3Hash.get(res).intValue();
if (index > 20)
{
continue;