From: kiramt Date: Tue, 26 Sep 2017 18:35:30 +0000 (+0100) Subject: Merge remote-tracking branch 'origin/bug/JAL-2742' into X-Git-Tag: Release_2_10_4~55^2~1^2~103 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=7012b60c122812320c562563505e308ce485d7e7;p=jalview.git Merge remote-tracking branch 'origin/bug/JAL-2742' into feature/JAL-2674take2 Conflicts: src/jalview/datamodel/CigarArray.java --- 7012b60c122812320c562563505e308ce485d7e7 diff --cc src/jalview/datamodel/CigarArray.java index d90b3cd,1723f1d..2aa3efb --- a/src/jalview/datamodel/CigarArray.java +++ b/src/jalview/datamodel/CigarArray.java @@@ -152,41 -154,29 +152,32 @@@ public class CigarArray extends CigarBa * @param selectionGroup */ private void constructFromAlignment(AlignmentI alignment, - List list, SequenceGroup selectionGroup) + HiddenColumns hidden, SequenceGroup selectionGroup) { int[] _startend = _calcStartEndBounds(alignment, selectionGroup); - int start = _startend[1], end = _startend[2]; + int start = _startend[1]; + int end = _startend[2]; // now construct the CigarArray operations - if (list != null) + if (hidden != null) { int[] region; - int hideStart, hideEnd; + int hideStart; + int hideEnd; int last = start; - for (int j = 0; last < end & j < list.size(); j++) + + Iterator regions = hidden.getBoundedIterator(start, end, true); + while (regions.hasNext()) { - region = list.get(j); + region = regions.next(); hideStart = region[0]; hideEnd = region[1]; - // edit hidden regions to selection range - // edit hidden regions to selection range - // TODO possible bug here in original code: if hideEnd==last we continue - // but shouldn't this be a single D at start? - if (hideStart < last) + // just move on if hideEnd is before last + if (hideEnd < last) { - if (hideEnd > last) - { - hideStart = last; - } - else - { - continue; - } + continue; } - + // exit if next region is after end if (hideStart > end) { break; @@@ -211,9 -204,8 +205,9 @@@ addOperation(CigarArray.D, 1 + hideEnd - hideStart); last = hideEnd + 1; } + // Final match if necessary. - if (last < end) + if (last <= end) { addOperation(CigarArray.M, end - last + 1); }