String line, label, description, token;\r
int graphStyle, index;\r
SequenceI refSeq = null;\r
- int refSeqIndex = 0;\r
+ int refSeqIndex = 1;\r
int existingAnnotations = 0;\r
if(al.getAlignmentAnnotation()!=null)\r
existingAnnotations = al.getAlignmentAnnotation().length;\r
\r
+ int alWidth = al.getWidth();\r
+\r
StringTokenizer st;\r
Annotation[] annotations;\r
AlignmentAnnotation annotation = null;\r
}\r
catch(Exception ex)\r
{\r
- refSeqIndex = 0;\r
+ refSeqIndex = 1;\r
}\r
\r
continue;\r
}\r
\r
+\r
graphStyle = AlignmentAnnotation.getGraphValueFromString(token);\r
label = description = st.nextToken();\r
\r
line = st.nextToken();\r
+\r
st = new StringTokenizer(line, "|", true);\r
- annotations = new Annotation[st.countTokens()+refSeqIndex];\r
- index = refSeqIndex;\r
+ annotations = new Annotation[alWidth];\r
+\r
+ index = 0;\r
boolean emptyColumn = true;\r
- while (st.hasMoreElements())\r
+\r
+\r
+ while (st.hasMoreElements() && index<alWidth)\r
{\r
token = st.nextToken().trim();\r
-\r
if(token.equals("|"))\r
{\r
if(emptyColumn)\r
- annotations[index++] = parseAnnotation("");\r
+ index++;\r
\r
emptyColumn = true;\r
}\r
0,\r
graphStyle);\r
\r
- annotation = al.addAnnotation(annotation, refSeq);\r
- al.setAnnotationIndex(annotation, al.getAlignmentAnnotation().length - existingAnnotations-1);\r
- }\r
+ if(refSeq!=null)\r
+ {\r
+ annotation.createSequenceMapping(refSeq, refSeqIndex);\r
+ refSeq.addAlignmentAnnotation(annotation);\r
+ }\r
\r
- al.adjustSequenceAnnotations();\r
+ al.addAnnotation(annotation);\r
\r
+ al.setAnnotationIndex(annotation, al.getAlignmentAnnotation().length - existingAnnotations-1);\r
+ }\r
\r
}catch(Exception ex)\r
{\r
"JNet Output", annotations);\r
}\r
\r
- al.addAnnotation(annot, seqRef);\r
+ if (seqRef != null)\r
+ {\r
+ annot.createSequenceMapping(seqRef, 0);\r
+ seqRef.addAlignmentAnnotation(annot);\r
+ }\r
+\r
+ al.addAnnotation(annot);\r
+\r
\r
if (noMsa)\r
{\r