JAL-281 added file identify criteria for PhyloXML and Nexus
authorkjvdheide <kjvanderheide@dundee.ac.uk>
Thu, 21 Dec 2017 16:25:55 +0000 (16:25 +0000)
committerkjvdheide <kjvanderheide@dundee.ac.uk>
Thu, 21 Dec 2017 16:26:35 +0000 (16:26 +0000)
src/jalview/io/IdentifyFile.java

index ff959b0..a4d6e8b 100755 (executable)
@@ -334,15 +334,26 @@ public class IdentifyFile
           reply = FileFormat.Phylip;
           break;
         }
-        else
+        else if (!lineswereskipped && looksLikeJnetData(data))
         {
-          if (!lineswereskipped && looksLikeJnetData(data))
-          {
             reply = FileFormat.Jnet;
             break;
+
+        }
+        else // phylogenetic file?
+        {
+          if (source.nextLine().startsWith("<phyloxml"))
+          {
+            reply = FileFormat.PhyloXML;
+            break;
           }
+          else if (( ( data.startsWith( "nexus" ) ) || ( data.startsWith( "#nexus" ) )
+                || ( data.startsWith( "# nexus" ) ) || ( data.startsWith( "begin" ) ) ) ) 
+          {
+          reply = FileFormat.Nexus;      
+           break;
+        }
         }
-
         lineswereskipped = true; // this means there was some junk before any
         // key file signature
       }