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
diff --git a/test/jalview/ws/dbsources/EBIAlphaFoldTest.java b/test/jalview/ws/dbsources/EBIAlphaFoldTest.java
new file mode 100644 (file)
index 0000000..20435f4
--- /dev/null
@@ -0,0 +1,44 @@
+package jalview.ws.dbsources;
+
+import java.io.FileInputStream;
+
+import org.junit.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import jalview.datamodel.Sequence;
+import jalview.gui.JvOptionPane;
+import jalview.ws.datamodel.alphafold.PAEContactMatrix;
+
+public class EBIAlphaFoldTest
+{
+
+  @BeforeClass(alwaysRun = true)
+  public void setUpJvOptionPane()
+  {
+    JvOptionPane.setInteractiveMode(false);
+    JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+  }
+
+  @DataProvider(name = "getExamplePAEfiles")
+  public Object[][] getExamplePAEfiles()
+  {
+    return new String[][] { {
+        "examples/test_fab41.result/test_fab41_predicted_aligned_error_v1.json" },
+        { "examples/AlphaFold/AF-A0A1U8FD60-F1-predicted_aligned_error_v4.json" },
+        { "examples/AlphaFold/AF-Q5VSL9-F1-predicted_aligned_error_v4.json" },
+        { "examples/AlphaFold/AF-Q5VSL9-F1-predicted_aligned_error_v4_2023.json" } ,
+        { "examples/AlphaFold/AF-Q5VSL9-F1-predicted_aligned_error_v4B.json" } };
+  }
+
+  @Test(groups = { "Functional" }, dataProvider = "getExamplePAEfiles")
+  public void checkPAEimport(String paeFile) throws Exception
+  {
+    PAEContactMatrix cm = new PAEContactMatrix(
+            new Sequence("Dummy/1-2000", "ASDASDA"),
+            EBIAlfaFold.parseJSONtoPAEContactMatrix(
+                    new FileInputStream(paeFile)));
+    Assert.assertNotEquals("No data from " + paeFile, cm.getMax(), 0);
+  }
+}