if (row.annotations[j] != null)\r
{\r
comma = "";\r
- if (row.annotations[j].secondaryStructure != ' ') // could be also hasGlyphs || ... \r
+ if (hasGlyphs) // could be also hasGlyphs || ... \r
{\r
\r
- text.append(comma + row.annotations[j].secondaryStructure);\r
+ text.append(comma);\r
+ if (row.annotations[j].secondaryStructure != ' ')\r
+ {\r
+ // only write out the field if its not whitespace.\r
+ text.append(row.annotations[j].secondaryStructure);\r
+ }\r
comma = ",";\r
}\r
if (hasValues)\r
StringTokenizer st = new StringTokenizer(string, ",", true);\r
String token;\r
boolean seenContent=false;\r
+ int pass=0;\r
while (st.hasMoreTokens())\r
{\r
+ pass++;\r
token = st.nextToken().trim();\r
if (token.equals(","))\r
{\r
} catch (NumberFormatException ex)\r
{\r
}\r
+ } else {\r
+ if (token.length()==1)\r
+ {\r
+ displayChar = token;\r
+ }\r
}\r
-\r
if (hasSymbols && (token.equals("H") || token.equals("E") || token.equals(" ")))\r
{\r
// Either this character represents a helix or sheet\r
displayChar = "";\r
}\r
}\r
- else if (desc == null)\r
+ else if (desc == null || (parsedValue && pass>2))\r
{\r
desc = token;\r
}\r
// {\r
// displayChar = " "; // empty display char symbol.\r
// }\r
- if (displayChar != null && displayChar.length() > 1 && desc != null\r
- && desc.length() == 1)\r
+ if (displayChar != null && desc!=null && desc.length()==1) \r
{\r
- String tmp = displayChar;\r
- displayChar = desc;\r
- desc = tmp;\r
+ if (displayChar.length() > 1)\r
+ {\r
+ // switch desc and displayChar - legacy support \r
+ String tmp = displayChar;\r
+ displayChar = desc;\r
+ desc = tmp;\r
+ } else {\r
+ if (displayChar.equals(desc)) {\r
+ // duplicate label - hangover from the 'robust parser' above\r
+ desc = null;\r
+ }\r
+ }\r
}\r
- /*\r
- * In principle, this code will ensure that the Annotation element generated\r
- * is renderable by any of the applet or application rendering code but\r
- * instead we check for null strings when the display character is rendered.\r
- * if (displayChar==null) { displayChar=""; }\r
- */\r
Annotation anot = new Annotation(displayChar, desc, ss, value);\r
\r
anot.colour = colour;\r