Skip to content

Commit cf74abd

Browse files
authored
Merge pull request #93 from ArcInstitute/refactor/make-binseq-inputs-paths
Refactor/make binseq inputs paths
2 parents 1826203 + e91b55c commit cf74abd

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "binseq"
3-
version = "0.9.1"
3+
version = "0.9.2"
44
edition = "2024"
55
description = "A high efficiency binary format for sequencing data"
66
license = "MIT"

src/parallel.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,30 @@ use crate::{
1010
/// An enum abstraction for BINSEQ readers that can process records in parallel
1111
///
1212
/// This is a convenience enum that can be used for general workflows where the
13-
/// distinction between BQ and VBQ readers is not important.
13+
/// distinction between BINSEQ readers is not important.
1414
///
15-
/// For more specialized workflows see [`bq::MmapReader`] and [`vbq::MmapReader`].
15+
/// For more specialized workflows see [`bq::MmapReader`], [`vbq::MmapReader`], and [`cbq::MmapReader`].
1616
pub enum BinseqReader {
1717
Bq(bq::MmapReader),
1818
Vbq(vbq::MmapReader),
1919
Cbq(cbq::MmapReader),
2020
}
2121
impl BinseqReader {
22-
pub fn new(path: &str) -> Result<Self> {
23-
let pathbuf = Path::new(path);
24-
match pathbuf.extension() {
22+
pub fn new<P: AsRef<Path>>(path: P) -> Result<Self> {
23+
match path.as_ref().extension() {
2524
Some(ext) => match ext.to_str() {
2625
Some("bq") => Ok(Self::Bq(bq::MmapReader::new(path)?)),
2726
Some("vbq") => Ok(Self::Vbq(vbq::MmapReader::new(path)?)),
2827
Some("cbq") => Ok(Self::Cbq(cbq::MmapReader::new(path)?)),
29-
_ => Err(ExtensionError::UnsupportedExtension(path.to_string()).into()),
28+
_ => Err(ExtensionError::UnsupportedExtension(
29+
path.as_ref().to_string_lossy().to_string(),
30+
)
31+
.into()),
3032
},
31-
None => Err(ExtensionError::UnsupportedExtension(path.to_string()).into()),
33+
None => Err(ExtensionError::UnsupportedExtension(
34+
path.as_ref().to_string_lossy().to_string(),
35+
)
36+
.into()),
3237
}
3338
}
3439

0 commit comments

Comments
 (0)