import jalview.datamodel.SequenceDummy;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
+import jalview.datamodel.features.FeatureMatcher;
import jalview.datamodel.features.FeatureMatcherI;
+import jalview.datamodel.features.FeatureMatcherSet;
import jalview.datamodel.features.FeatureMatcherSetI;
import jalview.datamodel.features.SequenceFeatures;
import jalview.gui.AlignFrame;
import jalview.gui.Desktop;
import jalview.gui.JvOptionPane;
+import jalview.schemes.FeatureColour;
import jalview.structure.StructureSelectionManager;
import jalview.util.matcher.Condition;
exported = featuresFile.printJalviewFormat(al.getSequencesArray(),
visible, null, visibleGroups, false);
expected = "METAL\tcc9900\n"
- + "GAMMA-TURN\tff0000|00ffff|20.0|95.0|below|66.0\n"
+ + "GAMMA-TURN\tscore|ff0000|00ffff|noValueMin|20.0|95.0|below|66.0\n"
+ "\nSTARTGROUP\tuniprot\n"
+ "Turn\tFER_CAPAA\t-1\t36\t38\tGAMMA-TURN\t0.0\n"
+ "Iron\tFER_CAPAA\t-1\t39\t39\tMETAL\t0.0\n"
*/
expected = "METAL\tcc9900\n"
+ "Pfam\tff0000\n"
- + "GAMMA-TURN\tff0000|00ffff|20.0|95.0|below|66.0\n"
+ + "GAMMA-TURN\tscore|ff0000|00ffff|noValueMin|20.0|95.0|below|66.0\n"
+ "\nSTARTGROUP\tuniprot\n"
+ "Turn\tFER_CAPAA\t-1\t36\t38\tGAMMA-TURN\t0.0\n"
+ "Iron\tFER_CAPAA\t-1\t39\t39\tMETAL\t0.0\n"
assertFalse(matchers.hasNext());
}
+
+ @Test(groups = { "Functional" })
+ public void testOutputFeatureFilters()
+ {
+ FeaturesFile ff = new FeaturesFile();
+ StringBuilder sb = new StringBuilder();
+ Map<String, FeatureColourI> visible = new HashMap<>();
+ visible.put("pfam", new FeatureColour(Color.red));
+ Map<String, FeatureMatcherSetI> featureFilters = new HashMap<>();
+
+ // with no filters, nothing is output
+ ff.outputFeatureFilters(sb, visible, featureFilters);
+ assertEquals("", sb.toString());
+
+ // with filter for not visible features only, nothing is output
+ FeatureMatcherSet filter = new FeatureMatcherSet();
+ filter.and(FeatureMatcher.byLabel(Condition.Present, null));
+ featureFilters.put("foobar", filter);
+ ff.outputFeatureFilters(sb, visible, featureFilters);
+ assertEquals("", sb.toString());
+
+ // with filters for visible feature types
+ FeatureMatcherSet filter2 = new FeatureMatcherSet();
+ filter2.and(FeatureMatcher.byAttribute(Condition.Present, null, "CSQ",
+ "PolyPhen"));
+ filter2.and(FeatureMatcher.byScore(Condition.LE, "-2.4"));
+ featureFilters.put("pfam", filter2);
+ visible.put("foobar", new FeatureColour(Color.blue));
+ ff.outputFeatureFilters(sb, visible, featureFilters);
+ String expected = "\nSTARTFILTERS\nfoobar\tLabel Present\npfam\t(CSQ:PolyPhen Present) AND (Score LE -2.4)\nENDFILTERS\n\n";
+ assertEquals(expected, sb.toString());
+ }
}