\r
public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotionListener\r
{\r
- public AppletPDBCanvas()\r
- {\r
- try\r
- {\r
- jbInit();\r
- }\r
- catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
- }\r
\r
MCMatrix idmat = new MCMatrix(3, 3);\r
MCMatrix objmat = new MCMatrix(3, 3);\r
jalview.appletgui.SequenceRenderer sr;\r
jalview.appletgui.FeatureRenderer fr;\r
jalview.appletgui.SeqCanvas seqcanvas;\r
- Sequence sequence;\r
+ public Sequence sequence;\r
final StringBuffer mappingDetails = new StringBuffer();\r
String appletToolTip = null;\r
int toolx, tooly;\r
+ PDBChain mainchain;\r
\r
public AppletPDBCanvas(jalview.appletgui.SeqCanvas seqcanvas, Sequence seq)\r
{\r
sr = seqcanvas.getSequenceRenderer();\r
fr = seqcanvas.getFeatureRenderer();\r
\r
- seqcanvas.setPDBViewer(this);\r
+ seqcanvas.setPDBCanvas(this);\r
addKeyListener(new KeyAdapter()\r
{\r
\r
doKeyPressed(evt);\r
}\r
});\r
-\r
}\r
\r
+ Bond highlightBond1, highlightBond2;\r
+ public void highlightRes(int ii)\r
+ {\r
+ highlightBond1 = null;\r
+ highlightBond2 = null;\r
+\r
+ int index = ii - mainchain.seqstart - mainchain.offset+1;\r
+ if(index <0 )\r
+ return;\r
+\r
+ if(index<=mainchain.bonds.size())\r
+ {\r
+ if(index>0)\r
+ {\r
+ highlightBond1 = (Bond) mainchain.bonds.elementAt(index - 1);\r
+ }\r
+\r
+ if(index!=mainchain.bonds.size())\r
+ highlightBond2 = (Bond) mainchain.bonds.elementAt(index);\r
+ }\r
+\r
+ redrawneeded = true;\r
+ repaint();\r
+ }\r
+\r
+\r
public void setPDBFile(PDBfile pdb)\r
{\r
this.sr = sr;\r
mappingDetails.append("\nSEQ start/end "+ seqstart + " " + seqend);\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
+ mainchain = (PDBChain) pdb.chains.elementAt(maxchain);\r
+\r
+ mainchain.pdbstart = pdbstart;\r
+ mainchain.pdbend = pdbend;\r
+ mainchain.seqstart = seqstart;\r
+ mainchain.seqend = seqend;\r
+ mainchain.isVisible = true;\r
+ mainchain.sequence = sequence;\r
\r
this.pdb = pdb;\r
this.prefsize = new Dimension(getSize().width, getSize().height);\r
//this saves much memory usage\r
if ((img == null) || (prefsize.width != getSize().width) ||\r
(prefsize.height != getSize().height)) {\r
- prefsize.width = getSize().width;\r
- prefsize.height = getSize().height;\r
\r
- scale = findScale();\r
- img = createImage(prefsize.width, prefsize.height);\r
- ig = img.getGraphics();\r
+ try{ prefsize.width = getSize().width;\r
+ prefsize.height = getSize().height;\r
\r
- redrawneeded = true;\r
+ scale = findScale();\r
+ img = createImage(prefsize.width, prefsize.height);\r
+ ig = img.getGraphics();\r
+\r
+ redrawneeded = true;\r
+ }catch(Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ System.out.println(getSize());\r
+ }\r
}\r
\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
+\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(sequence, index);\r
+ if(jalview.util.Comparison.isGap((sequence.getCharAt(index))))\r
+ {\r
+ index--;\r
+ }\r
+\r
+ tmp.startCol = sr.findSequenceColour(sequence, index);\r
\r
// tmp.startCol = fr.findFeatureColour(tmp.startCol, sequence, index);\r
\r
int pos = chain.seqstart +\r
(tmp.at2.resNumber - chain.pdbstart - chain.offset);\r
int index = sequence.findIndex(pos);\r
+ if (jalview.util.Comparison.isGap( (sequence.getCharAt(index))))\r
+ {\r
+ index--;\r
+ }\r
+\r
\r
- tmp.endCol = sr.findSequenceColour( sequence, index);\r
+ tmp.endCol = sr.findSequenceColour(sequence, index);\r
// tmp.endCol = fr.findFeatureColour(tmp.endCol, sequence, index);\r
}\r
else\r
\r
for (int i = 0; i < tmp.size(); i++)\r
{\r
- bonds.addElement(tmp.elementAt(i));\r
+ bonds.addElement(tmp.elementAt(i));\r
}\r
}\r
}\r
for (int i = 0; i < bonds.size(); i++) {\r
Bond tmpBond = (Bond) bonds.elementAt(i);\r
\r
+\r
xstart = (int) (((tmpBond.start[0] - centre[0]) * scale) +\r
(getSize().width / 2));\r
ystart = (int) (((tmpBond.start[1] - centre[1]) * scale) +\r
xmid = (xend + xstart) / 2;\r
ymid = (yend + ystart) / 2;\r
\r
- if (depthcue && !bymolecule) {\r
+ if (depthcue && !bymolecule)\r
+ {\r
if (tmpBond.start[2] < (centre[2] - (maxwidth / 6))) {\r
g.setColor(tmpBond.startCol.darker().darker());\r
drawLine(g, xstart, ystart, xmid, ymid);\r
} else {\r
drawLine(g, xstart, ystart, xend, yend);\r
}\r
+\r
+ if(highlightBond1!=null && highlightBond1==tmpBond)\r
+ {\r
+ g.setColor(Color.white);\r
+ drawLine(g, xmid, ymid, xend, yend);\r
+ }\r
+\r
+ if(highlightBond2!=null && highlightBond2==tmpBond)\r
+ {\r
+ g.setColor(Color.white);\r
+ drawLine(g, xstart, ystart, xmid, ymid);\r
+ }\r
+\r
}\r
}\r
\r
}\r
\r
public void mousePressed(MouseEvent e) {\r
- myAtom fatom = findAtom(e.getX(), e.getY());\r
+ Atom fatom = findAtom(e.getX(), e.getY());\r
if(fatom!=null)\r
{\r
fatom.isSelected = !fatom.isSelected;\r
\r
public void mouseMoved(MouseEvent e) {\r
\r
- myAtom fatom = findAtom(e.getX(), e.getY());\r
+ Atom fatom = findAtom(e.getX(), e.getY());\r
\r
+ PDBChain chain = null;\r
if(foundchain!=-1)\r
{\r
- PDBChain chain = (PDBChain) pdb.chains.elementAt(foundchain);\r
- int pos = chain.seqstart +\r
- (fatom.resNumber - chain.pdbstart - chain.offset)+1;\r
+ chain = (PDBChain) pdb.chains.elementAt(foundchain);\r
+ if(chain == mainchain)\r
+ {\r
+ int pos = chain.seqstart +\r
+ (fatom.resNumber - chain.pdbstart - chain.offset) + 1;\r
\r
- int index = seqcanvas.getViewport().getAlignment().findIndex(sequence);\r
+ int index = seqcanvas.getViewport().getAlignment().findIndex(\r
+ sequence);\r
\r
- seqcanvas.highlightSearchResults(new int[]{index, pos, pos});\r
+ seqcanvas.highlightSearchResults(new int[]\r
+ {index, pos, pos});\r
+ }\r
}\r
else\r
seqcanvas.highlightSearchResults(null);\r
if (fatom != null) {\r
toolx = e.getX();\r
tooly = e.getY();\r
- appletToolTip = fatom.resNumber+" "+ fatom.resName;\r
+\r
+ appletToolTip = chain.id+":"+ fatom.resNumber+" "+ fatom.resName;\r
redrawneeded = true;\r
repaint();\r
} else {\r
}\r
\r
int foundchain = -1;\r
- public myAtom findAtom(int x, int y) {\r
- myAtom fatom = null;\r
+ public Atom findAtom(int x, int y) {\r
+ Atom fatom = null;\r
\r
foundchain = -1;\r
\r
paint(g);\r
}\r
\r
- private void jbInit()\r
- throws Exception\r
- {\r
- }\r
+ public void setAllchainsVisible(boolean b)\r
+ {\r
+ for (int ii = 0; ii < pdb.chains.size(); ii++)\r
+ {\r
+ PDBChain chain = (PDBChain) pdb.chains.elementAt(ii);\r
+ chain.isVisible = b;\r
+ }\r
+ mainchain.isVisible = true;\r
+ findCentre();\r
+ }\r
+\r
}\r
molecule_actionPerformed();\r
}\r
});\r
- jMenuBar1.add(fileMenu);\r
+ allchains.setLabel("All Chains Visible");\r
+ allchains.addItemListener(new ItemListener()\r
+ {\r
+ public void itemStateChanged(ItemEvent itemEvent)\r
+ {\r
+ allchains_itemStateChanged(itemEvent);\r
+ }\r
+ });\r
+ jMenuBar1.add(fileMenu);\r
jMenuBar1.add(coloursMenu);\r
fileMenu.add(mapping);;\r
\r
coloursMenu.add(seqButton);\r
coloursMenu.add(chain);\r
- coloursMenu.add(hydro);\r
- coloursMenu.add(charge);\r
- coloursMenu.addSeparator();\r
+ coloursMenu.add(hydro);\r
+ coloursMenu.add(charge);\r
+ coloursMenu.add(molecule);\r
+ coloursMenu.addSeparator();\r
coloursMenu.add(wire);\r
coloursMenu.add(depth);\r
coloursMenu.add(zbuffer);\r
- coloursMenu.add(molecule);\r
-\r
- }\r
+ coloursMenu.add(allchains);\r
+ allchains.setState(true);\r
+ }\r
\r
MenuBar jMenuBar1 = new MenuBar();\r
Menu fileMenu = new Menu();\r
MenuItem seqButton = new MenuItem();\r
\r
CheckboxMenuItem molecule = new CheckboxMenuItem();\r
+ CheckboxMenuItem allchains = new CheckboxMenuItem();\r
\r
- public void charge_actionPerformed()\r
+ public void charge_actionPerformed()\r
{\r
clearButtonGroup();\r
pdbcanvas.pdb.setChargeColours();\r
jalview.bin.JalviewLite.addFrame(frame, "PDB - Sequence Mapping", 500, 600);\r
cap.setText(pdbcanvas.mappingDetails.toString());\r
}\r
- }\r
+\r
+ public void allchains_itemStateChanged(ItemEvent itemEvent)\r
+ {\r
+ pdbcanvas.setAllchainsVisible(allchains.getState());\r
+ }\r
+}\r
jalview.gui.SequenceRenderer sr;\r
jalview.gui.FeatureRenderer fr;\r
jalview.gui.SeqCanvas seqcanvas;\r
- Sequence sequence;\r
+ public Sequence sequence;\r
final StringBuffer mappingDetails = new StringBuffer();\r
+ PDBChain mainchain;\r
\r
public PDBCanvas(jalview.gui.SeqCanvas seqcanvas, Sequence seq)\r
{\r
sr = seqcanvas.getSequenceRenderer();\r
fr = seqcanvas.getFeatureRenderer();\r
\r
- seqcanvas.setPDBViewer(this);\r
+ seqcanvas.setPDBCanvas(this);\r
}\r
\r
public void setPDBFile(PDBfile pdb)\r
mappingDetails.append("\nSEQ start/end "+ seqstart + " " + seqend);\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
+ mainchain = (PDBChain) pdb.chains.elementAt(maxchain);\r
+\r
+ mainchain.pdbstart = pdbstart;\r
+ mainchain.pdbend = pdbend;\r
+ mainchain.seqstart = seqstart;\r
+ mainchain.seqend = seqend;\r
+ mainchain.isVisible = true;\r
+ mainchain.sequence = sequence;\r
\r
this.pdb = pdb;\r
this.prefsize = new Dimension(getWidth(), getHeight());\r
Zsort.Zsort(bonds);\r
}\r
\r
+ Bond tmpBond=null;\r
for (int i = 0; i < bonds.size(); i++) {\r
- Bond tmpBond = (Bond) bonds.elementAt(i);\r
+ tmpBond = (Bond) bonds.elementAt(i);\r
\r
xstart = (int) (((tmpBond.start[0] - centre[0]) * scale) +\r
(getWidth() / 2));\r
} else {\r
drawLine(g, xstart, ystart, xend, yend);\r
}\r
+\r
+ if(highlightBond1!=null && highlightBond1==tmpBond)\r
+ {\r
+ g.setColor(tmpBond.endCol.brighter().brighter().brighter());\r
+ drawLine(g, xmid, ymid, xend, yend);\r
+ }\r
+\r
+ if(highlightBond2!=null && highlightBond2==tmpBond)\r
+ {\r
+ g.setColor(tmpBond.startCol.brighter().brighter().brighter());\r
+ drawLine(g, xstart, ystart, xmid, ymid);\r
+ }\r
+\r
}\r
+\r
+\r
}\r
\r
public void drawLine(Graphics g, int x1, int y1, int x2, int y2) {\r
}\r
\r
public void mousePressed(MouseEvent e) {\r
- myAtom fatom = findAtom(e.getX(), e.getY());\r
+ Atom fatom = findAtom(e.getX(), e.getY());\r
if(fatom!=null)\r
{\r
fatom.isSelected = !fatom.isSelected;\r
\r
public void mouseMoved(MouseEvent e) {\r
\r
- myAtom fatom = findAtom(e.getX(), e.getY());\r
+ Atom fatom = findAtom(e.getX(), e.getY());\r
\r
+ PDBChain chain = null;\r
if(foundchain!=-1)\r
{\r
- PDBChain chain = (PDBChain) pdb.chains.elementAt(foundchain);\r
- int pos = chain.seqstart +\r
- (fatom.resNumber - chain.pdbstart - chain.offset)+1;\r
+ chain = (PDBChain) pdb.chains.elementAt(foundchain);\r
+ if(chain == mainchain)\r
+ {\r
+ int pos = chain.seqstart +\r
+ (fatom.resNumber - chain.pdbstart - chain.offset) + 1;\r
\r
- int index = seqcanvas.getViewport().getAlignment().findIndex(sequence);\r
+ int index = seqcanvas.getViewport().getAlignment().findIndex(\r
+ sequence);\r
\r
- seqcanvas.highlightSearchResults(new int[]{index, pos, pos});\r
+ seqcanvas.highlightSearchResults(new int[]\r
+ {index, pos, pos});\r
+ }\r
}\r
else\r
seqcanvas.highlightSearchResults(null);\r
\r
- if (fatom != null) {\r
- this.setToolTipText(fatom.resNumber+" "+ fatom.resName);\r
- } else {\r
+ if (fatom != null)\r
+ {\r
+ this.setToolTipText(chain.id+":"+ fatom.resNumber+" "+ fatom.resName);\r
+ } else\r
+ {\r
this.setToolTipText("");\r
}\r
}\r
}\r
\r
int foundchain = -1;\r
- public myAtom findAtom(int x, int y) {\r
- myAtom fatom = null;\r
+ public Atom findAtom(int x, int y) {\r
+ Atom fatom = null;\r
\r
foundchain = -1;\r
\r
- for (int ii = 0; ii < pdb.chains.size(); ii++) {\r
+ for (int ii = 0; ii < pdb.chains.size(); ii++)\r
+ {\r
PDBChain chain = (PDBChain) pdb.chains.elementAt(ii);\r
+ int truex;\r
+ Bond tmpBond=null;\r
\r
- if (chain.isVisible) {\r
+ if (chain.isVisible)\r
+ {\r
Vector bonds = ((PDBChain) pdb.chains.elementAt(ii)).bonds;\r
\r
- for (int i = 0; i < bonds.size(); i++) {\r
- Bond tmpBond = (Bond) bonds.elementAt(i);\r
+ for (int i = 0; i < bonds.size(); i++)\r
+ {\r
+ tmpBond = (Bond) bonds.elementAt(i);\r
\r
- int truex = (int) (((tmpBond.start[0] - centre[0]) * scale) +\r
+ truex = (int) (((tmpBond.start[0] - centre[0]) * scale) +\r
(getWidth() / 2));\r
\r
- if (Math.abs(truex - x) <= 2) {\r
+ if (Math.abs(truex - x) <= 2)\r
+ {\r
int truey = (int) (((tmpBond.start[1] - centre[1]) * scale) +\r
(getHeight() / 2));\r
\r
}\r
}\r
}\r
+\r
+ // Still here? Maybe its the last bond\r
+\r
+ truex = (int) ( ( (tmpBond.end[0] - centre[0]) * scale) +\r
+ (getWidth() / 2));\r
+\r
+ if (Math.abs(truex - x) <= 2)\r
+ {\r
+ int truey = (int) ( ( (tmpBond.end[1] - centre[1]) * scale) +\r
+ (getHeight() / 2));\r
+\r
+ if (Math.abs(truey - y) <= 2)\r
+ {\r
+ fatom = tmpBond.at2;\r
+ foundchain = ii;\r
+ break;\r
+ }\r
+ }\r
+\r
}\r
\r
if (fatom != null) //)&& chain.ds != null)\r
\r
return fatom;\r
}\r
+\r
+ Bond highlightBond1, highlightBond2;\r
+ public void highlightRes(int ii)\r
+ {\r
+ highlightBond1 = null;\r
+ highlightBond2 = null;\r
+\r
+ int index = ii - mainchain.seqstart - mainchain.offset+1;\r
+ if(index <0 )\r
+ return;\r
+\r
+ if(index<=mainchain.bonds.size())\r
+ {\r
+ if(index>0)\r
+ {\r
+ highlightBond1 = (Bond) mainchain.bonds.elementAt(index - 1);\r
+ }\r
+\r
+ if(index!=mainchain.bonds.size())\r
+ highlightBond2 = (Bond) mainchain.bonds.elementAt(index);\r
+ }\r
+\r
+ redrawneeded = true;\r
+ repaint();\r
+ }\r
+\r
+ public void setAllchainsVisible(boolean b)\r
+ {\r
+ for (int ii = 0; ii < pdb.chains.size(); ii++)\r
+ {\r
+ PDBChain chain = (PDBChain) pdb.chains.elementAt(ii);\r
+ chain.isVisible = b;\r
+ }\r
+ mainchain.isVisible = true;\r
+ findCentre();\r
+ }\r
}\r
public Vector residues = new Vector();\r
public int offset;\r
public Sequence sequence;\r
- public boolean isVisible = false;\r
+ public boolean isVisible = true;\r
public int pdbstart = 0;\r
public int pdbend = 0;\r
public int seqstart = 0;\r
for (int i = 0; i < (residues.size() - 1); i++) {\r
Residue tmpres = (Residue) residues.elementAt(i);\r
Residue tmpres2 = (Residue) residues.elementAt(i + 1);\r
- myAtom at1 = tmpres.findAtom("CA");\r
- myAtom at2 = tmpres2.findAtom("CA");\r
+ Atom at1 = tmpres.findAtom("CA");\r
+ Atom at2 = tmpres2.findAtom("CA");\r
\r
if ((at1 != null) && (at2 != null)) {\r
if (at1.chain.equals(at2.chain)) {\r
}\r
}\r
\r
- public void makeBond(myAtom at1, myAtom at2) {\r
+ public void makeBond(Atom at1, Atom at2) {\r
float[] start = new float[3];\r
float[] end = new float[3];\r
\r
String seq = "";\r
\r
for (int i = 0; i < atoms.size(); i++) {\r
- myAtom tmp = (myAtom) atoms.elementAt(i);\r
+ Atom tmp = (Atom) atoms.elementAt(i);\r
//String resName = tmp.resName;\r
int resNumber = tmp.resNumber;\r
int res = resNumber;\r
\r
Vector resAtoms = new Vector();\r
\r
- resAtoms.addElement((myAtom) atoms.elementAt(i));\r
+ resAtoms.addElement((Atom) atoms.elementAt(i));\r
i++;\r
- resNumber = ((myAtom) atoms.elementAt(i)).resNumber;\r
+ resNumber = ((Atom) atoms.elementAt(i)).resNumber;\r
\r
//Add atoms to a vector while the residue number\r
//remains the same\r
while ((resNumber == res) && (i < atoms.size())) {\r
- resAtoms.addElement((myAtom) atoms.elementAt(i));\r
+ resAtoms.addElement((Atom) atoms.elementAt(i));\r
i++;\r
\r
if (i < atoms.size()) {\r
- resNumber = ((myAtom) atoms.elementAt(i)).resNumber;\r
+ resNumber = ((Atom) atoms.elementAt(i)).resNumber;\r
} else {\r
resNumber++;\r
}\r
count++;\r
\r
Residue tmpres = (Residue) residues.lastElement();\r
- myAtom tmpat = (myAtom) tmpres.atoms.elementAt(0);\r
+ Atom tmpat = (Atom) tmpres.atoms.elementAt(0);\r
\r
// Keep totting up the sequence\r
if (ResidueProperties.getAA3Hash().get(tmpat.resName) == null) {\r
\r
\r
\r
- public void setChainColours() {\r
- for (int i = 0; i < bonds.size(); i++) {\r
+ public void setChainColours(Color col)\r
+ {\r
+ for (int i = 0; i < bonds.size(); i++)\r
+ {\r
Bond tmp = (Bond) bonds.elementAt(i);\r
-\r
- try {\r
- tmp.startCol = (Color) ResidueProperties.getChainColours().get(id);\r
- tmp.endCol = (Color) ResidueProperties.getChainColours().get(id);\r
- } catch (Exception e) {\r
- tmp.startCol = Color.lightGray;\r
- tmp.endCol = Color.lightGray;\r
- }\r
+ tmp.startCol = col;\r
+ tmp.endCol = col;\r
}\r
}\r
}\r
molecule_actionPerformed(e);\r
}\r
});\r
+ allchains.setSelected(true);\r
+ allchains.setText("Show All Chains");\r
+ allchains.addItemListener(new ItemListener()\r
+ {\r
+ public void itemStateChanged(ItemEvent e)\r
+ {\r
+ allchains_itemStateChanged(e);\r
+ }\r
+ });\r
jMenuBar1.add(fileMenu);\r
jMenuBar1.add(coloursMenu);\r
fileMenu.add(saveMenu);\r
coloursMenu.add(depth);\r
coloursMenu.add(zbuffer);\r
coloursMenu.add(molecule);\r
+ coloursMenu.add(allchains);\r
ButtonGroup bg = new ButtonGroup();\r
bg.add(seqButton);\r
bg.add(chain);\r
JRadioButtonMenuItem chain = new JRadioButtonMenuItem();\r
JRadioButtonMenuItem seqButton = new JRadioButtonMenuItem();\r
JCheckBoxMenuItem molecule = new JCheckBoxMenuItem();\r
+ JCheckBoxMenuItem allchains = new JCheckBoxMenuItem();\r
\r
/**\r
* DOCUMENT ME!\r
Desktop.addInternalFrame(cap, "PDB - Sequence Mapping", 500, 600);\r
cap.setText(pdbcanvas.mappingDetails.toString());\r
}\r
+\r
+ public void allchains_itemStateChanged(ItemEvent e)\r
+ {\r
+ pdbcanvas.setAllchainsVisible(allchains.getState());\r
+ }\r
}\r
import java.net.*;\r
\r
import java.util.*;\r
+import java.awt.Color;\r
\r
\r
public class PDBfile extends jalview.io.FileParse {\r
\r
if (inStr.indexOf("ATOM") != -1) {\r
try {\r
- myAtom tmpatom = new myAtom(str);\r
+ Atom tmpatom = new Atom(str);\r
\r
if (findChain(tmpatom.chain) != null) {\r
// System.out.println("Adding to chain " + tmpatom.chain);\r
\r
public PDBChain findChain(String id) {\r
for (int i = 0; i < chains.size(); i++) {\r
- // System.out.println("ID = " + id + " " +((PDBChain)chains.elementAt(i)).id);\r
if (((PDBChain) chains.elementAt(i)).id.equals(id)) {\r
return (PDBChain) chains.elementAt(i);\r
}\r
}\r
}\r
\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
- }\r
- }\r
-\r
- public void setChainColours() {\r
- for (int i = 0; i < chains.size(); i++) {\r
- ((PDBChain) chains.elementAt(i)).setChainColours();\r
+ public void setChainColours()\r
+ {\r
+ for (int i = 0; i < chains.size(); i++)\r
+ {\r
+ ((PDBChain) chains.elementAt(i)).setChainColours(\r
+ Color.getHSBColor(1.0f / (float)i, .4f, 1.0f)\r
+ );\r
}\r
}\r
}\r
this.count = count;\r
}\r
\r
- public myAtom findAtom(String name) {\r
+ public Atom findAtom(String name) {\r
for (int i = 0; i < atoms.size(); i++) {\r
- if (((myAtom) atoms.elementAt(i)).name.equals(name)) {\r
- return (myAtom) atoms.elementAt(i);\r
+ if (((Atom) atoms.elementAt(i)).name.equals(name)) {\r
+ return (Atom) atoms.elementAt(i);\r
}\r
}\r
\r