if (region[1]<region[0]) {
hiddenColumns.removeElementAt(i--);
}
-
+
if(region[0]<0)
region[0] = 0;
if(region[1] <0)
}
}
/**
- * Adjust hidden column boundaries based on a series of column
+ * Adjust hidden column boundaries based on a series of column
* additions or deletions in visible regions.
* @param shiftrecord
* @return
if (shifts!=null && shifts.size()>0) {
int shifted=0;
for (int i=0,j=shifts.size(); i<j; i++) {
- int[] sh = (int[]) shifts.get(i);
+ int[] sh = (int[]) shifts.elementAt(i);
//compensateForEdit(shifted+sh[0], sh[1]);
compensateForDelEdits(shifted+sh[0], sh[1]);
shifted-=sh[1];
return null;
}
/**
- * removes intersection of position,length ranges in deletions
+ * removes intersection of position,length ranges in deletions
* from the start,end regions marked in intervals.
* @param deletions
* @param intervals
}
int endshift=sr[0]+sr[1]; // deletion ranges - -ve means an insert
if (endshift<hr[0] || endshift<sr[0]) { // leadinghc disjoint or not a deletion
- if (s<t)
+ if (s<t)
sr=(int[]) deletions.elementAt(++s);
- else
+ else
s++;
continue;
}
pruned=true;
}
}
- if (!leadinghn) {
+ if (!leadinghn) {
if (trailinghc) {
- if (trailinghn) {
+ if (trailinghn) {
hr[1]=sr[0]-1;
pruned=true;
}
} else {
// sr contained in hr
- if (s<t)
+ if (s<t)
sr=(int[]) deletions.elementAt(++s);
- else
+ else
s++;
continue;
}
}
private boolean pruneColumnList(Vector deletion, Vector list) {
int s=0,t=deletion.size();
- int[] sr=(int[])list.get(s++);
+ int[] sr=(int[])list.elementAt(s++);
boolean pruned=false;
int i=0, j=list.size();
while (i<j && s<=t) {
if (s<t)
sr = (int[])deletion.elementAt(s);
s++;
- }
+ }
}
}
return pruned;
selected=null;
}
// and shift the rest.
- this.compensateForEdits(deletions);
+ this.compensateForEdits(deletions);
}
}
}
if (copy.selected!=null) {
selected = new Vector();
for (int i=0,j=copy.selected.size(); i<j; i++) {
- selected.set(i, ((Integer) copy.selected.get(i)));
+ selected.setElementAt( ((Integer) copy.selected.elementAt(i)), i);
}
}
if (copy.hiddenColumns!=null) {
hiddenColumns=new Vector();
for (int i=0,j=copy.hiddenColumns.size(); i<j; i++) {
int[] rh,cp;
- rh = (int[])copy.hiddenColumns.get(i);
+ rh = (int[])copy.hiddenColumns.elementAt(i);
if (rh!=null) {
cp = new int[rh.length];
System.arraycopy(rh, 0, cp, 0, rh.length);
- hiddenColumns.set(i, cp);
+ hiddenColumns.setElementAt(cp, i);
}
}
}
public ColumnSelection()
{
}
+
+ public String[] getVisibleSequenceStrings(int start, int end, SequenceI[] seqs) {
+ int i,iSize=seqs.length;
+ String selection[] = new String[iSize];
+ if (hiddenColumns!=null && hiddenColumns.size()>0)
+ {
+ for (i=0; i<iSize; i++) {
+ StringBuffer visibleSeq = new StringBuffer();
+ Vector regions = getHiddenColumns();
+
+ int blockStart = start, blockEnd=end;
+ int [] region;
+ int hideStart, hideEnd;
+
+ for (int j = 0; j < regions.size(); j++)
+ {
+ region = (int[]) regions.elementAt(j);
+ hideStart = region[0];
+ hideEnd = region[1];
+
+ if(hideStart < start)
+ {
+ continue;
+ }
+
+ blockStart = Math.min(blockStart, hideEnd+1);
+ blockEnd = Math.min(blockEnd, hideStart);
+
+ if(blockStart>blockEnd)
+ {
+ break;
+ }
+
+
+ visibleSeq.append(seqs[i].getSequence(blockStart, blockEnd));
+
+ blockStart = hideEnd+1;
+ blockEnd = end;
+ }
+
+ if(end>blockStart)
+ visibleSeq.append(seqs[i].getSequence(blockStart, end));
+
+ selection[i] = visibleSeq.toString();
+ }
+ }
+ else
+ {
+ for(i=0; i<iSize; i++)
+ {
+ selection[i] = seqs[i].getSequence(start, end);
+ }
+ }
+
+ return selection;
+ }
+
}