diff --git a/CommandLines.h b/CommandLines.h index f240a6c..a1c7424 100644 --- a/CommandLines.h +++ b/CommandLines.h @@ -3,7 +3,7 @@ #include -#define HA_VERSION "0.3.0-dirty-r178" +#define HA_VERSION "0.3.0-dirty-r179" #define VERBOSE 0 #define VERBOSE_GFA 0 diff --git a/Correct.h b/Correct.h index 791106a..01f3c1c 100644 --- a/Correct.h +++ b/Correct.h @@ -1173,4 +1173,4 @@ long long* max_t_pos, long long* max_q_pos, long long* score, long long* droped) #define GAP_EXT_KSW 2 #define Z_DROP_KSW 400 #define BAND_KSW 50 -#endif \ No newline at end of file +#endif diff --git a/Hash_Table.cpp b/Hash_Table.cpp index f209741..b54f868 100644 --- a/Hash_Table.cpp +++ b/Hash_Table.cpp @@ -12,6 +12,9 @@ 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); @@ -30,6 +33,7 @@ void init_overlap_region_alloc(overlap_region_alloc* list) init_window_list_alloc(&(list->list[i].boundary_cigars)); } } + void clear_overlap_region_alloc(overlap_region_alloc* list) { list->length = 0; @@ -58,7 +62,6 @@ void destory_overlap_region_alloc(overlap_region_alloc* list) free(list->list); } - int get_fake_gap_pos(Fake_Cigar* x, int index) { return (x->buffer[index]>>32); @@ -269,64 +272,6 @@ void append_overlap_region_alloc_debug(overlap_region_alloc* list, overlap_regio list->length++; } -int cmp_by_x_pos_s(const void * a, const void * b) -{ - if ((*(overlap_region*)a).x_pos_s > (*(overlap_region*)b).x_pos_s) - { - return 1; - } - else if ((*(overlap_region*)a).x_pos_s < (*(overlap_region*)b).x_pos_s) - { - return -1; - } - else - { - - if ((*(overlap_region*)a).x_pos_e > (*(overlap_region*)b).x_pos_e) - { - return 1; - } - else if ((*(overlap_region*)a).x_pos_e < (*(overlap_region*)b).x_pos_e) - { - return -1; - } - else - { - return 0; - } - - } -} - -int cmp_by_x_pos_e(const void * a, const void * b) -{ - if ((*(overlap_region*)a).x_pos_e > (*(overlap_region*)b).x_pos_e) - { - return 1; - } - else if ((*(overlap_region*)a).x_pos_e < (*(overlap_region*)b).x_pos_e) - { - return -1; - } - else - { - - if ((*(overlap_region*)a).x_pos_s > (*(overlap_region*)b).x_pos_s) - { - return 1; - } - else if ((*(overlap_region*)a).x_pos_s < (*(overlap_region*)b).x_pos_s) - { - return -1; - } - else - { - return 0; - } - - } -} - void debug_chain(k_mer_hit* a, long long a_n, Chain_Data* dp) { long long i, j, current_j; @@ -709,7 +654,7 @@ void calculate_overlap_region_by_chaining(Candidates_list* candidates, overlap_r destory_fake_cigar(&(tmp_region.f_cigar)); - qsort(overlap_list->list, overlap_list->length, sizeof(overlap_region), cmp_by_x_pos_s); + 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/Hash_Table.h b/Hash_Table.h index bf535c9..fff5945 100644 --- a/Hash_Table.h +++ b/Hash_Table.h @@ -80,24 +80,23 @@ typedef struct typedef struct { - uint64_t x_id; + uint32_t x_id; ///the begining and end of the whole overlap - uint64_t x_pos_s; - uint64_t x_pos_e; - uint64_t x_pos_strand; + uint32_t x_pos_s; + uint32_t x_pos_e; + uint32_t x_pos_strand; - uint64_t y_id; - uint64_t y_pos_s; - uint64_t y_pos_e; - uint64_t y_pos_strand; + uint32_t y_id; + uint32_t y_pos_s; + uint32_t y_pos_e; + uint32_t y_pos_strand; - uint64_t overlapLen; - uint64_t shared_seed; - uint64_t align_length; - ///uint64_t total_errors; + uint32_t overlapLen; + uint32_t shared_seed; + uint32_t align_length; uint8_t is_match; uint8_t without_large_indel; - uint64_t non_homopolymer_errors; + uint32_t non_homopolymer_errors; window_list* w_list; uint64_t w_list_size; @@ -163,7 +162,7 @@ void resize_fake_cigar(Fake_Cigar* x, uint64_t size); int get_fake_gap_pos(Fake_Cigar* x, int index); int get_fake_gap_shift(Fake_Cigar* x, int index); -inline long long y_start_offset(long long x_start, Fake_Cigar* o) +static inline long long y_start_offset(long long x_start, Fake_Cigar* o) { if(x_start == get_fake_gap_pos(o, o->length - 1)) { @@ -189,18 +188,6 @@ inline long long y_start_offset(long long x_start, Fake_Cigar* o) return get_fake_gap_shift(o, i - 1); } -inline void print_fake_gap(Fake_Cigar* o) -{ - long long i; - for (i = 0; i < (long long)o->length; i++) - { - fprintf(stderr, "**i: %lld, gap_pos_in_x: %d, gap_shift: %d\n", - i, get_fake_gap_pos(o, i), - get_fake_gap_shift(o, i)); - } - -} - void resize_Chain_Data(Chain_Data* x, long long size); void init_window_list_alloc(window_list_alloc* x); void clear_window_list_alloc(window_list_alloc* x); diff --git a/Process_Read.h b/Process_Read.h index aa06c55..e4baf86 100644 --- a/Process_Read.h +++ b/Process_Read.h @@ -24,8 +24,6 @@ #define Get_NAME(R_INF, ID) ((R_INF).name + (R_INF).name_index[(ID)]) - - extern uint8_t seq_nt6_table[256]; extern char bit_t_seq_table[256][4]; extern char bit_t_seq_table_rc[256][4]; @@ -33,7 +31,6 @@ extern char s_H[5]; extern char rc_Table[5]; - #define RC_CHAR(x) rc_Table[seq_nt6_table[(uint8_t)x]] void init_aux_table();