JAL-2136 JAL-2137 Added improvement to enable explicit and dynamic definition of...
[jalview.git] / test / jalview / io / AnnotationFileIOTest.java
index cfbc884..4bc8c3b 100644 (file)
@@ -1,49 +1,86 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
  * Jalview is free software: you can redistribute it and/or
  * modify it under the terms of the GNU General Public License 
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
  *  
  * Jalview is distributed in the hope that it will be useful, but 
  * WITHOUT ANY WARRANTY; without even the implied warranty 
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
  * PURPOSE.  See the GNU General Public License for more details.
  * 
- * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
  * The Jalview Authors are detailed in the 'AUTHORS' file.
  */
 package jalview.io;
 
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertTrue;
+
 import jalview.datamodel.AlignmentI;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.PDBEntry.Type;
+import jalview.datamodel.SequenceI;
+import jalview.gui.Desktop;
+import jalview.gui.JvOptionPane;
+import jalview.io.AnnotationFile.ViewDef;
+import jalview.structure.StructureSelectionManager;
 
 import java.io.File;
+import java.util.Hashtable;
 
-import org.junit.Test;
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
 
 public class AnnotationFileIOTest
 {
 
-  static String TestFiles[][] = {{ "Test example annotation import/export","examples/uniref50.fa", "examples/testdata/example_annot_file.jva" }
-          ,{"Test multiple combine annotation statements import/export","examples/uniref50.fa", "examples/testdata/test_combine_annot.jva"}
-          ,{"Test multiple combine annotation statements with sequence_ref import/export","examples/uniref50.fa", "examples/testdata/uniref50_iupred.jva"}};
+  private StructureSelectionManager ssm = null;
+
+  private AlignmentI al = null;
+
+  @BeforeClass(alwaysRun = true)
+  public void setUpJvOptionPane()
+  {
+    JvOptionPane.setInteractiveMode(false);
+    JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+  }
+
+  static String TestFiles[][] = {
+      { "Test example annotation import/export", "examples/uniref50.fa",
+          "examples/testdata/example_annot_file.jva" },
+      { "Test multiple combine annotation statements import/export",
+          "examples/uniref50.fa",
+          "examples/testdata/test_combine_annot.jva" },
+      {
+          "Test multiple combine annotation statements with sequence_ref import/export",
+          "examples/uniref50.fa", "examples/testdata/uniref50_iupred.jva" },
+      {
+          "Test group only annotation file parsing results in parser indicating annotation was parsed",
+          "examples/uniref50.fa", "examples/testdata/test_grpannot.jva" },
+      { "Test hiding/showing of insertions on sequence_ref",
+          "examples/uniref50.fa", "examples/testdata/uniref50_seqref.jva" } };
 
-  @Test
+  @Test(groups = { "Functional" })
   public void exampleAnnotationFileIO() throws Exception
   {
-    for (String[] testPair:TestFiles)
+    for (String[] testPair : TestFiles)
     {
-      testAnnotationFileIO(testPair[0], new File(testPair[1]), new File(testPair[2]));
+      testAnnotationFileIO(testPair[0], new File(testPair[1]), new File(
+              testPair[2]));
     }
   }
 
-  public static AlignmentI readAlignmentFile(File f)
+  AlignmentI readAlignmentFile(File f)
   {
     System.out.println("Reading file: " + f);
     String ff = f.getPath();
@@ -51,13 +88,13 @@ public class AnnotationFileIOTest
     {
       FormatAdapter rf = new FormatAdapter();
 
-      AlignmentI al = rf.readFile(ff, AppletFormatAdapter.FILE,
-              new IdentifyFile().Identify(ff, AppletFormatAdapter.FILE));
-      
+      AlignmentI al = rf.readFile(ff, DataSourceType.FILE,
+              new IdentifyFile().identify(ff, DataSourceType.FILE));
+
       // make sure dataset is initialised ? not sure about this
       for (int i = 0; i < al.getSequencesArray().length; ++i)
       {
-        al.getSequenceAt(i).setDatasetSequence(al.getSequenceAt(i).createDatasetSequence());
+        al.getSequenceAt(i).createDatasetSequence();
       }
       assertNotNull("Couldn't read supplied alignment data.", al);
       return al;
@@ -65,9 +102,10 @@ public class AnnotationFileIOTest
     {
       e.printStackTrace();
     }
-    fail("Couln't read the alignment in file '"+f.toString()+"'");
+    Assert.fail("Couln't read the alignment in file '" + f.toString() + "'");
     return null;
   }
+
   /**
    * test alignment data in given file can be imported, exported and reimported
    * with no dataloss
@@ -78,32 +116,426 @@ public class AnnotationFileIOTest
    *          - label for IO class used to write and read back in the data from
    *          f
    */
-  public static void testAnnotationFileIO(String testname, File f, File annotFile)
+  void testAnnotationFileIO(String testname, File f, File annotFile)
   {
-    System.out.println("Test: "+testname+"\nReading annotation file '"+annotFile+"' onto : " + f);
+    System.out.println("Test: " + testname + "\nReading annotation file '"
+            + annotFile + "' onto : " + f);
     String af = annotFile.getPath();
     try
     {
       AlignmentI al = readAlignmentFile(f);
-      
-      assertTrue("Test "+testname+"\nAlignment was not annotated - annotation file not imported.",new AnnotationFile().readAnnotationFile(al, af, FormatAdapter.FILE));
-      
-      String anfileout = new AnnotationFile().printAnnotations(al.getAlignmentAnnotation(), al.getGroups(), al.getProperties());
-      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");
-      
+      ColumnSelection cs = new ColumnSelection();
+      assertTrue(
+              "Test "
+                      + testname
+                      + "\nAlignment was not annotated - annotation file not imported.",
+              new AnnotationFile().readAnnotationFile(al, cs, af,
+                      DataSourceType.FILE));
+
+      AnnotationFile aff = new AnnotationFile();
+      ViewDef v = aff.new ViewDef(null, al.getHiddenSequences(), cs,
+              new Hashtable());
+      String anfileout = new AnnotationFile().printAnnotations(
+              al.getAlignmentAnnotation(), al.getGroups(),
+              al.getProperties(), null, al, v);
+      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 = readAlignmentFile(f);
-      assertTrue("Test "+testname+"\nregenerated annotation file did not annotate alignment.",new AnnotationFile().readAnnotationFile(al_new, anfileout, FormatAdapter.PASTE));
-      
+      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);
+      StockholmFileTest.testAlignmentEquivalence(al, al_new, false);
       return;
     } catch (Exception e)
     {
       e.printStackTrace();
     }
-    fail("Test "+testname+"\nCouldn't complete Annotation file roundtrip input/output/input test for '"+annotFile+"'.");
+    Assert.fail("Test "
+            + testname
+            + "\nCouldn't complete Annotation file roundtrip input/output/input test for '"
+            + annotFile + "'.");
+  }
+
+
+  @BeforeClass(alwaysRun = true)
+  void testProcessStructModel()
+  {
+    File alignmentFile = new File(
+            "examples/testdata/phyre2results/56da5616b4559c93/allhits.fasta");
+    String annotationFile = "examples/testdata/phyre2results/56da5616b4559c93/allhits.ann";
+    ColumnSelection cs = new ColumnSelection();
+    al = readAlignmentFile(alignmentFile);
+    boolean annotationRead = new AnnotationFile().readAnnotationFile(al,
+            cs, annotationFile, DataSourceType.FILE);
+    Assert.assertTrue(annotationRead);
+    ssm = StructureSelectionManager
+            .getStructureSelectionManager(Desktop.instance);
+    System.out.println("bla");
+  }
+  
+  @Test(
+    groups = { "Functional" },
+    dataProvider = "phyre2ModelPDBEntryDataProvider")
+  void testSequence_PDBEntryAssociation(String[] structModelHeader, String baseDir,
+          String structModelDataStr)
+  {
+    String structModelData[] = structModelDataStr.split("\t");
+    String templateSeq = structModelData[1];
+    String pdbId = structModelData[2];
+
+    SequenceI testSeq = al.findName(templateSeq);
+    Assert.assertNotNull(testSeq);
+    PDBEntry actualPDBEntry = testSeq.getDatasetSequence().getPDBEntry(
+            pdbId);
+    Assert.assertNotNull(actualPDBEntry);
+
+    PDBEntry expectedPDBEntry = new PDBEntry(pdbId, " ", Type.PDB, baseDir
+            + pdbId);
+    String phyre2ModelDesc = AnnotationFile.generatePhyre2InfoHTMLTable(structModelHeader,
+            structModelData);
+    expectedPDBEntry.setProperty("PHYRE2_MODEL_INFO", phyre2ModelDesc);
+    Assert.assertEquals(actualPDBEntry, expectedPDBEntry);
+  }
+
+  @Test(
+    groups = { "Functional" },
+    dataProvider = "phyre2ModelMappingDataProvider")
+  void testPhyre2ModelRegistration(String phyre2ModelFile,
+          String expectedPhyre2FastaMappingFile)
+  {
+
+    String actualFastaMappingFile = ssm
+            .getPhyre2FastaFileFor(phyre2ModelFile);
+    Assert.assertNotNull(actualFastaMappingFile);
+    Assert.assertEquals(actualFastaMappingFile,
+            expectedPhyre2FastaMappingFile);
+  }
+
+  @Test(
+    groups = { "Functional" },
+    dataProvider = "phyre2InfoHTMLTableDataProvider")
+  void testGeneratePhyre2InfoHTMLTable(String caseDescription,
+          String[] header, String[] data, String expectedHtml)
+  {
+    System.out.println(">>>> Testing Case - " + caseDescription);
+    String actualHtmlGenerated = AnnotationFile
+            .generatePhyre2InfoHTMLTable(header, data);
+    System.out.println("-----> " + actualHtmlGenerated);
+    Assert.assertEquals(actualHtmlGenerated, expectedHtml);
+  }
+
+  @Test(
+    groups = { "Functional" },
+    dataProvider = "StructModelHtmlDataProvider")
+  void testIsGenerateStructInfoHtml(String caseDescription,
+          String[] header, String[] data, boolean expectedOutcome)
+  {
+    System.out.println(">>>> Testing Case - " + caseDescription);
+    boolean actual = AnnotationFile.isGenerateStructInfoHtml(header, data);
+    Assert.assertEquals(actual, expectedOutcome);
+  }
+
+  @Test(groups = { "Functional" }, dataProvider = "FilePathProvider")
+  void testResolveAbsolutePath(String caseDescription, String suppliedPath,
+          String baseURI, String expectedURI)
+  {
+    System.out.println(">>>> Testing Case - " + caseDescription);
+    String actualURI = AnnotationFile.resolveAbsolutePath(suppliedPath,
+            baseURI);
+    Assert.assertEquals(actualURI, expectedURI);
+  }
+  
+  @DataProvider(name = "phyre2ModelPDBEntryDataProvider")
+  public static Object[][] phyre2ModelPDBEntryDataProvider()
+  {
+    String[] structModelHeader = new String[] { "QUERY_SEQ",
+            "TEMPLATE_SEQ", "MODEL_FILE", "MAPPING_FILE", "Confidence",
+            "% I.D", "Aligned Range", "Other Information"};
+    String baseDir = "examples/testdata/phyre2results/56da5616b4559c93/";
+    
+    return new Object[][] {
+        {
+            structModelHeader,
+            baseDir,
+            "FER_CAPAN_1-144\tc4n58A_\tc4n58A_.1.pdb\tc4n58A_.1.fasta\t1\t54\t48-143\t<b>PDB Header: </b>Hyrolase<br><b>Chain: "
+                    + "</b>A<br><b>PDB Molecule: </b>Pectocin m2<br> <b>PDB Title: </b>Crystal structure of pectocin m2 at 1.86 amgtroms" },
+        {
+            structModelHeader,
+            baseDir,
+            "FER_CAPAN_1-144\td1a70a_\td1a70a_.2.pdb\td1a70a_.2.fasta\t1\t71\t48-144\t<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br>"
+                    + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
+        {
+            structModelHeader,
+            baseDir,
+            "FER_CAPAN_1-144\td1offa_\td1offa_.3.pdb\td1offa_.3.fasta\t1\t73\t48-142\t<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br>"
+                    + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
+        {
+            structModelHeader,
+            baseDir,
+            "FER_CAPAN_1-144\td1frra_\td1frra_.4.pdb\td1frra_.4.fasta\t0.999\t62\t49-142\t<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br>"
+                    + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
+        {
+            structModelHeader,
+            baseDir,
+            "FER_CAPAN_1-144\td1pfda_\td1pfda_.5.pdb\td1pfda_.5.fasta\t0.999\t70\t48-143\t<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br>"
+                    + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
+        {
+            structModelHeader,
+            baseDir,
+            "FER_CAPAN_1-144\td1frda_\td1frda_.6.pdb\td1frda_.6.fasta\t0.999\t50\t48-143\t<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br>"
+                    + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
+        {
+            structModelHeader,
+            baseDir,
+            "FER_CAPAN_1-144\td1fxia_\td1fxia_.7.pdb\td1fxia_.7.fasta\t0.999\t62\t48-142\t<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br>"
+                    + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
+        {
+            structModelHeader,
+            baseDir,
+            "FER_CAPAN_1-144\td1gaqb_\td1gaqb_.8.pdb\td1gaqb_.8.fasta\t0.999\t71\t48-144\t<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br>"
+                    + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
+        {
+            structModelHeader,
+            baseDir,
+            "FER_CAPAN_1-144\td1iuea_\td1iuea_.9.pdb\td1iuea_.9.fasta\t0.999\t48\t48-142\t<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br>"
+                    + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
+        {
+            structModelHeader,
+            baseDir,
+            "FER_CAPAN_1-144\td1awda_\td1awda_.10.pdb\td1awda_.10.fasta\t0.999\t68\t50-142\t<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br>"
+                    + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
+        {
+            structModelHeader,
+            baseDir,
+            "FER_CAPAN_1-144\td1wria_\td1wria_.11.pdb\td1wria_.11.fasta\t0.999\t59\t49-142\t<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br>"
+                    + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
+        {
+            structModelHeader,
+            baseDir,
+            "FER_CAPAN_1-144\td1czpa_\td1czpa_.12.pdb\td1czpa_.12.fasta\t0.999\t64\t48-142\t<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br>"
+                    + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
+        {
+            structModelHeader,
+            baseDir,
+            "FER_CAPAN_1-144\td2cjoa_\td2cjoa_.13.pdb\td2cjoa_.13.fasta\t0.999\t63\t48-142\t<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br>"
+                    + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
+        {
+            structModelHeader,
+            baseDir,
+            "FER_CAPAN_1-144\td4fxca_\td4fxca_.14.pdb\td4fxca_.14.fasta\t0.999\t64\t48-142\t<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br>"
+                    + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
+        {
+            structModelHeader,
+            baseDir,
+            "FER_CAPAN_1-144\tc4itkA_\tc4itkA_.15.pdb\tc4itkA_.15.fasta\t0.999\t57\t50-142\t<b>PDB Header: </b>Electron transport<br>"
+                    + "<b>Chain: </b>A<br><b>PDB Molecule: </b>Apoferredoxin <br><b>PDB Title: </b>The structure of c.reinhardtii ferredoxin 2" },
+        {
+            structModelHeader,
+            baseDir,
+            "FER_CAPAN_1-144\tc1krhA_\tc1krhA_.16.pdb\tc1krhA_.16.fasta\t0.999\t25\t48-142\t<b>PDB Header: </b>Oxidoreductase<br><b>Chain: "
+                    + "</b>A<br><b>PDB Molecule: </b>Benzoate 1,2-deoxygenase reductase <br> <b>PDB Title: </b>X-ray structure of benzoate "
+                    + "deoxygenate reductase" },
+        {
+            structModelHeader,
+            baseDir,
+            "FER_CAPAN_1-144\td1krha3\td1krha3.17.pdb\td1krha3.17.fasta\t0.999\t24\t48-143\t<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br>"
+                    + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin domains from multi domain proteins" },
+        {
+            structModelHeader,
+            baseDir,
+            "FER_CAPAN_1-144\td1jq4a_\td1jq4a_.18.pdb\td1jq4a_.18.fasta\t0.999\t29\t47-138\t<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br>"
+                    + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin domains from multi domain proteins" },
+        {
+            structModelHeader,
+            baseDir,
+            "FER_CAPAN_1-144\tc4wqmA_\tc4wqmA_.19.pdb\tc4wqmA_.19.fasta\t0.999\t28\t49-144\t<b>PDB header: </b>Oxidoreductase<br><b>Chain: "
+                    + "</b>A<br><b>PDB Molecule: </b>Toluene-4-monooxygenase electron transfer component<br><b>PDB Title: </b>Structure of the "
+                    + "toluene 4-monooxygenase nah oxidoreductase t4mof,2 k270s k271s variant" },
+        {
+            structModelHeader,
+            baseDir,
+            "FER_CAPAN_1-144\tc2piaA_\tc2piaA_.20.pdb\tc2piaA_.20.fasta\t0.999\t22\t1-136\t<b>PDB header: </b>Reductase<br><b>Chain: "
+                    + "</b>A<br><b>PDB Molecule: </b>Phthalate deoxygenase reductase<br><b>PDB Title: </b>Phthalate deoxygenate reductase: a"
+                    + " modular structure for2 electron transfer from pyridine nucleotides to [2fe-2s]" }
+    };
+  }
+
+  @DataProvider(name = "phyre2ModelMappingDataProvider")
+  public static Object[][] phyre2ModelMappingDataProvider()
+  {
+    return new Object[][] {
+
+        { "examples/testdata/phyre2results/56da5616b4559c93/c4n58A_.1.pdb",
+            "examples/testdata/phyre2results/56da5616b4559c93/c4n58A_.1.fasta" },
+        { "examples/testdata/phyre2results/56da5616b4559c93/d1a70a_.2.pdb",
+            "examples/testdata/phyre2results/56da5616b4559c93/d1a70a_.2.fasta" },
+        { "examples/testdata/phyre2results/56da5616b4559c93/d1offa_.3.pdb",
+            "examples/testdata/phyre2results/56da5616b4559c93/d1offa_.3.fasta" },
+        { "examples/testdata/phyre2results/56da5616b4559c93/d1frra_.4.pdb",
+            "examples/testdata/phyre2results/56da5616b4559c93/d1frra_.4.fasta" },
+        { "examples/testdata/phyre2results/56da5616b4559c93/d1pfda_.5.pdb",
+            "examples/testdata/phyre2results/56da5616b4559c93/d1pfda_.5.fasta" },
+        { "examples/testdata/phyre2results/56da5616b4559c93/d1frda_.6.pdb",
+            "examples/testdata/phyre2results/56da5616b4559c93/d1frda_.6.fasta" },
+
+        { "examples/testdata/phyre2results/56da5616b4559c93/d1fxia_.7.pdb",
+            "examples/testdata/phyre2results/56da5616b4559c93/d1fxia_.7.fasta" },
+
+        { "examples/testdata/phyre2results/56da5616b4559c93/d1gaqb_.8.pdb",
+            "examples/testdata/phyre2results/56da5616b4559c93/d1gaqb_.8.fasta" },
+        { "examples/testdata/phyre2results/56da5616b4559c93/d1iuea_.9.pdb",
+            "examples/testdata/phyre2results/56da5616b4559c93/d1iuea_.9.fasta" },
+        {
+            "examples/testdata/phyre2results/56da5616b4559c93/d1awda_.10.pdb",
+            "examples/testdata/phyre2results/56da5616b4559c93/d1awda_.10.fasta" },
+        {
+            "examples/testdata/phyre2results/56da5616b4559c93/d1wria_.11.pdb",
+            "examples/testdata/phyre2results/56da5616b4559c93/d1wria_.11.fasta" },
+        {
+            "examples/testdata/phyre2results/56da5616b4559c93/d1czpa_.12.pdb",
+            "examples/testdata/phyre2results/56da5616b4559c93/d1czpa_.12.fasta" },
+        {
+            "examples/testdata/phyre2results/56da5616b4559c93/d2cjoa_.13.pdb",
+            "examples/testdata/phyre2results/56da5616b4559c93/d2cjoa_.13.fasta" },
+        {
+            "examples/testdata/phyre2results/56da5616b4559c93/d4fxca_.14.pdb",
+            "examples/testdata/phyre2results/56da5616b4559c93/d4fxca_.14.fasta" },
+        {
+            "examples/testdata/phyre2results/56da5616b4559c93/c4itkA_.15.pdb",
+            "examples/testdata/phyre2results/56da5616b4559c93/c4itkA_.15.fasta" },
+        {
+            "examples/testdata/phyre2results/56da5616b4559c93/c1krhA_.16.pdb",
+            "examples/testdata/phyre2results/56da5616b4559c93/c1krhA_.16.fasta" },
+        {
+            "examples/testdata/phyre2results/56da5616b4559c93/d1krha3.17.pdb",
+            "examples/testdata/phyre2results/56da5616b4559c93/d1krha3.17.fasta" },
+        {
+            "examples/testdata/phyre2results/56da5616b4559c93/d1jq4a_.18.pdb",
+            "examples/testdata/phyre2results/56da5616b4559c93/d1jq4a_.18.fasta" },
+        {
+            "examples/testdata/phyre2results/56da5616b4559c93/c4wqmA_.19.pdb",
+            "examples/testdata/phyre2results/56da5616b4559c93/c4wqmA_.19.fasta" },
+        {
+            "examples/testdata/phyre2results/56da5616b4559c93/c2piaA_.20.pdb",
+            "examples/testdata/phyre2results/56da5616b4559c93/c2piaA_.20.fasta" }
+
+    };
+  }
+
+  @DataProvider(name = "phyre2InfoHTMLTableDataProvider")
+  public static Object[][] phyre2InfoHTMLTableDataProvider()
+  {
+    return new Object[][] {
+        {
+            "STRUCTMODEL Annotation with no headear information provided",
+            null,
+            new String[] { "FER_CAPAN_1-144", "d1a70a_ d1a70a_.2.pdb",
+                "d1a70a_.2.fasta", }, "" },
+        {
+            "STRUCTMODEL Annotation with complete compulsary data and headear information provided",
+            new String[] { "HEADER_STRUCT_MODEL", "QUERY_SEQ",
+                "TEMPLATE_SEQ", "MODEL_FILE", "MAPPING_FILE" },
+            new String[] { "FER_CAPAN_1-144", "d1a70a_ d1a70a_.2.pdb",
+                "d1a70a_.2.fasta", },
+            "<html><table border=\"1\" width=100%><tr><td colspan=\"2\"><strong>Phyre2 Template Info</strong></td></tr></table></html>" },
+        {
+            "STRUCTMODEL Annotation with complete compulsary data and headear information provided",
+            new String[] { "HEADER_STRUCT_MODEL", "QUERY_SEQ",
+                "TEMPLATE_SEQ", "MODEL_FILE", "MAPPING_FILE", "Confidence",
+                "% I.D", "Aligned Range", "Other Information", "Coverage" },
+            new String[] {
+                "FER_CAPAN_1-144",
+                "d1a70a_ d1a70a_.2.pdb",
+                "d1a70a_.2.fasta",
+                "1",
+                "71",
+                "48-144",
+                "<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
+            "<html><table border=\"1\" width=100%><tr><td colspan=\"2\"><strong>Phyre2 Template Info</strong></td></tr><tr><td>MAPPING_FILE</td><td>71</td></tr><tr><td>Confidence</td><td>48-144</td></tr><tr><td>% I.D</td><td><b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related</td></tr></table></html>" } };
+  }
+
+  @DataProvider(name = "StructModelHtmlDataProvider")
+  public static Object[][] IsGenerateStructInfoHtmlDataProvider()
+  {
+    return new Object[][] {
+        { "STRUCTMODEL Annotation with no headear or data provided", null,
+            null, false },
+        {
+            "STRUCTMODEL Annotation with headear information and no data column provided",
+            new String[] { "HEADER_STRUCT_MODEL", "QUERY_SEQ" }, null,
+            false },
+        {
+            "STRUCTMODEL Annotation with no headear information provided",
+            null,
+            new String[] { "FER_CAPAN_1-144", "d1a70a_ d1a70a_.2.pdb",
+                "d1a70a_.2.fasta", }, false },
+        {
+            "STRUCTMODEL Annotation with only two headear information and two data column provided",
+            new String[] { "HEADER_STRUCT_MODEL", "QUERY_SEQ" },
+            new String[] { "FER_CAPAN_1-144", "d1a70a_" }, false },
+        {
+            "STRUCTMODEL Annotation with complete compulsary data and headear information provided",
+            new String[] { "HEADER_STRUCT_MODEL", "QUERY_SEQ",
+                "TEMPLATE_SEQ", "MODEL_FILE", "MAPPING_FILE" },
+            new String[] { "FER_CAPAN_1-144", "d1a70a_", "d1a70a_.2.pdb",
+                "d1a70a_.2.fasta", }, true },
+        {
+            "STRUCTMODEL Annotation with complete compulsary data and headear information provided",
+            new String[] { "HEADER_STRUCT_MODEL", "QUERY_SEQ",
+                "TEMPLATE_SEQ", "MODEL_FILE", "MAPPING_FILE", "Confidence",
+                "% I.D", "Aligned Range", "Other Information", "Coverage" },
+            new String[] {
+                "FER_CAPAN_1-144",
+                "d1a70a_",
+                "d1a70a_.2.pdb",
+                "d1a70a_.2.fasta",
+                "1",
+                "71",
+                "48-144",
+                "<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
+            true } };
+  }
+
+  @DataProvider(name = "FilePathProvider")
+  public static Object[][] filePathProvider()
+  {
+    return new Object[][] {
+        { "relative local file path resolution", "c4n58A_.1.pdb", "",
+            "c4n58A_.1.pdb" },
+        { "relative local file path resolution", "c4n58A_.1.pdb",
+            "/examples/testdata/phyre2results/",
+            "/examples/testdata/phyre2results/c4n58A_.1.pdb" },
+        {
+            "relative URL path resolution",
+            "c4n58A_.1.pdb",
+            "http://www.jalview.org/builds/develop/examples/testdata/phyre2results/",
+            "http://www.jalview.org/builds/develop/examples/testdata/phyre2results/c4n58A_.1.pdb" },
+        {
+            "Absolute local file path resolution",
+            "/examples/testdata/phyre2results_xx/c4n58A_.1.pdb",
+            "/examples/testdata/phyre2results/",
+            "/examples/testdata/phyre2results_xx/c4n58A_.1.pdb" },
+        {
+            "Absolute URL path resolution",
+            "http://www.jalview.org/builds/develop/another_directory/c4n58A_.1.pdb",
+            "http://www.jalview.org/builds/develop/examples/testdata/phyre2results/",
+            "http://www.jalview.org/builds/develop/another_directory/c4n58A_.1.pdb" } };
   }
 }