8
8
// Last revision by Mengyao Zhao on 2023-Apr-21
9
9
// ==========================
10
10
11
+ #include < algorithm>
11
12
#include < iostream>
12
- #include < string.h >
13
+ #include < string>
13
14
14
15
#include " ssw_cpp.h"
15
16
16
- using std::string;
17
17
using std::cout;
18
18
using std::endl;
19
+ using std::string;
19
20
20
21
static void PrintAlignment (const StripedSmithWaterman::Alignment& alignment);
21
22
22
23
int main () {
23
- const string ref = " CAGCCTTTCTGACCCGGAAATCAAAATAGGCACAACAAA" ;
24
- const string query = " CTGAGCCGGTAAATC" ;
25
- int32_t maskLen = strlen (query.c_str ())/2 ;
26
- maskLen = maskLen < 15 ? 15 : maskLen;
24
+ const string ref = " CAGCCTTTCTGACCCGGAAATCAAAATAGGCACAACAAA" ;
25
+ const string query = " CTGAGCCGGTAAATC" ;
26
+ const int32_t maskLen = std::max (query.size () / 2 , size_t (15 ));
27
27
28
28
// Declares a default Aligner
29
29
StripedSmithWaterman::Aligner aligner;
@@ -32,14 +32,14 @@ int main() {
32
32
// Declares an alignment that stores the result
33
33
StripedSmithWaterman::Alignment alignment;
34
34
// Aligns the query to the ref
35
- aligner.Align (query.c_str (), ref.c_str (), ref.size (), filter, & alignment, maskLen);
35
+ aligner.Align (query.c_str (), query. size (), ref.c_str (), ref.size (), filter, alignment, maskLen);
36
36
37
37
PrintAlignment (alignment);
38
38
39
39
return 0 ;
40
40
}
41
41
42
- static void PrintAlignment (const StripedSmithWaterman::Alignment& alignment){
42
+ static void PrintAlignment (const StripedSmithWaterman::Alignment& alignment) {
43
43
cout << " ===== SSW result =====" << endl;
44
44
cout << " Best Smith-Waterman score:\t " << alignment.sw_score << endl
45
45
<< " Next-best Smith-Waterman score:\t " << alignment.sw_score_next_best << endl
0 commit comments