From 223ccb5ee354120aa99f3f8887a9d094267f6546 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Thu, 4 May 2017 14:03:42 +0100 Subject: [PATCH] JAL-2507 JAL-2509 allow differences in visibility of annotation rows to be ignored when comparing round-tripped alignments --- test/jalview/io/StockholmFileTest.java | 36 ++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/test/jalview/io/StockholmFileTest.java b/test/jalview/io/StockholmFileTest.java index e9edd1b..e7f1435 100644 --- a/test/jalview/io/StockholmFileTest.java +++ b/test/jalview/io/StockholmFileTest.java @@ -56,7 +56,8 @@ public class StockholmFileTest @Test(groups = { "Functional" }) public void pfamFileIO() throws Exception { - testFileIOwithFormat(new File(PfamFile), FileFormat.Stockholm, -1, 0); + testFileIOwithFormat(new File(PfamFile), FileFormat.Stockholm, -1, 0, + false); } @Test(groups = { "Functional" }) @@ -81,7 +82,8 @@ public class StockholmFileTest @Test(groups = { "Functional" }) public void rfamFileIO() throws Exception { - testFileIOwithFormat(new File(RfamFile), FileFormat.Stockholm, 2, 1); + testFileIOwithFormat(new File(RfamFile), FileFormat.Stockholm, 2, 1, + false); } /** @@ -93,10 +95,11 @@ public class StockholmFileTest * @param ioformat * - label for IO class used to write and read back in the data from * f + * @param ignoreRowVisibility */ public static void testFileIOwithFormat(File f, FileFormatI ioformat, - int naliannot, int nminseqann) + int naliannot, int nminseqann, boolean ignoreRowVisibility) { System.out.println("Reading file: " + f); String ff = f.getPath(); @@ -174,6 +177,27 @@ public class StockholmFileTest public static void testAlignmentEquivalence(AlignmentI al, AlignmentI al_input, boolean ignoreFeatures) { + } + + /** + * assert alignment equivalence + * + * @param al + * 'original' + * @param al_input + * 'secondary' or generated alignment from some datapreserving + * transformation + * @param ignoreFeatures + * when true, differences in sequence feature annotation are ignored + * + * @param ignoreRowVisibility + * when true, do not fail if there are differences in the visibility + * of annotation rows + */ + public static void testAlignmentEquivalence(AlignmentI al, + AlignmentI al_input, boolean ignoreFeatures, + boolean ignoreRowVisibility) + { assertNotNull("Original alignment was null", al); assertNotNull("Generated alignment was null", al_input); @@ -207,8 +231,12 @@ public class StockholmFileTest // compare graphGroup or graph properties - needed to verify JAL-1299 assertEquals("Graph type not identical.", aa_original[i].graph, aa_new[i].graph); - assertEquals("Visibility not identical.", aa_original[i].visible, + if (!ignoreRowVisibility) + { + assertEquals("Visibility not identical.", + aa_original[i].visible, aa_new[i].visible); + } assertEquals("Threshold line not identical.", aa_original[i].threshold, aa_new[i].threshold); // graphGroup may differ, but pattern should be the same -- 1.7.10.2