this.description = description;
this.annotations = annotations;
- for (int i = 0; i < annotations.length; i++)
+ areLabelsSecondaryStructure();
+ }
+
+ void areLabelsSecondaryStructure()
+ {
+ boolean nonSSLabel = false;
+ for (int i = 0; i < annotations.length; i++)
+ {
+ if(annotations[i]==null)
+ continue;
+
+ if (annotations[i].secondaryStructure == 'H' ||
+ annotations[i].secondaryStructure == 'E')
{
- if ((annotations[i] != null) &&
- ((annotations[i].secondaryStructure == 'H') ||
- (annotations[i].secondaryStructure == 'E')))
- {
- hasIcons = true;
- }
+ hasIcons = true;
+ }
+
+ if (annotations[i].secondaryStructure != 'H'
+ && annotations[i].secondaryStructure != 'E')
+ {
+ nonSSLabel = true;
+ }
+
+ if (annotations[i].displayCharacter.length() > 0)
+ {
+ hasText = true;
+ }
+ }
+
+ if(nonSSLabel)
+ {
+ hasIcons = false;
+ for (int j = 0; j < annotations.length; j++)
+ {
+ if(annotations[j] !=null && annotations[j].secondaryStructure!=' ')
+ {
+ annotations[j].displayCharacter
+ =String.valueOf(annotations[j].secondaryStructure);
+ annotations[j].secondaryStructure = ' ';
+ if(annotations[j].description.length()<1)
+ annotations[j].description = annotations[j].displayCharacter;
+ }
- if ((annotations[i] != null) &&
- (annotations[i].displayCharacter.length() > 0))
- {
- hasText = true;
- }
}
+
+ }
+
}
/**
graphMin = min;
graphMax = max;
- for (int i = 0; i < annotations.length; i++)
- {
- if (!hasIcons
- && annotations[i] != null
- && ((annotations[i].secondaryStructure == 'H') ||
- (annotations[i].secondaryStructure == 'E')))
- {
- hasIcons = true;
- }
-
- if (!hasText
- && annotations[i]!=null
- && annotations[i].displayCharacter.length() > 0)
- {
- hasText = true;
- }
- }
+ areLabelsSecondaryStructure();
if(!drawValues && graphType!=NO_GRAPH)
{
\r
AlignmentAnnotation row;\r
String comma;\r
- String seqref = null;\r
+ SequenceI seqref = null;\r
\r
StringBuffer colours = new StringBuffer();\r
StringBuffer graphLine = new StringBuffer();\r
if( row.sequenceRef == null)\r
seqref = null;\r
\r
- else if (seqref == null\r
- || !seqref.equals(row.sequenceRef.getName()))\r
+ else if (seqref == null || seqref != row.sequenceRef)\r
{\r
- seqref = row.sequenceRef.getName();\r
- text.append("\nSEQUENCE_REF\t" + seqref + "\n");\r
+ seqref = row.sequenceRef;\r
+ text.append("\nSEQUENCE_REF\t" + seqref.getName() + "\n");\r
}\r
\r
\r
\r
for(int j=0; j<row.annotations.length; j++)\r
{\r
+ if (seqref != null && jalview.util.Comparison.isGap(seqref.getCharAt(j)))\r
+ continue;\r
+\r
if(row.annotations[j]!=null)\r
{\r
comma = "";\r
text.append(comma + row.annotations[j].secondaryStructure);\r
comma = ",";\r
}\r
- if (row.annotations[j].displayCharacter.length() > 0 \r
+ if (row.annotations[j].displayCharacter.length() > 0\r
&& !row.annotations[j].displayCharacter.equals(" "))\r
{\r
text.append(comma + row.annotations[j].displayCharacter);\r
comma = ",";\r
}\r
- if (row.annotations[j].value!=0f)\r
+\r
+ if (row.annotations[j]!=null)\r
{\r
color = row.annotations[j].colour;\r
- text.append(comma + row.annotations[j].value);\r
+ if (row.annotations[j].value!=0f)\r
+ text.append(comma + row.annotations[j].value);\r
}\r
}\r
text.append("|");\r
refSeq = al.findName(st.nextToken());\r
try{\r
refSeqIndex = Integer.parseInt(st.nextToken());\r
+ if(refSeqIndex<1)\r
+ {\r
+ refSeqIndex = 1;\r
+ System.out.println("WARNING: SEQUENCE_REF index must be > 0 in AnnotationFile");\r
+ }\r
}\r
catch(Exception ex)\r
{\r
\r
Annotation parseAnnotation(String string)\r
{\r
- String desc = "", displayChar="";\r
+ String desc = null, displayChar="";\r
char ss = ' '; // secondaryStructure\r
float value = 0;\r
boolean parsedValue = false;\r
displayChar = token;\r
value = new Float(token).floatValue();\r
parsedValue = true;\r
+ continue;\r
}catch(NumberFormatException ex){}\r
}\r
\r
if(displayChar.equals(token.substring(0,1)))\r
displayChar = "";\r
}\r
- else if(desc.length()<1)\r
+ else if(desc==null)\r
desc = token;\r
\r
}\r
\r
+ if(desc == null)\r
+ desc = value+"";\r
+\r
+ if(displayChar.length()>1 && desc.length()==1)\r
+ {\r
+ String tmp = displayChar;\r
+ displayChar = desc;\r
+ desc = tmp;\r
+ }\r
+\r
return new Annotation(displayChar, desc, ss, value);\r
}\r
\r