best flipping

This commit is contained in:
chhylp123
2021-04-14 18:50:20 -04:00
parent 67c7218264
commit 1e86e3dc02
7 changed files with 845 additions and 178 deletions
+135 -24
View File
@@ -12235,7 +12235,7 @@ trans_chain* init_trans_chain(ma_ug_t *ug, uint64_t r_num)
memset(&(x->b_buf_1), 0, sizeof(buf_t));
kv_init(x->topo_buf);
kv_init(x->topo_res);
MALLOC(x->uLen, x->u_num);
///MALLOC(x->uLen, x->u_num);
kv_init(x->c_buf);
ma_utg_t *u = NULL;
@@ -12263,7 +12263,7 @@ trans_chain* init_trans_chain(ma_ug_t *ug, uint64_t r_num)
offset += (uint32_t)u->a[k];
}
x->uLen[v] = u->len;
///x->uLen[v] = u->len;
}
if(is_dup)
@@ -12315,7 +12315,7 @@ void destory_trans_chain(trans_chain **x)
kv_destroy((*x)->topo_buf);
kv_destroy((*x)->topo_res);
kv_destroy((*x)->c_buf);
free((*x)->uLen);
///free((*x)->uLen);
free((*x));
}
}
@@ -12502,6 +12502,88 @@ void hic_clean(asg_t* read_g)
kv_destroy(ax);
}
void write_trans_chain(trans_chain* t_ch, const char *fn)
{
char *buf = (char*)calloc(strlen(fn) + 25, 1);
sprintf(buf, "%s.hic.trans.bin", fn);
FILE* fp = fopen(buf, "w");
fwrite(&t_ch->u_num, sizeof(t_ch->u_num), 1, fp);
fwrite(&t_ch->r_num, sizeof(t_ch->r_num), 1, fp);
fwrite(t_ch->rUidx, sizeof(uint32_t), t_ch->r_num, fp);
fwrite(t_ch->rUpos, sizeof(uint64_t), t_ch->r_num, fp);
fwrite(t_ch->is_r_het, sizeof(uint8_t), t_ch->r_num, fp);
uint32_t i;
fwrite(&t_ch->bed.n, sizeof(t_ch->bed.n), 1, fp);
for (i = 0; i < t_ch->bed.n; i++)
{
fwrite(&t_ch->bed.a[i].n, sizeof(t_ch->bed.a[i].n), 1, fp);
fwrite(t_ch->bed.a[i].a, sizeof(bed_interval), t_ch->bed.a[i].n, fp);
}
fwrite(&t_ch->k_trans.n, sizeof(t_ch->k_trans.n), 1, fp);
fwrite(t_ch->k_trans.a, sizeof(u_trans_t), t_ch->k_trans.n, fp);
fwrite(&t_ch->k_trans.idx.n, sizeof(t_ch->k_trans.idx.n), 1, fp);
fwrite(t_ch->k_trans.idx.a, sizeof(uint64_t), t_ch->k_trans.idx.n, fp);
fclose(fp);
free(buf);
}
trans_chain* load_hc_hits(const char *fn)
{
uint64_t flag = 0;
char *buf = (char*)calloc(strlen(fn) + 25, 1);
sprintf(buf, "%s.hic.trans.bin", fn);
FILE* fp = NULL;
fp = fopen(buf, "r");
if(!fp) return NULL;
trans_chain *t_ch = NULL;
CALLOC(t_ch, 1);
flag += fread(&t_ch->u_num, sizeof(t_ch->u_num), 1, fp);
flag += fread(&t_ch->r_num, sizeof(t_ch->r_num), 1, fp);
MALLOC(t_ch->rUidx, t_ch->r_num);
flag += fread(t_ch->rUidx, sizeof(uint32_t), t_ch->r_num, fp);
MALLOC(t_ch->rUpos, t_ch->r_num);
flag += fread(t_ch->rUpos, sizeof(uint64_t), t_ch->r_num, fp);
MALLOC(t_ch->is_r_het, t_ch->r_num);
flag += fread(t_ch->is_r_het, sizeof(uint8_t), t_ch->r_num, fp);
uint32_t i;
flag += fread(&t_ch->bed.n, sizeof(t_ch->bed.n), 1, fp);
MALLOC(t_ch->bed.a, t_ch->bed.n); t_ch->bed.m = t_ch->bed.n;
for (i = 0; i < t_ch->bed.n; i++)
{
flag += fread(&t_ch->bed.a[i].n, sizeof(t_ch->bed.a[i].n), 1, fp);
MALLOC(t_ch->bed.a[i].a, t_ch->bed.a[i].n); t_ch->bed.a[i].m = t_ch->bed.a[i].n;
flag += fread(t_ch->bed.a[i].a, sizeof(bed_interval), t_ch->bed.a[i].n, fp);
}
flag += fread(&t_ch->k_trans.n, sizeof(t_ch->k_trans.n), 1, fp);
MALLOC(t_ch->k_trans.a, t_ch->k_trans.n); t_ch->k_trans.m = t_ch->k_trans.n;
flag += fread(t_ch->k_trans.a, sizeof(u_trans_t), t_ch->k_trans.n, fp);
flag += fread(&t_ch->k_trans.idx.n, sizeof(t_ch->k_trans.idx.n), 1, fp);
MALLOC(t_ch->k_trans.idx.a, t_ch->k_trans.idx.n); t_ch->k_trans.idx.m = t_ch->k_trans.idx.n;
flag += fread(t_ch->k_trans.idx.a, sizeof(uint64_t), t_ch->k_trans.idx.n, fp);
fclose(fp);
free(buf);
fprintf(stderr, "[M::%s::] ==> Hi-C cov have been loaded\n", __func__);
return t_ch;
}
void clean_u_trans_t_idx(kv_u_trans_t *ta, ma_ug_t *ug, asg_t *read_g);
void output_hic_graph(asg_t *sg, ma_sub_t* coverage_cut, char* output_file_name,
ma_hit_t_alloc* sources, ma_hit_t_alloc* reverse_sources,
@@ -12519,31 +12601,59 @@ bub_label_t* b_mask_t)
new_rtg_edges.a.n = 0;
ma_ug_seq(ug, sg, &R_INF, coverage_cut, sources, &new_rtg_edges, max_hang, min_ovlp, &d_edges);///polish
new_rtg_edges.a.n = 0;
hap_cov_t *cov = NULL;
asg_t *copy_sg = copy_read_graph(sg);
ma_ug_t *copy_ug = copy_untig_graph(ug);
///asm_opt.purge_overlap_len = asm_opt.purge_overlap_len_hic;
///asm_opt.purge_simi_thres = asm_opt.purge_simi_rate_hic;
adjust_utg_by_primary(&copy_ug, copy_sg, TRIO_THRES, sources, reverse_sources, coverage_cut,
tipsLen, tip_drop_ratio, stops_threshold, ruIndex, chimeric_rate, drop_ratio,
max_hang, min_ovlp, &new_rtg_edges, &cov, b_mask_t, 1);
trans_chain* t_ch = load_hc_hits(output_file_name);
if(!t_ch)
{
new_rtg_edges.a.n = 0;
asg_t *copy_sg = copy_read_graph(sg);
ma_ug_t *copy_ug = copy_untig_graph(ug);
///asm_opt.purge_overlap_len = asm_opt.purge_overlap_len_hic;
///asm_opt.purge_simi_thres = asm_opt.purge_simi_rate_hic;
adjust_utg_by_primary(&copy_ug, copy_sg, TRIO_THRES, sources, reverse_sources, coverage_cut,
tipsLen, tip_drop_ratio, stops_threshold, ruIndex, chimeric_rate, drop_ratio,
max_hang, min_ovlp, &new_rtg_edges, &cov, b_mask_t, 1);
print_utg(copy_ug, copy_sg, coverage_cut, output_file_name, sources, ruIndex, max_hang,
min_ovlp, &new_rtg_edges);
print_utg(copy_ug, copy_sg, coverage_cut, output_file_name, sources, ruIndex, max_hang,
min_ovlp, &new_rtg_edges);
ma_ug_destroy(copy_ug);
asg_destroy(copy_sg);
ma_ug_destroy(copy_ug);
asg_destroy(copy_sg);
clean_u_trans_t_idx(&(cov->t_ch->k_trans), ug, sg);
clean_u_trans_t_idx(&(cov->t_ch->k_trans), ug, sg);
new_rtg_edges.a.n = 0;
ma_ug_print_bed(ug, sg, &R_INF, coverage_cut, sources, &new_rtg_edges,
max_hang, min_ovlp, asm_opt.hic_inconsist_rate, NULL, NULL, cov);
write_trans_chain(cov->t_ch, output_file_name);
}
new_rtg_edges.a.n = 0;
ma_ug_print_bed(ug, sg, &R_INF, coverage_cut, sources, &new_rtg_edges,
max_hang, min_ovlp, asm_opt.hic_inconsist_rate, NULL, NULL, cov);
hic_analysis(ug, sg, cov);
hic_analysis(ug, sg, cov?cov->t_ch:t_ch);
destory_hap_cov_t(&cov);
fprintf(stderr, "sa-0-sa\n");
char* gfa_name = (char*)malloc(strlen(output_file_name)+25);
sprintf(gfa_name, "%s.d_utg.noseq.gfa", output_file_name);
FILE* output_file = fopen(gfa_name, "w");
ma_ug_print_simple(ug, &R_INF, sg, coverage_cut, sources, ruIndex, "utg", output_file);
fclose(output_file);
free(gfa_name);
fprintf(stderr, "sa-1-sa\n");
if(cov) destory_hap_cov_t(&cov);
if(t_ch) destory_trans_chain(&t_ch);
fprintf(stderr, "sa-2-sa\n");
ma_ug_destroy(ug);
kv_destroy(new_rtg_edges.a);
@@ -12743,7 +12853,8 @@ void kt_u_trans_t_idx(kv_u_trans_t *ta, uint32_t n)
uint32_t get_u_trans_spec(kv_u_trans_t *ta, uint32_t qn, uint32_t tn, u_trans_t **r_a, uint32_t *occ)
{
(*r_a) = NULL; (*occ) = 0;
if(r_a) (*r_a) = NULL;
if(occ) (*occ) = 0;
u_trans_t *a = NULL;
uint32_t n, st, i;
a = u_trans_a(*ta, qn);
@@ -12754,8 +12865,8 @@ uint32_t get_u_trans_spec(kv_u_trans_t *ta, uint32_t qn, uint32_t tn, u_trans_t
{
if(a[st].tn == tn)
{
(*r_a) = a + st;
(*occ) = i - st;
if(r_a) (*r_a) = a + st;
if(occ) (*occ) = i - st;
return 1;
}
st = i;
+3 -1
View File
@@ -1110,7 +1110,7 @@ typedef struct{
kvec_t(uint32_t) topo_buf;
kvec_t(uint32_t) topo_res;
buf_t b_buf_0, b_buf_1;
uint32_t* uLen;
///uint32_t* uLen;
kv_u_trans_t k_trans;
kv_u_trans_hit_t k_t_b;
kv_ca_buf_t c_buf;
@@ -1181,6 +1181,8 @@ uint32_t *pri_a, uint32_t pri_n, uint32_t pri_beg, uint64_t *i_pri_len,
uint32_t *aux_a, uint32_t aux_n, uint32_t aux_beg, uint64_t *i_aux_len,
ma_ug_t *ug, uint32_t flag, double overall_score, const char* cmd);
int asg_arc_del_trans(asg_t *g, int fuzz);
void kt_u_trans_t_idx(kv_u_trans_t *ta, uint32_t n);
uint32_t get_u_trans_spec(kv_u_trans_t *ta, uint32_t qn, uint32_t tn, u_trans_t **r_a, uint32_t *occ);
#define JUNK_COV 5
#define DISCARD_RATE 0.8
+1 -1
View File
@@ -5237,7 +5237,7 @@ uint32_t just_coverage, hap_cov_t *cov, uint32_t collect_p_trans)
if(asm_opt.polyploidy <= 2)
{
mc_solve(&all_ovlp, cov->t_ch, NULL, ug, read_g, 0.8, R_INF.trio_flag);
mc_solve(&all_ovlp, cov->t_ch, NULL, ug, read_g, 0.8, R_INF.trio_flag, 1, NULL, 1);
///pt_solve(&all_ovlp, cov->t_ch, ug, read_g, 0.8, R_INF.trio_flag);
}
+593 -122
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -11,7 +11,7 @@
hc_edge* get_hc_edge(hc_links* link, uint64_t src, uint64_t dest, uint64_t dir);
void push_hc_edge(hc_linkeage* x, uint64_t uID, double weight, int dir, uint64_t* d);
void hic_analysis(ma_ug_t *ug, asg_t* read_g, hap_cov_t *cov);
void hic_analysis(ma_ug_t *ug, asg_t* read_g, trans_chain* t_ch);
void hic_benchmark(ma_ug_t *ug, asg_t* read_g);
typedef struct {
+107 -28
View File
@@ -32,39 +32,49 @@ typedef struct {
typedef struct {
uint64_t x; // RNG
uint32_t cc_off, cc_size;
///uint32_t n_cc_edge, m_cc_edge;
///uint64_t *cc_edge;
kvec_t(uint64_t) cc_edge;
uint32_t n_sub;
uint32_t *cc_node;
uint32_t *bfs, *bfs_mark;
mc_pairsc_t *z, *z_opt;///keep scores to nodes(1) and nodes(-1)
int8_t *s, *s_opt;
uint8_t *f;
} mc_svaux_t;
void mc_opt_init(mc_opt_t *opt)
{
memset(opt, 0, sizeof(mc_opt_t));
opt->n_perturb = 5000;
///opt->n_perturb = 5000;
opt->n_perturb = 100000;
opt->f_perturb = 0.1;
opt->max_iter = 1000;
opt->seed = 11;
}
mc_g_t *init_mc_g_t(ma_ug_t *ug, asg_t *read_g)
mc_g_t *init_mc_g_t(ma_ug_t *ug, asg_t *read_g, int8_t *s, uint32_t renew_s)
{
mc_g_t *p = NULL; CALLOC(p, 1);
p->ug = ug;
p->rg = read_g;
kv_init(p->s);
CALLOC(p->s.a, ug->g->n_seq);
p->s.n = p->s.m = ug->g->n_seq;
if(s)
{
p->s.a = s;
p->s.n = ug->g->n_seq;
p->s.m = 0;
if(renew_s) memset(p->s.a, 0, p->s.n);
}
else
{
CALLOC(p->s.a, ug->g->n_seq);
p->s.n = p->s.m = ug->g->n_seq;
}
return p;
}
void destory_mc_g_t(mc_g_t **p)
{
if(!p || !(*p)) return;
if((*p)->s.m == 0) (*p)->s.a = NULL;
kv_destroy((*p)->s);
if((*p)->e)
{
@@ -258,7 +268,7 @@ trans_chain* t_ch)
}
}
void update_mc_edges(mc_g_t *mg, hap_overlaps_list* ha, kv_u_trans_t *ta, trans_chain* t_ch, double f_rate)
void update_mc_edges(mc_g_t *mg, hap_overlaps_list* ha, kv_u_trans_t *ta, trans_chain* t_ch, double f_rate, uint32_t is_sys)
{
uint32_t v, i, k, qn, tn, qs, qe, ts, te, occ, as, ae, l, offset, l_pos;
uint64_t hetLen, homLen, oLen;
@@ -297,7 +307,7 @@ void update_mc_edges(mc_g_t *mg, hap_overlaps_list* ha, kv_u_trans_t *ta, trans_
kv_push(uint32_t, p_idx, p.n);
}
debug_mc_interval_t(p.a, p.n, p_idx.a, mg->ug, mg->rg, t_ch);
///debug_mc_interval_t(p.a, p.n, p_idx.a, mg->ug, mg->rg, t_ch);
}
if(!mg->e)
@@ -455,17 +465,17 @@ void update_mc_edges(mc_g_t *mg, hap_overlaps_list* ha, kv_u_trans_t *ta, trans_
if(hetLen <= ((hetLen + homLen)*f_rate)) continue;
/*****************tn*****************/
kv_pushp(mc_edge_t, mg->e->ma, &ma);
ma->x = (uint64_t)ta->a[i].qn << 32 | ta->a[i].tn;
ma->w = ta->a[i].nw;
}
kv_pushp(mc_edge_t, mg->e->ma, &ma);
ma->x = (uint64_t)ta->a[i].qn << 32 | ta->a[i].tn;
ma->w = w_cast(ta->a[i].nw);
}
}
radix_sort_mce(mg->e->ma.a, mg->e->ma.a + mg->e->ma.n);
mc_merge_dup(mg);
mc_edges_idx(mg->e);
mc_edges_symm(mg->e);
if(is_sys) mc_edges_symm(mg->e);
kv_destroy(p); kv_destroy(p_idx);
}
@@ -577,6 +587,7 @@ mc_svaux_t *mc_svaux_init(const mc_g_t *mg, uint64_t x)
MALLOC(b->bfs_mark, ma->n_seq);
CALLOC(b->z, ma->n_seq);
CALLOC(b->z_opt, ma->n_seq);
CALLOC(b->f, ma->n_seq);
return b;
}
void mc_svaux_destroy(mc_svaux_t *b)
@@ -586,9 +597,32 @@ void mc_svaux_destroy(mc_svaux_t *b)
free(b->s); free(b->s_opt);
free(b->z); free(b->z_opt);
free(b->bfs); free(b->bfs_mark);
free(b->f);
free(b);
}
uint32_t mc_best(const mc_match_t *ma, mc_svaux_t *b)
{
uint32_t i, max_i = (uint32_t)-1;
t_w_t w, max_w;
for (i = 0, max_w = -1; i < b->cc_size; ++i) {
uint32_t k = (uint32_t)ma->cc[b->cc_off + i];///uid
if(b->f[k] || b->s[k] == 0) continue;
///z += -((t_w_t)(b->s[k])) * (b->z[k].z[0] - b->z[k].z[1]);
///-((t_w_t)(b->s[k])) * (b->z[k].z[0] - b->z[k].z[1]) current
///((t_w_t)(b->s[k])) * (b->z[k].z[0] - b->z[k].z[1]) flipped
w = ((t_w_t)(b->s[k])) * (b->z[k].z[0] - b->z[k].z[1]) * 2;
if(w <= 0) continue;
if(w > max_w)
{
w = max_w; max_i = k;
}
}
return max_i;
}
t_w_t mc_score(const mc_match_t *ma, mc_svaux_t *b)
{
uint32_t i;
@@ -672,14 +706,40 @@ static void mc_set_spin(const mc_match_t *ma, mc_svaux_t *b, uint32_t k, int8_t
b->s[k] = s;
}
static t_w_t mc_optimize_local(const mc_opt_t *opt, const mc_match_t *ma, mc_svaux_t *b, uint32_t *n_iter)
t_w_t mc_best_flip(const mc_match_t *ma, mc_svaux_t *b, t_w_t *sc_max)
{
uint32_t idx, k;
t_w_t z = 0, w = 0;
for (idx = 0; idx < b->cc_size; ++idx) {
k = (uint32_t)ma->cc[b->cc_off + idx];
b->f[k] = 0;
z += -((t_w_t)(b->s[k])) * (b->z[k].z[0] - b->z[k].z[1]);
///b->f[(uint32_t)ma->cc[b->cc_off + idx]] = 0;
///uint32_t k = (uint32_t)ma->cc[b->cc_off + idx];///uid
}
while (1)
{
idx = mc_best(ma, b);
if(idx == (uint32_t)-1) break;
w = ((t_w_t)(b->s[k])) * (b->z[k].z[0] - b->z[k].z[1]) * 4;
if(sc_max && (*sc_max) >= (z + w)) break;
z += w;
mc_set_spin(ma, b, idx, -b->s[idx]);
b->f[idx] = 1;
}
return z;
}
static t_w_t mc_optimize_local(const mc_opt_t *opt, const mc_match_t *ma, mc_svaux_t *b, uint32_t *n_iter, t_w_t *sc_max)
{
uint32_t i, n_flip = 0;
int32_t n_iter_local = 0;
while (n_iter_local < opt->max_iter) {
uint32_t i, n_flip = 0;
++(*n_iter);
ks_shuffle_uint32_t(b->cc_size, b->cc_node, &b->x);
for (i = 0; i < b->cc_size; ++i) {
for (i = n_flip = 0; i < b->cc_size; ++i) {
uint32_t k = b->cc_node[i];///uid
int8_t s;
if (b->z[k].z[0] == b->z[k].z[1]) continue;
@@ -692,6 +752,14 @@ static t_w_t mc_optimize_local(const mc_opt_t *opt, const mc_match_t *ma, mc_sva
++n_iter_local;
if (n_flip == 0) break;
}
if(n_flip != 0)
{
t_w_t z_debug = mc_best_flip(ma, b, sc_max);
if(z_debug != mc_score(ma, b)) fprintf(stderr, "ERROR\n");
return z_debug;
}
return mc_score(ma, b);
}
@@ -743,25 +811,37 @@ static void mc_perturb_node(const mc_opt_t *opt, const mc_match_t *ma, mc_svaux_
uint32_t mc_solve_cc(const mc_opt_t *opt, const mc_g_t *mg, mc_svaux_t *b, uint32_t cc_off, uint32_t cc_size)
{
uint32_t j, k, n_iter = 0;
t_w_t /**sc_ori,**/ sc_opt = -(1<<30), sc;///problem-w
t_w_t sc_opt = -(1<<30), sc;///problem-w
b->cc_off = cc_off, b->cc_size = cc_size;
if (b->cc_size < 2) return 0;
// first guess
/**sc_ori =**/ mc_init_spin(opt, mg->e, b);
sc_opt = mc_init_spin(opt, mg->e, b);
if (b->cc_size == 2) return 0;
// optimize
sc_opt = mc_optimize_local(opt, mg->e, b, &n_iter);
for (j = 0; j < b->cc_size; ++j) {///backup s and z in s_opt and z_opt
b->s_opt[b->cc_node[j]] = b->s[b->cc_node[j]]; ///hap status of each unitig
b->z_opt[b->cc_node[j]] = b->z[b->cc_node[j]]; ///z[0]: positive weight; z[1]: positive weight
}
sc = mc_optimize_local(opt, mg->e, b, &n_iter, &sc_opt);
if (sc > sc_opt) {
for (j = 0; j < b->cc_size; ++j) {
b->s_opt[b->cc_node[j]] = b->s[b->cc_node[j]];
b->z_opt[b->cc_node[j]] = b->z[b->cc_node[j]];
}
sc_opt = sc;
} else {
for (j = 0; j < b->cc_size; ++j) {
b->s[b->cc_node[j]] = b->s_opt[b->cc_node[j]];
b->z[b->cc_node[j]] = b->z_opt[b->cc_node[j]];
}
}
// fprintf(stderr, "\ncc_size: %u, cc_off: %u\n", b->cc_size, b->cc_off);
for (k = 0; k < (uint32_t)opt->n_perturb; ++k) {
if (k&1) mc_perturb(opt, mg->e, b);
else mc_perturb_node(opt, mg->e, b, 3);
sc = mc_optimize_local(opt, mg->e, b, &n_iter);
sc = mc_optimize_local(opt, mg->e, b, &n_iter, &sc_opt);
// fprintf(stderr, "(%u) sc_opt: %f, sc: %f\n", k, sc_opt, sc);
if (sc > sc_opt) {
for (j = 0; j < b->cc_size; ++j) {
b->s_opt[b->cc_node[j]] = b->s[b->cc_node[j]];
@@ -901,13 +981,13 @@ void p_nodes(mc_g_t *mg, trans_chain* t_ch, uint8_t* trio_flag)
}
}
void mc_solve(hap_overlaps_list* ovlp, trans_chain* t_ch, kv_u_trans_t *ta, ma_ug_t *ug, asg_t *read_g, double f_rate, uint8_t* trio_flag)
void mc_solve(hap_overlaps_list* ovlp, trans_chain* t_ch, kv_u_trans_t *ta, ma_ug_t *ug, asg_t *read_g, double f_rate, uint8_t* trio_flag, uint32_t renew_s, int8_t *s, uint32_t is_sys)
{
mc_opt_t opt;
mc_opt_init(&opt);
mc_g_t *mg = init_mc_g_t(ug, read_g);
update_mc_edges(mg, ovlp, ta, t_ch, f_rate);
debug_mc_g_t(mg);
mc_g_t *mg = init_mc_g_t(ug, read_g, s, renew_s);
update_mc_edges(mg, ovlp, ta, t_ch, f_rate, is_sys);
///debug_mc_g_t(mg);
mc_solve_core(&opt, mg);
if((asm_opt.flag & HA_F_PARTITION) && t_ch)
@@ -917,6 +997,5 @@ void mc_solve(hap_overlaps_list* ovlp, trans_chain* t_ch, kv_u_trans_t *ta, ma_u
if(ovlp) clean_ovlp_by_mc(mg, ovlp);
destory_mc_g_t(&mg);
}
+5 -1
View File
@@ -16,8 +16,12 @@ typedef struct {
#define mc_node_t int8_t
// #define w_t int32_t
// #define t_w_t int64_t
// #define w_cast(x) ((t_w_t)((x) < 0 ? (x) - 0.5 : (x) + 0.5))
#define w_t double
#define t_w_t double
#define w_cast(x) ((t_w_t)((x)))
typedef struct {
uint64_t x; ///(uint64_t)nid1 << 32 | nid2;
@@ -38,5 +42,5 @@ typedef struct {
mc_match_t* e;
}mc_g_t;
void mc_solve(hap_overlaps_list* ovlp, trans_chain* t_ch, kv_u_trans_t *ta, ma_ug_t *ug, asg_t *read_g, double f_rate, uint8_t* trio_flag);
void mc_solve(hap_overlaps_list* ovlp, trans_chain* t_ch, kv_u_trans_t *ta, ma_ug_t *ug, asg_t *read_g, double f_rate, uint8_t* trio_flag, uint32_t renew_s, int8_t *s, uint32_t is_sys);
#endif