-package MCview;\r
+/*\r
+* Jalview - A Sequence Alignment Editor and Viewer\r
+* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+*\r
+* This program is free software; you can redistribute it and/or\r
+* modify it under the terms of the GNU General Public License\r
+* as published by the Free Software Foundation; either version 2\r
+* of the License, or (at your option) any later version.\r
+*\r
+* This program is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with this program; if not, write to the Free Software\r
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
+*/\r
\r
+package MCview;\r
+// JBPNote TODO: This class is quite noisy - needs proper log.info/log.debug\r
import java.awt.*;\r
import java.awt.event.*;\r
import java.util.*;\r
import java.io.*;\r
import javax.swing.*;\r
+import jalview.analysis.AlignSeq;\r
+import jalview.datamodel.*;\r
\r
public class rotCanvas extends JPanel implements KeyListener,\r
MouseListener,\r
\r
Font font = new Font("Helvetica",Font.PLAIN,10);\r
\r
- public rotCanvas(PDBfile pdb) throws IOException {\r
+ public rotCanvas(PDBfile pdb, Sequence sequence, jalview.gui.AlignViewport av) throws IOException {\r
+\r
+ int max = -10;\r
+ int maxchain = -1;\r
+ int pdbstart=0, pdbend=0, seqstart =0, seqend=0;\r
+\r
+\r
+ for (int i=0; i < pdb.chains.size(); i++) {\r
+ // Now lets compare the sequences to get\r
+ // the start and end points.\r
+\r
+ java.util.StringTokenizer str = new java.util.StringTokenizer(sequence.getSequence(), ".");\r
+ String newString = "";\r
+\r
+ while (str.hasMoreTokens()) {\r
+ newString += str.nextToken();\r
+ }\r
+ // Align the sequence to the pdb\r
+ AlignSeq as = new AlignSeq(sequence,((PDBChain)pdb.chains.elementAt(i)).sequence,"pep");\r
+ as.calcScoreMatrix();\r
+ as.traceAlignment();\r
+ as.printAlignment();\r
+\r
+ if (as.maxscore > max) {\r
+ max = as.maxscore;\r
+ maxchain = i;\r
+\r
+ pdbstart = as.seq2start;\r
+ pdbend = as.seq2end;\r
+ seqstart = as.seq1start - 1 ;\r
+ seqend = as.seq1end -1;\r
+ }\r
+\r
+ System.out.println("PDB start/end " + pdbstart + " " + pdbend);\r
+ System.out.println("SEQ start/end " + seqstart + " " + seqend);\r
+ }\r
+\r
+\r
+ ( (PDBChain)pdb.chains.elementAt(maxchain)).pdbstart = pdbstart;\r
+ ( (PDBChain)pdb.chains.elementAt(maxchain)).pdbend = pdbend;\r
+ ( (PDBChain)pdb.chains.elementAt(maxchain)).seqstart = seqstart;\r
+ ( (PDBChain)pdb.chains.elementAt(maxchain)).seqend = seqend;\r
+ ( (PDBChain) pdb.chains.elementAt(maxchain)).isVisible = true;\r
+ ( (PDBChain) pdb.chains.elementAt(maxchain)).sequence = sequence;\r
+ ( (PDBChain)pdb.chains.elementAt(maxchain)).colourBySequence(av, sequence);\r
+\r
+\r
\r
this.pdb = pdb;\r
this.prefsize = new Dimension( getWidth(), getHeight());\r
centre[2] = ztot / (2 * (float)bsize);\r
}\r
\r
- public void paintComponent(Graphics g) {\r
+ public void paint(Graphics g) {\r
//Only create the image at the beginning -\r
//this saves much memory usage\r
if ((img == null) || (prefsize.width != getWidth()) || (prefsize.height != getHeight())) {\r
}\r
}\r
if(fatom!=null)\r
+ {\r
this.setToolTipText(fatom.resName);\r
+ }\r
else\r
this.setToolTipText(null);\r
}\r