public boolean readAnnotationFile(AlignmentI al, String file,\r
String protocol)\r
{\r
+ Hashtable autoAnnots=new Hashtable();\r
try\r
{\r
BufferedReader in = null;\r
int graphStyle, index;\r
int refSeqIndex = 1;\r
int existingAnnotations = 0;\r
+ // when true - will add new rows regardless of whether they are duplicate auto-annotation like consensus or conservation graphs\r
+ boolean overrideAutoAnnot=false; \r
if (al.getAlignmentAnnotation() != null)\r
{\r
existingAnnotations = al.getAlignmentAnnotation().length;\r
+ if (existingAnnotations>0)\r
+ {\r
+ AlignmentAnnotation[] aa = al.getAlignmentAnnotation();\r
+ for (int aai=0;aai<aa.length;aai++)\r
+ {\r
+ if (aa[aai].autoCalculated)\r
+ {\r
+ // make a note of the name and description\r
+ autoAnnots.put(aa[aai].graph+"\t"+aa[aai].label+"\t"+aa[aai].description+"\t"+(aa[aai].sequenceRef!=null ? aa[aai].sequenceRef.getDisplayId(true) : "")\r
+ ,new Integer(1));\r
+ }\r
+ }\r
+ }\r
}\r
\r
int alWidth = al.getWidth();\r
}\r
\r
}\r
-\r
+ \r
annotation = new AlignmentAnnotation(label, description,\r
(index == 0) ? null : annotations, 0, 0, graphStyle);\r
\r
annotation.score = score;\r
-\r
+ if (!overrideAutoAnnot && autoAnnots.containsKey(annotation.graph+"\t"+annotation.label+"\t"+annotation.description+"\t"+(refSeq!=null ? refSeq.getDisplayId(true) : "")))\r
+ {\r
+ // skip - we've already got an automatic annotation of this type.\r
+ continue;\r
+ }\r
+ // otherwise add it!\r
if (refSeq != null)\r
{\r
+ \r
annotation.belowAlignment = false;\r
// make a copy of refSeq so we can find other matches in the alignment\r
SequenceI referedSeq = refSeq;\r