JAL-2349 JAL-3855 Integrate pAE retrieval in StructureFile so it can be transferred...
[jalview.git] / src / jalview / datamodel / Sequence.java
index d62be17..5ae7195 100755 (executable)
@@ -1625,6 +1625,13 @@ public class Sequence extends ASequence implements SequenceI
           _aa.adjustForAlignment(); // uses annotation's own record of
                                     // sequence-column mapping
           datasetSequence.addAlignmentAnnotation(_aa);
+
+          // transfer contact matrices
+          ContactMatrixI cm = getContactMatrixFor(aa);
+          if (cm != null)
+          {
+            datasetSequence.addContactListFor(_aa, cm);
+          }
         }
       }
     }
@@ -2111,7 +2118,7 @@ public class Sequence extends ASequence implements SequenceI
   ////
   //// Contact Matrix Holder Boilerplate
   ////
-  ContactMapHolder cmholder = new ContactMapHolder();
+  ContactMapHolderI cmholder = new ContactMapHolder();
 
   @Override
   public Collection<ContactMatrixI> getContactMaps()
@@ -2120,6 +2127,12 @@ public class Sequence extends ASequence implements SequenceI
   }
 
   @Override
+  public ContactMatrixI getContactMatrixFor(AlignmentAnnotation ann)
+  {
+    return cmholder.getContactMatrixFor(ann);
+  }
+
+  @Override
   public ContactListI getContactListFor(AlignmentAnnotation _aa, int column)
   {
     return cmholder.getContactListFor(_aa, column);
@@ -2137,8 +2150,16 @@ public class Sequence extends ASequence implements SequenceI
       ;
     }
     aa.annotations = _aa;
+    aa.setSequenceRef(this);
+    aa.createSequenceMapping(this, getStart(), false);
     addAlignmentAnnotation(aa);
     return aa;
   }
 
+  @Override
+  public void addContactListFor(AlignmentAnnotation annotation,
+          ContactMatrixI cm)
+  {
+    cmholder.addContactListFor(annotation, cm);
+  }
 }