*/
package jalview.io;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import jalview.datamodel.Alignment;
@Test
public void pfamFileIO() throws Exception
{
- testFileIOwithFormat(new File(PfamFile), "STH");
+ testFileIOwithFormat(new File(PfamFile), "STH", -1, 0);
}
@Test
@Test
public void rfamFileIO() throws Exception
{
- testFileIOwithFormat(new File(RfamFile), "STH");
+ testFileIOwithFormat(new File(RfamFile), "STH", 2, 1);
}
/**
* - label for IO class used to write and read back in the data from
* f
*/
- public static void testFileIOwithFormat(File f, String ioformat)
+ public static void testFileIOwithFormat(File f, String ioformat,
+ int naliannot, int nminseqann)
{
System.out.println("Reading file: " + f);
String ff = f.getPath();
+ ioformat + "' writer",
ioformat.equals(identifyoutput));
testAlignmentEquivalence(al, al_input);
+ int numaliannot = 0, numsqswithali = 0;
+ for (AlignmentAnnotation ala : al_input.getAlignmentAnnotation())
+ {
+ if (ala.sequenceRef == null)
+ {
+ numaliannot++;
+ }
+ else
+ {
+ numsqswithali++;
+ }
+ }
+ if (naliannot > -1)
+ {
+ assertEquals("Number of alignment annotations", naliannot,
+ numaliannot);
+ }
+
+ assertTrue(
+ "Number of sequence associated annotations wasn't at least "
+ + nminseqann, numsqswithali >= nminseqann);
+
} catch (Exception e)
{
e.printStackTrace();