X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FIdentifyFile.java;h=4ec5329d31aeb19b03cf136eedba5edda8262627;hb=db93a1adcbe0a4eaaf06e0a70ade0d6c5c1961c3;hp=40e93904f809578a7ef9c9fd2ec61cf370822206;hpb=26ba864a6c290121fe6cf616794d2d0bea65fb7d;p=jalview.git diff --git a/src/jalview/io/IdentifyFile.java b/src/jalview/io/IdentifyFile.java index 40e9390..4ec5329 100755 --- a/src/jalview/io/IdentifyFile.java +++ b/src/jalview/io/IdentifyFile.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b2) + * Copyright (C) 2015 The Jalview Authors * * This file is part of Jalview. * @@ -150,6 +150,13 @@ public class IdentifyFile reply = "STH"; break; } + if (data.indexOf("_ENTRY.ID") > -1 + || data.indexOf("_AUDIT_AUTHOR.NAME") > -1 + || data.indexOf("_ATOM_SITE.") > -1) + { + reply = "mmCIF"; + break; + } // if (data.indexOf(">") > -1) if (data.startsWith(">")) { @@ -223,7 +230,6 @@ public class IdentifyFile } catch (IOException ex) { } - ; if (dta != null && dta.indexOf("*") > -1) { starterm = true; @@ -243,34 +249,19 @@ public class IdentifyFile // read as a FASTA (probably) break; } - if ((data.indexOf("<") > -1)) // possible Markup Language data i.e HTML, - // RNAML, XML + int lessThan = data.indexOf("<"); + if ((lessThan > -1)) // possible Markup Language data i.e HTML, + // RNAML, XML { - // FIXME this is nuts - it consumes the rest of the file if no match - 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) + String upper = data.toUpperCase(); + if (upper.substring(lessThan).startsWith("