|
|
@@ -1,5 +1,7 @@
|
|
|
use std::{
|
|
|
- collections::HashSet, fmt, fs, path::{Path, PathBuf}
|
|
|
+ collections::HashSet,
|
|
|
+ fmt, fs,
|
|
|
+ path::{Path, PathBuf},
|
|
|
};
|
|
|
|
|
|
use chrono::{DateTime, Utc};
|
|
|
@@ -43,7 +45,11 @@ impl Pod5 {
|
|
|
/// corresponding fields in `Pod5`.
|
|
|
pub fn from_path<P: AsRef<Path>>(path: P) -> std::io::Result<Self> {
|
|
|
let path_ref = path.as_ref();
|
|
|
- let info = Pod5Info::from_pod5(path_ref.to_str().unwrap());
|
|
|
+ let path_str = path_ref.to_str().ok_or_else(|| {
|
|
|
+ anyhow::anyhow!("Path contains invalid UTF-8: {}", path_ref.display())
|
|
|
+ })?;
|
|
|
+
|
|
|
+ let info = Pod5Info::from_pod5(path_str);
|
|
|
let file_size = std::fs::metadata(path_ref)?.len();
|
|
|
|
|
|
Ok(Self {
|
|
|
@@ -370,7 +376,6 @@ mod tests {
|
|
|
let dir = "/mnt/beegfs02/scratch/t_steimle/prom_runs/A/20251117_0915_P2I-00461-A_PBI55810_22582b29/pod5_recovered";
|
|
|
let saved_runs = "~/data/seq_runs_cases.json";
|
|
|
|
|
|
-
|
|
|
let flow_cell = Pod5sRun::load_from_dir(dir)?;
|
|
|
println!("{:#?}", flow_cell.pod5s.first());
|
|
|
let stats = flow_cell.stats();
|