14b4747458af225dbbd423d89e4de8df1b05a0b4
[jalview.git] / test / jalview / io / AnnotationFileIOTest.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3  * Copyright (C) $$Year-Rel$$ The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3
10  * of the License, or (at your option) any later version.
11  *  
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
19  * The Jalview Authors are detailed in the 'AUTHORS' file.
20  */
21 package jalview.io;
22
23 import static org.testng.AssertJUnit.assertNotNull;
24 import static org.testng.AssertJUnit.assertTrue;
25
26 import jalview.datamodel.AlignmentI;
27 import jalview.datamodel.DynamicData;
28 import jalview.datamodel.HiddenColumns;
29 import jalview.datamodel.PDBEntry;
30 import jalview.datamodel.PDBEntry.Type;
31 import jalview.datamodel.SequenceI;
32 import jalview.gui.JvOptionPane;
33 import jalview.io.AnnotationFile.ViewDef;
34 import jalview.structure.StructureSelectionManager;
35
36 import java.io.File;
37 import java.util.Hashtable;
38 import java.util.List;
39
40 import org.testng.Assert;
41 import org.testng.annotations.BeforeClass;
42 import org.testng.annotations.DataProvider;
43 import org.testng.annotations.Test;
44
45 public class AnnotationFileIOTest
46 {
47
48   private StructureSelectionManager ssm = null;
49
50   private AlignmentI al = null;
51
52   @BeforeClass(alwaysRun = true)
53   public void setUpJvOptionPane()
54   {
55     JvOptionPane.setInteractiveMode(false);
56     JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
57   }
58
59   static String TestFiles[][] = {
60       { "Test example annotation import/export", "examples/uniref50.fa",
61           "examples/testdata/example_annot_file.jva" },
62       { "Test multiple combine annotation statements import/export",
63           "examples/uniref50.fa",
64           "examples/testdata/test_combine_annot.jva" },
65       {
66           "Test multiple combine annotation statements with sequence_ref import/export",
67           "examples/uniref50.fa", "examples/testdata/uniref50_iupred.jva" },
68       {
69           "Test group only annotation file parsing results in parser indicating annotation was parsed",
70           "examples/uniref50.fa", "examples/testdata/test_grpannot.jva" },
71       { "Test hiding/showing of insertions on sequence_ref",
72           "examples/uniref50.fa", "examples/testdata/uniref50_seqref.jva" } };
73
74   @Test(groups = { "Functional" })
75   public void exampleAnnotationFileIO() throws Exception
76   {
77     for (String[] testPair : TestFiles)
78     {
79       testAnnotationFileIO(testPair[0], new File(testPair[1]), new File(
80               testPair[2]));
81     }
82   }
83
84   AlignmentI readAlignmentFile(File f)
85   {
86     System.out.println("Reading file: " + f);
87     String ff = f.getPath();
88     try
89     {
90       FormatAdapter rf = new FormatAdapter();
91
92       AlignmentI al = rf.readFile(ff, DataSourceType.FILE,
93               new IdentifyFile().identify(ff, DataSourceType.FILE));
94
95       // make sure dataset is initialised ? not sure about this
96       for (int i = 0; i < al.getSequencesArray().length; ++i)
97       {
98         al.getSequenceAt(i).createDatasetSequence();
99       }
100       assertNotNull("Couldn't read supplied alignment data.", al);
101       return al;
102     } catch (Exception e)
103     {
104       e.printStackTrace();
105     }
106     Assert.fail("Couln't read the alignment in file '" + f.toString() + "'");
107     return null;
108   }
109
110   /**
111    * test alignment data in given file can be imported, exported and reimported
112    * with no dataloss
113    * 
114    * @param f
115    *          - source datafile (IdentifyFile.identify() should work with it)
116    * @param ioformat
117    *          - label for IO class used to write and read back in the data from
118    *          f
119    */
120   void testAnnotationFileIO(String testname, File f, File annotFile)
121   {
122     System.out.println("Test: " + testname + "\nReading annotation file '"
123             + annotFile + "' onto : " + f);
124     String af = annotFile.getPath();
125     try
126     {
127       AlignmentI al = readAlignmentFile(f);
128       HiddenColumns cs = new HiddenColumns();
129       assertTrue(
130               "Test "
131                       + testname
132                       + "\nAlignment was not annotated - annotation file not imported.",
133               new AnnotationFile().readAnnotationFile(al, cs, af,
134                       DataSourceType.FILE));
135
136       AnnotationFile aff = new AnnotationFile();
137       // ViewDef is not used by Jalview
138       ViewDef v = aff.new ViewDef(null, al.getHiddenSequences(), cs,
139               new Hashtable());
140       String anfileout = new AnnotationFile().printAnnotations(
141               al.getAlignmentAnnotation(), al.getGroups(),
142               al.getProperties(), null, al, v);
143       assertTrue(
144               "Test "
145                       + testname
146                       + "\nAlignment annotation file was not regenerated. Null string",
147               anfileout != null);
148       assertTrue(
149               "Test "
150                       + testname
151                       + "\nAlignment annotation file was not regenerated. Empty string",
152               anfileout.length() > "JALVIEW_ANNOTATION".length());
153
154       System.out.println("Output annotation file:\n" + anfileout
155               + "\n<<EOF\n");
156
157       AlignmentI al_new = readAlignmentFile(f);
158       assertTrue(
159               "Test "
160                       + testname
161                       + "\nregenerated annotation file did not annotate alignment.",
162               new AnnotationFile().readAnnotationFile(al_new, anfileout,
163                       DataSourceType.PASTE));
164
165       // test for consistency in io
166       StockholmFileTest.testAlignmentEquivalence(al, al_new, false, false,
167               false);
168       return;
169     } catch (Exception e)
170     {
171       e.printStackTrace();
172     }
173     Assert.fail("Test "
174             + testname
175             + "\nCouldn't complete Annotation file roundtrip input/output/input test for '"
176             + annotFile + "'.");
177   }
178
179
180   @BeforeClass(alwaysRun = true)
181   void testProcessStructModel()
182   {
183     try
184     {
185
186       ssm = StructureSelectionManager.getStructureSelectionManager();
187     } catch (NullPointerException e)
188     {
189       ssm = new StructureSelectionManager();
190     }
191     File alignmentFile = new File(
192             "examples/testdata/phyre2results/56da5616b4559c93/allhits.fasta");
193     String annotationFile = "examples/testdata/phyre2results/56da5616b4559c93/allhits.ann";
194     HiddenColumns cs = new HiddenColumns();
195     al = readAlignmentFile(alignmentFile);
196     boolean annotationRead = new AnnotationFile().readAnnotationFile(al,
197             cs, annotationFile, DataSourceType.FILE);
198     Assert.assertTrue(annotationRead);
199     System.out.println("bla");
200   }
201   
202   @Test(
203     groups = { "Functional" },
204     dataProvider = "phyre2ModelPDBEntryDataProvider")
205   void testSequence_PDBEntryAssociation(String[] structModelHeader, String baseDir,
206           String structModelDataStr)
207   {
208     String structModelData[] = structModelDataStr.split("\t");
209     String templateSeq = structModelData[1];
210     String pdbId = structModelData[2];
211
212     SequenceI testSeq = al.findName(templateSeq);
213     Assert.assertNotNull(testSeq);
214     PDBEntry actualPDBEntry = testSeq.getDatasetSequence().getPDBEntry(
215             pdbId);
216     Assert.assertNotNull(actualPDBEntry);
217
218     PDBEntry expectedPDBEntry = new PDBEntry(pdbId, " ", Type.PDB, baseDir
219             + pdbId);
220     List<DynamicData> phyreDD = AnnotationFile
221             .generatePhyreDynamicDataList(structModelHeader,
222                     structModelData);
223     expectedPDBEntry.setProperty("DYNAMIC_DATA_PHYRE2", phyreDD);
224
225     Assert.assertEquals(actualPDBEntry, expectedPDBEntry);
226   }
227
228   @Test(
229     groups = { "Functional" },
230     dataProvider = "phyre2ModelMappingDataProvider")
231   void testPhyre2ModelRegistration(String phyre2ModelFile,
232           String expectedPhyre2FastaMappingFile)
233   {
234
235     String actualFastaMappingFile = ssm
236             .getPhyre2FastaFileFor(phyre2ModelFile);
237     Assert.assertNotNull(actualFastaMappingFile);
238     Assert.assertEquals(actualFastaMappingFile,
239             expectedPhyre2FastaMappingFile);
240   }
241
242   @Test(groups = { "Functional" }, dataProvider = "FilePathProvider")
243   void testResolveAbsolutePath(String caseDescription, String suppliedPath,
244           String baseURI, String expectedURI)
245   {
246     System.out.println(">>>> Testing Case - " + caseDescription);
247     String actualURI = AnnotationFile.resolveAbsolutePath(suppliedPath,
248             baseURI);
249     Assert.assertEquals(actualURI, expectedURI);
250   }
251   
252   @DataProvider(name = "phyre2ModelPDBEntryDataProvider")
253   public static Object[][] phyre2ModelPDBEntryDataProvider()
254   {
255     String[] structModelHeader = new String[] { "QUERY_SEQ",
256             "TEMPLATE_SEQ", "MODEL_FILE", "MAPPING_FILE", "Confidence",
257             "% I.D", "Aligned Range", "Other Information"};
258     String baseDir = "examples/testdata/phyre2results/56da5616b4559c93/";
259     
260     return new Object[][] {
261         {
262             structModelHeader,
263             baseDir,
264             "FER_CAPAN_1-144\tc4n58A_\tc4n58A_.1.pdb\tc4n58A_.1.fasta\t1\t54\t48-143\t<b>PDB Header: </b>Hyrolase<br><b>Chain: "
265                     + "</b>A<br><b>PDB Molecule: </b>Pectocin m2<br> <b>PDB Title: </b>Crystal structure of pectocin m2 at 1.86 amgtroms" },
266         {
267             structModelHeader,
268             baseDir,
269             "FER_CAPAN_1-144\td1a70a_\td1a70a_.2.pdb\td1a70a_.2.fasta\t1\t71\t48-144\t<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br>"
270                     + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
271         {
272             structModelHeader,
273             baseDir,
274             "FER_CAPAN_1-144\td1offa_\td1offa_.3.pdb\td1offa_.3.fasta\t1\t73\t48-142\t<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br>"
275                     + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
276         {
277             structModelHeader,
278             baseDir,
279             "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>"
280                     + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
281         {
282             structModelHeader,
283             baseDir,
284             "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>"
285                     + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
286         {
287             structModelHeader,
288             baseDir,
289             "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>"
290                     + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
291         {
292             structModelHeader,
293             baseDir,
294             "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>"
295                     + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
296         {
297             structModelHeader,
298             baseDir,
299             "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>"
300                     + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
301         {
302             structModelHeader,
303             baseDir,
304             "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>"
305                     + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
306         {
307             structModelHeader,
308             baseDir,
309             "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>"
310                     + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
311         {
312             structModelHeader,
313             baseDir,
314             "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>"
315                     + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
316         {
317             structModelHeader,
318             baseDir,
319             "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>"
320                     + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
321         {
322             structModelHeader,
323             baseDir,
324             "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>"
325                     + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
326         {
327             structModelHeader,
328             baseDir,
329             "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>"
330                     + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
331         {
332             structModelHeader,
333             baseDir,
334             "FER_CAPAN_1-144\tc4itkA_\tc4itkA_.15.pdb\tc4itkA_.15.fasta\t0.999\t57\t50-142\t<b>PDB Header: </b>Electron transport<br>"
335                     + "<b>Chain: </b>A<br><b>PDB Molecule: </b>Apoferredoxin <br><b>PDB Title: </b>The structure of c.reinhardtii ferredoxin 2" },
336         {
337             structModelHeader,
338             baseDir,
339             "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: "
340                     + "</b>A<br><b>PDB Molecule: </b>Benzoate 1,2-deoxygenase reductase <br> <b>PDB Title: </b>X-ray structure of benzoate "
341                     + "deoxygenate reductase" },
342         {
343             structModelHeader,
344             baseDir,
345             "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>"
346                     + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin domains from multi domain proteins" },
347         {
348             structModelHeader,
349             baseDir,
350             "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>"
351                     + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin domains from multi domain proteins" },
352         {
353             structModelHeader,
354             baseDir,
355             "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: "
356                     + "</b>A<br><b>PDB Molecule: </b>Toluene-4-monooxygenase electron transfer component<br><b>PDB Title: </b>Structure of the "
357                     + "toluene 4-monooxygenase nah oxidoreductase t4mof,2 k270s k271s variant" },
358         {
359             structModelHeader,
360             baseDir,
361             "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: "
362                     + "</b>A<br><b>PDB Molecule: </b>Phthalate deoxygenase reductase<br><b>PDB Title: </b>Phthalate deoxygenate reductase: a"
363                     + " modular structure for2 electron transfer from pyridine nucleotides to [2fe-2s]" }
364     };
365   }
366
367   @DataProvider(name = "phyre2ModelMappingDataProvider")
368   public static Object[][] phyre2ModelMappingDataProvider()
369   {
370     return new Object[][] {
371
372         { "examples/testdata/phyre2results/56da5616b4559c93/c4n58A_.1.pdb",
373             "examples/testdata/phyre2results/56da5616b4559c93/c4n58A_.1.fasta" },
374         { "examples/testdata/phyre2results/56da5616b4559c93/d1a70a_.2.pdb",
375             "examples/testdata/phyre2results/56da5616b4559c93/d1a70a_.2.fasta" },
376         { "examples/testdata/phyre2results/56da5616b4559c93/d1offa_.3.pdb",
377             "examples/testdata/phyre2results/56da5616b4559c93/d1offa_.3.fasta" },
378         { "examples/testdata/phyre2results/56da5616b4559c93/d1frra_.4.pdb",
379             "examples/testdata/phyre2results/56da5616b4559c93/d1frra_.4.fasta" },
380         { "examples/testdata/phyre2results/56da5616b4559c93/d1pfda_.5.pdb",
381             "examples/testdata/phyre2results/56da5616b4559c93/d1pfda_.5.fasta" },
382         { "examples/testdata/phyre2results/56da5616b4559c93/d1frda_.6.pdb",
383             "examples/testdata/phyre2results/56da5616b4559c93/d1frda_.6.fasta" },
384
385         { "examples/testdata/phyre2results/56da5616b4559c93/d1fxia_.7.pdb",
386             "examples/testdata/phyre2results/56da5616b4559c93/d1fxia_.7.fasta" },
387
388         { "examples/testdata/phyre2results/56da5616b4559c93/d1gaqb_.8.pdb",
389             "examples/testdata/phyre2results/56da5616b4559c93/d1gaqb_.8.fasta" },
390         { "examples/testdata/phyre2results/56da5616b4559c93/d1iuea_.9.pdb",
391             "examples/testdata/phyre2results/56da5616b4559c93/d1iuea_.9.fasta" },
392         {
393             "examples/testdata/phyre2results/56da5616b4559c93/d1awda_.10.pdb",
394             "examples/testdata/phyre2results/56da5616b4559c93/d1awda_.10.fasta" },
395         {
396             "examples/testdata/phyre2results/56da5616b4559c93/d1wria_.11.pdb",
397             "examples/testdata/phyre2results/56da5616b4559c93/d1wria_.11.fasta" },
398         {
399             "examples/testdata/phyre2results/56da5616b4559c93/d1czpa_.12.pdb",
400             "examples/testdata/phyre2results/56da5616b4559c93/d1czpa_.12.fasta" },
401         {
402             "examples/testdata/phyre2results/56da5616b4559c93/d2cjoa_.13.pdb",
403             "examples/testdata/phyre2results/56da5616b4559c93/d2cjoa_.13.fasta" },
404         {
405             "examples/testdata/phyre2results/56da5616b4559c93/d4fxca_.14.pdb",
406             "examples/testdata/phyre2results/56da5616b4559c93/d4fxca_.14.fasta" },
407         {
408             "examples/testdata/phyre2results/56da5616b4559c93/c4itkA_.15.pdb",
409             "examples/testdata/phyre2results/56da5616b4559c93/c4itkA_.15.fasta" },
410         {
411             "examples/testdata/phyre2results/56da5616b4559c93/c1krhA_.16.pdb",
412             "examples/testdata/phyre2results/56da5616b4559c93/c1krhA_.16.fasta" },
413         {
414             "examples/testdata/phyre2results/56da5616b4559c93/d1krha3.17.pdb",
415             "examples/testdata/phyre2results/56da5616b4559c93/d1krha3.17.fasta" },
416         {
417             "examples/testdata/phyre2results/56da5616b4559c93/d1jq4a_.18.pdb",
418             "examples/testdata/phyre2results/56da5616b4559c93/d1jq4a_.18.fasta" },
419         {
420             "examples/testdata/phyre2results/56da5616b4559c93/c4wqmA_.19.pdb",
421             "examples/testdata/phyre2results/56da5616b4559c93/c4wqmA_.19.fasta" },
422         {
423             "examples/testdata/phyre2results/56da5616b4559c93/c2piaA_.20.pdb",
424             "examples/testdata/phyre2results/56da5616b4559c93/c2piaA_.20.fasta" }
425
426     };
427   }
428
429   @DataProvider(name = "phyre2InfoHTMLTableDataProvider")
430   public static Object[][] phyre2InfoHTMLTableDataProvider()
431   {
432     return new Object[][] {
433         {
434             "STRUCTMODEL Annotation with no headear information provided",
435             null,
436             new String[] { "FER_CAPAN_1-144", "d1a70a_ d1a70a_.2.pdb",
437                 "d1a70a_.2.fasta", }, "" },
438         {
439             "STRUCTMODEL Annotation with complete compulsary data and headear information provided",
440             new String[] { "HEADER_STRUCT_MODEL", "QUERY_SEQ",
441                 "TEMPLATE_SEQ", "MODEL_FILE", "MAPPING_FILE" },
442             new String[] { "FER_CAPAN_1-144", "d1a70a_ d1a70a_.2.pdb",
443                 "d1a70a_.2.fasta", },
444             "<html><table border=\"1\" width=100%><tr><td colspan=\"2\"><strong>Phyre2 Template Info</strong></td></tr></table></html>" },
445         {
446             "STRUCTMODEL Annotation with complete compulsary data and headear information provided",
447             new String[] { "HEADER_STRUCT_MODEL", "QUERY_SEQ",
448                 "TEMPLATE_SEQ", "MODEL_FILE", "MAPPING_FILE", "Confidence",
449                 "% I.D", "Aligned Range", "Other Information", "Coverage" },
450             new String[] {
451                 "FER_CAPAN_1-144",
452                 "d1a70a_ d1a70a_.2.pdb",
453                 "d1a70a_.2.fasta",
454                 "1",
455                 "71",
456                 "48-144",
457                 "<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
458             "<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>" } };
459   }
460
461   @DataProvider(name = "StructModelHtmlDataProvider")
462   public static Object[][] IsGenerateStructInfoHtmlDataProvider()
463   {
464     return new Object[][] {
465         { "STRUCTMODEL Annotation with no headear or data provided", null,
466             null, false },
467         {
468             "STRUCTMODEL Annotation with headear information and no data column provided",
469             new String[] { "HEADER_STRUCT_MODEL", "QUERY_SEQ" }, null,
470             false },
471         {
472             "STRUCTMODEL Annotation with no headear information provided",
473             null,
474             new String[] { "FER_CAPAN_1-144", "d1a70a_ d1a70a_.2.pdb",
475                 "d1a70a_.2.fasta", }, false },
476         {
477             "STRUCTMODEL Annotation with only two headear information and two data column provided",
478             new String[] { "HEADER_STRUCT_MODEL", "QUERY_SEQ" },
479             new String[] { "FER_CAPAN_1-144", "d1a70a_" }, false },
480         {
481             "STRUCTMODEL Annotation with complete compulsary data and headear information provided",
482             new String[] { "HEADER_STRUCT_MODEL", "QUERY_SEQ",
483                 "TEMPLATE_SEQ", "MODEL_FILE", "MAPPING_FILE" },
484             new String[] { "FER_CAPAN_1-144", "d1a70a_", "d1a70a_.2.pdb",
485                 "d1a70a_.2.fasta", }, true },
486         {
487             "STRUCTMODEL Annotation with complete compulsary data and headear information provided",
488             new String[] { "HEADER_STRUCT_MODEL", "QUERY_SEQ",
489                 "TEMPLATE_SEQ", "MODEL_FILE", "MAPPING_FILE", "Confidence",
490                 "% I.D", "Aligned Range", "Other Information", "Coverage" },
491             new String[] {
492                 "FER_CAPAN_1-144",
493                 "d1a70a_",
494                 "d1a70a_.2.pdb",
495                 "d1a70a_.2.fasta",
496                 "1",
497                 "71",
498                 "48-144",
499                 "<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
500             true } };
501   }
502
503   @DataProvider(name = "FilePathProvider")
504   public static Object[][] filePathProvider()
505   {
506     return new Object[][] {
507         { "relative local file path resolution", "c4n58A_.1.pdb", "",
508             "c4n58A_.1.pdb" },
509         { "relative local file path resolution", "c4n58A_.1.pdb",
510             "/examples/testdata/phyre2results/",
511             "/examples/testdata/phyre2results/c4n58A_.1.pdb" },
512         {
513             "relative URL path resolution",
514             "c4n58A_.1.pdb",
515             "http://www.jalview.org/builds/develop/examples/testdata/phyre2results/",
516             "http://www.jalview.org/builds/develop/examples/testdata/phyre2results/c4n58A_.1.pdb" },
517         {
518             "Absolute local file path resolution",
519             "/examples/testdata/phyre2results_xx/c4n58A_.1.pdb",
520             "/examples/testdata/phyre2results/",
521             "/examples/testdata/phyre2results_xx/c4n58A_.1.pdb" },
522         {
523             "Absolute URL path resolution",
524             "http://www.jalview.org/builds/develop/another_directory/c4n58A_.1.pdb",
525             "http://www.jalview.org/builds/develop/examples/testdata/phyre2results/",
526             "http://www.jalview.org/builds/develop/another_directory/c4n58A_.1.pdb" } };
527   }
528 }