Skip to content

Commit

Permalink
fix: Ensure complete reading of multi-member .gz FASTA files (#14)
Browse files Browse the repository at this point in the history
`flate2::read::GzDecoder` only reads the first member in a multi-member gzip file, which can result in incomplete reading of the reference FASTA file.

Replacing it with `flate2::read::MultiGzDecoder` ensures that all members of the input gzipped FASTA file can be processed, aligning the decoding behavior with standard tools like `gzip`, `gunzip`, and `zcat`.
  • Loading branch information
ykozxy authored Feb 27, 2024
1 parent fcdfa97 commit c1c69bb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use noodles::{bam, fasta, sam};

use fxhash::FxHashMap;

use flate2::read::GzDecoder;
use flate2::read::MultiGzDecoder;
use flate2::write::GzEncoder;

use std::fs::File;
Expand Down Expand Up @@ -65,7 +65,7 @@ fn run(
let mut ref_reader = {
let f = File::open(&reference_path).unwrap();
let r: Box<dyn Read> = if reference_path.ends_with(".gz") {
Box::new(GzDecoder::new(f))
Box::new(MultiGzDecoder::new(f))
} else {
Box::new(f)
};
Expand Down

0 comments on commit c1c69bb

Please sign in to comment.