Merge branch 'Release_2_9_0b1_Branch'
[jalview.git] / src / jalview / appletgui / CutAndPasteTransfer.java
index 5617c64..4a33e50 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b1)
+ * Copyright (C) 2015 The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
@@ -33,6 +33,7 @@ import jalview.io.FileParse;
 import jalview.io.IdentifyFile;
 import jalview.io.NewickFile;
 import jalview.io.TCoffeeScoreFile;
+import jalview.json.binding.biojson.v1.ColourSchemeMapper;
 import jalview.schemes.ColourSchemeI;
 import jalview.schemes.TCoffeeColourScheme;
 import jalview.util.MessageManager;
@@ -259,12 +260,18 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
                   .getHiddenSequences();
           boolean showSeqFeatures = ((ComplexAlignFile) source)
                   .isShowSeqFeatures();
-          ColourSchemeI cs = ((ComplexAlignFile) source).getColourScheme();
+          String colourSchemeName = ((ComplexAlignFile) source)
+                  .getGlobalColourScheme();
           af = new AlignFrame(al, hiddenSeqs, colSel,
                   alignFrame.viewport.applet, "Cut & Paste input - "
                           + format, false);
           af.getAlignViewport().setShowSequenceFeatures(showSeqFeatures);
-          af.changeColour(cs);
+          ColourSchemeI cs = ColourSchemeMapper.getJalviewColourScheme(
+                  colourSchemeName, al);
+          if (cs != null)
+          {
+            af.changeColour(cs);
+          }
         }
         else
         {
@@ -304,7 +311,7 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
     }
     AlignmentI protein = thisAlignment.isNucleotide() ? al : thisAlignment;
     AlignmentI dna = thisAlignment.isNucleotide() ? thisAlignment : al;
-    boolean mapped = AlignmentUtils.mapProteinToCdna(protein, dna);
+    boolean mapped = AlignmentUtils.mapProteinAlignmentToCdna(protein, dna);
     if (!mapped)
     {
       return false;
@@ -332,6 +339,11 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
     }
 
     /*
+     * 'align' the added alignment to match the current one
+     */
+    al.alignAs(thisAlignment);
+
+    /*
      * Open SplitFrame with DNA above and protein below, including the alignment
      * from textbox and a copy of the original.
      */