e016f5450750dabd824b430746a8155bae54ab06
[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.DynamicData;
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       ColumnSelection cs = new ColumnSelection();
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 v = aff.new ViewDef(null, al.getHiddenSequences(), cs,
138               new Hashtable());
139       String anfileout = new AnnotationFile().printAnnotations(
140               al.getAlignmentAnnotation(), al.getGroups(),
141               al.getProperties(), null, al, v);
142       assertTrue(
143               "Test "
144                       + testname
145                       + "\nAlignment annotation file was not regenerated. Null string",
146               anfileout != null);
147       assertTrue(
148               "Test "
149                       + testname
150                       + "\nAlignment annotation file was not regenerated. Empty string",
151               anfileout.length() > "JALVIEW_ANNOTATION".length());
152
153       System.out.println("Output annotation file:\n" + anfileout
154               + "\n<<EOF\n");
155
156       AlignmentI al_new = readAlignmentFile(f);
157       assertTrue(
158               "Test "
159                       + testname
160                       + "\nregenerated annotation file did not annotate alignment.",
161               new AnnotationFile().readAnnotationFile(al_new, anfileout,
162                       DataSourceType.PASTE));
163
164       // test for consistency in io
165       StockholmFileTest.testAlignmentEquivalence(al, al_new, false);
166       return;
167     } catch (Exception e)
168     {
169       e.printStackTrace();
170     }
171     Assert.fail("Test "
172             + testname
173             + "\nCouldn't complete Annotation file roundtrip input/output/input test for '"
174             + annotFile + "'.");
175   }
176
177
178   @BeforeClass(alwaysRun = true)
179   void testProcessStructModel()
180   {
181     try
182     {
183
184       ssm = StructureSelectionManager.getStructureSelectionManager();
185     } catch (NullPointerException e)
186     {
187       ssm = new StructureSelectionManager();
188     }
189     File alignmentFile = new File(
190             "examples/testdata/phyre2results/56da5616b4559c93/allhits.fasta");
191     String annotationFile = "examples/testdata/phyre2results/56da5616b4559c93/allhits.ann";
192     ColumnSelection cs = new ColumnSelection();
193     al = readAlignmentFile(alignmentFile);
194     boolean annotationRead = new AnnotationFile().readAnnotationFile(al,
195             cs, annotationFile, DataSourceType.FILE);
196     Assert.assertTrue(annotationRead);
197     System.out.println("bla");
198   }
199   
200   @Test(
201     groups = { "Functional" },
202     dataProvider = "phyre2ModelPDBEntryDataProvider")
203   void testSequence_PDBEntryAssociation(String[] structModelHeader, String baseDir,
204           String structModelDataStr)
205   {
206     String structModelData[] = structModelDataStr.split("\t");
207     String templateSeq = structModelData[1];
208     String pdbId = structModelData[2];
209
210     SequenceI testSeq = al.findName(templateSeq);
211     Assert.assertNotNull(testSeq);
212     PDBEntry actualPDBEntry = testSeq.getDatasetSequence().getPDBEntry(
213             pdbId);
214     Assert.assertNotNull(actualPDBEntry);
215
216     PDBEntry expectedPDBEntry = new PDBEntry(pdbId, " ", Type.PDB, baseDir
217             + pdbId);
218     List<DynamicData> phyreDD = AnnotationFile
219             .generatePhyreDynamicDataList(structModelHeader,
220                     structModelData);
221     expectedPDBEntry.setProperty("DYNAMIC_DATA_PHYRE2", phyreDD);
222
223     Assert.assertEquals(actualPDBEntry, expectedPDBEntry);
224   }
225
226   @Test(
227     groups = { "Functional" },
228     dataProvider = "phyre2ModelMappingDataProvider")
229   void testPhyre2ModelRegistration(String phyre2ModelFile,
230           String expectedPhyre2FastaMappingFile)
231   {
232
233     String actualFastaMappingFile = ssm
234             .getPhyre2FastaFileFor(phyre2ModelFile);
235     Assert.assertNotNull(actualFastaMappingFile);
236     Assert.assertEquals(actualFastaMappingFile,
237             expectedPhyre2FastaMappingFile);
238   }
239
240   @Test(groups = { "Functional" }, dataProvider = "FilePathProvider")
241   void testResolveAbsolutePath(String caseDescription, String suppliedPath,
242           String baseURI, String expectedURI)
243   {
244     System.out.println(">>>> Testing Case - " + caseDescription);
245     String actualURI = AnnotationFile.resolveAbsolutePath(suppliedPath,
246             baseURI);
247     Assert.assertEquals(actualURI, expectedURI);
248   }
249   
250   @DataProvider(name = "phyre2ModelPDBEntryDataProvider")
251   public static Object[][] phyre2ModelPDBEntryDataProvider()
252   {
253     String[] structModelHeader = new String[] { "QUERY_SEQ",
254             "TEMPLATE_SEQ", "MODEL_FILE", "MAPPING_FILE", "Confidence",
255             "% I.D", "Aligned Range", "Other Information"};
256     String baseDir = "examples/testdata/phyre2results/56da5616b4559c93/";
257     
258     return new Object[][] {
259         {
260             structModelHeader,
261             baseDir,
262             "FER_CAPAN_1-144\tc4n58A_\tc4n58A_.1.pdb\tc4n58A_.1.fasta\t1\t54\t48-143\t<b>PDB Header: </b>Hyrolase<br><b>Chain: "
263                     + "</b>A<br><b>PDB Molecule: </b>Pectocin m2<br> <b>PDB Title: </b>Crystal structure of pectocin m2 at 1.86 amgtroms" },
264         {
265             structModelHeader,
266             baseDir,
267             "FER_CAPAN_1-144\td1a70a_\td1a70a_.2.pdb\td1a70a_.2.fasta\t1\t71\t48-144\t<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br>"
268                     + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
269         {
270             structModelHeader,
271             baseDir,
272             "FER_CAPAN_1-144\td1offa_\td1offa_.3.pdb\td1offa_.3.fasta\t1\t73\t48-142\t<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br>"
273                     + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
274         {
275             structModelHeader,
276             baseDir,
277             "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>"
278                     + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
279         {
280             structModelHeader,
281             baseDir,
282             "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>"
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\td1frda_\td1frda_.6.pdb\td1frda_.6.fasta\t0.999\t50\t48-143\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\td1fxia_\td1fxia_.7.pdb\td1fxia_.7.fasta\t0.999\t62\t48-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\td1gaqb_\td1gaqb_.8.pdb\td1gaqb_.8.fasta\t0.999\t71\t48-144\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\td1iuea_\td1iuea_.9.pdb\td1iuea_.9.fasta\t0.999\t48\t48-142\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\td1awda_\td1awda_.10.pdb\td1awda_.10.fasta\t0.999\t68\t50-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\td1wria_\td1wria_.11.pdb\td1wria_.11.fasta\t0.999\t59\t49-142\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\td1czpa_\td1czpa_.12.pdb\td1czpa_.12.fasta\t0.999\t64\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\td2cjoa_\td2cjoa_.13.pdb\td2cjoa_.13.fasta\t0.999\t63\t48-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\td4fxca_\td4fxca_.14.pdb\td4fxca_.14.fasta\t0.999\t64\t48-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\tc4itkA_\tc4itkA_.15.pdb\tc4itkA_.15.fasta\t0.999\t57\t50-142\t<b>PDB Header: </b>Electron transport<br>"
333                     + "<b>Chain: </b>A<br><b>PDB Molecule: </b>Apoferredoxin <br><b>PDB Title: </b>The structure of c.reinhardtii ferredoxin 2" },
334         {
335             structModelHeader,
336             baseDir,
337             "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: "
338                     + "</b>A<br><b>PDB Molecule: </b>Benzoate 1,2-deoxygenase reductase <br> <b>PDB Title: </b>X-ray structure of benzoate "
339                     + "deoxygenate reductase" },
340         {
341             structModelHeader,
342             baseDir,
343             "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>"
344                     + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin domains from multi domain proteins" },
345         {
346             structModelHeader,
347             baseDir,
348             "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>"
349                     + "<b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin domains from multi domain proteins" },
350         {
351             structModelHeader,
352             baseDir,
353             "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: "
354                     + "</b>A<br><b>PDB Molecule: </b>Toluene-4-monooxygenase electron transfer component<br><b>PDB Title: </b>Structure of the "
355                     + "toluene 4-monooxygenase nah oxidoreductase t4mof,2 k270s k271s variant" },
356         {
357             structModelHeader,
358             baseDir,
359             "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: "
360                     + "</b>A<br><b>PDB Molecule: </b>Phthalate deoxygenase reductase<br><b>PDB Title: </b>Phthalate deoxygenate reductase: a"
361                     + " modular structure for2 electron transfer from pyridine nucleotides to [2fe-2s]" }
362     };
363   }
364
365   @DataProvider(name = "phyre2ModelMappingDataProvider")
366   public static Object[][] phyre2ModelMappingDataProvider()
367   {
368     return new Object[][] {
369
370         { "examples/testdata/phyre2results/56da5616b4559c93/c4n58A_.1.pdb",
371             "examples/testdata/phyre2results/56da5616b4559c93/c4n58A_.1.fasta" },
372         { "examples/testdata/phyre2results/56da5616b4559c93/d1a70a_.2.pdb",
373             "examples/testdata/phyre2results/56da5616b4559c93/d1a70a_.2.fasta" },
374         { "examples/testdata/phyre2results/56da5616b4559c93/d1offa_.3.pdb",
375             "examples/testdata/phyre2results/56da5616b4559c93/d1offa_.3.fasta" },
376         { "examples/testdata/phyre2results/56da5616b4559c93/d1frra_.4.pdb",
377             "examples/testdata/phyre2results/56da5616b4559c93/d1frra_.4.fasta" },
378         { "examples/testdata/phyre2results/56da5616b4559c93/d1pfda_.5.pdb",
379             "examples/testdata/phyre2results/56da5616b4559c93/d1pfda_.5.fasta" },
380         { "examples/testdata/phyre2results/56da5616b4559c93/d1frda_.6.pdb",
381             "examples/testdata/phyre2results/56da5616b4559c93/d1frda_.6.fasta" },
382
383         { "examples/testdata/phyre2results/56da5616b4559c93/d1fxia_.7.pdb",
384             "examples/testdata/phyre2results/56da5616b4559c93/d1fxia_.7.fasta" },
385
386         { "examples/testdata/phyre2results/56da5616b4559c93/d1gaqb_.8.pdb",
387             "examples/testdata/phyre2results/56da5616b4559c93/d1gaqb_.8.fasta" },
388         { "examples/testdata/phyre2results/56da5616b4559c93/d1iuea_.9.pdb",
389             "examples/testdata/phyre2results/56da5616b4559c93/d1iuea_.9.fasta" },
390         {
391             "examples/testdata/phyre2results/56da5616b4559c93/d1awda_.10.pdb",
392             "examples/testdata/phyre2results/56da5616b4559c93/d1awda_.10.fasta" },
393         {
394             "examples/testdata/phyre2results/56da5616b4559c93/d1wria_.11.pdb",
395             "examples/testdata/phyre2results/56da5616b4559c93/d1wria_.11.fasta" },
396         {
397             "examples/testdata/phyre2results/56da5616b4559c93/d1czpa_.12.pdb",
398             "examples/testdata/phyre2results/56da5616b4559c93/d1czpa_.12.fasta" },
399         {
400             "examples/testdata/phyre2results/56da5616b4559c93/d2cjoa_.13.pdb",
401             "examples/testdata/phyre2results/56da5616b4559c93/d2cjoa_.13.fasta" },
402         {
403             "examples/testdata/phyre2results/56da5616b4559c93/d4fxca_.14.pdb",
404             "examples/testdata/phyre2results/56da5616b4559c93/d4fxca_.14.fasta" },
405         {
406             "examples/testdata/phyre2results/56da5616b4559c93/c4itkA_.15.pdb",
407             "examples/testdata/phyre2results/56da5616b4559c93/c4itkA_.15.fasta" },
408         {
409             "examples/testdata/phyre2results/56da5616b4559c93/c1krhA_.16.pdb",
410             "examples/testdata/phyre2results/56da5616b4559c93/c1krhA_.16.fasta" },
411         {
412             "examples/testdata/phyre2results/56da5616b4559c93/d1krha3.17.pdb",
413             "examples/testdata/phyre2results/56da5616b4559c93/d1krha3.17.fasta" },
414         {
415             "examples/testdata/phyre2results/56da5616b4559c93/d1jq4a_.18.pdb",
416             "examples/testdata/phyre2results/56da5616b4559c93/d1jq4a_.18.fasta" },
417         {
418             "examples/testdata/phyre2results/56da5616b4559c93/c4wqmA_.19.pdb",
419             "examples/testdata/phyre2results/56da5616b4559c93/c4wqmA_.19.fasta" },
420         {
421             "examples/testdata/phyre2results/56da5616b4559c93/c2piaA_.20.pdb",
422             "examples/testdata/phyre2results/56da5616b4559c93/c2piaA_.20.fasta" }
423
424     };
425   }
426
427   @DataProvider(name = "phyre2InfoHTMLTableDataProvider")
428   public static Object[][] phyre2InfoHTMLTableDataProvider()
429   {
430     return new Object[][] {
431         {
432             "STRUCTMODEL Annotation with no headear information provided",
433             null,
434             new String[] { "FER_CAPAN_1-144", "d1a70a_ d1a70a_.2.pdb",
435                 "d1a70a_.2.fasta", }, "" },
436         {
437             "STRUCTMODEL Annotation with complete compulsary data and headear information provided",
438             new String[] { "HEADER_STRUCT_MODEL", "QUERY_SEQ",
439                 "TEMPLATE_SEQ", "MODEL_FILE", "MAPPING_FILE" },
440             new String[] { "FER_CAPAN_1-144", "d1a70a_ d1a70a_.2.pdb",
441                 "d1a70a_.2.fasta", },
442             "<html><table border=\"1\" width=100%><tr><td colspan=\"2\"><strong>Phyre2 Template Info</strong></td></tr></table></html>" },
443         {
444             "STRUCTMODEL Annotation with complete compulsary data and headear information provided",
445             new String[] { "HEADER_STRUCT_MODEL", "QUERY_SEQ",
446                 "TEMPLATE_SEQ", "MODEL_FILE", "MAPPING_FILE", "Confidence",
447                 "% I.D", "Aligned Range", "Other Information", "Coverage" },
448             new String[] {
449                 "FER_CAPAN_1-144",
450                 "d1a70a_ d1a70a_.2.pdb",
451                 "d1a70a_.2.fasta",
452                 "1",
453                 "71",
454                 "48-144",
455                 "<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
456             "<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>" } };
457   }
458
459   @DataProvider(name = "StructModelHtmlDataProvider")
460   public static Object[][] IsGenerateStructInfoHtmlDataProvider()
461   {
462     return new Object[][] {
463         { "STRUCTMODEL Annotation with no headear or data provided", null,
464             null, false },
465         {
466             "STRUCTMODEL Annotation with headear information and no data column provided",
467             new String[] { "HEADER_STRUCT_MODEL", "QUERY_SEQ" }, null,
468             false },
469         {
470             "STRUCTMODEL Annotation with no headear information provided",
471             null,
472             new String[] { "FER_CAPAN_1-144", "d1a70a_ d1a70a_.2.pdb",
473                 "d1a70a_.2.fasta", }, false },
474         {
475             "STRUCTMODEL Annotation with only two headear information and two data column provided",
476             new String[] { "HEADER_STRUCT_MODEL", "QUERY_SEQ" },
477             new String[] { "FER_CAPAN_1-144", "d1a70a_" }, false },
478         {
479             "STRUCTMODEL Annotation with complete compulsary data and headear information provided",
480             new String[] { "HEADER_STRUCT_MODEL", "QUERY_SEQ",
481                 "TEMPLATE_SEQ", "MODEL_FILE", "MAPPING_FILE" },
482             new String[] { "FER_CAPAN_1-144", "d1a70a_", "d1a70a_.2.pdb",
483                 "d1a70a_.2.fasta", }, true },
484         {
485             "STRUCTMODEL Annotation with complete compulsary data and headear information provided",
486             new String[] { "HEADER_STRUCT_MODEL", "QUERY_SEQ",
487                 "TEMPLATE_SEQ", "MODEL_FILE", "MAPPING_FILE", "Confidence",
488                 "% I.D", "Aligned Range", "Other Information", "Coverage" },
489             new String[] {
490                 "FER_CAPAN_1-144",
491                 "d1a70a_",
492                 "d1a70a_.2.pdb",
493                 "d1a70a_.2.fasta",
494                 "1",
495                 "71",
496                 "48-144",
497                 "<b>Fold: </b>Beta-Grasp (ubiquitin-like)<br><b>Superfamily: </b>2Fe-2S ferredoxin-like<br><b>Family: </b>2Fe-2S ferredoxin-related" },
498             true } };
499   }
500
501   @DataProvider(name = "FilePathProvider")
502   public static Object[][] filePathProvider()
503   {
504     return new Object[][] {
505         { "relative local file path resolution", "c4n58A_.1.pdb", "",
506             "c4n58A_.1.pdb" },
507         { "relative local file path resolution", "c4n58A_.1.pdb",
508             "/examples/testdata/phyre2results/",
509             "/examples/testdata/phyre2results/c4n58A_.1.pdb" },
510         {
511             "relative URL path resolution",
512             "c4n58A_.1.pdb",
513             "http://www.jalview.org/builds/develop/examples/testdata/phyre2results/",
514             "http://www.jalview.org/builds/develop/examples/testdata/phyre2results/c4n58A_.1.pdb" },
515         {
516             "Absolute local file path resolution",
517             "/examples/testdata/phyre2results_xx/c4n58A_.1.pdb",
518             "/examples/testdata/phyre2results/",
519             "/examples/testdata/phyre2results_xx/c4n58A_.1.pdb" },
520         {
521             "Absolute URL path resolution",
522             "http://www.jalview.org/builds/develop/another_directory/c4n58A_.1.pdb",
523             "http://www.jalview.org/builds/develop/examples/testdata/phyre2results/",
524             "http://www.jalview.org/builds/develop/another_directory/c4n58A_.1.pdb" } };
525   }
526 }