JAL-1499 patch from Mungo Carstairs
[jalview.git] / src / jalview / io / FormatAdapter.java
old mode 100755 (executable)
new mode 100644 (file)
index a71d645..c57ef8d
@@ -1,23 +1,32 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
- * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
+ * Copyright (C) 2014 The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
  * Jalview is free software: you can redistribute it and/or
  * modify it under the terms of the GNU General Public License 
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *  
  * Jalview is distributed in the hope that it will be useful, but 
  * WITHOUT ANY WARRANTY; without even the implied warranty 
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
  * PURPOSE.  See the GNU General Public License for more details.
  * 
- * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
  */
 package jalview.io;
 
-import jalview.datamodel.*;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
 
 /**
  * Additional formatting methods used by the application in a number of places.
@@ -122,6 +131,12 @@ public class FormatAdapter extends AppletFormatAdapter
         afile.addJVSuffix(jalview.bin.Cache.getDefault("PFAM_JVSUFFIX",
                 true));
       }
+      else if (format.equalsIgnoreCase("MEGA"))
+      {
+        afile = new MegaFile();
+        afile.addJVSuffix(jalview.bin.Cache.getDefault("MEGA_JVSUFFIX",
+                true));
+      }
       /*
        * amsa is not supported by this function - it requires an alignment
        * rather than a sequence vector else if (format.equalsIgnoreCase("AMSA"))
@@ -196,6 +211,8 @@ public class FormatAdapter extends AppletFormatAdapter
     {
       // TODO consider using AlignmentView to prune to visible region
       // TODO prune sequence annotation and groups to visible region
+      // TODO: JAL-1486 - set start and end for output correctly. basically,
+      // AlignmentView.getVisibleContigs does this.
       Alignment alv = new Alignment(replaceStrings(
               alignment.getSequencesArray(), omitHidden));
       AlignmentAnnotation[] ala = alignment.getAlignmentAnnotation();