JAL-2381 copy and paste sequence also copies contact matrix annotation
[jalview.git] / src / jalview / gui / AlignFrame.java
index 6b46041..48927bb 100644 (file)
@@ -112,6 +112,7 @@ import jalview.datamodel.AlignmentI;
 import jalview.datamodel.AlignmentOrder;
 import jalview.datamodel.AlignmentView;
 import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.ContactMatrixI;
 import jalview.datamodel.HiddenColumns;
 import jalview.datamodel.PDBEntry;
 import jalview.datamodel.SeqCigar;
@@ -1480,12 +1481,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   @Override
   public void createPNG(File f)
   {
-    createPNG(f, null);
+    createPNG(f, null, 0.0f, 0, 0);
   }
 
-  public void createPNG(File f, String renderer)
+  public void createPNG(File f, String renderer, float bitmapscale,
+          int bitmapwidth, int bitmapheight)
   {
-    alignPanel.makeAlignmentImage(TYPE.PNG, f, renderer);
+    alignPanel.makeAlignmentImage(TYPE.PNG, f, renderer, bitmapscale,
+            bitmapwidth, bitmapheight);
   }
 
   /**
@@ -2301,10 +2304,15 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
                         .intValue();
               }
             }
-            alignment.addAnnotation(sequences[i].getAnnotation()[a]); // annotation
-            // was
-            // duplicated
-            // earlier
+            // annotation was duplicated earlier
+            alignment.addAnnotation(sequences[i].getAnnotation()[a]);
+            // take care of contact matrix too
+            ContactMatrixI cm=sequences[i].getContactMatrixFor(sequences[i].getAnnotation()[a]);
+            if (cm!=null)
+            {
+              alignment.addContactListFor(sequences[i].getAnnotation()[a], cm);
+            }
+            
             alignment.setAnnotationIndex(sequences[i].getAnnotation()[a],
                     a);
           }
@@ -4200,7 +4208,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   }
 
   public void showContactMapTree(AlignmentAnnotation aa,
-          PAEContactMatrix cm)
+          ContactMatrixI cm)
   {
     int x = 4, y = 5;
     int w = 400, h = 500;
@@ -4209,8 +4217,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     {
       NewickFile fin = new NewickFile(
               new FileParse(cm.getNewick(), DataSourceType.PASTE));
-      String title = "PAE Matrix Tree for "
-              + cm.getReferenceSeq().getDisplayId(false);
+      String title = cm.getAnnotLabel() + " " + cm.getTreeMethod() + " tree"
+              + aa.sequenceRef != null
+                      ? (" for " + aa.sequenceRef.getDisplayId(false))
+                      : "";
 
       showColumnWiseTree(fin, aa, title, w, h, x, y);
     } catch (Throwable xx)