refactored key calc for hash to separate function
[jalview.git] / src / jalview / io / AnnotationFile.java
index 3459517..5c3b7f8 100755 (executable)
@@ -526,14 +526,8 @@ public class AnnotationFile
             {\r
               // make a note of the name and description\r
               autoAnnots\r
-                      .put(aa[aai].graph\r
-                              + "\t"\r
-                              + aa[aai].label\r
-                              + "\t"\r
-                              + aa[aai].description\r
-                              + "\t"\r
-                              + (aa[aai].sequenceRef != null ? aa[aai].sequenceRef\r
-                                      .getDisplayId(true) : ""),\r
+                      .put(autoAnnotsKey(aa[aai], aa[aai].sequenceRef, (aa[aai].groupRef==null ? null : aa[aai].groupRef.getName())\r
+                              ),\r
                               new Integer(1));\r
             }\r
           }\r
@@ -747,14 +741,7 @@ public class AnnotationFile
         annotation.score = score;\r
         if (!overrideAutoAnnot\r
                 && autoAnnots\r
-                        .containsKey(annotation.graph\r
-                                + "\t"\r
-                                + annotation.label\r
-                                + "\t"\r
-                                + annotation.description\r
-                                + "\t"\r
-                                + (refSeq != null ? refSeq\r
-                                        .getDisplayId(true) : "")))\r
+                        .containsKey(autoAnnotsKey(annotation, refSeq, groupRef)))\r
         {\r
           // skip - we've already got an automatic annotation of this type.\r
           continue;\r
@@ -847,6 +834,18 @@ public class AnnotationFile
     return true;\r
   }\r
 \r
+  private Object autoAnnotsKey(AlignmentAnnotation annotation, SequenceI refSeq, String groupRef)\r
+  {\r
+    return annotation.graph\r
+    + "\t"\r
+    + annotation.label\r
+    + "\t"\r
+    + annotation.description\r
+    + "\t"\r
+    + (refSeq != null ? refSeq\r
+            .getDisplayId(true) : "");\r
+  }\r
+\r
   Annotation parseAnnotation(String string, int graphStyle)\r
   {\r
     boolean hasSymbols = (graphStyle == AlignmentAnnotation.NO_GRAPH); // don't\r