git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'Jalview-JS/develop' of https://source.jalview.org/git/jalview.git into...
[jalview.git]
/
src
/
jalview
/
datamodel
/
CigarArray.java
diff --git
a/src/jalview/datamodel/CigarArray.java
b/src/jalview/datamodel/CigarArray.java
index
31af5f8
..
17e9ea6
100644
(file)
--- a/
src/jalview/datamodel/CigarArray.java
+++ b/
src/jalview/datamodel/CigarArray.java
@@
-20,7
+20,7
@@
*/
package jalview.datamodel;
*/
package jalview.datamodel;
-import java.util.List;
+import java.util.Iterator;
public class CigarArray extends CigarBase
{
public class CigarArray extends CigarBase
{
@@
-68,7
+68,8
@@
public class CigarArray extends CigarBase
for (int c = 0; c < cigars.length; c++)
{
refCigars[c] = cigars[c];
for (int c = 0; c < cigars.length; c++)
{
refCigars[c] = cigars[c];
- if (!((cigars[c] instanceof SeqCigar) || cigars[c] instanceof CigarCigar))
+ if (!((cigars[c] instanceof SeqCigar)
+ || cigars[c] instanceof CigarCigar))
{
seqcigararray = false;
}
{
seqcigararray = false;
}
@@
-89,9
+90,7
@@
public class CigarArray extends CigarBase
SequenceGroup selectionGroup)
{
this(constructSeqCigarArray(alignment, selectionGroup));
SequenceGroup selectionGroup)
{
this(constructSeqCigarArray(alignment, selectionGroup));
- constructFromAlignment(alignment,
- hidden != null ? hidden.getHiddenColumnsCopyAsList()
- : null, selectionGroup);
+ constructFromAlignment(alignment, hidden, selectionGroup);
}
private static int[] _calcStartEndBounds(AlignmentI alignment,
}
private static int[] _calcStartEndBounds(AlignmentI alignment,
@@
-153,48
+152,38
@@
public class CigarArray extends CigarBase
* @param selectionGroup
*/
private void constructFromAlignment(AlignmentI alignment,
* @param selectionGroup
*/
private void constructFromAlignment(AlignmentI alignment,
- List<int[]> list, SequenceGroup selectionGroup)
+ HiddenColumns hidden, SequenceGroup selectionGroup)
{
int[] _startend = _calcStartEndBounds(alignment, 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
// now construct the CigarArray operations
- if (list != null)
+ if (hidden != null)
{
int[] region;
{
int[] region;
- int hideStart, hideEnd;
+ int hideStart;
+ int hideEnd;
int last = start;
int last = start;
- for (int j = 0; last < end & j < list.size(); j++)
+
+ Iterator<int[]> regions = hidden.getBoundedIterator(start, end);
+ while (regions.hasNext())
{
{
- region = list.get(j);
+ region = regions.next();
hideStart = region[0];
hideEnd = region[1];
hideStart = region[0];
hideEnd = region[1];
- // edit hidden regions to selection range
- if (hideStart < last)
- {
- if (hideEnd > last)
- {
- hideStart = last;
- }
- else
- {
- continue;
- }
- }
- if (hideStart > end)
+ // truncate region at start if last falls in region
+ if ((hideStart < last) && (hideEnd >= last))
{
{
- break;
+ hideStart = last;
}
}
- if (hideEnd > end)
+ // truncate region at end if end falls in region
+ if (hideEnd > end) // already checked that hideStart<=end
{
hideEnd = end;
}
{
hideEnd = end;
}
- if (hideStart > hideEnd)
- {
- break;
- }
/**
* form operations...
*/
/**
* form operations...
*/
@@
-205,8
+194,9
@@
public class CigarArray extends CigarBase
addOperation(CigarArray.D, 1 + hideEnd - hideStart);
last = hideEnd + 1;
}
addOperation(CigarArray.D, 1 + hideEnd - hideStart);
last = hideEnd + 1;
}
+
// Final match if necessary.
// Final match if necessary.
- if (last < end)
+ if (last <= end)
{
addOperation(CigarArray.M, end - last + 1);
}
{
addOperation(CigarArray.M, end - last + 1);
}