diff --git a/src/common/wflign/src/wflign.cpp b/src/common/wflign/src/wflign.cpp index a8fd3cda..777a45e4 100644 --- a/src/common/wflign/src/wflign.cpp +++ b/src/common/wflign/src/wflign.cpp @@ -53,22 +53,23 @@ void do_biwfa_alignment( const int status = wf_aligner.alignEnd2End(target, (int)target_length, query, (int)query_length); if (status == 0) { // WF_STATUS_SUCCESSFUL - // Create alignment record on heap - auto* aln = new alignment_t(); - aln->ok = true; - aln->j = 0; - aln->i = 0; - aln->query_length = query_length; - aln->target_length = target_length; + // Create alignment record on stack + alignment_t aln; + aln.ok = true; + aln.j = 0; + aln.i = 0; + aln.query_length = query_length; + aln.target_length = target_length; + aln.is_rev = false; // Copy alignment CIGAR - wflign_edit_cigar_copy(wf_aligner, &aln->edit_cigar); + wflign_edit_cigar_copy(wf_aligner, &aln.edit_cigar); // Write alignment if (paf_format_else_sam) { write_alignment_paf( out, - *aln, // Dereference the pointer + aln, query_name, query_total_length, query_offset, @@ -81,48 +82,26 @@ void do_biwfa_alignment( min_identity, mashmap_estimated_identity); } else { - write_merged_alignment( + // Write SAM output directly + write_alignment_sam( out, - {aln}, // Pass pointer to alignment - wf_aligner, - penalties, - emit_md_tag, - paf_format_else_sam, - no_seq_in_sam, - query, + aln, query_name, query_total_length, query_offset, query_length, query_is_rev, - target, target_name, target_total_length, target_offset, target_length, min_identity, -#ifdef WFA_PNG_TSV_TIMING - 0, // elapsed_time_wflambda_ms - 1, // num_alignments - 1, // num_alignments_performed -#endif mashmap_estimated_identity, - wflign_max_len_minor, - wflign_max_len_minor, - 0, // erode_k - 0, // chain_gap - 0, // max_patching_score - 0, // min_inversion_length - MIN_WF_LENGTH, - 0 // wf_max_dist_threshold -#ifdef WFA_PNG_TSV_TIMING - , - nullptr, // prefix_wavefront_plot_in_png - 0, // wfplot_max_size - false, // emit_patching_tsv - nullptr // out_patching_tsv -#endif - ); + no_seq_in_sam, + emit_md_tag, + query, + target, + 0); // No target pointer shift for biwfa } } } @@ -467,7 +446,7 @@ void WFlign::wflign_affine_wavefront( // Use biWFA for smaller sequences or very high identity matches - if (!force_wflign) { + if (!force_wflign && (query_length <= MAX_LEN_FOR_STANDARD_WFA || target_length <= MAX_LEN_FOR_STANDARD_WFA)) { do_biwfa_alignment( query_name, query, query_total_length, query_offset, query_length, query_is_rev, target_name, target, target_total_length, target_offset, target_length,