From: amwaterhouse Date: Thu, 10 Nov 2005 11:00:35 +0000 (+0000) Subject: Colour PDB by sequence X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=e12d7b37af23fcf0d84b6b970c2b3c651601a02d;p=jalview.git Colour PDB by sequence --- diff --git a/src/MCview/PDBChain.java b/src/MCview/PDBChain.java index 192156e..86755dd 100755 --- a/src/MCview/PDBChain.java +++ b/src/MCview/PDBChain.java @@ -230,22 +230,29 @@ public class PDBChain { } } - public void colourBySequence(jalview.gui.AlignViewport av, Sequence seq) { - jalview.gui.SequenceRenderer sr = new jalview.gui.SequenceRenderer(av); + public void colourBySequence(jalview.gui.SequenceRenderer sr, + jalview.gui.FeatureRenderer fr) + { - for (int i = 0; i < bonds.size(); i++) { + for (int i = 0; i < bonds.size(); i++) + { Bond tmp = (Bond) bonds.elementAt(i); - try { if ((tmp.at1.resNumber >= ((offset + pdbstart) - 1)) && - (tmp.at1.resNumber <= ((offset + pdbend) - 1))) { + (tmp.at1.resNumber <= ((offset + pdbend) - 1))) + { int pos = seqstart + (tmp.at1.resNumber - pdbstart - offset); - int index = seq.findIndex(pos); - tmp.startCol = sr.getResidueBoxColour(av.getGlobalColourScheme(), - seq, index); - } else { + + int index = sequence.findIndex(pos); + + tmp.startCol = sr.findSequenceColour(Color.gray, sequence, index); + + tmp.startCol = fr.findFeatureColour(tmp.startCol, sequence, index); + + } else + { tmp.startCol = Color.gray; } @@ -253,17 +260,15 @@ public class PDBChain { (tmp.at2.resNumber <= ((pdbend + offset) - 1))) { int pos = seqstart + (tmp.at2.resNumber - pdbstart - offset); - int index = seq.findIndex(pos); + int index = sequence.findIndex(pos); - tmp.endCol = sr.getResidueBoxColour(av.getGlobalColourScheme(), - seq, index); - } else { + tmp.endCol = sr.findSequenceColour(Color.gray, sequence, index); + tmp.endCol = fr.findFeatureColour( tmp.endCol, sequence, index); + } + else + { tmp.endCol = Color.gray; } - } catch (Exception e) { - tmp.startCol = Color.lightGray; - tmp.endCol = Color.lightGray; - } } } diff --git a/src/MCview/PDBfile.java b/src/MCview/PDBfile.java index f97216b..ae1e4ec 100755 --- a/src/MCview/PDBfile.java +++ b/src/MCview/PDBfile.java @@ -97,11 +97,6 @@ public class PDBfile extends jalview.io.FileParse { makeResidueList(); makeCaBondList(); - - // for (int i=0; i < chains.size() ; i++) { - // String pog = ((PDBChain)chains.elementAt(i)).print(); - // System.out.println(pog); - // } } public void makeResidueList() { @@ -139,12 +134,11 @@ public class PDBfile extends jalview.io.FileParse { } } - public void colourBySequence(Sequence seq) { - //SMJS TODO - // int max = seq.maxchain; - // if (seq.maxchain != -1) { - // ((PDBChain)chains.elementAt(max)).colourBySequence(seq); - // } + public void colourBySequence(jalview.gui.SequenceRenderer sr, + jalview.gui.FeatureRenderer fr) { + for (int i = 0; i < chains.size(); i++) { + ((PDBChain)chains.elementAt(i)).colourBySequence(sr,fr); + } } public void setChainColours() {