Skip to content

Commit

Permalink
fix: allow loading JSON from .gz files (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe authored Mar 29, 2023
1 parent 48047b1 commit cefd950
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/db/create/txs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ fn load_and_extract(
genes: c_genes,
transcripts: c_txs,
..
} = if json_path.ends_with(".gz") {
} = if json_path.extension().unwrap_or_default() == "gz" {
tracing::info!("(from gzip compressed file)");
serde_json::from_reader(std::io::BufReader::new(flate2::read::GzDecoder::new(
std::fs::File::open(json_path)?,
)))?
} else {
tracing::info!("(from uncompressed file)");
serde_json::from_reader(std::io::BufReader::new(std::fs::File::open(json_path)?))?
};
tracing::info!(
Expand Down

0 comments on commit cefd950

Please sign in to comment.