git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c238278
)
next attempt for Bug #36198 - appears to work reproducibly
author
jprocter
<Jim Procter>
Fri, 23 Apr 2010 15:11:10 +0000
(15:11 +0000)
committer
jprocter
<Jim Procter>
Fri, 23 Apr 2010 15:11:10 +0000
(15:11 +0000)
src/jalview/io/AnnotationFile.java
patch
|
blob
|
history
diff --git
a/src/jalview/io/AnnotationFile.java
b/src/jalview/io/AnnotationFile.java
index
ce1afc2
..
87b21d3
100755
(executable)
--- a/
src/jalview/io/AnnotationFile.java
+++ b/
src/jalview/io/AnnotationFile.java
@@
-210,10
+210,15
@@
public class AnnotationFile
if (row.annotations[j] != null)
\r
{
\r
comma = "";
\r
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
{
\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
comma = ",";
\r
}
\r
if (hasValues)
\r
@@
-717,8
+722,10
@@
public class AnnotationFile
StringTokenizer st = new StringTokenizer(string, ",", true);
\r
String token;
\r
boolean seenContent=false;
\r
StringTokenizer st = new StringTokenizer(string, ",", true);
\r
String token;
\r
boolean seenContent=false;
\r
+ int pass=0;
\r
while (st.hasMoreTokens())
\r
{
\r
while (st.hasMoreTokens())
\r
{
\r
+ pass++;
\r
token = st.nextToken().trim();
\r
if (token.equals(","))
\r
{
\r
token = st.nextToken().trim();
\r
if (token.equals(","))
\r
{
\r
@@
-746,8
+753,12
@@
public class AnnotationFile
} catch (NumberFormatException ex)
\r
{
\r
}
\r
} catch (NumberFormatException ex)
\r
{
\r
}
\r
+ } else {
\r
+ if (token.length()==1)
\r
+ {
\r
+ displayChar = token;
\r
+ }
\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
if (hasSymbols && (token.equals("H") || token.equals("E") || token.equals(" ")))
\r
{
\r
// Either this character represents a helix or sheet
\r
@@
-758,7
+769,7
@@
public class AnnotationFile
displayChar = "";
\r
}
\r
}
\r
displayChar = "";
\r
}
\r
}
\r
- else if (desc == null)
\r
+ else if (desc == null || (parsedValue && pass>2))
\r
{
\r
desc = token;
\r
}
\r
{
\r
desc = token;
\r
}
\r
@@
-768,19
+779,21
@@
public class AnnotationFile
// {
\r
// displayChar = " "; // empty display char symbol.
\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
{
\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
- /*
\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
Annotation anot = new Annotation(displayChar, desc, ss, value);
\r
\r
anot.colour = colour;
\r