action.pairwise_alignment = Pairwise Alignment
action.user_defined = User Defined...
action.by_conservation = By Conservation
+action.by_consensus_secondary_structure = By Secondary Structure Consensus
action.wrap = Wrap
action.show_gaps = Show Gaps
action.show_hidden_markers = Show Hidden Markers
label.apply_colour_to_all_groups = Apply Colour To All Groups
label.modify_identity_threshold = Modify Identity Threshold...
label.modify_conservation_threshold = Modify Conservation Threshold...
+label.modify_consensus_secondary_structure_threshold = Modify Secondary Structure Consensus Threshold...
label.input_from_textbox = Input from textbox
label.centre_column_labels = Centre column labels
label.automatic_scrolling = Automatic Scrolling
label.cut_sequences = Cut Sequences
label.conservation_colour_increment = Conservation Colour Increment ({0})
label.percentage_identity_threshold = Percentage Identity Threshold ({0})
+label.consensus_secondary_structure_threshold = Consensus Secondary Structure Threshold ({0})
label.error_unsupported_owwner_user_colour_scheme = Unsupported owner for User Colour scheme dialog
label.save_alignment_to_file = Save Alignment to file
label.save_features_to_file = Save Features to File
boolean getColourAppliesToAllGroups();
boolean getAbovePIDThreshold();
+
+ boolean getByConsensusSecondaryStructureSelected();
void setIncrement(int inc);
boolean getScaleRightWrapped();
void setAbovePIDThreshold(boolean b);
+
+ void setByConsensusSecondaryStructureSelected(boolean b);
void setThreshold(int thresh);
conservationMenuItem.setEnabled(!nucleotide);
modifyConservation
.setEnabled(!nucleotide && conservationMenuItem.isSelected());
+ byConsensusSecondaryStructureMenuItem.setEnabled(!nucleotide);
+ modifyConsensusSecondaryStructureThreshold.setEnabled(!nucleotide
+ && byConsensusSecondaryStructureMenuItem.isSelected());
showGroupConservation.setEnabled(!nucleotide);
showComplementMenuItem
modifyPID.setEnabled(abovePIDThreshold.isSelected());
conservationMenuItem.setSelected(av.getConservationSelected());
modifyConservation.setEnabled(conservationMenuItem.isSelected());
+ byConsensusSecondaryStructureMenuItem.setSelected(
+ av.getByConsensusSecondaryStructureSelected());
+ modifyConsensusSecondaryStructureThreshold.setEnabled(
+ byConsensusSecondaryStructureMenuItem.isSelected());
seqLimits.setSelected(av.getShowJVSuffix());
idRightAlign.setSelected(av.isRightAlignIds());
centreColumnLabelsMenuItem.setState(av.isCentreColumnLabels());
viewport.getResidueShading(), alignPanel.getViewName());
SliderPanel.showConservationSlider();
}
+
+ @Override
+ protected void modifyConsensusSecondaryStructureThreshold_actionPerformed()
+ {
+ SliderPanel.setConsensusSecondaryStructureSlider(alignPanel,
+ viewport.getResidueShading(), alignPanel.getViewName());
+ SliderPanel.showConsensusSecondaryStructureSlider();
+ }
/**
* Action on selecting or deselecting (Colour) By Conservation
SliderPanel.hideConservationSlider();
}
}
+
+ @Override
+ public void colourByConsensusSecondaryStructureMenuItem_actionPerformed(boolean selected)
+ {
+ modifyConsensusSecondaryStructureThreshold.setEnabled(selected);
+ viewport.setByConsensusSecondaryStructureSelected(selected);
+ viewport.getResidueShading().setConsensusSecondaryStructureColouring(selected);
+
+ changeColour(viewport.getGlobalColourScheme());
+ if (selected)
+ {
+ modifyConsensusSecondaryStructureThreshold_actionPerformed();
+ }
+ else
+ {
+ SliderPanel.hideConsensusSecondaryStructureSlider();
+ }
+ }
/**
* Action on selecting or deselecting (Colour) Above PID Threshold
colourMenu.addSeparator();
colourMenu.add(conservationMenuItem);
colourMenu.add(modifyConservation);
+ colourMenu.add(byConsensusSecondaryStructureMenuItem);
+ colourMenu.add(modifyConsensusSecondaryStructureThreshold);
colourMenu.add(abovePIDThreshold);
colourMenu.add(modifyPID);
protected JMenuItem modifyConservation = new JMenuItem();
+ protected JCheckBoxMenuItem byConsensusSecondaryStructureMenuItem = new JCheckBoxMenuItem();
+
+ protected JMenuItem modifyConsensusSecondaryStructureThreshold = new JMenuItem();
+
JMenu sequenceMenu = new JMenu();
JMenuItem makeReferenceSeq = new JMenuItem();
ColourMenuHelper.setColourSelected(colourMenu, sg.getColourScheme());
conservationMenuItem.setEnabled(!sg.isNucleotide());
+
+ byConsensusSecondaryStructureMenuItem.setEnabled(!sg.isNucleotide());
if (sg.cs != null)
{
{
abovePIDColour.setSelected(true);
}
+ if(sg.cs.isConsensusSecondaryStructureColouring())
+ {
+ byConsensusSecondaryStructureMenuItem.setSelected(true);
+ }
}
modifyConservation.setEnabled(conservationMenuItem.isSelected());
modifyPID.setEnabled(abovePIDColour.isSelected());
+ modifyConsensusSecondaryStructureThreshold.setEnabled(
+ byConsensusSecondaryStructureMenuItem.isSelected());
displayNonconserved.setSelected(sg.getShowNonconserved());
showText.setSelected(sg.getDisplayText());
showColourText.setSelected(sg.getColourText());
conservationMenuItem.isSelected());
}
});
+
+ byConsensusSecondaryStructureMenuItem.setText(
+ MessageManager.getString("action.by_consensus_secondary_structure"));
+ byConsensusSecondaryStructureMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ colourByConsensusSecondaryStructureMenuItem_actionPerformed(
+ byConsensusSecondaryStructureMenuItem.isSelected());
+ }
+ });
annotationColour = new JRadioButtonMenuItem(
MessageManager.getString("action.by_annotation"));
modifyConservation_actionPerformed();
}
});
+
+ modifyConsensusSecondaryStructureThreshold.setText(MessageManager
+ .getString("label.modify_consensus_secondary_structure_threshold"));
+ modifyConsensusSecondaryStructureThreshold.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ modifyConsensusSecondaryStructureThreshold_actionPerformed();
+ }
+ });
}
/**
colourMenu.addSeparator();
colourMenu.add(conservationMenuItem);
colourMenu.add(modifyConservation);
+ colourMenu.add(byConsensusSecondaryStructureMenuItem);
+ colourMenu.add(modifyConsensusSecondaryStructureThreshold);
colourMenu.add(abovePIDColour);
colourMenu.add(modifyPID);
}
SliderPanel.showConservationSlider();
}
}
+
+ protected void modifyConsensusSecondaryStructureThreshold_actionPerformed()
+ {
+ SequenceGroup sg = getGroup();
+ if (sg.cs != null)
+ {
+ SliderPanel.setConsensusSecondaryStructureSlider(ap, sg.cs, sg.getName());
+ SliderPanel.showConsensusSecondaryStructureSlider();
+ }
+ }
+
protected void modifyPID_actionPerformed()
{
refresh();
}
+
+ public void colourByConsensusSecondaryStructureMenuItem_actionPerformed(boolean selected)
+ {
+ SequenceGroup sg = getGroup();
+ if (sg.cs == null)
+ {
+ return;
+ }
+
+ if (selected)
+ {
+
+ sg.cs.setConsensusSecondaryStructureColouring(selected);
+
+ SliderPanel.setConsensusSecondaryStructureSlider(ap, sg.getGroupColourScheme(),
+ sg.getName());
+ SliderPanel.showConsensusSecondaryStructureSlider();
+ }
+ else
+ // remove ConsensusSecondaryStructureColouring
+ {
+ sg.cs.setConsensusSecondaryStructureColouring(selected);
+ SliderPanel.hideConsensusSecondaryStructureSlider();
+ }
+ modifyConsensusSecondaryStructureThreshold.setEnabled(selected);
+
+ refresh();
+ }
/**
* Shows a dialog where group name and description may be edited
private static final String BACKGROUND = "Background";
static JInternalFrame conservationSlider;
+
+ static JInternalFrame consensusSecondaryStructureSlider;
static JInternalFrame PIDSlider;
AlignmentPanel ap;
boolean forConservation = true;
+
+ boolean forConsensusSecondaryStructure = false;
ResidueShaderI cs;
{
return (SliderPanel) PIDSlider.getContentPane();
}
+ if (consensusSecondaryStructureSlider != null && consensusSecondaryStructureSlider.isVisible())
+ {
+ return (SliderPanel) consensusSecondaryStructureSlider.getContentPane();
+ }
return null;
}
* DOCUMENT ME!
*/
public SliderPanel(final AlignmentPanel ap, int value,
- boolean forConserve, ResidueShaderI scheme)
+ boolean forConserve, boolean forConsensusSS, ResidueShaderI scheme)
{
this.ap = ap;
this.cs = scheme;
forConservation = forConserve;
+ forConsensusSecondaryStructure = forConsensusSS;
+
undoButton.setVisible(false);
applyButton.setVisible(false);
slider.setMinimum(0);
slider.setMaximum(100);
}
+ if(forConsensusSS) {
+ label.setText(MessageManager.getString(
+ "label.enter_value_increase_conservation_visibility"));
+ slider.setMinimum(0);
+ slider.setMaximum(100);
+ }
else
{
label.setText(MessageManager.getString(
if (conservationSlider == null)
{
- sliderPanel = new SliderPanel(ap, rs.getConservationInc(), true, rs);
+ sliderPanel = new SliderPanel(ap, rs.getConservationInc(), true, false, rs);
conservationSlider = new JInternalFrame();
conservationSlider.setFrameIcon(null);
conservationSlider.setContentPane(sliderPanel);
conservationSlider.setLayer(JLayeredPane.PALETTE_LAYER);
}
}
+
+ public static int setConsensusSecondaryStructureSlider(AlignmentPanel ap,
+ ResidueShaderI rs, String source)
+ {
+ SliderPanel sliderPanel = null;
+
+ if (consensusSecondaryStructureSlider == null)
+ {
+ sliderPanel = new SliderPanel(ap, rs.getConsensusSecondaryStructureThreshold(), false, true, rs);
+ consensusSecondaryStructureSlider = new JInternalFrame();
+ consensusSecondaryStructureSlider.setFrameIcon(null);
+ consensusSecondaryStructureSlider.setContentPane(sliderPanel);
+ consensusSecondaryStructureSlider.setLayer(JLayeredPane.PALETTE_LAYER);
+ }
+ else
+ {
+ sliderPanel = (SliderPanel) consensusSecondaryStructureSlider.getContentPane();
+ sliderPanel.valueField
+ .setText(String.valueOf(rs.getConsensusSecondaryStructureThreshold()));
+ sliderPanel.cs = rs;
+ sliderPanel.ap = ap;
+ sliderPanel.slider.setValue(rs.getConsensusSecondaryStructureThreshold());
+ }
+
+ consensusSecondaryStructureSlider.setTitle(MessageManager.formatMessage(
+ "label.consensus_secondary_structure_threshold", new String[]
+ { source == null ? BACKGROUND : source }));
+
+ List<SequenceGroup> groups = ap.av.getAlignment().getGroups();
+ if (groups != null && !groups.isEmpty())
+ {
+ sliderPanel.setAllGroupsCheckEnabled(true);
+ sliderPanel.allGroupsCheck
+ .setSelected(ap.av.getColourAppliesToAllGroups());
+ }
+ else
+ {
+ sliderPanel.setAllGroupsCheckEnabled(false);
+ }
+
+ return sliderPanel.getValue();
+ }
+
+
+ public static void hideConsensusSecondaryStructureSlider()
+ {
+ if (consensusSecondaryStructureSlider != null)
+ {
+ try
+ {
+ consensusSecondaryStructureSlider.setClosed(true);
+ consensusSecondaryStructureSlider = null;
+ } catch (PropertyVetoException ex)
+ {
+ }
+ }
+ }
+
+
+ public static void showConsensusSecondaryStructureSlider()
+ {
+ hidePIDSlider();
+ hideConservationSlider();
+
+ if (!consensusSecondaryStructureSlider.isVisible())
+ {
+ Desktop.addInternalFrame(consensusSecondaryStructureSlider,
+ consensusSecondaryStructureSlider.getTitle(), true, FRAME_WIDTH,
+ FRAME_HEIGHT, false, true);
+ consensusSecondaryStructureSlider.addInternalFrameListener(new InternalFrameAdapter()
+ {
+ @Override
+ public void internalFrameClosed(InternalFrameEvent e)
+ {
+ consensusSecondaryStructureSlider = null;
+ }
+ });
+ consensusSecondaryStructureSlider.setLayer(JLayeredPane.PALETTE_LAYER);
+ }
+ }
/**
* Method to 'set focus' of the PID slider panel
if (PIDSlider == null)
{
- sliderPanel = new SliderPanel(ap, threshold, false, rs);
+ sliderPanel = new SliderPanel(ap, threshold, false, false, rs);
PIDSlider = new JInternalFrame();
PIDSlider.setFrameIcon(null);
PIDSlider.setContentPane(sliderPanel);
*/
public void valueChanged(int percent)
{
- if (!forConservation)
+ if (!forConservation && !forConsensusSecondaryStructure)
{
ap.av.setThreshold(percent);
}
scheme.setConservationApplied(true);
scheme.setConservationInc(percent);
}
+ else if(forConsensusSecondaryStructure)
+ {
+ scheme.setConsensusSecondaryStructureColouring(true);
+ scheme.setConsensusSecondaryStructureThreshold(percent);
+ }
else
{
scheme.setThreshold(percent, ap.av.isIgnoreGapsConsensus());
{
return getValue(PIDSlider);
}
+
+ public static int getConsensusSecondaryStructureSliderValue()
+ {
+ return getValue(consensusSecondaryStructureSlider);
+ }
/**
* Answers true if the SliderPanel is for Conservation, false if it is for PID
{
title = PIDSlider.getTitle();
}
+ else if(consensusSecondaryStructureSlider != null)
+ {
+ title = consensusSecondaryStructureSlider.getTitle();
+ }
return title;
}
}
protected JCheckBoxMenuItem abovePIDThreshold;
- protected JMenuItem modifyPID;
+ protected JMenuItem modifyPID;
+
+ protected JCheckBoxMenuItem byConsensusSecondaryStructureMenuItem;
+
+ protected JMenuItem modifyConsensusSecondaryStructureThreshold;
protected JRadioButtonMenuItem annotationColour;
conservationMenuItem.isSelected());
}
});
+
+
+ byConsensusSecondaryStructureMenuItem = new JCheckBoxMenuItem(
+ MessageManager.getString("action.by_consensus_secondary_structure"));
+ byConsensusSecondaryStructureMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ colourByConsensusSecondaryStructureMenuItem_actionPerformed(
+ byConsensusSecondaryStructureMenuItem.isSelected());
+ }
+ });
abovePIDThreshold = new JCheckBoxMenuItem(
MessageManager.getString("label.above_identity_threshold"));
modifyConservation_actionPerformed();
}
});
+
+ modifyConsensusSecondaryStructureThreshold = new JMenuItem(MessageManager
+ .getString("label.modify_consensus_secondary_structure_threshold"));
+ modifyConsensusSecondaryStructureThreshold.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ modifyConsensusSecondaryStructureThreshold_actionPerformed();
+ }
+ });
+
annotationColour = new JRadioButtonMenuItem(
MessageManager.getString("action.by_annotation"));
protected void conservationMenuItem_actionPerformed(boolean selected)
{
}
+
+ public void colourByConsensusSecondaryStructureMenuItem_actionPerformed(boolean selected)
+ {
+ }
protected void printMenuItem_actionPerformed(ActionEvent e)
{
protected void modifyConservation_actionPerformed()
{
}
+
+ protected void modifyConsensusSecondaryStructureThreshold_actionPerformed()
+ {
+ }
protected void saveAs_actionPerformed()
{
import jalview.schemes.ColourSchemeI;
import jalview.util.ColorUtils;
import jalview.util.Comparison;
+import jalview.util.MessageManager;
import java.awt.Color;
import java.util.Map;
* if true, apply shading of colour by conservation
*/
private boolean conservationColouring;
+
+ private boolean consensusSecondaryStructureColouring;
+
+ @Override
+ public boolean isConsensusSecondaryStructureColouring()
+ {
+ return consensusSecondaryStructureColouring;
+ }
/*
* the physico-chemical property conservation scores for columns, with values
* setting of the By Conservation slider
*/
private int conservationIncrement = INITIAL_CONSERVATION;
+
+ private int consensusSecondaryStructureThreshold = 30;
public ResidueShader(ColourSchemeI cs)
{
this.ignoreGaps = rs.ignoreGaps;
this.pidThreshold = rs.pidThreshold;
this.ssConsensusProfileMap = rs.ssConsensusProfileMap;
+ this.consensusSecondaryStructureColouring = rs.consensusSecondaryStructureColouring;
+ this.consensusSecondaryStructureThreshold = rs.consensusSecondaryStructureThreshold;
}
/**
}
}
+
+ @Override
+ public void setConsensusSecondaryStructureColouring(boolean colourByConsensusSecondaryStructure)
+ {
+
+ consensusSecondaryStructureColouring = colourByConsensusSecondaryStructure;
+
+ }
/**
* @see jalview.renderer.ResidueShaderI#alignmentChanged(jalview.datamodel.AnnotatedCollectionI,
return conservationIncrement;
}
+ @Override
+ public void setConsensusSecondaryStructureThreshold(int i)
+ {
+ consensusSecondaryStructureThreshold = i;
+ }
+
+ @Override
+ public int getConsensusSecondaryStructureThreshold()
+ {
+ return consensusSecondaryStructureThreshold;
+ }
+
/**
* @see jalview.renderer.ResidueShaderI#getThreshold()
*/
{
colour = Color.white;
}
+
+ if(consensusSecondaryStructureColouring)
+ {
+ colour = applyByConsensusSecondaryStructure(colour, column);
+ }
if (conservationColouring)
{
return ColorUtils.bleachColour(currentColour, bleachFactor);
}
+
+
+ protected Color applyByConsensusSecondaryStructure(Color currentColour, int column)
+ {
+ if (ssConsensusProfileMap == null &&
+ ssConsensusProfileMap.get(MessageManager.getString("option.ss_providers_all")) == null)
+ {
+ return currentColour;
+ }
+
+ ProfilesI consensusSSProfileForAllSources =
+ ssConsensusProfileMap.get(MessageManager.getString("option.ss_providers_all"));
+ ProfileI profile = consensusSSProfileForAllSources.get(column);
+
+ if(profile != null)
+ {
+ float pid = profile.getSSPercentageIdentity(ignoreGaps);
+
+ if(pid == 0) {
+ return Color.white;
+ }
+
+ float bleachFactor = 1f - (pid/100);
+ bleachFactor *= (consensusSecondaryStructureThreshold/20);
+
+ return ColorUtils.bleachColour(currentColour, bleachFactor);
+
+ }
+
+ return currentColour;
+
+ }
/**
* @see jalview.renderer.ResidueShaderI#getColourScheme()
Color findSSColour(char symbol, int position, SequenceI seq,
String source);
+ int getConsensusSecondaryStructureThreshold();
+
+ void setConsensusSecondaryStructureThreshold(int i);
+
+ void setConsensusSecondaryStructureColouring(
+ boolean colourByConsensusSecondaryStructure);
+
+ boolean isConsensusSecondaryStructureColouring();
+
}
\ No newline at end of file
{
return viewStyle.getAbovePIDThreshold();
}
+
+ @Override
+ public boolean getByConsensusSecondaryStructureSelected()
+ {
+ return viewStyle.getByConsensusSecondaryStructureSelected();
+ }
/**
* @param inc
{
viewStyle.setAbovePIDThreshold(b);
}
+
+ @Override
+ public void setByConsensusSecondaryStructureSelected(boolean b)
+ {
+ viewStyle.setByConsensusSecondaryStructureSelected(b);
+ }
/**
* @param thresh
List<AlignmentAnnotation> ssAa = sg.getSSConsensus(secondaryStructureSources);
if(ssAa != null) {
for(AlignmentAnnotation aa : ssAa) {
- alignment.addAnnotation(aa, 0);
+ alignment.addAnnotation(aa, 0);
}
}
}
private boolean colourByReferenceSeq = false;
boolean conservationColourSelected = false;
+
+ boolean byConsensusSecondaryStructureSelected = false;
/**
* show the reference sequence in the alignment view
setColourAppliesToAllGroups(vs.getColourAppliesToAllGroups());
setColourByReferenceSeq(vs.isColourByReferenceSeq());
setColourText(vs.getColourText());
+ setByConsensusSecondaryStructureSelected(vs.getByConsensusSecondaryStructureSelected());
setConservationColourSelected(vs.isConservationColourSelected());
setConservationSelected(vs.getConservationSelected());
setDisplayReferenceSeq(vs.isDisplayReferenceSeq());
&& getColourText() == vs.getColourText()
&& isConservationColourSelected() == vs
.isConservationColourSelected()
+ && getByConsensusSecondaryStructureSelected() == vs.getByConsensusSecondaryStructureSelected()
&& getConservationSelected() == vs.getConservationSelected()
&& isDisplayReferenceSeq() == vs.isDisplayReferenceSeq()
&& getFontSize() == vs.getFontSize()
return abovePIDThreshold;
}
+ @Override
+ public boolean getByConsensusSecondaryStructureSelected()
+ {
+ return byConsensusSecondaryStructureSelected;
+ }
/**
* DOCUMENT ME!
*
{
abovePIDThreshold = b;
}
+
+ @Override
+ public void setByConsensusSecondaryStructureSelected(boolean b)
+ {
+ byConsensusSecondaryStructureSelected = b;
+ }
/**
* DOCUMENT ME!