e619b8e3768f29cba030786b4e1617ca845f1444
[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   }
33
34   @Test(groups = { "Functional" }, dataProvider = "getExamplePAEfiles")
35   public void checkPAEimport(String paeFile) throws Exception
36   {
37     PAEContactMatrix cm = new PAEContactMatrix(
38             new Sequence("Dummy/1-2000", "ASDASDA"),
39             EBIAlfaFold.parseJSONtoPAEContactMatrix(
40                     new FileInputStream(paeFile)));
41     Assert.assertNotEquals("No data from " + paeFile, cm.getMax(), 0);
42   }
43 }