Skip to content

Commit 07966f9

Browse files
committed
Clean up verbose/debug logging a bit
1 parent bfce78a commit 07966f9

File tree

3 files changed

+32
-32
lines changed

3 files changed

+32
-32
lines changed

src/aligner.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,15 @@ AlignmentInfo hamming_align(
193193
aln.query_end = segment_end;
194194
return aln;
195195
}
196+
197+
std::ostream& operator<<(std::ostream& os, const AlignmentParameters& params) {
198+
os
199+
<< "AlignmentParameters("
200+
<< "match=" << params.match
201+
<< ", mismatch=" << params.mismatch
202+
<< ", gap_open=" << params.gap_open
203+
<< ", gap_extend=" << params.gap_extend
204+
<< ", end_bonus=" << params.end_bonus
205+
<< ")";
206+
return os;
207+
}

src/aligner.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ struct AlignmentParameters {
1717
int end_bonus;
1818
};
1919

20+
std::ostream& operator<<(std::ostream& os, const AlignmentParameters& params);
21+
2022
struct AlignmentInfo {
2123
Cigar cigar;
2224
unsigned int edit_distance{0};

src/main.cpp

+18-32
Original file line numberDiff line numberDiff line change
@@ -66,24 +66,6 @@ void warn_if_no_optimizations() {
6666
}
6767
}
6868

69-
void log_parameters(const IndexParameters& index_parameters, const MappingParameters& map_param, const AlignmentParameters& aln_params) {
70-
logger.debug() << "Using" << std::endl
71-
<< "k: " << index_parameters.syncmer.k << std::endl
72-
<< "s: " << index_parameters.syncmer.s << std::endl
73-
<< "w_min: " << index_parameters.randstrobe.w_min << std::endl
74-
<< "w_max: " << index_parameters.randstrobe.w_max << std::endl
75-
<< "Read length (r): " << map_param.r << std::endl
76-
<< "Maximum seed length: " << index_parameters.randstrobe.max_dist + index_parameters.syncmer.k << std::endl
77-
<< "R: " << map_param.rescue_level << std::endl
78-
<< "Expected [w_min, w_max] in #syncmers: [" << index_parameters.randstrobe.w_min << ", " << index_parameters.randstrobe.w_max << "]" << std::endl
79-
<< "Expected [w_min, w_max] in #nucleotides: [" << (index_parameters.syncmer.k - index_parameters.syncmer.s + 1) * index_parameters.randstrobe.w_min << ", " << (index_parameters.syncmer.k - index_parameters.syncmer.s + 1) * index_parameters.randstrobe.w_max << "]" << std::endl
80-
<< "A: " << aln_params.match << std::endl
81-
<< "B: " << aln_params.mismatch << std::endl
82-
<< "O: " << aln_params.gap_open << std::endl
83-
<< "E: " << aln_params.gap_extend << std::endl
84-
<< "end bonus: " << aln_params.end_bonus << '\n';
85-
}
86-
8769
bool avx2_enabled() {
8870
#ifdef __AVX2__
8971
return true;
@@ -182,7 +164,6 @@ int run_strobealign(int argc, char **argv) {
182164
opt.max_seed_len_set ? opt.max_seed_len : IndexParameters::DEFAULT,
183165
opt.aux_len ? opt.aux_len : IndexParameters::DEFAULT
184166
);
185-
logger.debug() << index_parameters << '\n';
186167
AlignmentParameters aln_params;
187168
aln_params.match = opt.A;
188169
aln_params.mismatch = opt.B;
@@ -207,7 +188,13 @@ int run_strobealign(int argc, char **argv) {
207188
map_param.fastq_comments = opt.fastq_comments;
208189
map_param.verify();
209190

210-
log_parameters(index_parameters, map_param, aln_params);
191+
logger.debug() << index_parameters << '\n';
192+
logger.debug()
193+
<< " Maximum seed length: " << index_parameters.randstrobe.max_dist + index_parameters.syncmer.k << '\n'
194+
<< " Expected [w_min, w_max] in #syncmers: [" << index_parameters.randstrobe.w_min << ", " << index_parameters.randstrobe.w_max << "]\n"
195+
<< " Expected [w_min, w_max] in #nucleotides: [" << (index_parameters.syncmer.k - index_parameters.syncmer.s + 1) * index_parameters.randstrobe.w_min << ", " << (index_parameters.syncmer.k - index_parameters.syncmer.s + 1) * index_parameters.randstrobe.w_max << "]\n";
196+
logger.debug() << aln_params << '\n';
197+
logger.debug() << "Rescue level (R): " << map_param.rescue_level << '\n';
211198
logger.debug() << "Threads: " << opt.n_threads << std::endl;
212199

213200
// assert(k <= (w/2)*w_min && "k should be smaller than (w/2)*w_min to avoid creating short strobemers");
@@ -231,7 +218,6 @@ int run_strobealign(int argc, char **argv) {
231218
}
232219

233220
logger.debug() << "Auxiliary hash length: " << opt.aux_len << "\n";
234-
logger.debug() << "Base hash mask: " << std::hex << index_parameters.randstrobe.main_hash_mask << std::dec << '\n';
235221
logger.info() << "Using multi-context seeds: " << (map_param.use_mcs ? "yes" : "no") << '\n';
236222
StrobemerIndex index(references, index_parameters, opt.bits);
237223
if (opt.use_index) {
@@ -365,17 +351,17 @@ int run_strobealign(int argc, char **argv) {
365351
}
366352

367353
logger.debug()
368-
<< "Number of reads: " << tot_statistics.n_reads << std::endl
369-
<< "Number of randstrobes: " << tot_statistics.n_randstrobes
370-
<< " total. Per read: " << static_cast<float>(tot_statistics.n_randstrobes) / tot_statistics.n_reads << std::endl
371-
<< "Number of non-rescue hits: " << tot_statistics.n_hits
372-
<< " total. Per read: " << static_cast<float>(tot_statistics.n_hits) / tot_statistics.n_reads << std::endl
373-
<< "Number of non-rescue NAMs: " << tot_statistics.n_nams
374-
<< " total. Per read: " << static_cast<float>(tot_statistics.n_nams) / tot_statistics.n_reads << std::endl
375-
<< "Number of rescue hits: " << tot_statistics.n_rescue_hits
376-
<< " total. Per rescue attempt: " << static_cast<float>(tot_statistics.n_rescue_hits) / tot_statistics.nam_rescue << std::endl
377-
<< "Number of rescue NAMs: " << tot_statistics.n_rescue_nams
378-
<< " total. Per rescue attempt: " << static_cast<float>(tot_statistics.n_rescue_nams) / tot_statistics.nam_rescue << std::endl;
354+
<< "Number of reads: " << std::setw(12) << tot_statistics.n_reads << std::endl
355+
<< "Number of randstrobes: " << std::setw(12) << tot_statistics.n_randstrobes
356+
<< " Per read: " << std::setw(7) << static_cast<float>(tot_statistics.n_randstrobes) / tot_statistics.n_reads << std::endl
357+
<< "Number of non-rescue hits: " << std::setw(12) << tot_statistics.n_hits
358+
<< " Per read: " << std::setw(7) << static_cast<float>(tot_statistics.n_hits) / tot_statistics.n_reads << std::endl
359+
<< "Number of non-rescue NAMs: " << std::setw(12) << tot_statistics.n_nams
360+
<< " Per read: " << std::setw(7) << static_cast<float>(tot_statistics.n_nams) / tot_statistics.n_reads << std::endl
361+
<< "Number of rescue hits: " << std::setw(12) << tot_statistics.n_rescue_hits
362+
<< " Per rescue attempt: " << std::setw(7) << static_cast<float>(tot_statistics.n_rescue_hits) / tot_statistics.nam_rescue << std::endl
363+
<< "Number of rescue NAMs: " << std::setw(12) << tot_statistics.n_rescue_nams
364+
<< " Per rescue attempt: " << std::setw(7) << static_cast<float>(tot_statistics.n_rescue_nams) / tot_statistics.nam_rescue << std::endl;
379365
logger.info()
380366
<< "Total mapping sites tried: " << tot_statistics.tot_all_tried << std::endl
381367
<< "Total calls to ssw: " << tot_statistics.tot_aligner_calls << std::endl

0 commit comments

Comments
 (0)