throws Exception
{
nlinesread = 0;
+ /**
+ * number of combine statements in this annotation file. Used to create new groups for combined annotation graphs without disturbing existing ones
+ */
+ int combinecount = 0;
boolean modified = false;
String groupRef = null;
Hashtable groupRefRows = new Hashtable();
else if (token.equalsIgnoreCase("COMBINE"))
{
- combineAnnotations(al, st);
+ combineAnnotations(al, combinecount++, st);
modified = true;
continue;
}
}
}
- void combineAnnotations(AlignmentI al, StringTokenizer st)
+ void combineAnnotations(AlignmentI al, int combineCount, StringTokenizer st)
{
- int graphGroup = -1;
String group = st.nextToken();
// First make sure we are not overwriting the graphIndex
+ int graphGroup=0;
if (al.getAlignmentAnnotation() != null)
{
for (int i = 0; i < al.getAlignmentAnnotation().length; i++)
{
- if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group))
+ AlignmentAnnotation aa = al.getAlignmentAnnotation()[i];
+ if (aa.graphGroup>graphGroup)
{
- graphGroup = al.getAlignmentAnnotation()[i].graphGroup + 1;
- al.getAlignmentAnnotation()[i].graphGroup = graphGroup;
+ // try to number graphGroups in order of occurence.
+ graphGroup=aa.graphGroup;
+ }
+ if (aa.label.equalsIgnoreCase(group))
+ {
+ if (aa.graphGroup>-1)
+ {
+ graphGroup = aa.graphGroup;
+ } else {
+ if (graphGroup >= combineCount)
+ {
+ graphGroup++;
+ }
+ aa.graphGroup = graphGroup;
+ }
break;
}
}