@@ -18,7 +18,8 @@ bool RandstrobeParameters::operator==(const RandstrobeParameters& other) const {
1818 && this ->q == other.q
1919 && this ->max_dist == other.max_dist
2020 && this ->w_min == other.w_min
21- && this ->w_max == other.w_max ;
21+ && this ->w_max == other.w_max
22+ && this ->digest == other.digest ;
2223}
2324
2425/* Pre-defined index parameters that work well for a certain
@@ -30,24 +31,25 @@ struct Profile {
3031 int s_offset;
3132 int l;
3233 int u;
34+ int digest;
3335};
3436
3537static auto max{std::numeric_limits<int >::max ()};
3638
3739static std::vector<Profile> profiles = {
38- Profile{ 50 , 90 , 18 , -4 , -2 , 1 },
39- Profile{100 , 110 , 20 , -4 , -2 , 2 },
40- Profile{125 , 135 , 20 , -4 , -1 , 4 },
41- Profile{150 , 175 , 20 , -4 , 1 , 7 },
42- Profile{250 , 375 , 22 , -4 , 2 , 12 },
43- Profile{400 , max, 23 , -6 , 2 , 12 },
40+ Profile{ 50 , 90 , 18 , -4 , -2 , 1 , 24 },
41+ Profile{100 , 110 , 20 , -4 , -2 , 2 , 24 },
42+ Profile{125 , 135 , 20 , -4 , -1 , 4 , 24 },
43+ Profile{150 , 175 , 20 , -4 , 1 , 7 , 24 },
44+ Profile{250 , 375 , 22 , -4 , 2 , 12 , 24 },
45+ Profile{400 , max, 23 , -6 , 2 , 12 , 24 },
4446 };
4547
4648/* Create an IndexParameters instance based on a given read length.
4749 * k, s, l, u, c and max_seed_len can be used to override determined parameters
4850 * by setting them to a value other than IndexParameters::DEFAULT.
4951 */
50- IndexParameters IndexParameters::from_read_length (int read_length, int k, int s, int l, int u, int c, int max_seed_len) {
52+ IndexParameters IndexParameters::from_read_length (int read_length, int k, int s, int l, int u, int c, int max_seed_len, int digest ) {
5153 const int default_c = 8 ;
5254 size_t canonical_read_length = 50 ;
5355 for (const auto & p : profiles) {
@@ -64,6 +66,9 @@ IndexParameters IndexParameters::from_read_length(int read_length, int k, int s,
6466 if (u == DEFAULT) {
6567 u = p.u ;
6668 }
69+ if (digest == DEFAULT) {
70+ digest = p.digest ;
71+ }
6772 canonical_read_length = p.canonical_read_length ;
6873 break ;
6974 }
@@ -78,7 +83,7 @@ IndexParameters IndexParameters::from_read_length(int read_length, int k, int s,
7883 }
7984 int q = std::pow (2 , c == DEFAULT ? default_c : c) - 1 ;
8085
81- return IndexParameters (canonical_read_length, k, s, l, u, q, max_dist);
86+ return IndexParameters (canonical_read_length, k, s, l, u, q, max_dist, digest );
8287}
8388
8489void IndexParameters::write (std::ostream& os) const {
@@ -89,6 +94,7 @@ void IndexParameters::write(std::ostream& os) const {
8994 write_int_to_ostream (os, randstrobe.u );
9095 write_int_to_ostream (os, randstrobe.q );
9196 write_int_to_ostream (os, randstrobe.max_dist );
97+ write_int_to_ostream (os, randstrobe.digest );
9298}
9399
94100IndexParameters IndexParameters::read (std::istream& is) {
@@ -99,7 +105,8 @@ IndexParameters IndexParameters::read(std::istream& is) {
99105 int u = read_int_from_istream (is);
100106 int q = read_int_from_istream (is);
101107 int max_dist = read_int_from_istream (is);
102- return IndexParameters (canonical_read_length, k, s, l, u, q, max_dist);
108+ int digest = read_int_from_istream (is);
109+ return IndexParameters (canonical_read_length, k, s, l, u, q, max_dist, digest);
103110}
104111
105112bool IndexParameters::operator ==(const IndexParameters& other) const {
@@ -119,7 +126,7 @@ std::string IndexParameters::filename_extension() const {
119126 // nothing was overridden
120127 sstream << " .r" << canonical_read_length;
121128 }
122- sstream << " .sti " ;
129+ sstream << " .stimc " ;
123130 return sstream.str ();
124131}
125132
0 commit comments