JAL-845 bug fixes correcting linked editing
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 4 Mar 2015 13:37:13 +0000 (13:37 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Wed, 4 Mar 2015 13:37:13 +0000 (13:37 +0000)
src/jalview/datamodel/Alignment.java
src/jalview/gui/AlignFrame.java
src/jalview/gui/AlignViewport.java
src/jalview/util/MappingUtils.java

index 4558d8d..19819a6 100755 (executable)
@@ -376,14 +376,14 @@ public class Alignment implements AlignmentI
       for (int i = 0; i < gSize; i++)
       {
         SequenceGroup sg = groups.get(i);
-        if (sg == null || sg.getSequences(null) == null)
+        if (sg == null || sg.getSequences() == null)
         {
           this.deleteGroup(sg);
           gSize--;
           continue;
         }
 
-        if (sg.getSequences(null).contains(s))
+        if (sg.getSequences().contains(s))
         {
           temp.add(sg);
         }
index 9604458..e7a4735 100644 (file)
@@ -4904,10 +4904,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
               "label.translation_of_params", new Object[]
               { this.getTitle() });
       af.setTitle(newTitle);
-      final SequenceI[] seqs = viewport.getSelectionGroup() == null ? viewport
-              .getAlignment().getSequencesArray() : viewport
-              .getSelectionAsNewSequence();
-      viewport.openSplitFrame(af, seqs, al.getCodonFrames());
+      final SequenceI[] seqs = viewport.getSelectionAsNewSequence();
+      viewport.openSplitFrame(af, new Alignment(seqs), al.getCodonFrames());
       // Desktop.addInternalFrame(af, newTitle, DEFAULT_WIDTH, DEFAULT_HEIGHT);
     }
   }
index 93d8c19..430f373 100644 (file)
@@ -1069,8 +1069,8 @@ public class AlignViewport extends AlignmentViewport implements
 
     if (openSplitPane)
     {
-      protein = openSplitFrame(newAlignFrame,
-              thisAlignment.getSequencesArray(), protein.getCodonFrames());
+      protein = openSplitFrame(newAlignFrame, thisAlignment,
+              protein.getCodonFrames());
     }
 
     /*
@@ -1090,20 +1090,18 @@ public class AlignViewport extends AlignmentViewport implements
    * 
    * @param newAlignFrame
    *          containing a new alignment to be shown
-   * @param seqs
-   *          'complementary' sequences to show in the other split half
+   * @param complement
+   *          cdna/protein complement alignment to show in the other split half
    * @param mappings
    * @return the protein alignment in the split frame
    */
   protected AlignmentI openSplitFrame(AlignFrame newAlignFrame,
-          SequenceI[] seqs, Set<AlignedCodonFrame> mappings)
+          AlignmentI complement, Set<AlignedCodonFrame> mappings)
   {
-    AlignmentI complementAlignment = new Alignment(seqs);
-    // TODO: move this to a factory/controller method ?
     /*
      * Open in split pane. DNA sequence above, protein below.
      */
-    AlignFrame copyMe = new AlignFrame(complementAlignment,
+    AlignFrame copyMe = new AlignFrame(complement,
             AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
     copyMe.setTitle(getAlignPanel().alignFrame.getTitle());
 
index 9880ae7..eebc539 100644 (file)
@@ -92,8 +92,7 @@ public final class MappingUtils
       SequenceI ds = seq.getDatasetSequence();
       if (ds != null)
       {
-        final SequenceI copy = new Sequence("", new String(
-                seq.getSequence()));
+        final SequenceI copy = new Sequence(seq);
         copy.setDatasetSequence(ds);
         targetCopies.put(ds, copy);
       }