Merge branch 'develop' into features/JAL-4134_use_annotation_row_for_colours_and_groups
[jalview.git] / src / jalview / ws / dbsources / EBIAlfaFold.java
index 19eaf78..fd10c79 100644 (file)
@@ -44,6 +44,7 @@ import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.ContactMatrixI;
 import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.GroupSet;
 import jalview.datamodel.PDBEntry;
 import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceI;
@@ -314,6 +315,8 @@ public class EBIAlfaFold extends EbiFileRetrievedProxy
 
     if (isStruct)
     {
+      // ###### WRITE A TEST for this bit of the logic addAlphaFoldPAE with
+      // different params.
       StructureSelectionManager ssm = StructureSelectionManager
               .getStructureSelectionManager(Desktop.instance);
       if (ssm != null)
@@ -445,6 +448,7 @@ public class EBIAlfaFold extends EbiFileRetrievedProxy
     }
     ContactMatrixI matrix = new PAEContactMatrix(sequence,
             (Map<String, Object>) paeDict);
+    matrix.setGroupSet(GroupSet.makeGroups(matrix, 5f, true));
 
     AlignmentAnnotation cmannot = sequence.addContactList(matrix);
     if (label != null)
@@ -473,6 +477,7 @@ public class EBIAlfaFold extends EbiFileRetrievedProxy
     return paeDict;
   }
 
+  // ###### TEST THIS
   public static boolean importPaeJSONAsContactMatrixToStructure(
           StructureMapping[] smArray, InputStream paeInput, String label)
           throws IOException, ParseException
@@ -499,17 +504,13 @@ public class EBIAlfaFold extends EbiFileRetrievedProxy
     }
 
     SequenceI seq = sm.getSequence();
-    Console.debug("##### SEQUENCE FOUND=" + seq.getName());
-    Map<String, Object> paeObject = (Map<String, Object>) pae_obj;
-
-    ContactMatrixI matrix = new PAEContactMatrix(seq, paeObject);
-    AlignmentAnnotation cmannot = seq.addContactList(matrix);
-    if (label != null)
-    {
-      cmannot.label = label;
-    }
-    // seq.addAlignmentAnnotation(cmannot);
-
+    ContactMatrixI matrix = new PAEContactMatrix(seq,
+            (Map<String, Object>) pae_obj);
+    matrix.setGroupSet(GroupSet.makeGroups(matrix, 5f, true));
+    AlignmentAnnotation cmannot = sm.getSequence().addContactList(matrix);
+    /* this already happens in Sequence.addContactList()
+     seq.addAlignmentAnnotation(cmannot);
+     */
     return true;
   }