X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignment.java;h=23fe0573aa1c86a2fcbf4d7345228b91a3002860;hb=b81d4d7d46ea8b1c89df086fb847baab6b69d427;hp=708e566ad6fe87389af2ed9a370514df934fe852;hpb=a79f9e113c51c032070c670e45ce3eb464691166;p=jalview.git diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 708e566..23fe057 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -122,6 +122,13 @@ public class Alignment implements AlignmentI { return sequences; } + @Override + public List getSequences( + Map hiddenReps) + { + // TODO: in jalview 2.8 we don't do anything with hiddenreps - fix design to work on this. + return sequences; + } public SequenceI[] getSequencesArray() { @@ -1219,13 +1226,12 @@ public class Alignment implements AlignmentI { this.addCodonFrame(acod[a]); } - Vector sg = toappend.getGroups(); + List sg = toappend.getGroups(); if (sg != null) { - Enumeration el = sg.elements(); - while (el.hasMoreElements()) + for (SequenceGroup _sg:sg) { - addGroup((SequenceGroup) el.nextElement()); + addGroup(_sg); } } if (toappend.getHiddenSequences() != null) @@ -1292,4 +1298,47 @@ public class Alignment implements AlignmentI } } + @Override + public AlignmentAnnotation findOrCreateAnnotation(String name, boolean autoCalc, + SequenceI seqRef, SequenceGroup groupRef) + { + for (AlignmentAnnotation annot : + getAlignmentAnnotation()) + { + if (annot.autoCalculated == autoCalc + && annot.getCalcId().equals(name) + && annot.sequenceRef == seqRef && annot.groupRef == groupRef) + { + return annot; + } + } + AlignmentAnnotation annot = new AlignmentAnnotation(name, name, + new Annotation[1], 0f, 0f, AlignmentAnnotation.BAR_GRAPH); + annot.hasText = false; + annot.setCalcId(new String(name)); + annot.autoCalculated = autoCalc; + if (seqRef != null) + { + annot.setSequenceRef(seqRef); + } + annot.groupRef = groupRef; + addAnnotation(annot); + + return annot; + } + + @Override + public Iterable findAnnotation(String calcId) + { + ArrayList aa=new ArrayList(); + for (AlignmentAnnotation a:getAlignmentAnnotation()) + { + if (a.getCalcId()==calcId || (a.getCalcId()!=null && calcId!=null && a.getCalcId().equals(calcId))) + { + aa.add(a); + } + } + return aa; + } + }