import jalview.datamodel.SequenceI;
import jalview.util.MessageManager;
import jalview.util.ParseHtmlBodyAndLinks;
+import jalview.viewmodel.AlignmentViewport.AutoAnnotation;
import java.awt.Checkbox;
import java.awt.CheckboxMenuItem;
{
if (aa[selectedRow].autoCalculated)
{
- if (aa[selectedRow].label.indexOf("Consensus") > -1)
+ if (aa[selectedRow].label
+ .indexOf(AutoAnnotation.CONSENSUS.label) > -1)
{
popup.addSeparator();
final CheckboxMenuItem cbmi = new CheckboxMenuItem(
* <li>SHOW_QUALITY show alignment quality annotation</li>
* <li>SHOW_ANNOTATIONS show alignment annotation rows</li>
* <li>SHOW_CONSERVATION show alignment conservation annotation</li>
+ * <li>SHOW_OCCUPANCY show alignment column ungapped count annotation</li>
* <li>SORT_ANNOTATIONS currently either SEQUENCE_AND_LABEL or
* LABEL_AND_SEQUENCE</li>
* <li>SHOW_AUTOCALC_ABOVE true to show autocalculated annotations above
{
return applicationProperties.getProperty(key);
}
-
/**
* These methods are used when checking if the saved preference is different
* to the default setting
import jalview.analysis.Rna;
import jalview.analysis.SecStrConsensus.SimpleBP;
import jalview.analysis.WUSSParseException;
+import jalview.viewmodel.AlignmentViewport.AutoAnnotation;
import java.util.ArrayList;
import java.util.Arrays;
buffer.append(", ");
}
// TODO: remove disgusting hack for 'special' treatment of consensus line.
- if (label.indexOf("Consensus") == 0)
+ if (label.indexOf(AutoAnnotation.CONSENSUS.label) == 0)
{
buffer.append("\n");
{
if (!alignment.isNucleotide())
{
- showConservation = Cache.getDefault("SHOW_CONSERVATION", true);
- showQuality = Cache.getDefault("SHOW_QUALITY", true);
+ showConservation = Cache.getDefault(
+ AutoAnnotation.CONSERVATION.preferenceKey, true);
+ showQuality = Cache.getDefault(AutoAnnotation.QUALITY.preferenceKey,
+ true);
showGroupConservation = Cache.getDefault("SHOW_GROUP_CONSERVATION",
false);
}
normaliseSequenceLogo = Cache.getDefault("NORMALISE_CONSENSUS_LOGO",
false);
showGroupConsensus = Cache.getDefault("SHOW_GROUP_CONSENSUS", false);
- showConsensus = Cache.getDefault("SHOW_IDENTITY", true);
+ showConsensus = Cache
+ .getDefault(AutoAnnotation.CONSENSUS.preferenceKey, true);
- showOccupancy = Cache.getDefault(Preferences.SHOW_OCCUPANCY, true);
+ showOccupancy = Cache
+ .getDefault(AutoAnnotation.OCCUPANCY.preferenceKey, true);
}
initAutoAnnotation();
String colourProperty = alignment.isNucleotide()
import jalview.util.Comparison;
import jalview.util.MessageManager;
import jalview.util.Platform;
+import jalview.viewmodel.AlignmentViewport.AutoAnnotation;
import java.awt.Color;
import java.awt.Cursor;
pop.add(item);
}
}
- else if (label.indexOf("Consensus") > -1)
+ else if (label.indexOf(AutoAnnotation.CONSENSUS.label) > -1)
{
addConsensusMenuOptions(ap, aa[selectedRow], pop);
import jalview.util.MessageManager;
import jalview.util.Platform;
import jalview.viewmodel.AlignmentViewport;
+import jalview.viewmodel.AlignmentViewport.AutoAnnotation;
import jalview.viewmodel.ViewportRanges;
import java.awt.BorderLayout;
return;
}
AlignmentAnnotation ann = anns[pos.annotationIndex];
- if (!ann.label.contains("Consensus"))
+ if (!ann.label.contains(AutoAnnotation.CONSENSUS.label))
{
return;
}
import jalview.util.MessageManager;
import jalview.util.Platform;
import jalview.util.UrlConstants;
+import jalview.viewmodel.AlignmentViewport.AutoAnnotation;
import jalview.ws.sifts.SiftsSettings;
import java.awt.BorderLayout;
public static final String SHOW_AUTOCALC_ABOVE = "SHOW_AUTOCALC_ABOVE";
- public static final String SHOW_OCCUPANCY = "SHOW_OCCUPANCY";
-
public static final String SHOW_OV_HIDDEN_AT_START = "SHOW_OV_HIDDEN_AT_START";
public static final String USE_LEGACY_GAP = "USE_LEGACY_GAP";
fullScreen.setSelected(Cache.getDefault("SHOW_FULLSCREEN", false));
annotations.setSelected(Cache.getDefault("SHOW_ANNOTATIONS", true));
- conservation.setSelected(Cache.getDefault("SHOW_CONSERVATION", true));
- quality.setSelected(Cache.getDefault("SHOW_QUALITY", true));
- identity.setSelected(Cache.getDefault("SHOW_IDENTITY", true));
+ conservation.setSelected(Cache
+ .getDefault(AutoAnnotation.CONSERVATION.preferenceKey, true));
+ quality.setSelected(
+ Cache.getDefault(AutoAnnotation.QUALITY.preferenceKey, true));
+ identity.setSelected(
+ Cache.getDefault(AutoAnnotation.CONSENSUS.preferenceKey, true));
openoverv.setSelected(Cache.getDefault("SHOW_OVERVIEW", false));
showUnconserved
.setSelected(Cache.getDefault("SHOW_UNCONSERVED", false));
- showOccupancy.setSelected(Cache.getDefault(SHOW_OCCUPANCY, false));
+ showOccupancy.setSelected(Cache
+ .getDefault(AutoAnnotation.OCCUPANCY.preferenceKey, false));
showGroupConsensus
.setSelected(Cache.getDefault("SHOW_GROUP_CONSENSUS", false));
showGroupConservation.setSelected(
Boolean.toString(openoverv.isSelected()));
Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS",
Boolean.toString(annotations.isSelected()));
- Cache.applicationProperties.setProperty("SHOW_CONSERVATION",
+ Cache.applicationProperties.setProperty(
+ AutoAnnotation.CONSERVATION.preferenceKey,
Boolean.toString(conservation.isSelected()));
- Cache.applicationProperties.setProperty("SHOW_QUALITY",
+ Cache.applicationProperties.setProperty(
+ AutoAnnotation.QUALITY.preferenceKey,
Boolean.toString(quality.isSelected()));
- Cache.applicationProperties.setProperty("SHOW_IDENTITY",
+ Cache.applicationProperties.setProperty(
+ AutoAnnotation.CONSENSUS.preferenceKey,
Boolean.toString(identity.isSelected()));
+ Cache.applicationProperties.setProperty(
+ AutoAnnotation.OCCUPANCY.preferenceKey,
+ Boolean.toString(showOccupancy.isSelected()));
Cache.applicationProperties.setProperty("GAP_SYMBOL",
gapSymbolCB.getSelectedItem().toString());
Boolean.toString(idItalics.isSelected()));
Cache.applicationProperties.setProperty("SHOW_UNCONSERVED",
Boolean.toString(showUnconserved.isSelected()));
- Cache.applicationProperties.setProperty(SHOW_OCCUPANCY,
- Boolean.toString(showOccupancy.isSelected()));
Cache.applicationProperties.setProperty("SHOW_GROUP_CONSENSUS",
Boolean.toString(showGroupConsensus.isSelected()));
Cache.applicationProperties.setProperty("SHOW_GROUP_CONSERVATION",
import jalview.util.jarInputStreamProvider;
import jalview.util.matcher.Condition;
import jalview.viewmodel.AlignmentViewport;
+import jalview.viewmodel.AlignmentViewport.AutoAnnotation;
import jalview.viewmodel.PCAModel;
import jalview.viewmodel.ViewportRanges;
import jalview.viewmodel.seqfeatures.FeatureRendererSettings;
*/
public class Jalview2XML
{
+ private static final String TRUE = "true";
+
+ private static final String FALSE = "false";
+
private static final String VIEWER_PREFIX = "viewer_";
private static final String RNA_PREFIX = "rna_";
* test if annotation is automatically calculated for this view only
*/
boolean autoForView = false;
- if (annotation.getLabel().equals("Quality")
- || annotation.getLabel().equals("Conservation")
- || annotation.getLabel().equals("Consensus"))
+ if (annotation.getLabel().equals(AutoAnnotation.QUALITY.label)
+ || annotation.getLabel()
+ .equals(AutoAnnotation.CONSERVATION.label)
+ || annotation.getLabel()
+ .equals(AutoAnnotation.CONSENSUS.label))
{
// Kludge for pre 2.5 projects which lacked the autocalculated flag
autoForView = true;
- // JAXB has no has() test; schema defaults value to false
- // if (!annotation.hasAutoCalculated())
- // {
- // annotation.setAutoCalculated(true);
- // }
}
if (autoForView || annotation.isAutoCalculated())
{
{
if (val.contains("e")) // eh? what can it be?
{
- if (val.trim().equals("true"))
+ if (val.trim().equals(TRUE))
{
val = "1";
}
import jalview.schemes.ResidueProperties;
import jalview.schemes.ZappoColourScheme;
import jalview.util.Platform;
+import jalview.viewmodel.AlignmentViewport.AutoAnnotation;
import java.awt.BasicStroke;
import java.awt.Color;
// properties/rendering attributes as a global 'alignment group' which holds
// all vis settings for the alignment as a whole rather than a subset
//
- if (aa.autoCalculated && (aa.label.startsWith("Consensus")
+ if (aa.autoCalculated
+ && (aa.label.startsWith(AutoAnnotation.CONSENSUS.label)
|| aa.label.startsWith("cDNA Consensus")))
{
boolean forComplement = aa.label.startsWith("cDNA Consensus");
public abstract class AlignmentViewport
implements AlignViewportI, CommandListener, VamsasSource
{
+ /**
+ * An enum for auto-calculated annotations, with constants for the
+ * annotation's label, and the key for the property to show it or not
+ */
+ public enum AutoAnnotation
+ {
+ CONSERVATION("Conservation", "SHOW_CONSERVATION"),
+ QUALITY("Quality", "SHOW_QUALITY"),
+ CONSENSUS("Consensus", "SHOW_IDENTITY"),
+ OCCUPANCY("Occupancy", "SHOW_OCCUPANCY");
+
+ public final String label;
+ public final String preferenceKey;
+
+ private AutoAnnotation(String lbl, String prefKey)
+ {
+ this.label = lbl;
+ this.preferenceKey = prefKey;
+ }
+ }
+
protected ViewportRanges ranges;
protected ViewStyleI viewStyle = new ViewStyle();
{
initRNAStructure();
}
- consensus = new AlignmentAnnotation("Consensus",
+ consensus = new AlignmentAnnotation(AutoAnnotation.CONSENSUS.label,
MessageManager.getString("label.consensus_descr"),
new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
initConsensus(consensus);
}
}
- // these should be extracted from the view model - style and settings for
- // derived annotation
private void initGapCounts()
{
if (showOccupancy)
{
- gapcounts = new AlignmentAnnotation("Occupancy",
+ gapcounts = new AlignmentAnnotation(AutoAnnotation.OCCUPANCY.label,
MessageManager.getString("label.occupancy_descr"),
new Annotation[1], 0f, alignment.getHeight(),
AlignmentAnnotation.BAR_GRAPH);
{
if (conservation == null)
{
- conservation = new AlignmentAnnotation("Conservation",
+ conservation = new AlignmentAnnotation(
+ AutoAnnotation.CONSERVATION.label,
MessageManager.formatMessage("label.conservation_descr",
getConsPercGaps()),
new Annotation[1], 0f, 11f, AlignmentAnnotation.BAR_GRAPH);
{
if (quality == null)
{
- quality = new AlignmentAnnotation("Quality",
+ quality = new AlignmentAnnotation(AutoAnnotation.QUALITY.label,
MessageManager.getString("label.quality_descr"),
new Annotation[1], 0f, 11f, AlignmentAnnotation.BAR_GRAPH);
quality.hasText = true;