Merge branch 'features/JAL-4134_treeviewerforcolumns' into develop
[jalview.git] / src / jalview / datamodel / ContactMapHolder.java
index ac1b267..296feaf 100644 (file)
@@ -28,19 +28,24 @@ public class ContactMapHolder implements ContactMapHolderI
     {
       return null;
     }
+    // TODO: could resolve sequence position to column position here
+    // TODO: what about for complexes - where contactMatrix may involve two or
+    // more sequences
     return cm.getContactList(column);
   }
 
   @Override
   public AlignmentAnnotation addContactList(ContactMatrixI cm)
   {
-    AlignmentAnnotation aa = new AlignmentAnnotation("Contact Matrix",
-            "Contact Matrix", new Annotation[0]);
-    aa.graph = AlignmentAnnotation.CUSTOMRENDERER;
+
+    AlignmentAnnotation aa = new AlignmentAnnotation(cm.getAnnotLabel(),
+            cm.getAnnotDescr(), new Annotation[0]);
+    aa.graph = AlignmentAnnotation.CONTACT_MAP;
     aa.graphMin = cm.getMin();
     aa.graphMax = cm.getMax();
     aa.editable = false;
-    // aa.autoCalculated = true;
+    aa.calcId = cm.getType();
+
     contactmaps.put(aa.annotationId, cm);
     // TODO: contact matrices could be intra or inter - more than one refseq
     // possible!
@@ -61,6 +66,21 @@ public class ContactMapHolder implements ContactMapHolderI
   public void addContactListFor(AlignmentAnnotation annotation,
           ContactMatrixI cm)
   {
+    // update annotation with data from contact map
+    annotation.graphMin = cm.getMin();
+    annotation.graphMax = cm.getMax();
+    annotation.editable = false;
+    annotation.graph = AlignmentAnnotation.CONTACT_MAP;
+    annotation.calcId = cm.getType();
+    if (annotation.label == null || "".equals(annotation.label))
+    {
+      annotation.label = cm.getAnnotLabel();
+
+    }
+    if (annotation.description == null || "".equals(annotation.description))
+    {
+      annotation.description = cm.getAnnotDescr();
+    }
     contactmaps.put(annotation.annotationId, cm);
   }
 }