diff --git a/Hash_Table.cpp b/Hash_Table.cpp index b54f868..1c4a73e 100644 --- a/Hash_Table.cpp +++ b/Hash_Table.cpp @@ -12,9 +12,6 @@ pthread_mutex_t output_mutex; #define overlap_region_key(a) ((a).y_id) KRADIX_SORT_INIT(overlap_region_sort, overlap_region, overlap_region_key, member_size(overlap_region, y_id)) -#define oreg_xs_lt(a, b) (((uint64_t)(a).x_pos_s<<32|(a).x_pos_e) < ((uint64_t)(b).x_pos_s<<32|(b).x_pos_e)) -KSORT_INIT(or_xs, overlap_region, oreg_xs_lt) - void overlap_region_sort_y_id(overlap_region *a, long long n) { radix_sort_overlap_region_sort(a, a + n); @@ -648,13 +645,10 @@ void calculate_overlap_region_by_chaining(Candidates_list* candidates, overlap_r if (tmp_region.x_id != tmp_region.y_id) { append_inexact_overlap_region_alloc(overlap_list, &tmp_region, R_INF, add_beg_end); - ///append_inexact_overlap_region_alloc_back(overlap_list, &tmp_region, R_INF); } } destory_fake_cigar(&(tmp_region.f_cigar)); - - ks_introsort_or_xs(overlap_list->length, overlap_list->list); } void append_window_list(overlap_region* region, uint64_t x_start, uint64_t x_end, int y_start, int y_end, int error, diff --git a/anchor.cpp b/anchor.cpp index 95dfbda..f313ff5 100644 --- a/anchor.cpp +++ b/anchor.cpp @@ -14,6 +14,9 @@ typedef struct { // this struct is not strictly necessary; we can use k_mer_pos KRADIX_SORT_INIT(ha_an1, anchor1_t, an_key1, 8) KRADIX_SORT_INIT(ha_an2, anchor1_t, an_key2, 4) +#define oreg_xs_lt(a, b) (((uint64_t)(a).x_pos_s<<32|(a).x_pos_e) < ((uint64_t)(b).x_pos_s<<32|(b).x_pos_e)) +KSORT_INIT(or_xs, overlap_region, oreg_xs_lt) + typedef struct { int n; const ha_idxpos_t *a; @@ -104,4 +107,17 @@ void ha_get_new_candidates(ha_abuf_t *ab, int64_t rid, UC_Read *ucr, overlap_reg cl->length = ab->n_a; calculate_overlap_region_by_chaining(cl, overlap_list, rid, ucr->length, &R_INF, band_width_threshold, keep_whole_chain); + + ks_introsort_or_xs(overlap_list->length, overlap_list->list); + + #if 0 + if (overlap_list->length > 2000) { + fprintf(stderr, "B\t%ld\t%ld\t%ld\n", (long)rid, (long)overlap_list->length, (long)Get_READ_LENGTH(R_INF, rid)); + for (int i = 0; i < (int)overlap_list->length; ++i) { + overlap_region *r = &overlap_list->list[i]; + fprintf(stderr, "C\t%d\t%d\t%d\t%c\t%d\t%ld\t%d\t%d\t%c\t%d\n", (int)r->x_id, (int)r->x_pos_s, (int)r->x_pos_e, "+-"[r->x_pos_strand], + (int)r->y_id, (long)Get_READ_LENGTH(R_INF, r->y_id), (int)r->y_pos_s, (int)r->y_pos_e, "+-"[r->y_pos_strand], (int)r->shared_seed); + } + } + #endif }