Colour PDB by sequence
authoramwaterhouse <Andrew Waterhouse>
Thu, 10 Nov 2005 11:00:35 +0000 (11:00 +0000)
committeramwaterhouse <Andrew Waterhouse>
Thu, 10 Nov 2005 11:00:35 +0000 (11:00 +0000)
src/MCview/PDBChain.java
src/MCview/PDBfile.java

index 192156e..86755dd 100755 (executable)
@@ -230,22 +230,29 @@ public class PDBChain {
         }\r
     }\r
 \r
-    public void colourBySequence(jalview.gui.AlignViewport av, Sequence seq) {\r
-        jalview.gui.SequenceRenderer sr = new jalview.gui.SequenceRenderer(av);\r
+    public void colourBySequence(jalview.gui.SequenceRenderer sr,\r
+                                 jalview.gui.FeatureRenderer fr)\r
+    {\r
 \r
-        for (int i = 0; i < bonds.size(); i++) {\r
+        for (int i = 0; i < bonds.size(); i++)\r
+        {\r
             Bond tmp = (Bond) bonds.elementAt(i);\r
 \r
-            try {\r
                 if ((tmp.at1.resNumber >= ((offset + pdbstart) - 1)) &&\r
-                        (tmp.at1.resNumber <= ((offset + pdbend) - 1))) {\r
+                        (tmp.at1.resNumber <= ((offset + pdbend) - 1)))\r
+                    {\r
                     int pos = seqstart +\r
                         (tmp.at1.resNumber - pdbstart - offset);\r
-                    int index = seq.findIndex(pos);\r
 \r
-                    tmp.startCol = sr.getResidueBoxColour(av.getGlobalColourScheme(),\r
-                            seq, index);\r
-                } else {\r
+\r
+                    int index = sequence.findIndex(pos);\r
+\r
+                    tmp.startCol = sr.findSequenceColour(Color.gray, sequence,  index);\r
+\r
+                    tmp.startCol = fr.findFeatureColour(tmp.startCol, sequence, index);\r
+\r
+                } else\r
+                {\r
                     tmp.startCol = Color.gray;\r
                 }\r
 \r
@@ -253,17 +260,15 @@ public class PDBChain {
                         (tmp.at2.resNumber <= ((pdbend + offset) - 1))) {\r
                     int pos = seqstart +\r
                         (tmp.at2.resNumber - pdbstart - offset);\r
-                    int index = seq.findIndex(pos);\r
+                    int index = sequence.findIndex(pos);\r
 \r
-                    tmp.endCol = sr.getResidueBoxColour(av.getGlobalColourScheme(),\r
-                            seq, index);\r
-                } else {\r
+                   tmp.endCol = sr.findSequenceColour(Color.gray, sequence, index);\r
+                   tmp.endCol = fr.findFeatureColour( tmp.endCol, sequence, index);\r
+                }\r
+                else\r
+                {\r
                     tmp.endCol = Color.gray;\r
                 }\r
-            } catch (Exception e) {\r
-                tmp.startCol = Color.lightGray;\r
-                tmp.endCol = Color.lightGray;\r
-            }\r
         }\r
     }\r
 \r
index f97216b..ae1e4ec 100755 (executable)
@@ -97,11 +97,6 @@ public class PDBfile extends jalview.io.FileParse {
 \r
         makeResidueList();\r
         makeCaBondList();\r
-\r
-        //    for (int i=0; i < chains.size() ; i++) {\r
-        //  String pog = ((PDBChain)chains.elementAt(i)).print();\r
-        //  System.out.println(pog);\r
-        // }\r
     }\r
 \r
     public void makeResidueList() {\r
@@ -139,12 +134,11 @@ public class PDBfile extends jalview.io.FileParse {
         }\r
     }\r
 \r
-    public void colourBySequence(Sequence seq) {\r
-        //SMJS TODO\r
-        //    int max = seq.maxchain;\r
-        //    if (seq.maxchain != -1) {\r
-        //      ((PDBChain)chains.elementAt(max)).colourBySequence(seq);\r
-        //    }\r
+    public void colourBySequence(jalview.gui.SequenceRenderer sr,\r
+                                 jalview.gui.FeatureRenderer fr) {\r
+            for (int i = 0; i < chains.size(); i++) {\r
+              ((PDBChain)chains.elementAt(i)).colourBySequence(sr,fr);\r
+            }\r
     }\r
 \r
     public void setChainColours() {\r