Skip to content

Commit

Permalink
fix: extract samples by name, so order is always in-sync with header
Browse files Browse the repository at this point in the history
  • Loading branch information
tedil committed Jan 21, 2025
1 parent 07d6c9e commit 50d9f4f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/annotate/strucvars/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -845,15 +845,17 @@ impl AsyncAnnotatedVariantWriter for VarFishStrucvarTsvWriter {
}

// First, create genotype info records.
let mut gt_it = record.samples().values();
for sample_name in header.sample_names() {
tsv_record.genotype.entries.push(GenotypeInfo {
name: sample_name.clone(),
..Default::default()
});

let entry = tsv_record.genotype.entries.last_mut().expect("just pushed");
let sample = gt_it.next().expect("genotype iterator exhausted");
let sample = record
.samples()
.get(&header, sample_name)

Check warning on line 857 in src/annotate/strucvars/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/annotate/strucvars/mod.rs:857:22 | 857 | .get(&header, sample_name) | ^^^^^^^ help: change this to: `header` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow = note: `#[warn(clippy::needless_borrow)]` on by default
.expect("sample not found");

for (key, value) in sample.keys().as_ref().iter().zip(sample.values().iter()) {
match (key.as_ref(), value) {
Expand Down

0 comments on commit 50d9f4f

Please sign in to comment.