JAL-2136 JAL-2137 Added improvement to enable explicit and dynamic definition of...
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Tue, 28 Mar 2017 17:20:10 +0000 (18:20 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Tue, 28 Mar 2017 17:20:10 +0000 (18:20 +0100)
examples/testdata/phyre2results/56da5616b4559c93/allhits.ann
src/jalview/io/AnnotationFile.java
src/jalview/io/StructureFile.java
test/jalview/io/AnnotationFileIOTest.java

index 4912c65..fe4a88f 100644 (file)
@@ -1,22 +1,26 @@
 JALVIEW_ANNOTATION
 HIDE_INSERTIONS
-STRUCTMODEL    FER_CAPAN_1-144 c4n58A_ c4n58A_.1.pdb   c4n58A_.1.fasta 1       54      48      143     <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
-STRUCTMODEL    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
-STRUCTMODEL    FER_CAPAN_1-144 d1offa_ d1offa_.3.pdb   d1offa_.3.fasta 1       73      48      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    FER_CAPAN_1-144 d1frra_ d1frra_.4.pdb   d1frra_.4.fasta 0.999   62      49      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    FER_CAPAN_1-144 d1pfda_ d1pfda_.5.pdb   d1pfda_.5.fasta 0.999   70      48      143     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    FER_CAPAN_1-144 d1frda_ d1frda_.6.pdb   d1frda_.6.fasta 0.999   50      48      143     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    FER_CAPAN_1-144 d1fxia_ d1fxia_.7.pdb   d1fxia_.7.fasta 0.999   62      48      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    FER_CAPAN_1-144 d1gaqb_ d1gaqb_.8.pdb   d1gaqb_.8.fasta 0.999   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
-STRUCTMODEL    FER_CAPAN_1-144 d1iuea_ d1iuea_.9.pdb   d1iuea_.9.fasta 0.999   48      48      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    FER_CAPAN_1-144 d1awda_ d1awda_.10.pdb  d1awda_.10.fasta        0.999   68      50      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    FER_CAPAN_1-144 d1wria_ d1wria_.11.pdb  d1wria_.11.fasta        0.999   59      49      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    FER_CAPAN_1-144 d1czpa_ d1czpa_.12.pdb  d1czpa_.12.fasta        0.999   64      48      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    FER_CAPAN_1-144 d2cjoa_ d2cjoa_.13.pdb  d2cjoa_.13.fasta        0.999   63      48      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    FER_CAPAN_1-144 d4fxca_ d4fxca_.14.pdb  d4fxca_.14.fasta        0.999   64      48      142     <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
-STRUCTMODEL    FER_CAPAN_1-144 c4itkA_ c4itkA_.15.pdb  c4itkA_.15.fasta        0.999   57      50      142     <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
-STRUCTMODEL    FER_CAPAN_1-144 c1krhA_ c1krhA_.16.pdb  c1krhA_.16.fasta        0.999   25      48      142     <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
-STRUCTMODEL    FER_CAPAN_1-144 d1krha3 d1krha3.17.pdb  d1krha3.17.fasta        0.999   24      48      143     <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
-STRUCTMODEL    FER_CAPAN_1-144 d1jq4a_ d1jq4a_.18.pdb  d1jq4a_.18.fasta        0.999   29      47      138     <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
-STRUCTMODEL    FER_CAPAN_1-144 c4wqmA_ c4wqmA_.19.pdb  c4wqmA_.19.fasta        0.999   28      49      144     <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
-STRUCTMODEL    FER_CAPAN_1-144 c2piaA_ c2piaA_.20.pdb  c2piaA_.20.fasta        0.999   22      1       136     <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]
\ No newline at end of file
+HEADER_STRUCT_MODEL    QUERY_SEQ       TEMPLATE_SEQ    MODEL_FILE      MAPPING_FILE    Confidence      % I.D   Aligned Range   Other Information
+STRUCTMODEL    FER_CAPAN_1-144 c4n58A_ c4n58A_.1.pdb   c4n58A_.1.fasta 1       54      48-143  <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
+STRUCTMODEL    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
+STRUCTMODEL    FER_CAPAN_1-144 d1offa_ d1offa_.3.pdb   d1offa_.3.fasta 1       73      48-142  <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
+STRUCTMODEL    FER_CAPAN_1-144 d1frra_ d1frra_.4.pdb   d1frra_.4.fasta 0.999   62      49-142  <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
+STRUCTMODEL    FER_CAPAN_1-144 d1pfda_ d1pfda_.5.pdb   d1pfda_.5.fasta 0.999   70      48-143  <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
+STRUCTMODEL    FER_CAPAN_1-144 d1frda_ d1frda_.6.pdb   d1frda_.6.fasta 0.999   50      48-143  <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related      
+STRUCTMODEL    FER_CAPAN_1-144 d1fxia_ d1fxia_.7.pdb   d1fxia_.7.fasta 0.999   62      48-142  <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
+STRUCTMODEL    FER_CAPAN_1-144 d1gaqb_ d1gaqb_.8.pdb   d1gaqb_.8.fasta 0.999   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
+STRUCTMODEL    FER_CAPAN_1-144 d1iuea_ d1iuea_.9.pdb   d1iuea_.9.fasta 0.999   48      48-142  <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
+STRUCTMODEL    FER_CAPAN_1-144 d1awda_ d1awda_.10.pdb  d1awda_.10.fasta        0.999   68      50-142  <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
+STRUCTMODEL    FER_CAPAN_1-144 d1wria_ d1wria_.11.pdb  d1wria_.11.fasta        0.999   59      49-142  <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
+STRUCTMODEL    FER_CAPAN_1-144 d1czpa_ d1czpa_.12.pdb  d1czpa_.12.fasta        0.999   64      48-142  <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
+STRUCTMODEL    FER_CAPAN_1-144 d2cjoa_ d2cjoa_.13.pdb  d2cjoa_.13.fasta        0.999   63      48-142  <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
+STRUCTMODEL    FER_CAPAN_1-144 d4fxca_ d4fxca_.14.pdb  d4fxca_.14.fasta        0.999   64      48-142  <b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related
+STRUCTMODEL    FER_CAPAN_1-144 c4itkA_ c4itkA_.15.pdb  c4itkA_.15.fasta        0.999   57      50-142  <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
+STRUCTMODEL    FER_CAPAN_1-144 c1krhA_ c1krhA_.16.pdb  c1krhA_.16.fasta        0.999   25      48-142  <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
+STRUCTMODEL    FER_CAPAN_1-144 d1krha3 d1krha3.17.pdb  d1krha3.17.fasta        0.999   24      48-143  <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
+STRUCTMODEL    FER_CAPAN_1-144 d1jq4a_ d1jq4a_.18.pdb  d1jq4a_.18.fasta        0.999   29      47-138  <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
+STRUCTMODEL    FER_CAPAN_1-144 c4wqmA_ c4wqmA_.19.pdb  c4wqmA_.19.fasta        0.999   28      49-144  <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
+STRUCTMODEL    FER_CAPAN_1-144 c2piaA_ c2piaA_.20.pdb  c2piaA_.20.fasta        0.999   22      1-136   <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]
+
+
+5 test that exercises 54 cases
\ No newline at end of file
index b72184b..8e1730a 100755 (executable)
@@ -56,6 +56,28 @@ import java.util.Vector;
 
 public class AnnotationFile
 {
+  StringBuffer text;
+
+  SequenceI refSeq = null;
+
+  String refSeqId = null;
+
+  String[] StructModelHeader = null;
+
+  long nlinesread = 0;
+
+  String lastread = "";
+
+  /**
+   * used for resolving absolute references to resources relative to
+   * annotationFile location
+   */
+  String baseUri = "";
+
+  private static String GRAPHLINE = "GRAPHLINE", COMBINE = "COMBINE",
+          STRUCTMODEL = "STRUCTMODEL",
+          HEADER_STRUCT_MODEL = "HEADER_STRUCT_MODEL";
+
   public AnnotationFile()
   {
     init();
@@ -82,7 +104,6 @@ public class AnnotationFile
     return newline;
   }
 
-  StringBuffer text;
 
   private void init()
   {
@@ -661,9 +682,6 @@ public class AnnotationFile
     }
   }
 
-  SequenceI refSeq = null;
-
-  String refSeqId = null;
 
   public boolean annotateAlignmentView(AlignViewportI viewport,
           String file, DataSourceType protocol)
@@ -757,18 +775,6 @@ public class AnnotationFile
     return false;
   }
 
-  long nlinesread = 0;
-
-  String lastread = "";
-
-  /**
-   * used for resolving absolute references to resources relative to
-   * annotationFile location
-   */
-  String baseUri = "";
-
-  private static String GRAPHLINE = "GRAPHLINE", COMBINE = "COMBINE",
-          STRUCTMODEL = "STRUCTMODEL";
 
   public boolean parseAnnotationFrom(AlignmentI al, ColumnSelection colSel,
           BufferedReader in) throws Exception
@@ -962,12 +968,6 @@ public class AnnotationFile
           modified = true;
           continue;
         }
-        // else if (token.equalsIgnoreCase("VIEW_DEF"))
-        // {
-        // addOrSetView(al,st);
-        // modified = true;
-        // continue;
-        // }
         else if (token.equalsIgnoreCase("VIEW_SETREF"))
         {
           if (refSeq != null)
@@ -1014,13 +1014,21 @@ public class AnnotationFile
           modified = true;
           continue;
         }
+        else if (token.equalsIgnoreCase(HEADER_STRUCT_MODEL))
+        {
+          int hSize = st.countTokens();
+          StructModelHeader = new String[hSize];
+          for (int x = 0; x < hSize; x++)
+          {
+            StructModelHeader[x] = st.nextToken();
+          }
+          continue;
+        }
         else if (token.equalsIgnoreCase(STRUCTMODEL))
         {
           boolean failedtoadd = true;
-          // expect
-          // STRUCTMODEL <Query> <TemplateSeqId> <ModelFile> <FastaMappingFile>
-          // <Confidence> <%.I.D>
-          // <MatchStart> <MatchEnd> <Coverage> [<Other Information>]
+          // expects STRUCTMODEL <Query> <TemplateSeqId> <ModelFile>
+          // <FastaMappingFile>
           String querySeqId = !st.hasMoreTokens() ? "" : st.nextToken();
           SequenceI querySeq = al.findName(querySeqId);
           if (st.hasMoreTokens()) {
@@ -1033,19 +1041,16 @@ public class AnnotationFile
             }
             else
             {
-              String tempId = st.nextToken();
-              String fastaMapping = st.nextToken();
-              String confidence = !st.hasMoreTokens() ? "" : 100
-                      * Double.valueOf(st.nextToken()) + "";
-              String pid = !st.hasMoreTokens() ? "" : st.nextToken();
-              String alignRange = !st.hasMoreTokens() ? "" : st.nextToken()
-                      + "-" + st.nextToken();
-              String otherInfo = !st.hasMoreTokens() ? "" : st.nextToken();
-              String coverage = "";
-              if (add_structmodel(al, querySeq, refSeq, tempId,
-                      fastaMapping,
-                      alignRange, coverage,
-                      confidence, pid, otherInfo))
+              int tSize = st.countTokens() + 2;
+              String[] rowData = new String[tSize];
+              rowData[0] = querySeqId;
+              rowData[1] = refSeqId;
+              for (int x = 2; x < tSize; x++)
+              {
+                rowData[x] = st.nextToken();
+              }
+              if (processStructModel(al, querySeq, refSeq,
+                      StructModelHeader, rowData, baseUri))
               {
                 failedtoadd = false;
               }
@@ -1054,9 +1059,8 @@ public class AnnotationFile
           if (failedtoadd)
           {
             System.err
-                    .println("Need <Query> <TemplateSeqId> <ModelFile> <FastaMappingFile> <Confidence> <%.I.D> <MatchStart> <MatchEnd> <Coverage> [<Other Information>] as tab separated fields after"
-                            + STRUCTMODEL
-                            + ".\nNote: other information could be provided in html format ");
+                    .println("Need minimum of <Query> <TemplateSeqId> <ModelFile> <FastaMappingFile> as tab separated fields after"
+                            + STRUCTMODEL);
           } else {
             modified = true;
           }
@@ -1262,33 +1266,36 @@ public class AnnotationFile
   }
 
   /**
-   * resolve a structural model and generate and add an alignment sequence for
-   * it
+   * Resolve structural model to a reference sequence and register it to
+   * StructureSelectionManager
    * 
-   * @param refSeq2
-   * @param tempId
-   * @param urlToModel
-   * @param urlToPairwise
+   * @param al
+   * @param querySequence
+   * @param templateSeq
+   * @param structModelHeader
+   * @param structModelData
    * @return true if model and sequence was added
    */
-  private boolean add_structmodel(AlignmentI al, SequenceI querySequence,
+  static boolean processStructModel(AlignmentI al, SequenceI querySequence,
           SequenceI templateSeq,
-          String modelFile, String fastaFile, String aRange,
-          String coverage, String confidence,
-          String pid, String otherInfo)
+ String[] structModelHeader,
+          String[] structModelData, String baseUri)
   {
     String warningMessage = null;
     boolean added = false;
     try {
-      String structureModelFile = resolveAbsolute(modelFile);
-      String fastaMappingFile = resolveAbsolute(fastaFile.replaceAll(
-              ".fasta.jal", ".fasta"));
+      String structureModelFile = resolveAbsolutePath(structModelData[2],
+              baseUri);
+      String fastaMappingFile = resolveAbsolutePath(structModelData[3],
+              baseUri);
       // System.out.println("Model File >> " + structureModelFile);
       // System.out.println("Fasta File >> " + fastaMappingFile);
-      PDBEntry phyre2PDBEntry = new PDBEntry(modelFile, null, Type.FILE,
+      String modelName = StructureFile.safeName(structureModelFile);
+      PDBEntry phyre2PDBEntry = new PDBEntry(modelName, " ",
+              Type.PDB,
               structureModelFile);
-      String phyre2ModelDesc = generatePhyre2InfoHTMLTable(aRange,
-              coverage, confidence, pid, otherInfo);
+      String phyre2ModelDesc = generatePhyre2InfoHTMLTable(
+              structModelHeader, structModelData);
       phyre2PDBEntry.setProperty("PHYRE2_MODEL_INFO", phyre2ModelDesc);
       templateSeq.getDatasetSequence().addPDBId(phyre2PDBEntry);
       if (querySequence != null)
@@ -1312,50 +1319,47 @@ public class AnnotationFile
     return added;
   }
 
-  private String generatePhyre2InfoHTMLTable(String aRange,
-          String coverage, String confidence, String pid, String otherInfo)
+  static String generatePhyre2InfoHTMLTable(String[] structModelHeader,
+          String[] structModelData)
   {
     StringBuilder phyre2InfoBuilder = new StringBuilder();
-    phyre2InfoBuilder.append("<html><table border=\"1\" width=100%>");
-    phyre2InfoBuilder
-            .append("<tr><td colspan=\"2\"><strong>Phyre2 Template Info</strong></td></tr>");
-    if (aRange != null && !aRange.isEmpty())
-    {
-      phyre2InfoBuilder.append("<tr><td>").append("Aligned range")
-              .append("</td><td>").append(aRange).append("</td></tr>");
-    }
-    if (coverage != null && !coverage.isEmpty())
+    if (isGenerateStructInfoHtml(structModelHeader, structModelData))
     {
-      phyre2InfoBuilder.append("<tr><td>").append("Coverage")
-              .append("</td><td>").append(coverage).append("</td></tr>");
-    }
-    if (confidence != null && !confidence.isEmpty())
-    {
-      phyre2InfoBuilder.append("<tr><td>").append("Confidence")
-              .append("</td><td>").append(confidence).append("</td></tr>");
+      phyre2InfoBuilder.append("<html><table border=\"1\" width=100%>")
+              .append("<tr><td colspan=\"2\"><strong>Phyre2 Template Info</strong></td></tr>");
+      for (int x = 4; x < structModelData.length; x++)
+      {
+        phyre2InfoBuilder.append("<tr><td>").append(structModelHeader[x])
+                .append("</td><td>").append(structModelData[x])
+                .append("</td></tr>");
+      }
+      phyre2InfoBuilder.append("</table></html>");
     }
-    if (pid != null && !pid.isEmpty())
+    return phyre2InfoBuilder.toString();
+  }
+
+  static boolean isGenerateStructInfoHtml(String[] header, String[] data)
+  {
+    boolean generate = true;
+    if (header == null || data == null)
     {
-      phyre2InfoBuilder.append("<tr><td>").append("%.i.d")
-              .append("</td><td>").append(pid).append("</td></tr>");
+      return false;
     }
-    if (otherInfo != null && !otherInfo.isEmpty())
+    if (header.length < 3 || data.length < 3)
     {
-      phyre2InfoBuilder.append("<tr><td>").append("Other information")
-              .append("</td><td>").append(otherInfo).append("</td></tr>");
+      generate = false;
     }
-    phyre2InfoBuilder.append("</table></html>");
-    return phyre2InfoBuilder.toString();
+    return generate;
   }
 
-  private String resolveAbsolute(String relURI)
+  static String resolveAbsolutePath(String relURI, String _baseUri)
   {
     if (relURI.indexOf(":/") > -1 || relURI.startsWith("/")
-            || "".equals(baseUri) || relURI.startsWith(baseUri))
+            || "".equals(_baseUri) || relURI.startsWith(_baseUri))
     {
       return relURI;
     }
-    return baseUri + relURI;
+    return _baseUri + relURI;
   }
 
   private void parseHideCols(ColumnSelection colSel, String nextToken)
index 7fe17c8..63a8476 100644 (file)
@@ -408,7 +408,7 @@ public abstract class StructureFile extends AlignFile
    * @param dataName
    * @return truncated dataName to after last '/'
    */
-  protected String safeName(String dataName)
+  public static String safeName(String dataName)
   {
     int p = 0;
     while ((p = dataName.indexOf("/")) > -1 && p < dataName.length())
index 885c673..4bc8c3b 100644 (file)
@@ -25,19 +25,29 @@ 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.testng.Assert;
 import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
 public class AnnotationFileIOTest
 {
 
+  private StructureSelectionManager ssm = null;
+
+  private AlignmentI al = null;
+
   @BeforeClass(alwaysRun = true)
   public void setUpJvOptionPane()
   {
@@ -106,8 +116,7 @@ public class AnnotationFileIOTest
    *          - label for IO class used to write and read back in the data from
    *          f
    */
-  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);
@@ -163,4 +172,370 @@ public class AnnotationFileIOTest
             + "\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" } };
+  }
 }