X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2FMCview%2FPDBChain.java;h=ddf05e1320e827b35ea4d32d8aef973135ad335f;hb=f1bef1a257c565ebf63ff5f55e62f48329f5bf81;hp=4bfe2559558fc7d7c75ca3c99a10c58a6b524b23;hpb=588042b69abf8e60bcc950b24c283933c7dd422f;p=jalview.git diff --git a/src/MCview/PDBChain.java b/src/MCview/PDBChain.java index 4bfe255..ddf05e1 100755 --- a/src/MCview/PDBChain.java +++ b/src/MCview/PDBChain.java @@ -1,6 +1,6 @@ /* * Jalview - A Sequence Alignment Editor and Viewer -* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle +* Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -25,6 +25,7 @@ import jalview.schemes.ResidueProperties; import java.awt.*; import java.util.*; +import jalview.analysis.AlignSeq; public class PDBChain { @@ -34,13 +35,12 @@ public class PDBChain { public Vector residues = new Vector(); public int offset; public Sequence sequence; - public boolean isVisible = false; + public boolean isVisible = true; public int pdbstart = 0; public int pdbend = 0; public int seqstart = 0; public int seqend = 0; - //public DrawableSequence ds; public PDBChain(String id) { this.id = id; } @@ -57,22 +57,60 @@ public class PDBChain { return tmp; } - public void makeCaBondList() { - for (int i = 0; i < (residues.size() - 1); i++) { + void makeExactMapping(AlignSeq as, Sequence s1) + { + int pdbpos = as.getSeq2Start()-2; + int alignpos = s1.getStart() + as.getSeq1Start()-3; + + for(int i=0; i (float) 1.0) { - red = (float) 1.0; - } - - if (red < (float) 0.0) { - red = (float) 0.0; - } + ( (Bond) bonds.elementAt(i)).startCol = cs.findColour( + ResidueProperties.aa[ ( (Integer) ResidueProperties.aa3Hash. + get(b.at1.resName)).intValue()] + ); - b.startCol = new Color(red, (float) 0.0, (float) 1.0 - red); - atno = ((Integer) AA3Hash.get(b.at2.resName.toUpperCase())).intValue(); - - red = ((float) hyd[atno] - hydmin) / (hydmax - hydmin); - - if (red > (float) 1.0) { - red = (float) 1.0; - } + b.endCol = cs.findColour( + ResidueProperties.aa[ ( (Integer) ResidueProperties.aa3Hash. + get(b.at2.resName)).intValue()] + ); - if (red < (float) 0.0) { - red = (float) 0.0; - } - - b.endCol = new Color(red, (float) 0.2, (float) 1.0 - red); - } catch (Exception e) { - Bond b = (Bond) bonds.elementAt(i); + } catch (Exception e) + { + b = (Bond) bonds.elementAt(i); b.startCol = Color.gray; b.endCol = Color.gray; } } } - public void colourBySequence(jalview.gui.AlignViewport av, Sequence seq) { - jalview.gui.SequenceRenderer sr = new jalview.gui.SequenceRenderer(av); - - 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))) { - int pos = seqstart + - (tmp.at1.resNumber - pdbstart - offset); - int index = seq.findIndex(pos); - - tmp.startCol = sr.getResidueBoxColour(av.getGlobalColourScheme(), - seq, index); - } else { - tmp.startCol = Color.gray; - } - if ((tmp.at2.resNumber >= ((offset + pdbstart) - 1)) && - (tmp.at2.resNumber <= ((pdbend + offset) - 1))) { - int pos = seqstart + - (tmp.at2.resNumber - pdbstart - offset); - int index = seq.findIndex(pos); - tmp.endCol = sr.getResidueBoxColour(av.getGlobalColourScheme(), - seq, index); - } else { - tmp.endCol = Color.gray; - } - } catch (Exception e) { - tmp.startCol = Color.lightGray; - tmp.endCol = Color.lightGray; - } - } - } - - public void setChainColours() { - for (int i = 0; i < bonds.size(); i++) { + public void setChainColours(Color col) + { + for (int i = 0; i < bonds.size(); i++) + { Bond tmp = (Bond) bonds.elementAt(i); - - try { - tmp.startCol = (Color) ResidueProperties.getChainColours().get(id); - tmp.endCol = (Color) ResidueProperties.getChainColours().get(id); - } catch (Exception e) { - tmp.startCol = Color.lightGray; - tmp.endCol = Color.lightGray; - } + tmp.startCol = col; + tmp.endCol = col; } } }