Skip to content

Commit

Permalink
logging in pair overlap
Browse files Browse the repository at this point in the history
  • Loading branch information
brentp committed Aug 24, 2023
1 parent 6201ea1 commit a456deb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/bin/commands/trimmer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub(crate) struct TrimmerOpts {
#[clap(long, default_value = "15")]
osc_window: usize,

/// Required of oscillations in a window to trigger trimming/masking.
/// Required number of oscillations in a window to trigger trimming/masking.
#[clap(long, default_value = "4")]
osc_max_oscillations: usize,

Expand Down Expand Up @@ -173,6 +173,13 @@ impl Command for TrimmerOpts {
self.overlap_min_length,
self.overlap_max_error_rate,
) {
log::debug!(
"found overlap in pair: {} shift: {}, overlap: {}, adapter: {}",
r1.id().unwrap_or("read"),
overlap.shift,
overlap.overlap,
overlap.adapter
);
stats.overlap_stats.update(overlap);
let corrections = overlap.correct(
&mut r1,
Expand All @@ -184,6 +191,7 @@ impl Command for TrimmerOpts {
Some(self.mask_quality)
},
);
log::debug!("corrections: {:?}", corrections);
stats.overlap_stats.update_corrections(corrections.0, stats::ReadI::R1);
stats.overlap_stats.update_corrections(corrections.1, stats::ReadI::R2);
}
Expand Down
14 changes: 14 additions & 0 deletions src/lib/pair_overlap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,24 @@ impl PairOverlap {
} else {
// when bases disagree, set the lower quality base to the higher quality base.
if r1_quals[i + self.shift] >= r2_quals[i] + bq_delta {
log::debug!(
"correcting read2 at {} with read1 at {}, base: {} to {}",
i,
i + self.shift,
r2_seq[i] as char,
r1_seq[i + self.shift] as char
);
r2_seq[i] = r1_seq[i + self.shift];
r2_quals[i] = r1_quals[i + self.shift];
correction_counts.1 += 1;
} else if r2_quals[i] >= r1_quals[i + self.shift] + bq_delta {
log::debug!(
"correcting read1 at {} with read2 at {}, base: {} to {}",
i + self.shift,
i,
r1_seq[i + self.shift] as char,
r2_seq[i] as char
);
r1_seq[i + self.shift] = r2_seq[i];
r1_quals[i + self.shift] = r2_quals[i];
correction_counts.0 += 1;
Expand Down

0 comments on commit a456deb

Please sign in to comment.