JAL-2023 CDS sequences added to / share alignment dataset
[jalview.git] / src / jalview / gui / AlignFrame.java
index 8d54f08..433afba 100644 (file)
@@ -4780,13 +4780,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
               AlignmentI copyAlignment = null;
               final SequenceI[] sequenceSelection = AlignFrame.this.viewport
                       .getSequenceSelection();
-              final char gapChar = AlignFrame.this.viewport
-                      .getGapCharacter();
               List<AlignedCodonFrame> cf = xrefs.getCodonFrames();
               if (dna)
               {
                 copyAlignment = AlignmentUtils.makeCdsAlignment(
-                        sequenceSelection, cf, gapChar);
+                        sequenceSelection, cf, alignment);
                 al.getCodonFrames().clear();
                 al.getCodonFrames().addAll(cf);
               }
@@ -4795,8 +4793,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
                 copyAlignment = new Alignment(new Alignment(
                         sequenceSelection));
                 copyAlignment.getCodonFrames().addAll(cf);
-                copyAlignment.setGapCharacter(gapChar);
               }
+              copyAlignment.setGapCharacter(AlignFrame.this.viewport
+                      .getGapCharacter());
               StructureSelectionManager ssm = StructureSelectionManager
                       .getStructureSelectionManager(Desktop.instance);
               ssm.registerMappings(cf);
@@ -4890,17 +4889,21 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       }
 
       /**
-       * @param alignment
-       * @param prods
+       * Makes an alignment containing the given sequences; the sequences are
+       * added to the given alignment dataset, and the dataset is set on (shared
+       * by) the new alignment
+       * 
+       * @param dataset
+       * @param seqs
        * @return
        */
       protected Alignment makeCrossReferencesAlignment(Alignment dataset,
-              Alignment prods)
+              Alignment seqs)
       {
-        SequenceI[] sprods = new SequenceI[prods.getHeight()];
+        SequenceI[] sprods = new SequenceI[seqs.getHeight()];
         for (int s = 0; s < sprods.length; s++)
         {
-          sprods[s] = (prods.getSequenceAt(s)).deriveSequence();
+          sprods[s] = (seqs.getSequenceAt(s)).deriveSequence();
           if (dataset.getSequences() == null
                   || !dataset.getSequences().contains(
                           sprods[s].getDatasetSequence()))