-
- static void checkAnnotationFileIO(String testname, AlignmentI al)
- {
- try
- {
- String aligfileout = FileFormat.Pfam.getWriter(al).print(
- al.getSequencesArray(), true);
- String anfileout = new AnnotationFile()
- .printAnnotationsForAlignment(al);
- assertTrue(
- "Test "
- + testname
- + "\nAlignment annotation file was not regenerated. Null string",
- anfileout != null);
- assertTrue(
- "Test "
- + testname
- + "\nAlignment annotation file was not regenerated. Empty string",
- anfileout.length() > "JALVIEW_ANNOTATION".length());
-
- System.out.println("Output annotation file:\n" + anfileout
- + "\n<<EOF\n");
-
- AlignmentI al_new = new FormatAdapter().readFile(aligfileout,
- DataSourceType.PASTE, FileFormat.Pfam);
- assertTrue(
- "Test "
- + testname
- + "\nregenerated annotation file did not annotate alignment.",
- new AnnotationFile().readAnnotationFile(al_new, anfileout,
- DataSourceType.PASTE));
-
- // test for consistency in io
- StockholmFileTest.testAlignmentEquivalence(al, al_new, true, false,
- false);
- return;
- } catch (Exception e)
- {
- e.printStackTrace();
- }
- Assert.fail("Test "
- + testname
- + "\nCouldn't complete Annotation file roundtrip input/output/input test.");
- }
-