From: amwaterhouse Date: Mon, 23 Apr 2007 11:49:36 +0000 (+0000) Subject: Test out new arrangement X-Git-Tag: Release_2_3~191 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=7e107cbd8d3112584c63396d33a69157f7d1c68d;p=jalview.git Test out new arrangement --- diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 45bf5ed..ef87c2f 100755 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -82,6 +82,9 @@ public class PopupMenu JMenuItem sequenceFeature = new JMenuItem(); JMenuItem textColour = new JMenuItem(); JMenu jMenu1 = new JMenu(); + JMenu structureMenu = new JMenu(); + JMenu viewStructureMenu = new JMenu(); + JMenu colStructureMenu = new JMenu(); /** * Creates a new PopupMenu object. @@ -155,12 +158,11 @@ public class PopupMenu final PDBEntry pdb = (PDBEntry) e.nextElement(); menuItem = new JMenuItem(); - menuItem.setText("View PDB entry: " + pdb.getId()); + menuItem.setText(pdb.getId()); menuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { - Vector seqs = new Vector(); for (int i = 0; i < ap.av.alignment.getHeight(); i++) { @@ -178,7 +180,6 @@ public class PopupMenu continue; } - } } @@ -188,7 +189,18 @@ public class PopupMenu new AppJMol(pdb, seqs2, ap); } }); - sequenceMenu.add(menuItem); + viewStructureMenu.add(menuItem); + + menuItem = new JMenuItem(); + menuItem.setText(pdb.getId()); + menuItem.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + colourByStructure(pdb.getId()); + } + }); + colStructureMenu.add(menuItem); } } @@ -334,7 +346,7 @@ public class PopupMenu if (seq == null) { sequenceMenu.setVisible(false); - pdbMenu.setVisible(false); + structureMenu.setVisible(false); } if (links != null && links.size() > 0) @@ -551,15 +563,19 @@ public class PopupMenu } }); jMenu1.setText("Group"); + structureMenu.setText("Structure"); + viewStructureMenu.setText("View Structure"); + colStructureMenu.setText("Colour By Structure"); + add(groupMenu); add(sequenceMenu); + this.add(structureMenu); groupMenu.add(editMenu); groupMenu.add(outputMenu); groupMenu.add(sequenceFeature); groupMenu.add(jMenu1); sequenceMenu.add(sequenceName); - sequenceMenu.add(pdbMenu); colourMenu.add(textColour); colourMenu.add(noColourmenuItem); colourMenu.add(clustalColour); @@ -613,6 +629,9 @@ public class PopupMenu jMenu1.add(showText); jMenu1.add(showColourText); jMenu1.add(outline); + structureMenu.add(pdbMenu); + structureMenu.add(viewStructureMenu); + structureMenu.add(colStructureMenu); noColourmenuItem.setText("None"); noColourmenuItem.addActionListener(new java.awt.event.ActionListener() { @@ -1319,8 +1338,13 @@ public class PopupMenu public void discoverPDB_actionPerformed() { - new jalview.io.DBRefFetcher( - ap.av.getAlignment(), ap.alignFrame).fetchDBRefs(false); + SequenceI[] sequences = + ap.av.selectionGroup == null ? + new Sequence[]{sequence} + : ap.av.selectionGroup.getSequencesInOrder(ap.av.alignment); + + new jalview.io.DBRefFetcher(sequences, + ap.alignFrame).fetchDBRefs(false); } public void sequenceFeature_actionPerformed() @@ -1360,4 +1384,23 @@ public class PopupMenu new TextColourChooser().chooseColour(ap, sg); } } + + public void colourByStructure(String pdbid) + { + Annotation [] anots = jalview.structure.StructureSelectionManager.getStructureSelectionManager() + .colourSequenceFromStructure(sequence, pdbid); + + AlignmentAnnotation an = new AlignmentAnnotation( + "Structure", "Coloured by "+pdbid, anots); + + ap.av.alignment.addAnnotation(an); + an.createSequenceMapping(sequence, 0, true); + //an.adjustForAlignment(); + ap.av.alignment.setAnnotationIndex(an,0); + + ap.adjustAnnotationHeight(); + + sequence.addAlignmentAnnotation(an); + + } }