mirror of
https://github.com/chhylp123/hifiasm.git
synced 2026-09-26 10:18:12 +08:00
Change stupid merge function
This commit is contained in:
+141
-1
@@ -575,6 +575,7 @@ void* Overlap_calculate(void* arg)
|
||||
k_mer_pos_list_alloc array_list;
|
||||
init_k_mer_pos_list_alloc(&array_list);
|
||||
|
||||
|
||||
for (i = thr_ID; i < R_INF.total_reads; i = i + thread_num)
|
||||
///for (i = thr_ID; i < R_INF.total_reads/50; i = i + thread_num)
|
||||
{
|
||||
@@ -674,6 +675,144 @@ void* Overlap_calculate(void* arg)
|
||||
}
|
||||
|
||||
|
||||
void* Overlap_calculate_heap_merge(void* arg)
|
||||
{
|
||||
|
||||
int thr_ID = *((int*)arg);
|
||||
|
||||
long long i = 0;
|
||||
int avalible_k = 0;
|
||||
|
||||
UC_Read g_read;
|
||||
init_UC_Read(&g_read);
|
||||
HPC_seq HPC_read;
|
||||
Hash_code k_code;
|
||||
uint64_t code;
|
||||
uint64_t end_pos;
|
||||
k_mer_pos* list;
|
||||
uint64_t list_length;
|
||||
uint64_t sub_ID;
|
||||
|
||||
Candidates_list l;
|
||||
//Candidates_list debug_l;
|
||||
|
||||
init_Candidates_list(&l);
|
||||
//init_Candidates_list(&debug_l);
|
||||
|
||||
k_mer_pos_list_alloc array_list;
|
||||
init_k_mer_pos_list_alloc(&array_list);
|
||||
|
||||
HeapSq heap;
|
||||
|
||||
Init_Heap(&heap);
|
||||
|
||||
for (i = thr_ID; i < R_INF.total_reads; i = i + thread_num)
|
||||
{
|
||||
|
||||
clear_Heap(&heap);
|
||||
clear_Candidates_list(&l);
|
||||
///clear_Candidates_list(&debug_l);
|
||||
|
||||
clear_k_mer_pos_list_alloc(&array_list);
|
||||
recover_UC_Read(&g_read, &R_INF, i);
|
||||
|
||||
|
||||
///forward strand
|
||||
init_HPC_seq(&HPC_read, g_read.seq, g_read.length);
|
||||
init_Hash_code(&k_code);
|
||||
avalible_k = 0;
|
||||
|
||||
while ((code = get_HPC_code(&HPC_read, &end_pos)) != 6)
|
||||
{
|
||||
if(code < 4)
|
||||
{
|
||||
k_mer_append(&k_code,code,k_mer_length);
|
||||
avalible_k++;
|
||||
if (avalible_k>=k_mer_length)
|
||||
{
|
||||
list_length = locate_Total_Pos_Table(&PCB, &k_code, &list, k_mer_length, &sub_ID);
|
||||
|
||||
if (list_length != 0)
|
||||
{
|
||||
append_k_mer_pos_list_alloc(&array_list, list, list_length, end_pos, 0);
|
||||
}
|
||||
///merge_Candidates_list(&l, list, list_length, end_pos, 0);
|
||||
//merge_Candidates_list_version(&debug_l, list, list_length, end_pos, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
avalible_k = 0;
|
||||
init_Hash_code(&k_code);
|
||||
}
|
||||
|
||||
///HPC_base++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
///reverse complement strand
|
||||
reverse_complement(g_read.seq, g_read.length);
|
||||
init_HPC_seq(&HPC_read, g_read.seq, g_read.length);
|
||||
init_Hash_code(&k_code);
|
||||
avalible_k = 0;
|
||||
|
||||
while ((code = get_HPC_code(&HPC_read, &end_pos)) != 6)
|
||||
{
|
||||
if(code < 4)
|
||||
{
|
||||
k_mer_append(&k_code,code,k_mer_length);
|
||||
avalible_k++;
|
||||
if (avalible_k>=k_mer_length)
|
||||
{
|
||||
list_length = locate_Total_Pos_Table(&PCB, &k_code, &list, k_mer_length, &sub_ID);
|
||||
if (list_length != 0)
|
||||
{
|
||||
append_k_mer_pos_list_alloc(&array_list, list, list_length, end_pos, 1);
|
||||
}
|
||||
///merge_Candidates_list(&l, list, list_length, end_pos, 1);
|
||||
//merge_Candidates_list_version(&debug_l, list, list_length, end_pos, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
avalible_k = 0;
|
||||
init_Hash_code(&k_code);
|
||||
}
|
||||
|
||||
///HPC_base++;
|
||||
}
|
||||
|
||||
///merge_k_mer_pos_list_alloc(&array_list, &l);
|
||||
merge_k_mer_pos_list_alloc_heap_sort(&array_list, &l, &heap);
|
||||
/**
|
||||
if (array_list.length < 3)
|
||||
{
|
||||
merge_k_mer_pos_list_alloc(&array_list, &l);
|
||||
}
|
||||
else
|
||||
{
|
||||
merge_k_mer_pos_list_alloc_heap_sort_advance(&array_list, &l, &heap);
|
||||
}
|
||||
**/
|
||||
|
||||
|
||||
///merge_k_mer_pos_list_alloc_heap_sort_advance(&array_list, &l, &heap);
|
||||
|
||||
|
||||
|
||||
///debug_merge_result(&l, &debug_l);
|
||||
|
||||
}
|
||||
|
||||
destory_Candidates_list(&l);
|
||||
//destory_Candidates_list(&debug_l);
|
||||
|
||||
destory_Heap(&heap);
|
||||
destory_k_mer_pos_list_alloc(&array_list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -698,7 +837,8 @@ void Overlap_calculate_multipe_thr()
|
||||
int *arg = (int*)malloc(sizeof(*arg));
|
||||
*arg = i;
|
||||
|
||||
pthread_create(_r_threads + i, NULL, Overlap_calculate, (void*)arg);
|
||||
pthread_create(_r_threads + i, NULL, Overlap_calculate_heap_merge, (void*)arg);
|
||||
//pthread_create(_r_threads + i, NULL, Overlap_calculate, (void*)arg);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user