Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More refactorings #337

Merged
merged 11 commits into from
Sep 6, 2023
8 changes: 4 additions & 4 deletions src/aligner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#include <cassert>
#include "aligner.hpp"

aln_info Aligner::align(const std::string &query, const std::string &ref) const {
AlignmentInfo Aligner::align(const std::string &query, const std::string &ref) const {
m_align_calls++;
aln_info aln;
AlignmentInfo aln;
int32_t maskLen = query.length() / 2;
maskLen = std::max(maskLen, 15);
if (ref.length() > 2000){
Expand Down Expand Up @@ -150,10 +150,10 @@ std::tuple<size_t, size_t, int> highest_scoring_segment(
return std::make_tuple(best_start, best_end, best_score);
}

aln_info hamming_align(
AlignmentInfo hamming_align(
const std::string &query, const std::string &ref, int match, int mismatch, int end_bonus
) {
aln_info aln;
AlignmentInfo aln;
if (query.length() != ref.length()) {
return aln;
}
Expand Down
12 changes: 6 additions & 6 deletions src/aligner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "cigar.hpp"


struct alignment_params {
struct AlignmentParameters {
// match is a score, the others are penalties (all are nonnegative)
int match;
int mismatch;
Expand All @@ -16,7 +16,7 @@ struct alignment_params {
int end_bonus;
};

struct aln_info {
struct AlignmentInfo {
Cigar cigar;
unsigned int edit_distance{0};
unsigned int ref_start{0};
Expand All @@ -30,14 +30,14 @@ struct aln_info {

struct Aligner {
public:
Aligner(alignment_params parameters)
Aligner(AlignmentParameters parameters)
: parameters(parameters)
, ssw_aligner(StripedSmithWaterman::Aligner(parameters.match, parameters.mismatch, parameters.gap_open, parameters.gap_extend))
{ }

aln_info align(const std::string &query, const std::string &ref) const;
AlignmentInfo align(const std::string &query, const std::string &ref) const;

alignment_params parameters;
AlignmentParameters parameters;

unsigned calls_count() {
return m_align_calls;
Expand Down Expand Up @@ -68,7 +68,7 @@ std::tuple<size_t, size_t, int> highest_scoring_segment(
const std::string& query, const std::string& ref, int match, int mismatch, int end_bonus
);

aln_info hamming_align(
AlignmentInfo hamming_align(
const std::string &query, const std::string &ref, int match, int mismatch, int end_bonus
);

Expand Down
Loading