FontChooser fc = new FontChooser( alignPanel, frame );\r
frame.setContentPane(fc);\r
Desktop.addInternalFrame(frame, "Change Font", 480,100);\r
+ frame.setLayer(JLayeredPane.PALETTE_LAYER);\r
}\r
\r
protected void fullSeqId_actionPerformed(ActionEvent e)\r
\r
void changeColour(ColourSchemeI cs)\r
{\r
+ int threshold = 0;\r
\r
- if(viewport.getColourAppliesToAllGroups())\r
+ if ( viewport.getAbovePIDThreshold() )\r
{\r
- Vector groups = viewport.alignment.getGroups();\r
- for(int i=0; i<groups.size(); i++)\r
- {\r
- SequenceGroup sg = (SequenceGroup)groups.elementAt(i);\r
- sg.cs = cs;\r
+ threshold = SliderPanel.setPIDSliderSource(alignPanel, cs, "Background");\r
\r
- if(abovePIDThreshold.isSelected())\r
- abovePIDThreshold_actionPerformed(null);\r
- else if( viewport.getConservationSelected() )\r
- {\r
- Conservation c = new Conservation("Group",\r
- ResidueProperties.propHash, 3,\r
- sg.sequences, sg.getStartRes(),\r
- sg.getEndRes());\r
- c.calculate();\r
- c.verdict(false, viewport.ConsPercGaps);\r
- ConservationColourScheme ccs = new ConservationColourScheme(c, sg.cs);\r
- sg.cs = ccs;\r
- }\r
+ if (cs instanceof ResidueColourScheme)\r
+ ( (ResidueColourScheme) cs).setThreshold(threshold);\r
+ else if (cs instanceof ScoreColourScheme)\r
+ ( (ScoreColourScheme) cs).setThreshold(threshold);\r
\r
- }\r
+ viewport.setGlobalColourScheme(cs);\r
}\r
+ else if (cs instanceof ResidueColourScheme)\r
+ ( (ResidueColourScheme) cs).setThreshold(0);\r
+ else if (cs instanceof ScoreColourScheme)\r
+ ( (ScoreColourScheme) cs).setThreshold(0);\r
\r
\r
- if ( viewport.getAbovePIDThreshold() )\r
+\r
+ if (viewport.getConservationSelected())\r
{\r
- // int threshold = 0;\r
- // threshold = Desktop.setPIDSliderSource(alignPanel, cs, "Background");\r
- Desktop.hideConservationSlider();\r
+ ConservationColourScheme ccs = null;\r
\r
- // if (cs instanceof ResidueColourScheme)\r
- // ( (ResidueColourScheme) cs).setThreshold(threshold);\r
- // else if (cs instanceof ScoreColourScheme)\r
- // ( (ScoreColourScheme) cs).setThreshold(threshold);\r
+ Alignment al = (Alignment) viewport.alignment;\r
+ Conservation c = new Conservation("All",\r
+ ResidueProperties.propHash, 3,\r
+ al.getSequences(), 0,\r
+ al.getWidth() - 1);\r
\r
- viewport.setGlobalColourScheme(cs);\r
+ c.calculate();\r
+ c.verdict(false, viewport.ConsPercGaps);\r
+\r
+ ccs = new ConservationColourScheme(c, cs);\r
+\r
+ // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!\r
+ ccs.setConsensus( viewport.vconsensus );\r
+ viewport.setGlobalColourScheme(ccs);\r
\r
}\r
else\r
- if (cs instanceof ResidueColourScheme)\r
- ( (ResidueColourScheme) cs).setThreshold(0);\r
- else if (cs instanceof ScoreColourScheme)\r
- ( (ScoreColourScheme) cs).setThreshold(0);\r
+ {\r
+ // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!\r
+ cs.setConsensus( viewport.vconsensus );\r
+ viewport.setGlobalColourScheme(cs);\r
+ }\r
\r
\r
+ if(viewport.getColourAppliesToAllGroups())\r
+ {\r
+ Vector groups = viewport.alignment.getGroups();\r
+ for(int i=0; i<groups.size(); i++)\r
+ {\r
+ SequenceGroup sg = (SequenceGroup)groups.elementAt(i);\r
\r
\r
-if ( viewport.getConservationSelected() )\r
- {\r
- ConservationColourScheme ccs = null;\r
+ try{\r
+ sg.cs = (ColourSchemeI)cs.getClass().newInstance();\r
+ }catch(Exception ex){}\r
\r
- Alignment al = (Alignment) viewport.alignment;\r
- Conservation c = new Conservation("All",\r
- ResidueProperties.propHash, 3,\r
- al.getSequences(), 0,\r
- al.getWidth()-1);\r
+ if(viewport.getAbovePIDThreshold())\r
+ {\r
+ if (sg.cs instanceof ResidueColourScheme)\r
+ ( (ResidueColourScheme) sg.cs).setThreshold(threshold);\r
+ else if (sg.cs instanceof ScoreColourScheme)\r
+ ( (ScoreColourScheme) sg.cs).setThreshold(threshold);\r
\r
- c.calculate();\r
- c.verdict(false, viewport.ConsPercGaps);\r
+ sg.cs.setConsensus( AAFrequency.calculate(sg.sequences, 0, sg.getWidth()) );\r
+ }\r
\r
- ccs = new ConservationColourScheme(c, cs);\r
+ if( viewport.getConservationSelected() )\r
+ {\r
+ Conservation c = new Conservation("Group",\r
+ ResidueProperties.propHash, 3,\r
+ sg.sequences, 0, viewport.alignment.getWidth()-1);\r
+ c.calculate();\r
+ c.verdict(false, viewport.ConsPercGaps);\r
+ ConservationColourScheme ccs = new ConservationColourScheme(c, sg.cs);\r
+\r
+ // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!\r
+ ccs.setConsensus( AAFrequency.calculate(sg.sequences, 0, sg.getWidth()));\r
+ sg.cs = ccs;\r
+ }\r
+ else\r
+ {\r
+ // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!\r
+ sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0, sg.getWidth()));\r
+ }\r
+\r
+ }\r
+ }\r
\r
- viewport.setGlobalColourScheme(ccs);\r
\r
- }\r
- else\r
- viewport.setGlobalColourScheme( cs );\r
\r
alignPanel.RefreshPanels();\r
}\r
\r
protected void modifyPID_actionPerformed(ActionEvent e)\r
{\r
- if(viewport.getAbovePIDThreshold())\r
- Desktop.setPIDSliderSource(alignPanel, viewport.getGlobalColourScheme(), "Background");\r
+ if(viewport.getAbovePIDThreshold())\r
+ {\r
+ SliderPanel.setPIDSliderSource(alignPanel, viewport.getGlobalColourScheme(),\r
+ "Background");\r
+ SliderPanel.showPIDSlider();\r
+ }\r
}\r
\r
protected void modifyConservation_actionPerformed(ActionEvent e)\r
{\r
if(viewport.getConservationSelected())\r
- Desktop.setConservationSliderSource(alignPanel, viewport.globalColourScheme, "Background");\r
+ {\r
+ SliderPanel.setConservationSlider(alignPanel, viewport.globalColourScheme,\r
+ "Background");\r
+ SliderPanel.showConservationSlider();\r
+ }\r
}\r
\r
\r
protected void conservationMenuItem_actionPerformed(ActionEvent e)\r
{\r
viewport.setConservationSelected(conservationMenuItem.isSelected());\r
- if(coloursChanging)\r
- return;\r
-\r
- coloursChanging = true;\r
\r
viewport.setAbovePIDThreshold(false);\r
abovePIDThreshold.setSelected(false);\r
- Desktop.hidePIDSlider();\r
- if(!viewport.getConservationSelected())\r
- Desktop.hideConservationSlider();\r
\r
ColourSchemeI cs = viewport.getGlobalColourScheme();\r
if(cs instanceof ConservationColourScheme )\r
else\r
changeColour( cs );\r
\r
- coloursChanging = false;\r
}\r
\r
- boolean coloursChanging = false;\r
+ // boolean coloursChanging = false;\r
public void abovePIDThreshold_actionPerformed(ActionEvent e)\r
{\r
- if(coloursChanging)\r
- return;\r
-\r
- coloursChanging = true;\r
viewport.setAbovePIDThreshold(abovePIDThreshold.isSelected());\r
\r
conservationMenuItem.setSelected(false);\r
viewport.setConservationSelected(false);\r
- Desktop.hideConservationSlider();\r
-\r
- if(!viewport.getAbovePIDThreshold())\r
- Desktop.hidePIDSlider();\r
-\r
\r
ColourSchemeI cs = viewport.getGlobalColourScheme();\r
+\r
if(cs instanceof ConservationColourScheme )\r
changeColour( ((ConservationColourScheme)cs).cs );\r
else\r
changeColour( cs );\r
-\r
- coloursChanging = false;\r
}\r
\r
\r
\r
public void BLOSUM62Colour_actionPerformed(ActionEvent e)\r
{\r
- changeColour(new Blosum62ColourScheme(viewport) );\r
+ changeColour(new Blosum62ColourScheme() );\r
}\r
\r
\r