JAL-2480 include sequenceFeatureStore in createDatasetSequence
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 9 May 2017 08:52:14 +0000 (09:52 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 9 May 2017 08:52:14 +0000 (09:52 +0100)
src/jalview/datamodel/Sequence.java
test/jalview/datamodel/SequenceTest.java

index ae7df53..af6592b 100755 (executable)
@@ -1185,6 +1185,8 @@ public class Sequence extends ASequence implements SequenceI
       // move features and database references onto dataset sequence
       dsseq.sequenceFeatures = sequenceFeatures;
       sequenceFeatures = null;
+      dsseq.sequenceFeatureStore = sequenceFeatureStore;
+      sequenceFeatureStore = null;
       dsseq.dbrefs = dbrefs;
       dbrefs = null;
       // TODO: search and replace any references to this sequence with
index 4a208ae..586cc5d 100644 (file)
@@ -38,6 +38,8 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.Vector;
 
+import junit.extensions.PA;
+
 import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.BeforeMethod;
@@ -435,11 +437,26 @@ public class SequenceTest
   public void testCreateDatasetSequence()
   {
     SequenceI sq = new Sequence("my", "ASDASD");
+    sq.addSequenceFeature(new SequenceFeature("type", "desc", 1, 10, 1f,
+            "group"));
+    sq.addDBRef(new DBRefEntry("source", "version", "accession"));
     assertNull(sq.getDatasetSequence());
+    assertNotNull(PA.getValue(sq, "sequenceFeatures")); // to be removed!
+    assertNotNull(PA.getValue(sq, "sequenceFeatureStore"));
+    assertNotNull(PA.getValue(sq, "dbrefs"));
+
     SequenceI rds = sq.createDatasetSequence();
     assertNotNull(rds);
     assertNull(rds.getDatasetSequence());
-    assertEquals(sq.getDatasetSequence(), rds);
+    assertSame(sq.getDatasetSequence(), rds);
+
+    // sequence features and dbrefs transferred to dataset sequence
+    assertNull(PA.getValue(sq, "sequenceFeatures"));
+    assertNull(PA.getValue(sq, "sequenceFeatureStore"));
+    assertNull(PA.getValue(sq, "dbrefs"));
+    assertNotNull(PA.getValue(rds, "sequenceFeatures"));
+    assertNotNull(PA.getValue(rds, "sequenceFeatureStore"));
+    assertNotNull(PA.getValue(rds, "dbrefs"));
   }
 
   /**