Skip to content

Commit f76d08b

Browse files
committed
fixes
1 parent dfe85c5 commit f76d08b

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

src/bin/commands/demux.rs

+11-9
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl ReadSet {
9393
const SPACE: u8 = b' ';
9494
const COLON: u8 = b':';
9595
const PLUS: u8 = b'+';
96-
const READ_NUMBERS: &[u8] = &[b'1', b'2', b'3', b'4', b'5', b'6', b'7', b'8'];
96+
const READ_NUMBERS: &[u8] = b"12345678";
9797

9898
/// Produces an iterator over references to the template segments stored in this ``ReadSet``.
9999
fn template_segments(&self) -> SegmentIter {
@@ -217,7 +217,7 @@ impl ReadSet {
217217
if read_num < Self::READ_NUMBERS.len() {
218218
writer.write_all(&[Self::READ_NUMBERS[read_num - 1]])?;
219219
write!(writer, ":N:0:")?;
220-
} else{
220+
} else {
221221
write!(writer, "{}:N:0:", read_num)?;
222222
}
223223
}
@@ -247,7 +247,7 @@ impl ReadSet {
247247

248248
if read_num < Self::READ_NUMBERS.len() {
249249
writer.write_all(&[Self::READ_NUMBERS[read_num - 1], b':'])?;
250-
} else{
250+
} else {
251251
write!(writer, "{}:", read_num)?;
252252
}
253253
writer.write_all(remainder)?;
@@ -546,6 +546,7 @@ impl DemuxMetric {
546546
/// mismatches (see `--max-mismatches`).
547547
/// 2. The difference between number of mismatches in the best and second best barcodes is greater
548548
/// than or equal to the minimum mismatch delta (`--min-mismatch-delta`).
549+
///
549550
/// The expected barcode sequence may contains Ns, which are not counted as mismatches regardless
550551
/// of the observed base (e.g. the expected barcode `AAN` will have zero mismatches relative to
551552
/// both the observed barcodes `AAA` and `AAN`).
@@ -754,7 +755,7 @@ impl Demux {
754755
let mut new_sample_barcode_writers = None;
755756
let mut new_molecular_barcode_writers = None;
756757

757-
for (optional_ws, target) in vec![
758+
for (optional_ws, target) in [
758759
(template_writers, &mut new_template_writers),
759760
(barcode_writers, &mut new_sample_barcode_writers),
760761
(mol_writers, &mut new_molecular_barcode_writers),
@@ -907,7 +908,7 @@ impl Command for Demux {
907908
);
908909

909910
let mut fq_iterators = fq_sources
910-
.zip(self.read_structures.clone().into_iter())
911+
.zip(self.read_structures.clone())
911912
.map(|(source, read_structure)| {
912913
ReadSetIterator::new(read_structure, source, self.skip_reasons.clone())
913914
.read_ahead(1000, 1000)
@@ -1194,6 +1195,7 @@ mod tests {
11941195
skip_reasons: vec![],
11951196
};
11961197
let demux_result = demux_inputs.execute();
1198+
#[allow(clippy::permissions_set_readonly_false)]
11971199
permissions.set_readonly(false);
11981200
fs::set_permissions(tmp.path(), permissions).unwrap();
11991201
demux_result.unwrap();
@@ -1888,11 +1890,11 @@ mod tests {
18881890
let read_structures =
18891891
vec![ReadStructure::from_str("+T").unwrap(), ReadStructure::from_str("7B").unwrap()];
18901892

1891-
let records = vec![
1893+
let records = [
18921894
vec!["AAAAAAA", &SAMPLE1_BARCODE[0..7]], // barcode too short
18931895
vec!["CCCCCCC", SAMPLE1_BARCODE], // barcode the correct length
18941896
vec!["", SAMPLE1_BARCODE], // template basese too short
1895-
vec!["G", SAMPLE1_BARCODE], // barcode the correct length
1897+
vec!["G", SAMPLE1_BARCODE],
18961898
];
18971899

18981900
let input_files = vec![
@@ -1924,11 +1926,11 @@ mod tests {
19241926
let read_structures =
19251927
vec![ReadStructure::from_str("+T").unwrap(), ReadStructure::from_str("7B").unwrap()];
19261928

1927-
let records = vec![
1929+
let records = [
19281930
vec!["AAAAAAA", &SAMPLE1_BARCODE[0..7]], // barcode too short
19291931
vec!["CCCCCCC", SAMPLE1_BARCODE], // barcode the correct length
19301932
vec!["", SAMPLE1_BARCODE], // template basese too short
1931-
vec!["G", SAMPLE1_BARCODE], // barcode the correct length
1933+
vec!["G", SAMPLE1_BARCODE],
19321934
];
19331935

19341936
let input_files = vec![

src/lib/barcode_matching.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ impl BarcodeMatcher {
8585
);
8686
}
8787
let mut count: usize = 0;
88-
for (&expected_base, &observed_base) in sample.barcode_bytes.iter().zip(observed_bases.iter()) {
88+
for (&expected_base, &observed_base) in
89+
sample.barcode_bytes.iter().zip(observed_bases.iter())
90+
{
8991
if expected_base != observed_base && !byte_is_nocall(expected_base) {
9092
count += 1;
9193
}

src/lib/samples.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,7 @@ mod tests {
297297
let barcode = "GATTACA".to_owned();
298298
let ordinal = 0;
299299
let sample = Sample::new(ordinal, name.clone(), barcode.clone());
300-
assert_eq!(
301-
Sample { sample_id: name, barcode, ordinal },
302-
sample,
303-
"Sample differed from expectation"
304-
);
300+
assert_eq!(Sample::new(ordinal, name, barcode), sample, "Sample differed from expectation");
305301
}
306302

307303
// ############################################################################################

0 commit comments

Comments
 (0)