merge from develop
[jalview.git] / src / jalview / io / IdentifyFile.java
index dae8f82..a5e7fbc 100755 (executable)
@@ -142,69 +142,8 @@ public class IdentifyFile
           reply = "STH";
           break;
         }
-
-        if ((data.indexOf("<") > -1)) // possible Markup Language data i.e HTML,
-                                      // RNAML, XML
-        {
-          boolean identified = false;
-          do
-          {
-            if (data.matches("<(?i)html(\"[^\"]*\"|'[^']*'|[^'\">])*>"))
-            {
-              reply = HtmlFile.FILE_DESC;
-              identified = true;
-              break;
-            }
-
-            if (data.matches("<(?i)rnaml (\"[^\"]*\"|'[^']*'|[^'\">])*>"))
-            {
-              reply = "RNAML";
-              identified = true;
-              break;
-            }
-          } while ((data = source.nextLine()) != null);
-
-          if (identified)
-          {
-            break;
-          }
-        }
-
-
-         if (data.indexOf("{\"") > -1)
-         {
-         reply = JSONFile.FILE_DESC;
-         break;
-         }
-        if ((data.length() < 1) || (data.indexOf("#") == 0))
-        {
-          lineswereskipped = true;
-          continue;
-        }
-
-        if (data.indexOf("PILEUP") > -1)
-        {
-          reply = "PileUp";
-
-          break;
-        }
-
-        if ((data.indexOf("//") == 0)
-                || ((data.indexOf("!!") > -1) && (data.indexOf("!!") < data
-                        .indexOf("_MULTIPLE_ALIGNMENT "))))
-        {
-          reply = "MSF";
-
-          break;
-        }
-        else if (data.indexOf("CLUSTAL") > -1)
-        {
-          reply = "CLUSTAL";
-
-          break;
-        }
-
-        else if (data.indexOf(">") > -1)
+        // if (data.indexOf(">") > -1)
+        if (data.startsWith(">"))
         {
           // FASTA, PIR file or BLC file
           boolean checkPIR = false, starterm = false;
@@ -296,6 +235,66 @@ public class IdentifyFile
           // read as a FASTA (probably)
           break;
         }
+        if ((data.indexOf("<") > -1)) // possible Markup Language data i.e HTML,
+                                      // RNAML, XML
+        {
+          boolean identified = false;
+          do
+          {
+            if (data.matches("<(?i)html(\"[^\"]*\"|'[^']*'|[^'\">])*>"))
+            {
+              reply = HtmlFile.FILE_DESC;
+              identified = true;
+              break;
+            }
+
+            if (data.matches("<(?i)rnaml (\"[^\"]*\"|'[^']*'|[^'\">])*>"))
+            {
+              reply = "RNAML";
+              identified = true;
+              break;
+            }
+          } while ((data = source.nextLine()) != null);
+
+          if (identified)
+          {
+            break;
+          }
+        }
+
+        if (data.indexOf("{\"") > -1)
+        {
+          reply = JSONFile.FILE_DESC;
+          break;
+        }
+        if ((data.length() < 1) || (data.indexOf("#") == 0))
+        {
+          lineswereskipped = true;
+          continue;
+        }
+
+        if (data.indexOf("PILEUP") > -1)
+        {
+          reply = "PileUp";
+
+          break;
+        }
+
+        if ((data.indexOf("//") == 0)
+                || ((data.indexOf("!!") > -1) && (data.indexOf("!!") < data
+                        .indexOf("_MULTIPLE_ALIGNMENT "))))
+        {
+          reply = "MSF";
+
+          break;
+        }
+        else if (data.indexOf("CLUSTAL") > -1)
+        {
+          reply = "CLUSTAL";
+
+          break;
+        }
+
         else if (data.indexOf("HEADER") == 0 || data.indexOf("ATOM") == 0)
         {
           reply = "PDB";