// build filter params
filterParams
.setThresholdType(AnnotationFilterParameter.ThresholdType.NO_THRESHOLD);
- if (getCurrentAnnotation().graph != AlignmentAnnotation.NO_GRAPH)
+ if (getCurrentAnnotation().isQuantitative())
{
filterParams
.setThresholdValue(getCurrentAnnotation().threshold.value);
{
String currentView = AnnotationColumnChooser.NO_GRAPH_VIEW;
if (av.getAlignment().getAlignmentAnnotation()[getAnnotations()
- .getSelectedIndex()].graph != AlignmentAnnotation.NO_GRAPH)
+ .getSelectedIndex()].isQuantitative())
{
currentView = AnnotationColumnChooser.GRAPH_VIEW;
}
package jalview.gui;
-import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.ColumnSelection;
import jalview.schemes.AnnotationColourGradient;
import jalview.util.MessageManager;
// build filter params
filterParams
.setThresholdType(AnnotationFilterParameter.ThresholdType.NO_THRESHOLD);
- if (getCurrentAnnotation().graph != AlignmentAnnotation.NO_GRAPH)
+ if (getCurrentAnnotation().isQuantitative())
{
filterParams
.setThresholdValue(getCurrentAnnotation().threshold.value);
public void selectedAnnotationChanged()
{
String currentView = AnnotationColumnChooser.NO_GRAPH_VIEW;
- if (av.getAlignment().getAlignmentAnnotation()[annmap[getAnnotations()
- .getSelectedIndex()]].graph != AlignmentAnnotation.NO_GRAPH)
+ if (av.getAlignment()
+ .getAlignmentAnnotation()[annmap[getAnnotations()
+ .getSelectedIndex()]].isQuantitative())
{
currentView = AnnotationColumnChooser.GRAPH_VIEW;
}
import jalview.io.AppletFormatAdapter;
import jalview.io.FileFormat;
+import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
ann.getDefaultRnaHelixSymbol(i));
}
}
+
+ public static Annotation newAnnotation(String ann)
+ {
+ float val = 0f;
+ try
+ {
+ val = Float.parseFloat(ann);
+ } catch (NumberFormatException q)
+ {
+ }
+ ;
+ return new Annotation(ann, ann, '\0', val);
+ }
+
+ @Test(groups = { "Functional" })
+ public void testIsQuantitative()
+ {
+ AlignmentAnnotation ann = null;
+
+ ann = new AlignmentAnnotation("an", "some an", null);
+ Assert.assertFalse(ann.isQuantitative(),
+ "Empty annotation set should not be quantitative.");
+
+ ann = new AlignmentAnnotation("an", "some an", new Annotation[] {
+ newAnnotation("4"), newAnnotation("1"), newAnnotation("1"),
+ newAnnotation("0.1"), newAnnotation("0.3") });
+ Assert.assertTrue(ann.isQuantitative(),
+ "All numbers annotation set should be quantitative.");
+
+ ann = new AlignmentAnnotation("an", "some an", new Annotation[] {
+ newAnnotation("E"), newAnnotation("E"), newAnnotation("E"),
+ newAnnotation("E"), newAnnotation("E") });
+ Assert.assertFalse(ann.isQuantitative(),
+ "All 'E' annotation set should not be quantitative.");
+
+ ann = new AlignmentAnnotation("an", "some an", new Annotation[] {
+ newAnnotation("E"), newAnnotation("1"), newAnnotation("2"),
+ newAnnotation("3"), newAnnotation("E") });
+ Assert.assertTrue(ann.isQuantitative(),
+ "Mixed 'E' annotation set should be quantitative.");
+ }
}