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