git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-1759 merge from develop
[jalview.git]
/
src
/
jalview
/
io
/
IdentifyFile.java
diff --git
a/src/jalview/io/IdentifyFile.java
b/src/jalview/io/IdentifyFile.java
index
4074c45
..
4c83ac1
100755
(executable)
--- 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.2b1)
- * 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.
*
*
* This file is part of Jalview.
*
@@
-30,6
+30,8
@@
import java.io.IOException;
*/
public class IdentifyFile
{
*/
public class IdentifyFile
{
+ public static final String GFF3File = "GFF v2 or v3";
+
/**
* Identify a datasource's file content.
*
/**
* Identify a datasource's file content.
*
@@
-96,7
+98,7
@@
public class IdentifyFile
}
while ((data = source.nextLine()) != null)
{
}
while ((data = source.nextLine()) != null)
{
- length += data.length();
+ length += data.trim().length();
if (!lineswereskipped)
{
for (int i = 0; !isBinary && i < data.length(); i++)
if (!lineswereskipped)
{
for (int i = 0; !isBinary && i < data.length(); i++)
@@
-130,26
+132,34
@@
public class IdentifyFile
}
data = data.toUpperCase();
}
data = data.toUpperCase();
- if ((data.indexOf("# STOCKHOLM") > -1))
+ if (data.startsWith("##GFF-VERSION"))
+ {
+ reply = GFF3File;
+ break;
+ }
+ if (data.indexOf("# STOCKHOLM") > -1)
{
reply = "STH";
{
reply = "STH";
-
break;
}
// if (data.matches("<(\"[^\"]*\"|'[^']*'|[^'\">])*>"))
if (data.matches("<(?i)html(\"[^\"]*\"|'[^']*'|[^'\">])*>"))
{
break;
}
// if (data.matches("<(\"[^\"]*\"|'[^']*'|[^'\">])*>"))
if (data.matches("<(?i)html(\"[^\"]*\"|'[^']*'|[^'\">])*>"))
{
- reply = "HTML";
+ reply = HtmlFile.FILE_DESC;
break;
}
if (data.matches("<(?i)rnaml (\"[^\"]*\"|'[^']*'|[^'\">])*>"))
{
reply = "RNAML";
break;
}
if (data.matches("<(?i)rnaml (\"[^\"]*\"|'[^']*'|[^'\">])*>"))
{
reply = "RNAML";
-
break;
}
break;
}
+ if (data.indexOf("{\"") > -1)
+ {
+ reply = JSONFile.FILE_DESC;
+ break;
+ }
if ((data.length() < 1) || (data.indexOf("#") == 0))
{
lineswereskipped = true;
if ((data.length() < 1) || (data.indexOf("#") == 0))
{
lineswereskipped = true;