JAL-1236 TODO: fix up parser to cope with the currently defined custom header......
[jalview.git] / src / jalview / io / ClustalFile.java
index afb2009..c558186 100755 (executable)
@@ -36,17 +36,28 @@ public class ClustalFile extends AlignFile
 
   public ClustalFile()
   {
+    _initHeader();
   }
 
   public ClustalFile(String inFile, DataSourceType sourceType)
           throws IOException
   {
     super(inFile, sourceType);
+    _initHeader();
   }
 
   public ClustalFile(FileParse source) throws IOException
   {
     super(source);
+    _initHeader();
+  }
+
+  private void _initHeader()
+  {
+    try {
+       clustalHeader = jalview.bin.Cache.getDefault("CLUSTAL_HEADER","CLUSTAL");
+    } catch (Error e) {};
+
   }
 
   @Override
@@ -86,7 +97,7 @@ public class ClustalFile extends AlignFile
           if (str.hasMoreTokens())
           {
             id = str.nextToken();
-
+           // TODO: JAL-1236 other tokens may be indicative of a header for Clustal format
             if (id.equalsIgnoreCase("CLUSTAL"))
             {
               flag = true;
@@ -196,11 +207,15 @@ public class ClustalFile extends AlignFile
       }
     }
   }
-
+  /**
+   * clustal header - customise if needed
+   */
+  public String clustalHeader = "CLUSTAL";
+  
   @Override
   public String print(SequenceI[] s, boolean jvsuffix)
   {
-    StringBuffer out = new StringBuffer("CLUSTAL" + newline + newline);
+    StringBuffer out = new StringBuffer(clustalHeader + newline + newline);
 
     int max = 0;
     int maxid = 0;