Merge branch 'develop' into features/r2_11_2_alphafold/JAL-629
authorBen Soares <b.soares@dundee.ac.uk>
Thu, 1 Jun 2023 16:01:58 +0000 (17:01 +0100)
committerBen Soares <b.soares@dundee.ac.uk>
Thu, 1 Jun 2023 16:01:58 +0000 (17:01 +0100)
src/jalview/bin/Commands.java
test/jalview/ws/dbsources/EBIAlphaFoldTest.java

index 753ded2..30fdc30 100644 (file)
@@ -452,14 +452,6 @@ public class Commands
           Console.debug("Using structure file "
                   + structureFile.getAbsolutePath());
 
-          // ##### Does this need to happen? Follow
-          // openStructureFileForSequence() below
-          /*
-          PDBEntry fileEntry = new AssociatePdbFileWithSeq()
-                  .associatePdbWithSeq(structureFile.getAbsolutePath(),
-                          DataSourceType.FILE, seq, true, Desktop.instance);
-                          */
-
           // open structure view
           AlignmentPanel ap = af.alignPanel;
           if (headless)
@@ -505,15 +497,6 @@ public class Commands
                   Arg.NOTEMPFAC, subVals, null, "ADD_TEMPFACT_ANN", false,
                   true);
           TFType tft = notempfac ? null : TFType.DEFAULT;
-          /*
-          String tftString = subVals.get("tempfac");
-          ArgValue tftAv = getArgAssociatedWithStructure(Arg.TEMPFAC, avm,
-                  af, structureFilepath);
-          if (tftString == null && tftAv != null)
-          {
-            tftString = tftAv.getSubVals().getContent();
-          }
-          */
           if (tftString != null && !notempfac)
           {
             // get kind of temperature factor annotation
index 076ee7e..74a149b 100644 (file)
@@ -6,13 +6,17 @@ import java.io.FileNotFoundException;
 import java.io.IOException;
 
 import org.json.simple.parser.ParseException;
-import org.junit.Assert;
+import org.testng.Assert;
 import org.testng.FileAssert;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
 import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
 import jalview.gui.Desktop;
 import jalview.gui.JvOptionPane;
 import jalview.structure.StructureMapping;
@@ -46,7 +50,7 @@ public class EBIAlphaFoldTest
             new Sequence("Dummy/1-2000", "ASDASDA"),
             EBIAlfaFold.parseJSONtoPAEContactMatrix(
                     new FileInputStream(paeFile)));
-    Assert.assertNotEquals("No data from " + paeFile, cm.getMax(), 0);
+    Assert.assertNotEquals(cm.getMax(), 0.0f, "No data from " + paeFile);
   }
 
   @Test(groups = { "Functional" }, dataProvider = "getPDBandPAEfiles")
@@ -62,8 +66,15 @@ public class EBIAlphaFoldTest
       FileAssert.assertFile(new File(paeFile),
               "Test file '" + paeFile + "' doesn't seem to exist");
     }
+    SequenceI seq = new Sequence("Dummy/1-2000",
+            "ASDASDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
+    AlignmentI al = new Alignment(new SequenceI[] { seq });
+    AlignFrame af = new AlignFrame(al, seq.getLength(), 1);
     StructureSelectionManager ssm = StructureSelectionManager
             .getStructureSelectionManager(Desktop.instance);
+    StructureMapping sm = new StructureMapping(seq, pdbFile, null, null,
+            null, null);
+    ssm.addStructureMapping(sm);
 
     StructureMapping[] smArray = ssm.getMapping(pdbFile);
 
@@ -71,13 +82,32 @@ public class EBIAlphaFoldTest
     {
       boolean done = EBIAlfaFold.importPaeJSONAsContactMatrixToStructure(
               smArray, paeInput, "label");
-      Assert.assertTrue(
-              "Import of '" + paeFile + "' didn't complete successfully",
-              done);
+      Assert.assertTrue(done,
+              "Import of '" + paeFile + "' didn't complete successfully");
     } catch (IOException | ParseException e)
     {
       e.printStackTrace();
     }
+  }
 
+  @DataProvider(name = "getPDBandPAEfiles")
+  public Object[][] getPDBandPAEfiles()
+  {
+    return new String[][] {
+        //
+        /*
+         */
+        { "examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb",
+            "examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3_scores.json" },
+        /*
+        { "examples/AlphaFold/AF-A0A1U8FD60-F1-model_v4.pdb",
+            "examples/AlphaFold/AF-A0A1U8FD60-F1-predicted_aligned_error_v4.json" },
+        { "examples/AlphaFold/AF-Q5VSL9-F1-model_v4.pdb",
+            "examples/AlphaFold/AF-Q5VSL9-F1-predicted_aligned_error_v4.json" },
+        { "examples/AlphaFold/AF-Q5VSL9-F1-model_v4.pdb",
+            "examples/AlphaFold/AF-Q5VSL9-F1-predicted_aligned_error_v4_2023.json" },
+         */
+    };
   }
+
 }