JAL-2632 corrected lookup of residue colour
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 12 Dec 2016 12:20:44 +0000 (12:20 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 12 Dec 2016 12:20:44 +0000 (12:20 +0000)
src/jalview/ext/jmol/JalviewJmolBinding.java
src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java

index 2d2d10e..38ce476 100644 (file)
@@ -1300,10 +1300,12 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
     command.append("select *;color white;");
     List<String> residueSet = ResidueProperties.getResidues(isNucleotide(),
             false);
-    for (String res : residueSet)
+    for (String resName : residueSet)
     {
-      Color col = cs.findColour(res.charAt(0));
-      command.append("select " + res + ";color[" + col.getRed() + ","
+      char res = resName.length() == 3 ? ResidueProperties
+              .getSingleCharacterCode(resName) : resName.charAt(0);
+      Color col = cs.findColour(res);
+      command.append("select " + resName + ";color[" + col.getRed() + ","
               + col.getGreen() + "," + col.getBlue() + "];");
     }
 
index 262b8a2..8354410 100644 (file)
@@ -992,12 +992,14 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel
 
     List<String> residueSet = ResidueProperties.getResidues(isNucleotide(),
             false);
-    for (String res : residueSet)
+    for (String resName : residueSet)
     {
-      Color col = cs.findColour(res.charAt(0));
+      char res = resName.length() == 3 ? ResidueProperties
+              .getSingleCharacterCode(resName) : resName.charAt(0);
+      Color col = cs.findColour(res);
       command.append("color " + col.getRed() / normalise + ","
               + col.getGreen() / normalise + "," + col.getBlue()
-              / normalise + " ::" + res + ";");
+              / normalise + " ::" + resName + ";");
     }
 
     sendAsynchronousCommand(command.toString(), COLOURING_CHIMERA);