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(">"))
{
} catch (IOException ex)
{
}
- ;
if (dta != null && dta.indexOf("*") > -1)
{
starterm = true;
// 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("<HTML"))
{
+ reply = HtmlFile.FILE_DESC;
break;
}
- if (data == null)
+ if (upper.substring(lessThan).startsWith("<RNAML"))
{
+ reply = "RNAML";
break;
}
}
}
/**
- * Returns true if the data has at least 6 tab-delimited fields _and_
- * fields 4 and 5 are integer (start/end)
+ * Returns true if the data has at least 6 tab-delimited fields _and_ fields 4
+ * and 5 are integer (start/end)
+ *
* @param data
* @return
*/
return false;
}
String[] columns = data.split("\t");
- if (columns.length < 6) {
+ if (columns.length < 6)
+ {
return false;
}
for (int col = 3; col < 5; col++)
{
- try {
+ try
+ {
Integer.parseInt(columns[col]);
- } catch (NumberFormatException e) {
+ } catch (NumberFormatException e)
+ {
return false;
}
}