mirror of
https://github.com/chhylp123/hifiasm.git
synced 2026-10-03 12:48:11 +08:00
resolve centromere
This commit is contained in:
+39
-7
@@ -2242,10 +2242,10 @@ uint32_t* xBeg, uint32_t* xEnd, uint32_t* yBeg, uint32_t* yEnd)
|
||||
KRADIX_SORT_INIT(i32, int32_t, generic_key, sizeof(int32_t))
|
||||
|
||||
long long get_chain_score(ma_utg_t *xReads, asg_t *read_g, kvec_asg_arc_t_offset* u_buffer, kvec_t_i32_warp* tailIndex, kvec_t_i32_warp* idx,
|
||||
ma_hit_t_alloc* reverse_sources, long long xBegPos, long long xEndPos)
|
||||
ma_hit_t_alloc* reverse_sources, long long xBegPos, long long xEndPos, uint32_t xUid, uint32_t yUid)
|
||||
{
|
||||
long long offset, r_beg, r_end, inp_beg, inp_end, hap_beg, hap_end, inp_match, hap_match, ovlp;
|
||||
uint64_t i, k, rId;
|
||||
uint64_t i, k, rId, all, found;
|
||||
idx->a.n = 0;
|
||||
|
||||
for (i = k = 0; i < tailIndex->a.n; i++)
|
||||
@@ -2331,8 +2331,19 @@ ma_hit_t_alloc* reverse_sources, long long xBegPos, long long xEndPos)
|
||||
// if(inp_match > hap_match) fprintf(stderr, "ERROR3\n");
|
||||
// fprintf(stderr, "tailIndex->a.n: %u, xReads->n: %u, total_match: %lld, hap_match: %lld, inp_match: %lld\n",
|
||||
// tailIndex->a.n, xReads->n, (xEndPos - xBegPos + 1), hap_match, inp_match);
|
||||
|
||||
return ((double)(inp_match)*CHAIN_MATCH) - ((double)(hap_match-inp_match)*CHAIN_UNMATCH);
|
||||
double base_w = 0, k_w = 1;
|
||||
base_w = ((double)(inp_match)*CHAIN_MATCH) - ((double)(hap_match-inp_match)*CHAIN_UNMATCH);
|
||||
if(base_w <= 0) return base_w; ///hard filter
|
||||
|
||||
if(!count_unique_k_mers(xReads->s + xBegPos, xEndPos+1-xBegPos, xUid, yUid, &all, &found))
|
||||
{
|
||||
return base_w;
|
||||
}
|
||||
|
||||
if(all > 0) k_w += ((double)(found)/(double)(all));
|
||||
|
||||
return (base_w*k_w)/2;
|
||||
// return ((double)(inp_match)*CHAIN_MATCH) - ((double)(hap_match-inp_match)*CHAIN_UNMATCH);
|
||||
}
|
||||
|
||||
|
||||
@@ -2378,7 +2389,7 @@ kvec_t_i32_warp* prevIndex, long long* r_x_pos_beg, long long* r_x_pos_end, long
|
||||
hap_can->weight = xLeftMatch;
|
||||
hap_can->index_beg = xLeftTotal;
|
||||
hap_can->score = get_chain_score(xReads, read_g, u_buffer, tailIndex, prevIndex, reverse_sources,
|
||||
(*r_x_pos_beg), (*r_x_pos_end));
|
||||
(*r_x_pos_beg), (*r_x_pos_end), xUid, yUid);
|
||||
if(hap_can->score <= 0) return (uint32_t)-1;
|
||||
return hap_can->index_end;
|
||||
}
|
||||
@@ -2541,7 +2552,14 @@ long long* r_y_pos_beg, long long* r_y_pos_end, float *sim)
|
||||
(*sim) = ((double)xLeftMatch)/((double)xLeftTotal);
|
||||
if(xLeftMatch == 0 || xLeftTotal == 0 || xLeftMatch <= xLeftTotal*Hap_rate)
|
||||
{
|
||||
return NON_PLOID;
|
||||
uint64_t all, found;
|
||||
if(!count_unique_k_mers(xReads->s + (*r_x_pos_beg), (*r_x_pos_end)+1-(*r_x_pos_beg),
|
||||
xUid, yUid, &all, &found))
|
||||
{
|
||||
return NON_PLOID;
|
||||
}
|
||||
(*sim) = MAX((*sim), (((double)found)/((double)all)));
|
||||
if(found == 0 || all == 0 || found <= all*Hap_rate) return NON_PLOID;
|
||||
}
|
||||
|
||||
return PLOID;
|
||||
@@ -5263,7 +5281,12 @@ uint32_t just_coverage, hap_cov_t *cov, uint32_t collect_p_trans, uint32_t colle
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(just_coverage == 0)
|
||||
{
|
||||
ma_ug_seq(ug, read_g, coverage_cut, sources, edge, max_hang, min_ovlp, 0, 0);
|
||||
}
|
||||
init_ug_idx(ug, asm_opt.k_mer_length, asm_opt.polyploidy, 2, !just_coverage);
|
||||
|
||||
init_hap_alignment_struct_pip(&hap_buf, asm_opt.thread_num, nsg->n_seq, ug, read_g,
|
||||
sources, reverse_sources, ruIndex, coverage_cut, position_index, density, max_hang, min_ovlp,
|
||||
0.1, &all_ovlp, cov);
|
||||
@@ -5392,4 +5415,13 @@ uint32_t just_coverage, hap_cov_t *cov, uint32_t collect_p_trans, uint32_t colle
|
||||
else free(position_index);
|
||||
destory_hap_alignment_struct_pip(&hap_buf);
|
||||
destory_p_g_t(&pg);
|
||||
if(just_coverage == 0)
|
||||
{
|
||||
des_ug_idx();
|
||||
for (i = 0; i < ug->u.n; i++)
|
||||
{
|
||||
free(ug->u.a[i].s);
|
||||
ug->u.a[i].s = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user