From: jprocter Date: Wed, 15 Dec 2010 09:51:00 +0000 (+0000) Subject: refactored key calc for hash to separate function X-Git-Tag: Release_2_7~348 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=bacecb72ddbc576bd80339b7b02c4c08313f6a83;p=jalview.git refactored key calc for hash to separate function --- 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