JAL-845 - portability patch - workaround for lastToken failing for '\'
[jalview.git] / src / jalview / io / AppletFormatAdapter.java
index efddab3..f316a7e 100755 (executable)
@@ -46,10 +46,24 @@ 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", "JnetFile", "RNAML", PhylipFile.FILE_DESC, HtmlFile.FILE_DESC }; // ,
-                                                                              // "SimpleBLAST"
-                                                                              // };
+  { "BLC", "CLUSTAL", "FASTA", "MSF", "PileUp", "PIR", "PFAM", "STH",
+      "PDB", "JnetFile", "RNAML", PhylipFile.FILE_DESC, "HTML" };
+
+  /**
+   * List of readable format file extensions by application in order
+   * corresponding to READABLE_FNAMES
+   */
+  public static final String[] READABLE_EXTENSIONS = new String[]
+  { "fa, fasta, mfa, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa",
+      "sto,stk", "xml,rnaml", PhylipFile.FILE_EXT, "jar,jvp", "html" };
+
+  /**
+   * List of readable formats by application in order corresponding to
+   * READABLE_EXTENSIONS
+   */
+  public static final String[] READABLE_FNAMES = new String[]
+  { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "Stockholm",
+      "RNAML", PhylipFile.FILE_DESC, "Jalview", "HTML" };
 
   /**
    * List of valid format strings for use by callers of the formatSequences
@@ -64,36 +78,16 @@ 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",
-    "jvp", "sto,stk", "jar", PhylipFile.FILE_EXT };
+  { "fa, fasta, mfa, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa",
+      "sto,stk", PhylipFile.FILE_EXT, "jvp" };
 
   /**
    * List of writable formats by the application. Order must correspond with the
    * WRITABLE_EXTENSIONS list of formats.
    */
   public static final String[] WRITABLE_FNAMES = new String[]
-          { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "Jalview",
-    "STH", "Jalview", PhylipFile.FILE_DESC };
-
-  /**
-   * List of readable format file extensions by application in order
-   * corresponding to READABLE_FNAMES
-   */
-  public static final String[] READABLE_EXTENSIONS = new String[]
-          { "fa, fasta, mfa, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa",
-      "jar,jvp", "sto,stk", "xml,rnaml", PhylipFile.FILE_EXT,
-      HtmlFile.FILE_EXT }; // ".blast"
-
-  /**
-   * List of readable formats by application in order corresponding to
-   * READABLE_EXTENSIONS
-   */
-  public static final String[] READABLE_FNAMES = new String[]
-          { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "Jalview",
-      "Stockholm", "RNAML", PhylipFile.FILE_DESC, HtmlFile.FILE_DESC };// ,
-
-  // "SimpleBLAST"
-  // };
+  { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "STH",
+      PhylipFile.FILE_DESC, "Jalview" };
 
   public static String INVALID_CHARACTERS = "Contains invalid characters";
 
@@ -126,6 +120,21 @@ public class AppletFormatAdapter
 
   public static String CLASSLOADER = "ClassLoader";
 
+  /**
+   * add jalview-derived non-secondary structure annotation from PDB structure
+   */
+  boolean annotFromStructure = false;
+
+  /**
+   * add secondary structure from PDB data with built-in algorithms
+   */
+  boolean localSecondaryStruct = false;
+
+  /**
+   * process PDB data with web services
+   */
+  boolean serviceSecondaryStruct = false;
+
   AlignFile afile = null;
 
   String inFile;
@@ -239,7 +248,8 @@ public class AppletFormatAdapter
       }
       else if (format.equals("PDB"))
       {
-        afile = new MCview.PDBfile(true,true,inFile, type);
+        afile = new MCview.PDBfile(annotFromStructure,
+                localSecondaryStruct, serviceSecondaryStruct, inFile, type);
         // Uncomment to test Jmol data based PDB processing: JAL-1213
         // afile = new jalview.ext.jmol.PDBFileWithJmol(inFile, type);
       }
@@ -255,10 +265,10 @@ public class AppletFormatAdapter
       {
         afile = new PhylipFile(inFile, type);
       }
-      else if (format.equals(HtmlFile.FILE_DESC))
-      {
-        afile = new HtmlFile(inFile, type);
-      }
+      // else if (format.equals(HtmlFile.FILE_DESC))
+      // {
+      // afile = new HtmlFile(inFile, type);
+      // }
       else if (format.equals("RNAML"))
       {
         afile = new RnamlFile(inFile, type);
@@ -364,7 +374,8 @@ public class AppletFormatAdapter
       }
       else if (format.equals("PDB"))
       {
-        afile = new MCview.PDBfile(true,true,source);
+        afile = new MCview.PDBfile(annotFromStructure,
+                localSecondaryStruct, serviceSecondaryStruct, source);
       }
       else if (format.equals("STH"))
       {
@@ -382,10 +393,10 @@ public class AppletFormatAdapter
       {
         afile = new PhylipFile(source);
       }
-      else if (format.equals(HtmlFile.FILE_DESC))
-      {
-        afile = new HtmlFile(source);
-      }
+      // else if (format.equals(HtmlFile.FILE_DESC))
+      // {
+      // afile = new HtmlFile(source);
+      // }
       Alignment al = new Alignment(afile.getSeqsAsArray());
 
       afile.addAnnotations(al);
@@ -521,10 +532,10 @@ public class AppletFormatAdapter
       {
         afile = new PhylipFile();
       }
-      else if (format.equalsIgnoreCase(HtmlFile.FILE_DESC))
-      {
-        afile = new HtmlFile();
-      }
+      // else if (format.equalsIgnoreCase(HtmlFile.FILE_DESC))
+      // {
+      // afile = new HtmlFile();
+      // }
       else if (format.equalsIgnoreCase("RNAML"))
       {
         afile = new RnamlFile();