JAL-2110 copy alcodonframes only if copy constructor called on dataset alignmentI...
authorJim Procter <jprocter@issues.jalview.org>
Mon, 20 Jun 2016 07:58:10 +0000 (08:58 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Mon, 20 Jun 2016 07:58:10 +0000 (08:58 +0100)
src/jalview/datamodel/Alignment.java
test/jalview/datamodel/AlignmentTest.java

index 34f8f6e..c9ec77b 100755 (executable)
@@ -110,7 +110,10 @@ public class Alignment implements AlignmentI
     /*
      * Share the same dataset sequence mappings (if any). 
      */
-    this.setCodonFrames(al.getCodonFrames());
+    if (dataset == null && al.getDataset() == null)
+    {
+      this.setCodonFrames(al.getCodonFrames());
+    }
   }
 
   /**
@@ -1427,6 +1430,7 @@ public class Alignment implements AlignmentI
       addAnnotation(alan[a]);
     }
 
+    // use add method
     getCodonFrames().addAll(toappend.getCodonFrames());
 
     List<SequenceGroup> sg = toappend.getGroups();
index 5753e97..08a9441 100644 (file)
@@ -398,6 +398,8 @@ public class AlignmentTest
     // TODO should the copy constructor copy the dataset?
     // or make a new one referring to the same dataset sequences??
     assertNull(copy.getDataset());
+    // TODO test metadata is copied when AlignmentI is a dataset
+
     // assertArrayEquals(copy.getDataset().getSequencesArray(), protein
     // .getDataset().getSequencesArray());
   }