X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FIdentifyFile.java;h=27f08aeb9ce41e3934001e5d5ae54991c180dd96;hb=44e5428356c618d139354d02bbfc2f9008ae50b6;hp=365982ea9ef5b40a7ecc042dc88f749578adb0d7;hpb=68c26e8852772be21fdb5b091fa9083d8cdb6eec;p=jalview.git diff --git a/src/jalview/io/IdentifyFile.java b/src/jalview/io/IdentifyFile.java index 365982e..27f08ae 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 2.8.2) - * Copyright (C) 2014 The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * @@ -30,6 +30,8 @@ import java.io.IOException; */ public class IdentifyFile { + public static final String GFF3File = "GFF v2 or v3"; + /** * Identify a datasource's file content. * @@ -130,25 +132,34 @@ public class IdentifyFile } data = data.toUpperCase(); - if ((data.indexOf("# STOCKHOLM") > -1)) + if (data.startsWith("##GFF-VERSION")) + { + reply = GFF3File; + break; + } + if (data.indexOf("# STOCKHOLM") > -1) { reply = "STH"; - break; } - if (data.matches("<(\"[^\"]*\"|'[^']*'|[^'\">])*>")) + // if (data.matches("<(\"[^\"]*\"|'[^']*'|[^'\">])*>")) + if (data.matches("<(?i)html(\"[^\"]*\"|'[^']*'|[^'\">])*>")) { - reply = "HTML"; + reply = HtmlFile.FILE_DESC; break; } - if ((data.indexOf("<") > -1)) + if (data.matches("<(?i)rnaml (\"[^\"]*\"|'[^']*'|[^'\">])*>")) { reply = "RNAML"; - break; } + if (data.indexOf("{\"") > -1) + { + reply = JSONFile.FILE_DESC; + break; + } if ((data.length() < 1) || (data.indexOf("#") == 0)) { lineswereskipped = true;