JAL-629 JAL-4124 JAL-3855 test to check we can import PAE matrices in a variety of...
[jalview.git] / test / jalview / ws / dbsources / EBIAlphaFoldTest.java
1 package jalview.ws.dbsources;
2
3 import java.io.FileInputStream;
4
5 import org.junit.Assert;
6 import org.testng.annotations.BeforeClass;
7 import org.testng.annotations.DataProvider;
8 import org.testng.annotations.Test;
9
10 import jalview.datamodel.Sequence;
11 import jalview.gui.JvOptionPane;
12 import jalview.ws.datamodel.alphafold.PAEContactMatrix;
13
14 public class EBIAlphaFoldTest
15 {
16
17   @BeforeClass(alwaysRun = true)
18   public void setUpJvOptionPane()
19   {
20     JvOptionPane.setInteractiveMode(false);
21     JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
22   }
23
24   @DataProvider(name = "getExamplePAEfiles")
25   public Object[][] getExamplePAEfiles()
26   {
27     return new String[][] { {
28         "examples/test_fab41.result/test_fab41_predicted_aligned_error_v1.json" },
29         { "examples/AlphaFold/AF-A0A1U8FD60-F1-predicted_aligned_error_v4.json" },
30         { "examples/AlphaFold/AF-Q5VSL9-F1-predicted_aligned_error_v4.json" },
31         { "examples/AlphaFold/AF-Q5VSL9-F1-predicted_aligned_error_v4_2023.json" } ,
32         { "examples/AlphaFold/AF-Q5VSL9-F1-predicted_aligned_error_v4B.json" } };
33   }
34
35   @Test(groups = { "Functional" }, dataProvider = "getExamplePAEfiles")
36   public void checkPAEimport(String paeFile) throws Exception
37   {
38     PAEContactMatrix cm = new PAEContactMatrix(
39             new Sequence("Dummy/1-2000", "ASDASDA"),
40             EBIAlfaFold.parseJSONtoPAEContactMatrix(
41                     new FileInputStream(paeFile)));
42     Assert.assertNotEquals("No data from " + paeFile, cm.getMax(), 0);
43   }
44 }