X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FSequenceGroup.java;h=0944c3465bad8d23900a57ceac74543f0d1d1649;hb=ab43013b7e357b84b4abade0dba949668dfb2a0e;hp=f8fd3ee0fc235634f562b3d436c5c1de52ef8aac;hpb=fe6b3fb39308b5c045849db2be75ba07824be776;p=jalview.git diff --git a/src/jalview/datamodel/SequenceGroup.java b/src/jalview/datamodel/SequenceGroup.java index f8fd3ee..0944c34 100755 --- a/src/jalview/datamodel/SequenceGroup.java +++ b/src/jalview/datamodel/SequenceGroup.java @@ -1,5 +1,5 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2) + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2b1) * Copyright (C) 2014 The Jalview Authors * * This file is part of Jalview. @@ -178,7 +178,9 @@ public class SequenceGroup implements AnnotatedCollectionI endRes = seqsel.endRes; cs = seqsel.cs; if (seqsel.description != null) + { description = new String(seqsel.description); + } hidecols = seqsel.hidecols; hidereps = seqsel.hidereps; idColour = seqsel.idColour; @@ -238,7 +240,9 @@ public class SequenceGroup implements AnnotatedCollectionI } } if (!found) + { continue; + } } AlignmentAnnotation newannot = new AlignmentAnnotation( seq.getAnnotation()[a]); @@ -1261,6 +1265,29 @@ public class SequenceGroup implements AnnotatedCollectionI } /** + * Returns a list of annotations that match the specified sequenceRef, calcId + * and label, ignoring null values. + * + * @return list of AlignmentAnnotation objects + */ + @Override + public Iterable findAnnotations(SequenceI seq, + String calcId, String label) + { + ArrayList aa = new ArrayList(); + for (AlignmentAnnotation ann : getAlignmentAnnotation()) + { + if (ann.getCalcId() != null && ann.getCalcId().equals(calcId) + && ann.sequenceRef != null && ann.sequenceRef == seq + && ann.label != null && ann.label.equals(label)) + { + aa.add(ann); + } + } + return aa; + } + + /** * Answer true if any annotation matches the calcId passed in (if not null). * * @param calcId @@ -1308,28 +1335,4 @@ public class SequenceGroup implements AnnotatedCollectionI { return context; } - - @Override - public Iterable findAnnotation( - SequenceI datasequence, String calcId, String label) - { - List result = new ArrayList(); - for (AlignmentAnnotation ann : getAlignmentAnnotation()) - { - // only sequence-linked annotations can qualify (have a datasequence) - if (ann.sequenceRef == null) - { - continue; - } - boolean matchDatasequence = (ann.sequenceRef.getDatasetSequence() == datasequence); - final String annCalcId = ann.getCalcId(); - boolean matchCalcId = (annCalcId != null && annCalcId.equals(calcId)); - boolean matchLabel = (ann.label != null && ann.label.equals(label)); - if (matchDatasequence && matchCalcId && matchLabel) - { - result.add(ann); - } - } - return result; - } }