{
return seqcigararray;
}
-
/**
* Apply CIGAR operations to several cigars in parallel
* will throw an error if any of cigar are actually CigarArrays.
* Combines the CigarArray cigar operations with the operations in each
* reference cigar - creating a new reference cigar
* @return Cigar[]
- */
+
public CigarBase[] getEditedCigars() {
return new CigarBase[] {};
}
+*/
+ /**
+ * applyDeletions
+ * edits underlying refCigars to propagate deleted regions, and removes deletion
+ * operations from CigarArray operation list.
+ * @return int[] position where deletion occured in cigarArray or null if none occured
+ */
+ public int[] applyDeletions()
+ {
+ java.util.Vector delpos=null;
+ if (length==0)
+ return null;
+ int cursor=0; // range counter for deletions
+ int vcursor=0; // visible column index
+ for (int i=0; i<length; i++) {
+ if (operation[i]!=D) {
+ if (operation[i]==M)
+ cursor+=range[i];
+ vcursor+=range[i];
+ }
+ else
+ {
+ if (delpos==null)
+ delpos=new java.util.Vector();
+ int delstart=cursor, delend=cursor+range[i]-1; // inclusive
+ delpos.add(new Integer(vcursor-1)); // index of left hand column of hidden region boundary
+ System.arraycopy(operation, i+1, operation, i, length-i);
+ System.arraycopy(range, i+1, range, i, length-i);
+ length--;
+ for (int s=0; s<refCigars.length; s++) {
+ refCigars[s].deleteRange(delstart, delend);
+ }
+ }
+ }
+ if (delpos!=null)
+ {
+ int[] pos=new int[delpos.size()];
+ for (int k = 0, l = delpos.size(); k < l; k++) {
+ pos[k] = ((Integer) delpos.get(k)).intValue();
+ delpos.set(k,null);
+ }
+ delpos=null;
+ return pos;
+ }
+ return null;
+ }
+ /**
+ *
+ * @return SeqCigar[] or null if CigarArray is not a SeqCigarArray (ie it does not resolve to set of seqCigars)
+ */
+ public SeqCigar[] getSeqCigarArray() {
+ if (!isSeqCigarArray())
+ return null;
+ SeqCigar[] sa = new SeqCigar[refCigars.length];
+ for (int i=0; i<refCigars.length; i++)
+ sa[i] = (SeqCigar) refCigars[i];
+ return sa;
+ }
}