{\r
for (int ii = 0; ii < pdb.chains.size(); ii++)\r
{\r
- ( (PDBChain) pdb.chains.elementAt(ii)).colourBySequence(sr, fr);\r
+ colourBySequence( (PDBChain) pdb.chains.elementAt(ii) );\r
}\r
}\r
\r
\r
}\r
\r
+ // This method has been taken out of PDBChain to allow\r
+ // Applet and Application specific sequence renderers to be used\r
+ void colourBySequence(PDBChain chain)\r
+ {\r
+ for (int i = 0; i < chain.bonds.size(); i++)\r
+ {\r
+ Bond tmp = (Bond) chain.bonds.elementAt(i);\r
+\r
+ if ( (tmp.at1.resNumber >= ( (chain.offset + chain.pdbstart) - 1)) &&\r
+ (tmp.at1.resNumber <= ( (chain.offset + chain.pdbend) - 1)))\r
+ {\r
+ int pos = chain.seqstart +\r
+ (tmp.at1.resNumber - chain.pdbstart - chain.offset);\r
+\r
+ int index = sequence.findIndex(pos);\r
+\r
+ tmp.startCol = sr.findSequenceColour(tmp.startCol, sequence, index);\r
+\r
+ tmp.startCol = fr.findFeatureColour(tmp.startCol, sequence, index);\r
+\r
+ }\r
+ else\r
+ {\r
+ tmp.startCol = Color.gray;\r
+ }\r
+\r
+ if ( (tmp.at2.resNumber >= ( (chain.offset + chain.pdbstart) - 1)) &&\r
+ (tmp.at2.resNumber <= ( (chain.pdbend + chain.offset) - 1)))\r
+ {\r
+ int pos = chain.seqstart +\r
+ (tmp.at2.resNumber - chain.pdbstart - chain.offset);\r
+ int index = sequence.findIndex(pos);\r
+\r
+ tmp.endCol = sr.findSequenceColour(tmp.endCol, sequence, index);\r
+ tmp.endCol = fr.findFeatureColour(tmp.endCol, sequence, index);\r
+ }\r
+ else\r
+ {\r
+ tmp.endCol = Color.gray;\r
+ }\r
+ }\r
+ }\r
+\r
+\r
public void drawScene(Graphics g) {\r
// Sort the bonds by z coord\r
Vector bonds = new Vector();\r
}\r
\r
sequence = new Sequence("PDB_seq", seq, 1, seq.length());\r
- // System.out.println("PDB Sequence is :\nSequence = " + seq);\r
- // System.out.println("No of residues = " + residues.size());\r
+ // System.out.println("PDB Sequence is :\nSequence = " + seq);\r
+ // System.out.println("No of residues = " + residues.size());\r
}\r
\r
public void setChargeColours() {\r
}\r
}\r
\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
- {\r
- Bond tmp = (Bond) bonds.elementAt(i);\r
-\r
- if ((tmp.at1.resNumber >= ((offset + pdbstart) - 1)) &&\r
- (tmp.at1.resNumber <= ((offset + pdbend) - 1)))\r
- {\r
- int pos = seqstart +\r
- (tmp.at1.resNumber - pdbstart - offset);\r
-\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
- if ((tmp.at2.resNumber >= ((offset + pdbstart) - 1)) &&\r
- (tmp.at2.resNumber <= ((pdbend + offset) - 1))) {\r
- int pos = seqstart +\r
- (tmp.at2.resNumber - pdbstart - offset);\r
- int index = sequence.findIndex(pos);\r
-\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
- }\r
- }\r
\r
public void setChainColours() {\r
for (int i = 0; i < bonds.size(); i++) {\r
if (inType.equals("File")) {\r
dataIn = new BufferedReader(new FileReader(inFile));\r
}\r
+ else if(inType.equals("Paste"))\r
+ {\r
+ dataIn = new BufferedReader(new StringReader(inFile));\r
+ }\r
else {\r
URL url = new URL(inFile);\r
this.fileSize = 0;\r
// System.out.println("Adding to chain " + tmpatom.chain);\r
findChain(tmpatom.chain).atoms.addElement(tmpatom);\r
} else {\r
- // System.out.println("Making chain " + tmpatom.chain);\r
PDBChain tmpchain = new PDBChain(tmpatom.chain);\r
chains.addElement(tmpchain);\r
tmpchain.atoms.addElement(tmpatom);\r
}\r
}\r
\r
- public void colourBySequence(jalview.gui.SequenceRenderer sr,\r
- jalview.gui.FeatureRenderer fr) {\r
+ public void colourBySequence()//jalview.gui.SequenceRenderer sr,\r
+ // jalview.gui.FeatureRenderer fr)\r
+ {\r
for (int i = 0; i < chains.size(); i++) {\r
- ((PDBChain)chains.elementAt(i)).colourBySequence(sr,fr);\r
+ //((PDBChain)chains.elementAt(i)).colourBySequence(sr,fr);\r
}\r
}\r
\r