Skip to content

Commit

Permalink
output header always; update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
bluenote-1577 committed Dec 4, 2024
1 parent 475b2bd commit 0aa8482
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## sylph v0.7.1 (main branch + upcoming): 2024-11-XX
## sylph v0.8.0: default output behaviour change + more efficient `inspect`.

### Major
* `inspect` option takes much less memory (thanks to Martin Larralde/@althonos for this)
* BREAKING: Changed default behaviour of sylph to write a TSV header even when no genomes are detected (thanks to Florian Plaza Onate for this suggestion)

* `inspect` uses much less memory thanks to Martin Larralde

## sylph v0.7.0: `inspect` option - 2024-11-06

Expand Down
11 changes: 2 additions & 9 deletions src/contain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,12 @@ pub fn contain(mut args: ContainArgs, pseudotax_in: bool) {

let read_sketch_files_as_vec = read_sketch_files.clone().into_iter().map(|x| vec![x]).collect::<Vec<Vec<&String>>>();
read_files.extend(read_sketch_files_as_vec);
let first_write = Mutex::new(true);
let sequence_index_vec = (0..read_files.len()).collect::<Vec<usize>>();
let out_writer:Mutex<Box<dyn Write + Send>> = Mutex::new(out_writer);

let chunks = get_chunks(&sequence_index_vec, step);

print_header(args.pseudotax,&mut *out_writer.lock().unwrap(), args.estimate_unknown);
chunks.into_iter().for_each(|chunk| {
chunk.into_par_iter().for_each(|j|{
let is_sketch = j >= read_files.len() - read_sketch_files.len();
Expand Down Expand Up @@ -328,14 +328,7 @@ pub fn contain(mut args: ContainArgs, pseudotax_in: bool) {
else{
stats_vec_seq.sort_by(|x,y| y.final_est_ani.partial_cmp(&x.final_est_ani).unwrap());
}

if *first_write.lock().unwrap(){
if !stats_vec_seq.is_empty(){
*first_write.lock().unwrap() = false;
print_header(args.pseudotax,&mut *out_writer.lock().unwrap(), args.estimate_unknown);
}

}

let mut out_writer = out_writer.lock().unwrap();
for res in stats_vec_seq{
print_ani_result(&res, args.pseudotax, &mut *out_writer);
Expand Down

0 comments on commit 0aa8482

Please sign in to comment.