JAL-1705 transfer features to the dataset sequence if there is one
[jalview.git] / src / jalview / analysis / AlignmentUtils.java
index d8cb9a2..194e6af 100644 (file)
@@ -1424,6 +1424,12 @@ public class AlignmentUtils
   protected static void transferFeatures(SequenceI fromSeq,
           SequenceI toSeq, MapList mapping, String... omitting)
   {
+    SequenceI copyTo = toSeq;
+    while (copyTo.getDatasetSequence() != null)
+    {
+      copyTo = copyTo.getDatasetSequence();
+    }
+
     SequenceFeature[] sfs = fromSeq.getSequenceFeatures();
     if (sfs != null)
     {
@@ -1453,7 +1459,7 @@ public class AlignmentUtils
           SequenceFeature copy = new SequenceFeature(sf);
           copy.setBegin(Math.min(mappedTo[0], mappedTo[1]));
           copy.setEnd(Math.max(mappedTo[0], mappedTo[1]));
-          toSeq.addSequenceFeature(copy);
+          copyTo.addSequenceFeature(copy);
         }
       }
     }