From 3cfc00efb6972327724cedb0990eff835f2bb36f Mon Sep 17 00:00:00 2001 From: faithokamoto Date: Thu, 23 Apr 2026 14:40:54 -0700 Subject: [PATCH] remove unnecessary return info --- src/minimizer_mapper.hpp | 8 +++---- src/minimizer_mapper_from_chains.cpp | 31 ++++++++++------------------ 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/src/minimizer_mapper.hpp b/src/minimizer_mapper.hpp index 693f19cb8b..91ca024bd6 100644 --- a/src/minimizer_mapper.hpp +++ b/src/minimizer_mapper.hpp @@ -1081,11 +1081,11 @@ class MinimizerMapper : public AlignerClient { * * For connecting alignment, restricts the alignment to use <= max_dp_cells * cells. If too many DP cells would be used, produces an Alignment with - * and empty path. + * an empty path. * - * Returns the number of nodes and bases in the graph aligned against. + * Returns whether a graph was aligned against or not. */ - static std::pair align_sequence_between(const pos_t& left_anchor, const pos_t& right_anchor, size_t max_path_length, size_t max_gap_length, const HandleGraph* graph, const GSSWAligner* aligner, Alignment& alignment, const std::string* alignment_name = nullptr, size_t max_dp_cells = std::numeric_limits::max(), const std::function& choose_band_padding = algorithms::pad_band_random_walk()); + static bool align_sequence_between(const pos_t& left_anchor, const pos_t& right_anchor, size_t max_path_length, size_t max_gap_length, const HandleGraph* graph, const GSSWAligner* aligner, Alignment& alignment, const std::string* alignment_name = nullptr, size_t max_dp_cells = std::numeric_limits::max(), const std::function& choose_band_padding = algorithms::pad_band_random_walk()); public: /** @@ -1093,7 +1093,7 @@ class MinimizerMapper : public AlignerClient { * same answer (modulo reverse-complementation) no matter whether the * sequence and anchors are reverse-complemented or not. */ - static std::pair align_sequence_between_consistently(const pos_t& left_anchor, const pos_t& right_anchor, size_t max_path_length, size_t max_gap_length, const HandleGraph* graph, const GSSWAligner* aligner, Alignment& alignment, const std::string* alignment_name = nullptr, size_t max_dp_cells = std::numeric_limits::max(), const std::function& choose_band_padding = algorithms::pad_band_random_walk()); + static bool align_sequence_between_consistently(const pos_t& left_anchor, const pos_t& right_anchor, size_t max_path_length, size_t max_gap_length, const HandleGraph* graph, const GSSWAligner* aligner, Alignment& alignment, const std::string* alignment_name = nullptr, size_t max_dp_cells = std::numeric_limits::max(), const std::function& choose_band_padding = algorithms::pad_band_random_walk()); protected: /** diff --git a/src/minimizer_mapper_from_chains.cpp b/src/minimizer_mapper_from_chains.cpp index 4ba5d3b909..aaf7f80268 100644 --- a/src/minimizer_mapper_from_chains.cpp +++ b/src/minimizer_mapper_from_chains.cpp @@ -2557,10 +2557,10 @@ Alignment MinimizerMapper::find_chain_alignment( if (stats) { start_time = std::chrono::high_resolution_clock::now(); } - auto nodes_and_bases = align_sequence_between_consistently(empty_pos_t(), right_anchor, graph_horizon, max_gap_length, &this->gbwt_graph, this->get_regular_aligner(), tail_aln, &aln.name(), this->max_dp_cells, this->choose_band_padding); + bool did_aln = align_sequence_between_consistently(empty_pos_t(), right_anchor, graph_horizon, max_gap_length, &this->gbwt_graph, this->get_regular_aligner(), tail_aln, &aln.name(), this->max_dp_cells, this->choose_band_padding); if (stats) { stop_time = std::chrono::high_resolution_clock::now(); - if (nodes_and_bases.first > 0) { + if (did_aln) { // Actually did the alignment stats->bases.dozeu_tail += left_tail_length; stats->time.dozeu_tail += std::chrono::duration_cast>(stop_time - start_time).count(); @@ -2883,10 +2883,10 @@ Alignment MinimizerMapper::find_chain_alignment( if (stats) { start_time = std::chrono::high_resolution_clock::now(); } - auto nodes_and_bases = MinimizerMapper::align_sequence_between_consistently((*here).graph_end(), (*next).graph_start(), path_length+max_gap_length, max_gap_length, &this->gbwt_graph, this->get_regular_aligner(), link_aln, &aln.name(), this->max_dp_cells, this->choose_band_padding); + bool did_aln = MinimizerMapper::align_sequence_between_consistently((*here).graph_end(), (*next).graph_start(), path_length+max_gap_length, max_gap_length, &this->gbwt_graph, this->get_regular_aligner(), link_aln, &aln.name(), this->max_dp_cells, this->choose_band_padding); if (stats) { stop_time = std::chrono::high_resolution_clock::now(); - if (nodes_and_bases.first > 0) { + if (did_aln) { // Actually did the alignment stats->bases.bga_middle += link_length; stats->time.bga_middle += std::chrono::duration_cast>(stop_time - start_time).count(); @@ -3070,10 +3070,10 @@ Alignment MinimizerMapper::find_chain_alignment( if (stats) { start_time = std::chrono::high_resolution_clock::now(); } - auto nodes_and_bases = align_sequence_between_consistently(left_anchor_included, empty_pos_t(), graph_horizon, max_gap_length, &this->gbwt_graph, this->get_regular_aligner(), tail_aln, &aln.name(), this->max_dp_cells, this->choose_band_padding); + bool did_aln = align_sequence_between_consistently(left_anchor_included, empty_pos_t(), graph_horizon, max_gap_length, &this->gbwt_graph, this->get_regular_aligner(), tail_aln, &aln.name(), this->max_dp_cells, this->choose_band_padding); if (stats) { stop_time = std::chrono::high_resolution_clock::now(); - if (nodes_and_bases.first > 0) { + if (did_aln) { // Actually did the alignment stats->bases.dozeu_tail += right_tail_length; stats->time.dozeu_tail += std::chrono::duration_cast>(stop_time - start_time).count(); @@ -3464,11 +3464,9 @@ size_t MinimizerMapper::longest_detectable_gap_in_range(const Alignment& aln, co return aligner->longest_detectable_gap(aln, sequence_end); } -std::pair MinimizerMapper::align_sequence_between(const pos_t& left_anchor, const pos_t& right_anchor, size_t max_path_length, size_t max_gap_length, const HandleGraph* graph, const GSSWAligner* aligner, Alignment& alignment, const std::string* alignment_name, size_t max_dp_cells, const std::function& choose_band_padding) { - - // This holds node count and node length aligned to. - std::pair to_return; +bool MinimizerMapper::align_sequence_between(const pos_t& left_anchor, const pos_t& right_anchor, size_t max_path_length, size_t max_gap_length, const HandleGraph* graph, const GSSWAligner* aligner, Alignment& alignment, const std::string* alignment_name, size_t max_dp_cells, const std::function& choose_band_padding) { + bool did_aln = true; // Get the dagified local graph, and the back translation MinimizerMapper::with_dagified_local_graph(left_anchor, right_anchor, max_path_length, *graph, [&](DeletableHandleGraph& dagified_graph, @@ -3594,10 +3592,6 @@ std::pair MinimizerMapper::align_sequence_between(const pos_t& l // Clear out the alignment path to indicate that we didn't actually compute an alignment. alignment.mutable_path()->clear_mapping(); } - // Always report the size of what we were aligning to. - // TODO: Do we still need this? - to_return.first = dagified_graph.get_node_count(); - to_return.second = dagified_graph.get_total_length(); } else { // Do pinned alignment off the anchor we actually have. // Work out how big it will be. @@ -3621,8 +3615,7 @@ std::pair MinimizerMapper::align_sequence_between(const pos_t& l Edit* e = m->add_edit(); e->set_to_length(alignment.sequence().size()); e->set_sequence(alignment.sequence()); - to_return.first = 0; - to_return.second = 0; + did_aln = false; return; } else { #ifdef debug @@ -3630,8 +3623,6 @@ std::pair MinimizerMapper::align_sequence_between(const pos_t& l std::cerr << "debug[MinimizerMapper::align_sequence_between]: Fill " << cell_count << " DP cells in tail with Xdrop" << std::endl; #endif aligner->align_pinned(alignment, dagified_graph, !is_empty(left_anchor), true, max_gap_length); - to_return.first = dagified_graph.get_node_count(); - to_return.second = dagified_graph.get_total_length(); } } @@ -3687,10 +3678,10 @@ std::pair MinimizerMapper::align_sequence_between(const pos_t& l // Now the alignment is filled in! }); - return to_return; + return did_aln; } -std::pair MinimizerMapper::align_sequence_between_consistently(const pos_t& left_anchor, const pos_t& right_anchor, size_t max_path_length, size_t max_gap_length, const HandleGraph* graph, const GSSWAligner* aligner, Alignment& alignment, const std::string* alignment_name, size_t max_dp_cells, const std::function& choose_band_padding) { +bool MinimizerMapper::align_sequence_between_consistently(const pos_t& left_anchor, const pos_t& right_anchor, size_t max_path_length, size_t max_gap_length, const HandleGraph* graph, const GSSWAligner* aligner, Alignment& alignment, const std::string* alignment_name, size_t max_dp_cells, const std::function& choose_band_padding) { if (left_anchor < right_anchor) { // Left anchor is unambiguously first, so align as-is return align_sequence_between(left_anchor, right_anchor, max_path_length, max_gap_length, graph, aligner, alignment, alignment_name, max_dp_cells, choose_band_padding);