Skip to content

Commit

Permalink
feat: better error message when barcode length differs from expected
Browse files Browse the repository at this point in the history
 - barcode bases and lengths (actual and expected) and sample name are printed
 - fixes #31 by passing `Sample` to `count_mismatches()` instead of barcode string
 - all `count_mismatches()` tests updated to match new signature
 - minor miscellaneous comment typos fixed as well
  • Loading branch information
TimD1 committed Jul 10, 2024
1 parent 6ed98a3 commit 745cdb8
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 79 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ bases, and molecular identifiers from each read. The observed sample barcode
will be matched to the sample barcodes extracted from the bases in the sample
metadata and associated read structures.

An observed barcode matches an expected barcocde if all the following are true:
An observed barcode matches an expected barcode if all the following are true:

1. The number of mismatches (edits/substitutions) is less than or equal to the
maximum mismatches (see --max-mismatches).
Expand Down
8 changes: 4 additions & 4 deletions src/bin/commands/demux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct FastqSegment {

#[derive(Eq, Hash, PartialEq, Debug, Clone, Copy)]
enum SkipReason {
/// The read had to few bases for the segment.
/// The read had too few bases for the segment.
TooFewBases,
}

Expand Down Expand Up @@ -526,7 +526,7 @@ impl DemuxMetric {
/// molecular identifiers from each read. The observed sample barcode will be matched to the
/// sample barcodes extracted from the bases in the sample metadata and associated read structures.
///
/// An observed barcode matches an expected barcocde if all the following are true:
/// An observed barcode matches an expected barcode if all the following are true:
/// 1. The number of mismatches (edits/substitutions) is less than or equal to the maximum
/// mismatches (see `--max-mismatches`).
/// 2. The difference between number of mismatches in the best and second best barcodes is greater
Expand Down Expand Up @@ -580,7 +580,7 @@ pub(crate) struct Demux {

/// The read structure types to write to their own files (Must be one of T, B, or M for
/// template reads, sample barcode reads, and molecular barcode reads).
///
///
/// Multiple output types may be specified as a space-delimited list.
#[clap(long, short='b', default_value="T", num_args = 1.. )]
output_types: Vec<char>,
Expand Down Expand Up @@ -881,7 +881,7 @@ impl Command for Demux {

// Setup the barcode matcher - the primary return from here is the index of the samp
let mut barcode_matcher = BarcodeMatcher::new(
&sample_group.samples.iter().map(|s| s.barcode.as_str()).collect::<Vec<_>>(),
&sample_group.samples,
u8::try_from(self.max_mismatches)?,
u8::try_from(self.min_mismatch_delta)?,
true,
Expand Down
Loading

0 comments on commit 745cdb8

Please sign in to comment.