JAL-4134 override default hasTree so PAE tree is saved!
authorJames Procter <j.procter@dundee.ac.uk>
Mon, 20 Mar 2023 17:43:46 +0000 (17:43 +0000)
committerJames Procter <j.procter@dundee.ac.uk>
Mon, 20 Mar 2023 17:43:46 +0000 (17:43 +0000)
src/jalview/project/Jalview2XML.java
src/jalview/ws/datamodel/alphafold/PAEContactMatrix.java
test/jalview/project/Jalview2xmlTests.java

index efcc7ff..ddf2afd 100644 (file)
@@ -3995,7 +3995,7 @@ public class Jalview2XML
                     Console.log.info(
                             "Ignoring additional clusterings for contact matrix");
                   }
-
+                  
                   String treeMethod = xmlmat.getTreeMethod();
                   double thresh = xmlmat.getCutHeight()!=null ? xmlmat.getCutHeight() : 0;
                   newpae.restoreGroups(newgroups, treeMethod, nwk, thresh);
index a5ce9a0..5fe27cc 100644 (file)
@@ -267,6 +267,11 @@ public class PAEContactMatrix implements ContactMatrixI
   {
     return newick;
   }
+  @Override
+  public boolean hasTree()
+  {
+    return newick!=null && newick.length()>0;
+  }
   boolean abs;
   double thresh;
   String treeType=null;
index fa6c25c..81756e0 100644 (file)
@@ -1599,10 +1599,10 @@ public class Jalview2xmlTests extends Jalview2xmlBase
         Assert.assertEquals(oldCM.getContactAt(j), newCM.getContactAt(j));
       }
     }
-    Assert.assertEquals(dummyMat.hasGroups(), restoredMat.hasGroups());
-    Assert.assertEquals(dummyMat.getGroups(), restoredMat.getGroups());
-    Assert.assertEquals(dummyMat.hasTree(), restoredMat.hasTree());
-    Assert.assertEquals(dummyMat.getNewick(), restoredMat.getNewick());
+    Assert.assertEquals(restoredMat.hasGroups(), dummyMat.hasGroups());
+    Assert.assertEquals(restoredMat.getGroups(), dummyMat.getGroups());
+    Assert.assertEquals(restoredMat.hasTree(), dummyMat.hasTree());
+    Assert.assertEquals( restoredMat.getNewick(),dummyMat.getNewick());
     
     
   }