GtMultieoplist * gt_xdrop_backtrack(const GtXdropresources *res, const GtXdropbest *best) { GtMultieoplist *meops = gt_multieoplist_new(); GtUword idx, i; GtWord k = best->best_k, d = best->best_d, old_row = (GtWord) best->ivalue; GtXdropfrontvalue *fronts = res->fronts.spaceGtXdropfrontvalue, currfront; gt_assert(best->ivalue != 0 && best->jvalue != 0); idx = GT_XDROP_FRONTIDX(d, k); currfront = fronts[idx]; while (d > 0) { if (currfront.direction == GT_XDROP_INSERTIONBIT) { d -= res->arbitdistances.ins; k++; idx = GT_XDROP_FRONTIDX(d, k); currfront = fronts[idx]; for (i = 0; i < (GtUword) old_row - (currfront.row); ++i) { gt_multieoplist_add_match(meops); } gt_multieoplist_add_insertion(meops); } else if (currfront.direction == GT_XDROP_DELETIONBIT) { d -= res->arbitdistances.del; k--; idx = GT_XDROP_FRONTIDX(d, k); currfront = fronts[idx]; for (i = 0; i < (GtUword) old_row - (currfront.row + 1); ++i) { gt_multieoplist_add_match(meops); } gt_multieoplist_add_deletion(meops); } else if (currfront.direction == GT_XDROP_REPLACEMENTBIT) { d -= res->arbitdistances.mis; idx = GT_XDROP_FRONTIDX(d, k); currfront = fronts[idx]; for (i = 0; i < (GtUword) old_row - (currfront.row + 1); ++i) { gt_multieoplist_add_match(meops); } gt_multieoplist_add_mismatch(meops); } else { gt_assert(false && "this should not be reached"); } gt_assert(currfront.row >= 0 && old_row >= currfront.row); old_row = currfront.row; } while (old_row > 0) { gt_multieoplist_add_match(meops); old_row--; } gt_assert(d == 0); return meops; }
void gt_alignment_add_deletion(GtAlignment *alignment) { gt_multieoplist_add_deletion(alignment->eops); alignment->alilen++; }