From: amwaterhouse Date: Wed, 16 Nov 2005 16:41:08 +0000 (+0000) Subject: No more myAtom, Highlight from alignment X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=c6aaf0ef217426a5e23be7db9cbc6a8369115850;p=jalview.git No more myAtom, Highlight from alignment --- diff --git a/src/MCview/AppletPDBCanvas.java b/src/MCview/AppletPDBCanvas.java index 1ee0828..1df39fa 100755 --- a/src/MCview/AppletPDBCanvas.java +++ b/src/MCview/AppletPDBCanvas.java @@ -34,17 +34,6 @@ import java.util.*; public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotionListener { - public AppletPDBCanvas() - { - try - { - jbInit(); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } MCMatrix idmat = new MCMatrix(3, 3); MCMatrix objmat = new MCMatrix(3, 3); @@ -80,10 +69,11 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion jalview.appletgui.SequenceRenderer sr; jalview.appletgui.FeatureRenderer fr; jalview.appletgui.SeqCanvas seqcanvas; - Sequence sequence; + public Sequence sequence; final StringBuffer mappingDetails = new StringBuffer(); String appletToolTip = null; int toolx, tooly; + PDBChain mainchain; public AppletPDBCanvas(jalview.appletgui.SeqCanvas seqcanvas, Sequence seq) { @@ -92,7 +82,7 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion sr = seqcanvas.getSequenceRenderer(); fr = seqcanvas.getFeatureRenderer(); - seqcanvas.setPDBViewer(this); + seqcanvas.setPDBCanvas(this); addKeyListener(new KeyAdapter() { @@ -101,9 +91,34 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion doKeyPressed(evt); } }); - } + Bond highlightBond1, highlightBond2; + public void highlightRes(int ii) + { + highlightBond1 = null; + highlightBond2 = null; + + int index = ii - mainchain.seqstart - mainchain.offset+1; + if(index <0 ) + return; + + if(index<=mainchain.bonds.size()) + { + if(index>0) + { + highlightBond1 = (Bond) mainchain.bonds.elementAt(index - 1); + } + + if(index!=mainchain.bonds.size()) + highlightBond2 = (Bond) mainchain.bonds.elementAt(index); + } + + redrawneeded = true; + repaint(); + } + + public void setPDBFile(PDBfile pdb) { this.sr = sr; @@ -155,12 +170,14 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion mappingDetails.append("\nSEQ start/end "+ seqstart + " " + seqend); } - ((PDBChain) pdb.chains.elementAt(maxchain)).pdbstart = pdbstart; - ((PDBChain) pdb.chains.elementAt(maxchain)).pdbend = pdbend; - ((PDBChain) pdb.chains.elementAt(maxchain)).seqstart = seqstart; - ((PDBChain) pdb.chains.elementAt(maxchain)).seqend = seqend; - ((PDBChain) pdb.chains.elementAt(maxchain)).isVisible = true; - ((PDBChain) pdb.chains.elementAt(maxchain)).sequence = sequence; + mainchain = (PDBChain) pdb.chains.elementAt(maxchain); + + mainchain.pdbstart = pdbstart; + mainchain.pdbend = pdbend; + mainchain.seqstart = seqstart; + mainchain.seqend = seqend; + mainchain.isVisible = true; + mainchain.sequence = sequence; this.pdb = pdb; this.prefsize = new Dimension(getSize().width, getSize().height); @@ -373,14 +390,20 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion //this saves much memory usage if ((img == null) || (prefsize.width != getSize().width) || (prefsize.height != getSize().height)) { - prefsize.width = getSize().width; - prefsize.height = getSize().height; - scale = findScale(); - img = createImage(prefsize.width, prefsize.height); - ig = img.getGraphics(); + try{ prefsize.width = getSize().width; + prefsize.height = getSize().height; - redrawneeded = true; + scale = findScale(); + img = createImage(prefsize.width, prefsize.height); + ig = img.getGraphics(); + + redrawneeded = true; + }catch(Exception ex) + { + ex.printStackTrace(); + System.out.println(getSize()); + } } @@ -430,16 +453,21 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion for (int i = 0; i < chain.bonds.size(); i++) { Bond tmp = (Bond) chain.bonds.elementAt(i); - if ( (tmp.at1.resNumber >= ( (chain.offset + chain.pdbstart) - 1)) && (tmp.at1.resNumber <= ( (chain.offset + chain.pdbend) - 1))) { + int pos = chain.seqstart + (tmp.at1.resNumber - chain.pdbstart - chain.offset); int index = sequence.findIndex(pos); - tmp.startCol = sr.findSequenceColour(sequence, index); + if(jalview.util.Comparison.isGap((sequence.getCharAt(index)))) + { + index--; + } + + tmp.startCol = sr.findSequenceColour(sequence, index); // tmp.startCol = fr.findFeatureColour(tmp.startCol, sequence, index); @@ -455,8 +483,13 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion int pos = chain.seqstart + (tmp.at2.resNumber - chain.pdbstart - chain.offset); int index = sequence.findIndex(pos); + if (jalview.util.Comparison.isGap( (sequence.getCharAt(index)))) + { + index--; + } + - tmp.endCol = sr.findSequenceColour( sequence, index); + tmp.endCol = sr.findSequenceColour(sequence, index); // tmp.endCol = fr.findFeatureColour(tmp.endCol, sequence, index); } else @@ -479,7 +512,7 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion for (int i = 0; i < tmp.size(); i++) { - bonds.addElement(tmp.elementAt(i)); + bonds.addElement(tmp.elementAt(i)); } } } @@ -491,6 +524,7 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion for (int i = 0; i < bonds.size(); i++) { Bond tmpBond = (Bond) bonds.elementAt(i); + xstart = (int) (((tmpBond.start[0] - centre[0]) * scale) + (getSize().width / 2)); ystart = (int) (((tmpBond.start[1] - centre[1]) * scale) + @@ -504,7 +538,8 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion xmid = (xend + xstart) / 2; ymid = (yend + ystart) / 2; - if (depthcue && !bymolecule) { + if (depthcue && !bymolecule) + { if (tmpBond.start[2] < (centre[2] - (maxwidth / 6))) { g.setColor(tmpBond.startCol.darker().darker()); drawLine(g, xstart, ystart, xmid, ymid); @@ -543,6 +578,19 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion } else { drawLine(g, xstart, ystart, xend, yend); } + + if(highlightBond1!=null && highlightBond1==tmpBond) + { + g.setColor(Color.white); + drawLine(g, xmid, ymid, xend, yend); + } + + if(highlightBond2!=null && highlightBond2==tmpBond) + { + g.setColor(Color.white); + drawLine(g, xstart, ystart, xmid, ymid); + } + } } @@ -588,7 +636,7 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion } public void mousePressed(MouseEvent e) { - myAtom fatom = findAtom(e.getX(), e.getY()); + Atom fatom = findAtom(e.getX(), e.getY()); if(fatom!=null) { fatom.isSelected = !fatom.isSelected; @@ -604,17 +652,23 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion public void mouseMoved(MouseEvent e) { - myAtom fatom = findAtom(e.getX(), e.getY()); + Atom fatom = findAtom(e.getX(), e.getY()); + PDBChain chain = null; if(foundchain!=-1) { - PDBChain chain = (PDBChain) pdb.chains.elementAt(foundchain); - int pos = chain.seqstart + - (fatom.resNumber - chain.pdbstart - chain.offset)+1; + chain = (PDBChain) pdb.chains.elementAt(foundchain); + if(chain == mainchain) + { + int pos = chain.seqstart + + (fatom.resNumber - chain.pdbstart - chain.offset) + 1; - int index = seqcanvas.getViewport().getAlignment().findIndex(sequence); + int index = seqcanvas.getViewport().getAlignment().findIndex( + sequence); - seqcanvas.highlightSearchResults(new int[]{index, pos, pos}); + seqcanvas.highlightSearchResults(new int[] + {index, pos, pos}); + } } else seqcanvas.highlightSearchResults(null); @@ -622,7 +676,8 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion if (fatom != null) { toolx = e.getX(); tooly = e.getY(); - appletToolTip = fatom.resNumber+" "+ fatom.resName; + + appletToolTip = chain.id+":"+ fatom.resNumber+" "+ fatom.resName; redrawneeded = true; repaint(); } else { @@ -747,8 +802,8 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion } int foundchain = -1; - public myAtom findAtom(int x, int y) { - myAtom fatom = null; + public Atom findAtom(int x, int y) { + Atom fatom = null; foundchain = -1; @@ -792,8 +847,15 @@ public class AppletPDBCanvas extends Panel implements MouseListener, MouseMotion paint(g); } - private void jbInit() - throws Exception - { - } + public void setAllchainsVisible(boolean b) + { + for (int ii = 0; ii < pdb.chains.size(); ii++) + { + PDBChain chain = (PDBChain) pdb.chains.elementAt(ii); + chain.isVisible = b; + } + mainchain.isVisible = true; + findCentre(); + } + } diff --git a/src/MCview/AppletPDBViewer.java b/src/MCview/AppletPDBViewer.java index 77bbd8c..1ed4d10 100755 --- a/src/MCview/AppletPDBViewer.java +++ b/src/MCview/AppletPDBViewer.java @@ -125,21 +125,30 @@ public class AppletPDBViewer extends Frame molecule_actionPerformed(); } }); - jMenuBar1.add(fileMenu); + allchains.setLabel("All Chains Visible"); + allchains.addItemListener(new ItemListener() + { + public void itemStateChanged(ItemEvent itemEvent) + { + allchains_itemStateChanged(itemEvent); + } + }); + jMenuBar1.add(fileMenu); jMenuBar1.add(coloursMenu); fileMenu.add(mapping);; coloursMenu.add(seqButton); coloursMenu.add(chain); - coloursMenu.add(hydro); - coloursMenu.add(charge); - coloursMenu.addSeparator(); + coloursMenu.add(hydro); + coloursMenu.add(charge); + coloursMenu.add(molecule); + coloursMenu.addSeparator(); coloursMenu.add(wire); coloursMenu.add(depth); coloursMenu.add(zbuffer); - coloursMenu.add(molecule); - - } + coloursMenu.add(allchains); + allchains.setState(true); + } MenuBar jMenuBar1 = new MenuBar(); Menu fileMenu = new Menu(); @@ -156,8 +165,9 @@ public class AppletPDBViewer extends Frame MenuItem seqButton = new MenuItem(); CheckboxMenuItem molecule = new CheckboxMenuItem(); + CheckboxMenuItem allchains = new CheckboxMenuItem(); - public void charge_actionPerformed() + public void charge_actionPerformed() { clearButtonGroup(); pdbcanvas.pdb.setChargeColours(); @@ -231,4 +241,9 @@ public class AppletPDBViewer extends Frame jalview.bin.JalviewLite.addFrame(frame, "PDB - Sequence Mapping", 500, 600); cap.setText(pdbcanvas.mappingDetails.toString()); } - } + + public void allchains_itemStateChanged(ItemEvent itemEvent) + { + pdbcanvas.setAllchainsVisible(allchains.getState()); + } +} diff --git a/src/MCview/PDBCanvas.java b/src/MCview/PDBCanvas.java index b1d8805..f0806a8 100755 --- a/src/MCview/PDBCanvas.java +++ b/src/MCview/PDBCanvas.java @@ -69,8 +69,9 @@ public class PDBCanvas extends JPanel implements MouseListener, MouseMotionListe jalview.gui.SequenceRenderer sr; jalview.gui.FeatureRenderer fr; jalview.gui.SeqCanvas seqcanvas; - Sequence sequence; + public Sequence sequence; final StringBuffer mappingDetails = new StringBuffer(); + PDBChain mainchain; public PDBCanvas(jalview.gui.SeqCanvas seqcanvas, Sequence seq) { @@ -79,7 +80,7 @@ public class PDBCanvas extends JPanel implements MouseListener, MouseMotionListe sr = seqcanvas.getSequenceRenderer(); fr = seqcanvas.getFeatureRenderer(); - seqcanvas.setPDBViewer(this); + seqcanvas.setPDBCanvas(this); } public void setPDBFile(PDBfile pdb) @@ -133,12 +134,14 @@ public class PDBCanvas extends JPanel implements MouseListener, MouseMotionListe mappingDetails.append("\nSEQ start/end "+ seqstart + " " + seqend); } - ((PDBChain) pdb.chains.elementAt(maxchain)).pdbstart = pdbstart; - ((PDBChain) pdb.chains.elementAt(maxchain)).pdbend = pdbend; - ((PDBChain) pdb.chains.elementAt(maxchain)).seqstart = seqstart; - ((PDBChain) pdb.chains.elementAt(maxchain)).seqend = seqend; - ((PDBChain) pdb.chains.elementAt(maxchain)).isVisible = true; - ((PDBChain) pdb.chains.elementAt(maxchain)).sequence = sequence; + mainchain = (PDBChain) pdb.chains.elementAt(maxchain); + + mainchain.pdbstart = pdbstart; + mainchain.pdbend = pdbend; + mainchain.seqstart = seqstart; + mainchain.seqend = seqend; + mainchain.isVisible = true; + mainchain.sequence = sequence; this.pdb = pdb; this.prefsize = new Dimension(getWidth(), getHeight()); @@ -495,8 +498,9 @@ public class PDBCanvas extends JPanel implements MouseListener, MouseMotionListe Zsort.Zsort(bonds); } + Bond tmpBond=null; for (int i = 0; i < bonds.size(); i++) { - Bond tmpBond = (Bond) bonds.elementAt(i); + tmpBond = (Bond) bonds.elementAt(i); xstart = (int) (((tmpBond.start[0] - centre[0]) * scale) + (getWidth() / 2)); @@ -550,7 +554,22 @@ public class PDBCanvas extends JPanel implements MouseListener, MouseMotionListe } else { drawLine(g, xstart, ystart, xend, yend); } + + if(highlightBond1!=null && highlightBond1==tmpBond) + { + g.setColor(tmpBond.endCol.brighter().brighter().brighter()); + drawLine(g, xmid, ymid, xend, yend); + } + + if(highlightBond2!=null && highlightBond2==tmpBond) + { + g.setColor(tmpBond.startCol.brighter().brighter().brighter()); + drawLine(g, xstart, ystart, xmid, ymid); + } + } + + } public void drawLine(Graphics g, int x1, int y1, int x2, int y2) { @@ -595,7 +614,7 @@ public class PDBCanvas extends JPanel implements MouseListener, MouseMotionListe } public void mousePressed(MouseEvent e) { - myAtom fatom = findAtom(e.getX(), e.getY()); + Atom fatom = findAtom(e.getX(), e.getY()); if(fatom!=null) { fatom.isSelected = !fatom.isSelected; @@ -611,24 +630,32 @@ public class PDBCanvas extends JPanel implements MouseListener, MouseMotionListe public void mouseMoved(MouseEvent e) { - myAtom fatom = findAtom(e.getX(), e.getY()); + Atom fatom = findAtom(e.getX(), e.getY()); + PDBChain chain = null; if(foundchain!=-1) { - PDBChain chain = (PDBChain) pdb.chains.elementAt(foundchain); - int pos = chain.seqstart + - (fatom.resNumber - chain.pdbstart - chain.offset)+1; + chain = (PDBChain) pdb.chains.elementAt(foundchain); + if(chain == mainchain) + { + int pos = chain.seqstart + + (fatom.resNumber - chain.pdbstart - chain.offset) + 1; - int index = seqcanvas.getViewport().getAlignment().findIndex(sequence); + int index = seqcanvas.getViewport().getAlignment().findIndex( + sequence); - seqcanvas.highlightSearchResults(new int[]{index, pos, pos}); + seqcanvas.highlightSearchResults(new int[] + {index, pos, pos}); + } } else seqcanvas.highlightSearchResults(null); - if (fatom != null) { - this.setToolTipText(fatom.resNumber+" "+ fatom.resName); - } else { + if (fatom != null) + { + this.setToolTipText(chain.id+":"+ fatom.resNumber+" "+ fatom.resName); + } else + { this.setToolTipText(""); } } @@ -748,24 +775,30 @@ public class PDBCanvas extends JPanel implements MouseListener, MouseMotionListe } int foundchain = -1; - public myAtom findAtom(int x, int y) { - myAtom fatom = null; + public Atom findAtom(int x, int y) { + Atom fatom = null; foundchain = -1; - for (int ii = 0; ii < pdb.chains.size(); ii++) { + for (int ii = 0; ii < pdb.chains.size(); ii++) + { PDBChain chain = (PDBChain) pdb.chains.elementAt(ii); + int truex; + Bond tmpBond=null; - if (chain.isVisible) { + if (chain.isVisible) + { Vector bonds = ((PDBChain) pdb.chains.elementAt(ii)).bonds; - for (int i = 0; i < bonds.size(); i++) { - Bond tmpBond = (Bond) bonds.elementAt(i); + for (int i = 0; i < bonds.size(); i++) + { + tmpBond = (Bond) bonds.elementAt(i); - int truex = (int) (((tmpBond.start[0] - centre[0]) * scale) + + truex = (int) (((tmpBond.start[0] - centre[0]) * scale) + (getWidth() / 2)); - if (Math.abs(truex - x) <= 2) { + if (Math.abs(truex - x) <= 2) + { int truey = (int) (((tmpBond.start[1] - centre[1]) * scale) + (getHeight() / 2)); @@ -777,6 +810,25 @@ public class PDBCanvas extends JPanel implements MouseListener, MouseMotionListe } } } + + // Still here? Maybe its the last bond + + truex = (int) ( ( (tmpBond.end[0] - centre[0]) * scale) + + (getWidth() / 2)); + + if (Math.abs(truex - x) <= 2) + { + int truey = (int) ( ( (tmpBond.end[1] - centre[1]) * scale) + + (getHeight() / 2)); + + if (Math.abs(truey - y) <= 2) + { + fatom = tmpBond.at2; + foundchain = ii; + break; + } + } + } if (fatom != null) //)&& chain.ds != null) @@ -787,4 +839,40 @@ public class PDBCanvas extends JPanel implements MouseListener, MouseMotionListe return fatom; } + + Bond highlightBond1, highlightBond2; + public void highlightRes(int ii) + { + highlightBond1 = null; + highlightBond2 = null; + + int index = ii - mainchain.seqstart - mainchain.offset+1; + if(index <0 ) + return; + + if(index<=mainchain.bonds.size()) + { + if(index>0) + { + highlightBond1 = (Bond) mainchain.bonds.elementAt(index - 1); + } + + if(index!=mainchain.bonds.size()) + highlightBond2 = (Bond) mainchain.bonds.elementAt(index); + } + + redrawneeded = true; + repaint(); + } + + public void setAllchainsVisible(boolean b) + { + for (int ii = 0; ii < pdb.chains.size(); ii++) + { + PDBChain chain = (PDBChain) pdb.chains.elementAt(ii); + chain.isVisible = b; + } + mainchain.isVisible = true; + findCentre(); + } } diff --git a/src/MCview/PDBChain.java b/src/MCview/PDBChain.java index 208ecd0..9c1d0e0 100755 --- a/src/MCview/PDBChain.java +++ b/src/MCview/PDBChain.java @@ -34,7 +34,7 @@ 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; @@ -61,8 +61,8 @@ public class PDBChain { for (int i = 0; i < (residues.size() - 1); i++) { Residue tmpres = (Residue) residues.elementAt(i); Residue tmpres2 = (Residue) residues.elementAt(i + 1); - myAtom at1 = tmpres.findAtom("CA"); - myAtom at2 = tmpres2.findAtom("CA"); + Atom at1 = tmpres.findAtom("CA"); + Atom at2 = tmpres2.findAtom("CA"); if ((at1 != null) && (at2 != null)) { if (at1.chain.equals(at2.chain)) { @@ -72,7 +72,7 @@ public class PDBChain { } } - public void makeBond(myAtom at1, myAtom at2) { + public void makeBond(Atom at1, Atom at2) { float[] start = new float[3]; float[] end = new float[3]; @@ -92,7 +92,7 @@ public class PDBChain { String seq = ""; for (int i = 0; i < atoms.size(); i++) { - myAtom tmp = (myAtom) atoms.elementAt(i); + Atom tmp = (Atom) atoms.elementAt(i); //String resName = tmp.resName; int resNumber = tmp.resNumber; int res = resNumber; @@ -103,18 +103,18 @@ public class PDBChain { Vector resAtoms = new Vector(); - resAtoms.addElement((myAtom) atoms.elementAt(i)); + resAtoms.addElement((Atom) atoms.elementAt(i)); i++; - resNumber = ((myAtom) atoms.elementAt(i)).resNumber; + resNumber = ((Atom) atoms.elementAt(i)).resNumber; //Add atoms to a vector while the residue number //remains the same while ((resNumber == res) && (i < atoms.size())) { - resAtoms.addElement((myAtom) atoms.elementAt(i)); + resAtoms.addElement((Atom) atoms.elementAt(i)); i++; if (i < atoms.size()) { - resNumber = ((myAtom) atoms.elementAt(i)).resNumber; + resNumber = ((Atom) atoms.elementAt(i)).resNumber; } else { resNumber++; } @@ -128,7 +128,7 @@ public class PDBChain { count++; Residue tmpres = (Residue) residues.lastElement(); - myAtom tmpat = (myAtom) tmpres.atoms.elementAt(0); + Atom tmpat = (Atom) tmpres.atoms.elementAt(0); // Keep totting up the sequence if (ResidueProperties.getAA3Hash().get(tmpat.resName) == null) { @@ -231,17 +231,13 @@ public class PDBChain { - 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; } } } diff --git a/src/MCview/PDBViewer.java b/src/MCview/PDBViewer.java index 95d4b35..06b6f65 100755 --- a/src/MCview/PDBViewer.java +++ b/src/MCview/PDBViewer.java @@ -174,6 +174,15 @@ public class PDBViewer extends JInternalFrame implements Runnable molecule_actionPerformed(e); } }); + allchains.setSelected(true); + allchains.setText("Show All Chains"); + allchains.addItemListener(new ItemListener() + { + public void itemStateChanged(ItemEvent e) + { + allchains_itemStateChanged(e); + } + }); jMenuBar1.add(fileMenu); jMenuBar1.add(coloursMenu); fileMenu.add(saveMenu); @@ -189,6 +198,7 @@ public class PDBViewer extends JInternalFrame implements Runnable coloursMenu.add(depth); coloursMenu.add(zbuffer); coloursMenu.add(molecule); + coloursMenu.add(allchains); ButtonGroup bg = new ButtonGroup(); bg.add(seqButton); bg.add(chain); @@ -211,6 +221,7 @@ public class PDBViewer extends JInternalFrame implements Runnable JRadioButtonMenuItem chain = new JRadioButtonMenuItem(); JRadioButtonMenuItem seqButton = new JRadioButtonMenuItem(); JCheckBoxMenuItem molecule = new JCheckBoxMenuItem(); + JCheckBoxMenuItem allchains = new JCheckBoxMenuItem(); /** * DOCUMENT ME! @@ -329,4 +340,9 @@ public class PDBViewer extends JInternalFrame implements Runnable Desktop.addInternalFrame(cap, "PDB - Sequence Mapping", 500, 600); cap.setText(pdbcanvas.mappingDetails.toString()); } + + public void allchains_itemStateChanged(ItemEvent e) + { + pdbcanvas.setAllchainsVisible(allchains.getState()); + } } diff --git a/src/MCview/PDBfile.java b/src/MCview/PDBfile.java index f9d842f..d1e4d65 100755 --- a/src/MCview/PDBfile.java +++ b/src/MCview/PDBfile.java @@ -23,6 +23,7 @@ import java.io.*; import java.net.*; import java.util.*; +import java.awt.Color; public class PDBfile extends jalview.io.FileParse { @@ -77,7 +78,7 @@ public class PDBfile extends jalview.io.FileParse { if (inStr.indexOf("ATOM") != -1) { try { - myAtom tmpatom = new myAtom(str); + Atom tmpatom = new Atom(str); if (findChain(tmpatom.chain) != null) { // System.out.println("Adding to chain " + tmpatom.chain); @@ -114,7 +115,6 @@ public class PDBfile extends jalview.io.FileParse { public PDBChain findChain(String id) { for (int i = 0; i < chains.size(); i++) { - // System.out.println("ID = " + id + " " +((PDBChain)chains.elementAt(i)).id); if (((PDBChain) chains.elementAt(i)).id.equals(id)) { return (PDBChain) chains.elementAt(i); } @@ -135,17 +135,13 @@ public class PDBfile extends jalview.io.FileParse { } } - 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() { - for (int i = 0; i < chains.size(); i++) { - ((PDBChain) chains.elementAt(i)).setChainColours(); + public void setChainColours() + { + for (int i = 0; i < chains.size(); i++) + { + ((PDBChain) chains.elementAt(i)).setChainColours( + Color.getHSBColor(1.0f / (float)i, .4f, 1.0f) + ); } } } diff --git a/src/MCview/Residue.java b/src/MCview/Residue.java index b01d982..efaf1f0 100755 --- a/src/MCview/Residue.java +++ b/src/MCview/Residue.java @@ -33,10 +33,10 @@ public class Residue { this.count = count; } - public myAtom findAtom(String name) { + public Atom findAtom(String name) { for (int i = 0; i < atoms.size(); i++) { - if (((myAtom) atoms.elementAt(i)).name.equals(name)) { - return (myAtom) atoms.elementAt(i); + if (((Atom) atoms.elementAt(i)).name.equals(name)) { + return (Atom) atoms.elementAt(i); } }