1 package jalview.ws.dbsources;
4 import java.io.FileInputStream;
5 import java.io.FileNotFoundException;
6 import java.io.IOException;
8 import org.json.simple.parser.ParseException;
9 import org.testng.Assert;
10 import org.testng.FileAssert;
11 import org.testng.annotations.BeforeClass;
12 import org.testng.annotations.DataProvider;
13 import org.testng.annotations.Test;
15 import jalview.datamodel.Sequence;
16 import jalview.gui.Desktop;
17 import jalview.gui.JvOptionPane;
18 import jalview.structure.StructureMapping;
19 import jalview.structure.StructureSelectionManager;
20 import jalview.ws.datamodel.alphafold.PAEContactMatrix;
22 public class EBIAlphaFoldTest
25 @BeforeClass(alwaysRun = true)
26 public void setUpJvOptionPane()
28 JvOptionPane.setInteractiveMode(false);
29 JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
32 @DataProvider(name = "getExamplePAEfiles")
33 public Object[][] getExamplePAEfiles()
35 return new String[][] { {
36 "examples/test_fab41.result/test_fab41_predicted_aligned_error_v1.json" },
37 { "examples/AlphaFold/AF-A0A1U8FD60-F1-predicted_aligned_error_v4.json" },
38 { "examples/AlphaFold/AF-Q5VSL9-F1-predicted_aligned_error_v4.json" },
39 { "examples/AlphaFold/AF-Q5VSL9-F1-predicted_aligned_error_v4_2023.json" } };
42 @Test(groups = { "Functional" }, dataProvider = "getExamplePAEfiles")
43 public void checkPAEimport(String paeFile) throws Exception
45 PAEContactMatrix cm = new PAEContactMatrix(
46 new Sequence("Dummy/1-2000", "ASDASDA"),
47 EBIAlfaFold.parseJSONtoPAEContactMatrix(
48 new FileInputStream(paeFile)));
49 Assert.assertNotEquals(cm.getMax(), 0.0f, "No data from " + paeFile);
52 @Test(groups = { "Functional" }, dataProvider = "getPDBandPAEfiles")
53 public void checkImportPAEToStructure(String pdbFile, String paeFile)
55 FileInputStream paeInput = null;
58 paeInput = new FileInputStream(paeFile);
59 } catch (FileNotFoundException e)
62 FileAssert.assertFile(new File(paeFile),
63 "Test file '" + paeFile + "' doesn't seem to exist");
65 StructureSelectionManager ssm = StructureSelectionManager
66 .getStructureSelectionManager(Desktop.instance);
68 StructureMapping[] smArray = ssm.getMapping(pdbFile);
72 boolean done = EBIAlfaFold.importPaeJSONAsContactMatrixToStructure(
73 smArray, paeInput, "label");
74 Assert.assertTrue(done,
75 "Import of '" + paeFile + "' didn't complete successfully");
76 } catch (IOException | ParseException e)
82 @DataProvider(name = "getPDBandPAEfiles")
83 public Object[][] getPDBandPAEfiles()
85 return new String[][] {
89 { "examples/test_fab41.result/sample.a2m",
90 "examples/test_fab41.result/test_fab41_predicted_aligned_error_v1.json" },
92 { "examples/AlphaFold/AF-A0A1U8FD60-F1-model_v4.pdb",
93 "examples/AlphaFold/AF-A0A1U8FD60-F1-predicted_aligned_error_v4.json" },
94 { "examples/AlphaFold/AF-Q5VSL9-F1-model_v4.pdb",
95 "examples/AlphaFold/AF-Q5VSL9-F1-predicted_aligned_error_v4.json" },
96 { "examples/AlphaFold/AF-Q5VSL9-F1-model_v4.pdb",
97 "examples/AlphaFold/AF-Q5VSL9-F1-predicted_aligned_error_v4_2023.json" },