Skip to content

Commit 1751719

Browse files
committed
Score left margins of minimizer anchors
1 parent eee4b94 commit 1751719

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

src/minimizer_mapper_from_chains.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3828,7 +3828,7 @@ algorithms::Anchor MinimizerMapper::to_anchor(const Alignment& aln, const Vector
38283828
// Work out how many points the anchor is.
38293829
// TODO: Always make sequence and quality available for scoring!
38303830
// We're going to score the anchor as the full minimizer, and rely on the margins to stop us from taking overlapping anchors.
3831-
int score = aligner->score_exact_match(aln, read_start - margin_left, length + margin_right);
3831+
int score = aligner->score_exact_match(aln, read_start - margin_left, margin_left + length + margin_right);
38323832
return algorithms::Anchor(read_start, graph_start, length, margin_left, margin_right, score, seed_number, &(seed.zipcode), hint_start, source.is_repetitive, paths);
38333833
}
38343834

src/unittest/minimizer_mapper.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,13 +1064,15 @@ TEST_CASE("MinimizerMapper can make correct anchors from minimizers and their zi
10641064

10651065
TEST_CASE("MinimizerMapper scores anchors the same regardless of node structure", "[giraffe][mapping]") {
10661066

1067-
std::string stick_sequence = "GATTACACATTACACGATCGATCGACTGACTCGCAGCTG";
1067+
std::string stick_sequence = "GATTACACATTAG";
10681068

10691069
// Make an aligner for scoring
10701070
Aligner aligner;
10711071

10721072
for (int node_size : {1, 2, 10}) {
1073+
#ifdef debug
10731074
std::cerr << "Node size: " << node_size << std::endl;
1075+
#endif
10741076

10751077
bdsg::HashGraph graph;
10761078

@@ -1103,12 +1105,13 @@ TEST_CASE("MinimizerMapper scores anchors the same regardless of node structure"
11031105
Alignment aln;
11041106
aln.set_sequence(stick_sequence);
11051107

1106-
1107-
1108+
// Try 5 base minimizers
11081109
size_t min_length = 5;
11091110

11101111
for (size_t min_start = 0; min_start + min_length < stick_sequence.size(); min_start++) {
1112+
#ifdef debug
11111113
std::cerr << "Minimizer start: " << min_start << std::endl;
1114+
#endif
11121115
for (bool min_reverse : {false, true}) {
11131116
// Consider just one minimizer and one seed at a time, in its own collection.
11141117
vector<MinimizerMapper::Minimizer> minimizers;
@@ -1129,7 +1132,9 @@ TEST_CASE("MinimizerMapper scores anchors the same regardless of node structure"
11291132
// Make an anchor
11301133
algorithms::Anchor anchor = TestMinimizerMapper::to_anchor(aln, minimizers, seeds, seeds.size() - 1, graph, &aligner);
11311134

1132-
std::cerr << "Made minimizer at read " << minimizers.back().value.offset << " orientation " << minimizers.back().value.is_reverse << " at graph position " << graph_pos << " and anchor " << anchor << " score " << anchor.score() << std::endl;
1135+
#ifdef debug
1136+
std::cerr << "Made minimizer at read " << minimizers.back().value.offset << " orientation " << minimizers.back().value.is_reverse << " at graph position " << graph_pos << " and anchor " << anchor << " score " << anchor.score() << std::endl;
1137+
#endif
11331138

11341139
REQUIRE(anchor.score() == min_length);
11351140
}

0 commit comments

Comments
 (0)