- // exonerate does not tag sequences after features, so we have a more
- // conventional annotation import test here
-
- FileLoader loader = new FileLoader(false);
-
- AlignFrame af = loader.LoadFileWaitTillLoaded(exonerateSeqs,
- FormatAdapter.FILE);
-
- assertEquals("Unexpected number of DNA protein associations", 0, af
- .getViewport().getAlignment().getCodonFrames().size());
-
- af.loadJalviewDataFile(exonerateOutput, FormatAdapter.FILE, null, null);
-
- assertTrue("Expected at least one DNA protein association", 0 != af
- .getViewport().getAlignment().getDataset().getCodonFrames()
- .size());
+ File f = new File("examples/uniref50.fa");
+ AlignmentI al = readAlignmentFile(f);
+ AlignFrame af = new AlignFrame(al, 500, 500);
+ Map<String, FeatureColourI> colours = af.getFeatureRenderer()
+ .getFeatureColours();
+ String features = "METAL\tcc9900\n"
+ + "GAMMA-TURN\tred|0,255,255|20.0|95.0|below|66.0\n"
+ + "Pfam\tred\n"
+ + "STARTGROUP\tuniprot\n"
+ + "Iron\tFER_CAPAA\t-1\t39\t39\tMETAL\n"
+ + "Turn\tFER_CAPAA\t-1\t36\t38\tGAMMA-TURN\n"
+ + "<html>Pfam domain<a href=\"http://pfam.xfam.org/family/PF00111\">Pfam_3_4</a></html>\tFER_CAPAA\t-1\t20\t20\tPfam\n"
+ + "ENDGROUP\tuniprot\n";
+ FeaturesFile featuresFile = new FeaturesFile(features,
+ FormatAdapter.PASTE);
+ featuresFile.parse(al.getDataset(), colours, false);
+
+ /*
+ * first with no features displayed
+ */
+ FeatureRenderer fr = af.alignPanel.getFeatureRenderer();
+ Map<String, FeatureColourI> visible = fr.getDisplayedFeatureCols();
+ String exported = featuresFile.printJalviewFormat(
+ al.getSequencesArray(), visible);
+ String expected = "No Features Visible";
+ assertEquals(expected, exported);
+
+ /*
+ * set METAL (in uniprot group) and GAMMA-TURN visible, but not Pfam
+ */
+ fr.setVisible("METAL");
+ fr.setVisible("GAMMA-TURN");
+ visible = fr.getDisplayedFeatureCols();
+ exported = featuresFile.printJalviewFormat(al.getSequencesArray(),
+ visible);
+ expected = "METAL\tcc9900\n"
+ + "GAMMA-TURN\tff0000|00ffff|20.0|95.0|below|66.0\n"
+ + "\nSTARTGROUP\tuniprot\n"
+ + "Iron\tFER_CAPAA\t-1\t39\t39\tMETAL\t0.0\n"
+ + "Turn\tFER_CAPAA\t-1\t36\t38\tGAMMA-TURN\t0.0\n"
+ + "ENDGROUP\tuniprot\n";
+ assertEquals(expected, exported);
+
+ /*
+ * now set Pfam visible
+ */
+ fr.setVisible("Pfam");
+ visible = fr.getDisplayedFeatureCols();
+ exported = featuresFile.printJalviewFormat(al.getSequencesArray(),
+ visible);
+ /*
+ * note the order of feature types is uncontrolled - derives from
+ * FeaturesDisplayed.featuresDisplayed which is a HashSet
+ */
+ expected = "METAL\tcc9900\n"
+ + "Pfam\tff0000\n"
+ + "GAMMA-TURN\tff0000|00ffff|20.0|95.0|below|66.0\n"
+ + "\nSTARTGROUP\tuniprot\n"
+ + "Iron\tFER_CAPAA\t-1\t39\t39\tMETAL\t0.0\n"
+ + "Turn\tFER_CAPAA\t-1\t36\t38\tGAMMA-TURN\t0.0\n"
+ + "<html>Pfam domain<a href=\"http://pfam.xfam.org/family/PF00111\">Pfam_3_4</a></html>\tFER_CAPAA\t-1\t20\t20\tPfam\t0.0\n"
+ + "ENDGROUP\tuniprot\n";
+ assertEquals(expected, exported);