JAL-1499 first pass update of parsing and tests, more to come
[jalview.git] / src / jalview / io / AppletFormatAdapter.java
index 239c531..d2d607b 100755 (executable)
@@ -84,7 +84,8 @@ public class AppletFormatAdapter
    * List of valid format strings used in the isValidFormat method
    */
   public static final String[] READABLE_FORMATS = new String[] { "BLC",
-      "CLUSTAL", "FASTA", "MSF", "PileUp", "PIR", "PFAM", "STH", "PDB",
+      "CLUSTAL", "FASTA", "MEGA", "MSF", "PileUp", "PIR", "PFAM", "STH",
+      "PDB",
       "JnetFile", "RNAML", PhylipFile.FILE_DESC, JSONFile.FILE_DESC,
       IdentifyFile.GFF3File, "HTML" };
 
@@ -93,7 +94,8 @@ public class AppletFormatAdapter
    * corresponding to READABLE_FNAMES
    */
   public static final String[] READABLE_EXTENSIONS = new String[] {
-      "fa, fasta, mfa, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa",
+      "fa, fasta, mfa, fastq", "aln", "pfam", "meg", "msf", "pir", "blc",
+      "amsa",
       "sto,stk", "xml,rnaml", PhylipFile.FILE_EXT, JSONFile.FILE_EXT,
       ".gff2,gff3", "jar,jvp", HtmlFile.FILE_EXT };
 
@@ -102,7 +104,8 @@ public class AppletFormatAdapter
    * READABLE_EXTENSIONS
    */
   public static final String[] READABLE_FNAMES = new String[] { "Fasta",
-      "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "Stockholm", "RNAML",
+      "Clustal", "PFAM", "MEGA", "MSF", "PIR", "BLC", "AMSA", "Stockholm",
+      "RNAML",
       PhylipFile.FILE_DESC, JSONFile.FILE_DESC, IdentifyFile.GFF3File,
       "Jalview", HtmlFile.FILE_DESC };
 
@@ -111,7 +114,8 @@ public class AppletFormatAdapter
    * method
    */
   public static final String[] WRITEABLE_FORMATS = new String[] { "BLC",
-      "CLUSTAL", "FASTA", "MSF", "PileUp", "PIR", "PFAM", "AMSA", "STH",
+      "CLUSTAL", "FASTA", "MEGA", "MSF", "PileUp", "PIR", "PFAM", "AMSA",
+      "STH",
       PhylipFile.FILE_DESC, JSONFile.FILE_DESC };
 
   /**
@@ -119,7 +123,8 @@ public class AppletFormatAdapter
    * that are writable by the application.
    */
   public static final String[] WRITABLE_EXTENSIONS = new String[] {
-      "fa, fasta, mfa, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa",
+      "fa, fasta, mfa, fastq", "aln", "pfam", "meg", "msf", "pir", "blc",
+      "amsa",
       "sto,stk", PhylipFile.FILE_EXT, JSONFile.FILE_EXT, "jvp" };
 
   /**
@@ -127,7 +132,7 @@ public class AppletFormatAdapter
    * WRITABLE_EXTENSIONS list of formats.
    */
   public static final String[] WRITABLE_FNAMES = new String[] { "Fasta",
-      "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "STH",
+      "Clustal", "PFAM", "MEGA", "MSF", "PIR", "BLC", "AMSA", "STH",
       PhylipFile.FILE_DESC, JSONFile.FILE_DESC, "Jalview" };
 
   public static String INVALID_CHARACTERS = "Contains invalid characters";
@@ -306,6 +311,10 @@ public class AppletFormatAdapter
       {
         alignFile = new RnamlFile(inFile, type);
       }
+      else if (format.equals("MEGA"))
+      {
+        alignFile = new MegaFile(inFile, type);
+      }
       else if (format.equals(IdentifyFile.GFF3File))
       {
         alignFile = new Gff3File(inFile, type);
@@ -418,6 +427,10 @@ public class AppletFormatAdapter
       {
         alignFile = new RnamlFile(source);
       }
+      else if (format.equals("MEGA"))
+      {
+        alignFile = new MegaFile(source);
+      }
       else if (format.equals("SimpleBLAST"))
       {
         alignFile = new SimpleBlastFile(source);
@@ -598,7 +611,10 @@ public class AppletFormatAdapter
       {
         afile = new RnamlFile();
       }
-
+      else if (format.equalsIgnoreCase("MEGA"))
+      {
+        afile = new MegaFile();
+      }
       else
       {
         throw new Exception(