Skip to content

Commit

Permalink
Merge pull request #180 from pangenome/update_seg_fault_abpoa
Browse files Browse the repository at this point in the history
update `abpoa`
  • Loading branch information
AndreaGuarracino authored Dec 8, 2022
2 parents bd3f497 + e67ab35 commit a8a0e9e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion deps/abPOA
10 changes: 8 additions & 2 deletions src/smooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,12 @@ odgi::graph_t* smooth_abpoa(const xg::XG &graph, const block_t &block, const uin
// if (seq_lens[i] > max_len) max_len = seq_lens[i];
// }

abpoa_poa(ab, abpt, bseqs, seq_lens, exist_n_seq, n_seq);
int j, **weights = (int**)_err_malloc(n_seq * sizeof(int*));
for (i = 0; i < n_seq; ++i) {
weights[i] = (int*)_err_malloc(seq_lens[i] * sizeof(int));
for (j = 0; j < seq_lens[i]; ++j) weights[i][j] = 1;
}
abpoa_poa(ab, abpt, bseqs, weights, seq_lens, exist_n_seq, n_seq);

// It seems not necessary, as the Breadth-First-Search (in build_odgi_abPOA) follows the graph topology
//abpoa_topological_sort(ab->abg, abpt);
Expand Down Expand Up @@ -448,10 +453,11 @@ odgi::graph_t* smooth_abpoa(const xg::XG &graph, const block_t &block, const uin
// free memory
for (i = 0; i < n_seq; ++i) {
free(bseqs[i]);
free(weights[i]);
}
free(bseqs);
free(seq_lens);

free(weights);
if (save_block_fastas) {
std::chrono::duration<double> elapsed_time = std::chrono::steady_clock::now() - start_time;
write_fasta_for_block(graph, block, block_id, seqs, names, "smoothxg_into_abpoa_pad" + std::to_string(poa_padding) + "_", "_in_" + std::to_string(elapsed_time.count()) + "s");
Expand Down

0 comments on commit a8a0e9e

Please sign in to comment.