X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignmentAnnotation.java;h=4ba0ac4dc9f0bb71727f625912969bfd1cd23216;hb=bc7c2cf5500c5a4124a69ef8e7b1374d8997558f;hp=9354d55fa447e8dc43a1b6acdd08ae1fa5cb9329;hpb=ed581b841fe9361bfe80bb006df190a29df264fb;p=jalview.git diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index 9354d55..4ba0ac4 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -710,6 +710,17 @@ public class AlignmentAnnotation public AlignmentAnnotation(AlignmentAnnotation annotation) { setAnnotationId(); + updateAlignmentAnnotationFrom(annotation); + } + + /** + * copy attributes and annotation from an existing annotation (used by copy + * constructor). This method does not update the unique annotationId + * + * @param annotation + */ + public void updateAlignmentAnnotationFrom(AlignmentAnnotation annotation) + { this.label = new String(annotation.label); if (annotation.description != null) { @@ -733,6 +744,9 @@ public class AlignmentAnnotation this.scaleColLabel = annotation.scaleColLabel; this.showAllColLabels = annotation.showAllColLabels; this.calcId = annotation.calcId; + this.bitScore = annotation.bitScore; + this.eValue = annotation.eValue; + if (annotation.properties != null) { properties = new HashMap<>(); @@ -1738,4 +1752,22 @@ public class AlignmentAnnotation this.eValue = eValue; } + public static AlignmentAnnotation findFirstAnnotation( + Iterable alignmentAnnotation, String name, + String calcId, boolean autoCalc, SequenceI seqRef, + SequenceGroup groupRef) + { + + for (AlignmentAnnotation annot : alignmentAnnotation) + { + if (annot.autoCalculated == autoCalc && (name.equals(annot.label)) + && (calcId == null || annot.getCalcId().equals(calcId)) + && annot.sequenceRef == seqRef && annot.groupRef == groupRef) + { + return annot; + } + } + return null; + } + }