From bacecb72ddbc576bd80339b7b02c4c08313f6a83 Mon Sep 17 00:00:00 2001 From: jprocter Date: Wed, 15 Dec 2010 09:51:00 +0000 Subject: [PATCH] refactored key calc for hash to separate function --- src/jalview/io/AnnotationFile.java | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/jalview/io/AnnotationFile.java b/src/jalview/io/AnnotationFile.java index 3459517..5c3b7f8 100755 --- a/src/jalview/io/AnnotationFile.java +++ b/src/jalview/io/AnnotationFile.java @@ -526,14 +526,8 @@ public class AnnotationFile { // make a note of the name and description autoAnnots - .put(aa[aai].graph - + "\t" - + aa[aai].label - + "\t" - + aa[aai].description - + "\t" - + (aa[aai].sequenceRef != null ? aa[aai].sequenceRef - .getDisplayId(true) : ""), + .put(autoAnnotsKey(aa[aai], aa[aai].sequenceRef, (aa[aai].groupRef==null ? null : aa[aai].groupRef.getName()) + ), new Integer(1)); } } @@ -747,14 +741,7 @@ public class AnnotationFile annotation.score = score; if (!overrideAutoAnnot && autoAnnots - .containsKey(annotation.graph - + "\t" - + annotation.label - + "\t" - + annotation.description - + "\t" - + (refSeq != null ? refSeq - .getDisplayId(true) : ""))) + .containsKey(autoAnnotsKey(annotation, refSeq, groupRef))) { // skip - we've already got an automatic annotation of this type. continue; @@ -847,6 +834,18 @@ public class AnnotationFile return true; } + private Object autoAnnotsKey(AlignmentAnnotation annotation, SequenceI refSeq, String groupRef) + { + return annotation.graph + + "\t" + + annotation.label + + "\t" + + annotation.description + + "\t" + + (refSeq != null ? refSeq + .getDisplayId(true) : ""); + } + Annotation parseAnnotation(String string, int graphStyle) { boolean hasSymbols = (graphStyle == AlignmentAnnotation.NO_GRAPH); // don't -- 1.7.10.2