From 02fa015e2850f1b1f7c3b084d7f5ed389886c797 Mon Sep 17 00:00:00 2001 From: chhylp123 Date: Sat, 13 Feb 2021 23:58:39 -0500 Subject: [PATCH] fix memory leak --- Overlaps.cpp | 4 ++-- hic.cpp | 9 +++++---- hifiasm.1 | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Overlaps.cpp b/Overlaps.cpp index 3cc16e6..21c8d28 100644 --- a/Overlaps.cpp +++ b/Overlaps.cpp @@ -11601,7 +11601,6 @@ void init_hc_links(hc_links* link, uint64_t ug_num, uint64_t r_num) { kv_init(link->bed.a[i]); } - } void destory_hc_links(hc_links* link) @@ -11619,6 +11618,7 @@ void destory_hc_links(hc_links* link) kv_destroy(link->bed.a[i]); } kv_destroy(link->bed); + kv_destroy(link->enzymes); } void pop_small_bub(ma_ug_t *ug) @@ -11855,7 +11855,7 @@ R_to_U* ruIndex, float chimeric_rate, float drop_ratio, int max_hang, int min_ov ma_ug_destroy(ug); kv_destroy(new_rtg_edges.a); - ///output_unitig_graph(sg, coverage_cut, output_file_name, sources, ruIndex, max_hang, min_ovlp); + output_unitig_graph(sg, coverage_cut, output_file_name, sources, ruIndex, max_hang, min_ovlp); output_trio_unitig_graph(sg, coverage_cut, output_file_name, FATHER, sources, reverse_sources, bubble_dist, (asm_opt.max_short_tip*2), 0.15, 3, ruIndex, 0.05, 0.9, max_hang, min_ovlp, 0); diff --git a/hic.cpp b/hic.cpp index b235d0d..4e6081d 100644 --- a/hic.cpp +++ b/hic.cpp @@ -444,7 +444,7 @@ void hc_pt_t_gen_single(hc_pt1_t* pt, uint64_t* up_bound) int write_hc_pt_index(ha_ug_index* idx, char* file_name) { char* gfa_name = (char*)malloc(strlen(file_name)+25); - sprintf(gfa_name, "%s.hc_tlb", file_name); + sprintf(gfa_name, "%s.hic.tlb.bin", file_name); FILE* fp = fopen(gfa_name, "w"); if (!fp) { free(gfa_name); @@ -481,7 +481,7 @@ int load_hc_pt_index(ha_ug_index** r_idx, char* file_name) uint64_t flag = 0; double index_time = yak_realtime(); char* gfa_name = (char*)malloc(strlen(file_name)+25); - sprintf(gfa_name, "%s.hc_tlb", file_name); + sprintf(gfa_name, "%s.hic.tlb.bin", file_name); FILE* fp = fopen(gfa_name, "r"); if (!fp) { free(gfa_name); @@ -2142,6 +2142,7 @@ void destory_pdq(pdq* q) { kv_destroy(q->x); kv_destroy(q->dis); + kv_destroy(q->vis); } void reset_pdq(pdq* q) @@ -2889,7 +2890,7 @@ int load_hc_links(hc_links* link, const char *fn) void write_hc_hits(kvec_pe_hit* hits, const char *fn) { char *buf = (char*)calloc(strlen(fn) + 25, 1); - sprintf(buf, "%s.hic.lk", fn); + sprintf(buf, "%s.hic.lk.bin", fn); FILE* fp = fopen(buf, "w"); fwrite(&hits->a.n, sizeof(hits->a.n), 1, fp); @@ -2903,7 +2904,7 @@ int load_hc_hits(kvec_pe_hit* hits, const char *fn) { uint64_t flag = 0; char *buf = (char*)calloc(strlen(fn) + 25, 1); - sprintf(buf, "%s.hic.lk", fn); + sprintf(buf, "%s.hic.lk.bin", fn); FILE* fp = NULL; fp = fopen(buf, "r"); diff --git a/hifiasm.1 b/hifiasm.1 index d2e5b36..42bb851 100644 --- a/hifiasm.1 +++ b/hifiasm.1 @@ -384,6 +384,21 @@ phased maternal/haplotype2 contig graph. This graph keeps the phased maternal/haplotype2 assembly. .RE +.PP +With Hi-C partition, hifiasm outputs the assembly graphs like trio partition, +but with additional prefix +.B [hic]. +In this mode, hifiasm keeps Hi-C alignment results and Hi-C index in two bin +files: +.B *hic.lk.bin +and +.B *hic.tlb.bin. +Rerunning hifiasm with different Hi-C reads needs to delete these bin files. +.RE + + + + .PP For each graph, hifiasm also outputs a simplified version without sequences for the ease of visualization. Hifiasm keeps corrected reads and overlaps in three