|
|
@@ -4,7 +4,9 @@ use std::{
|
|
|
path::{Path, PathBuf},
|
|
|
};
|
|
|
|
|
|
+use anyhow::Context;
|
|
|
use log::{info, warn};
|
|
|
+use pandora_lib_scan::par_whole_scan;
|
|
|
|
|
|
use self::{bam::BamCollection, pod5::Pod5Collection, vcf::VcfCollection};
|
|
|
use crate::{
|
|
|
@@ -67,7 +69,7 @@ impl Collections {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- pub fn todo(&mut self, min_diag_cov: f32, min_mrd_cov: f32) {
|
|
|
+ pub fn todo(&mut self, min_diag_cov: f32, min_mrd_cov: f32) -> anyhow::Result<()> {
|
|
|
info!("Looking for base calling tasks...");
|
|
|
|
|
|
let mut tasks = Vec::new();
|
|
|
@@ -111,17 +113,16 @@ impl Collections {
|
|
|
|
|
|
// Whole scan
|
|
|
for bam in self.bam.by_id_completed() {
|
|
|
- let id = bam.id;
|
|
|
let scan_dir = format!("{}/{}/{}/scan", self.result_dir, bam.id, bam.time_point);
|
|
|
- if PathBuf::from(scan_dir).exists() {
|
|
|
- let dir_mod = fs::metadata(scan_dir)?.modified()?;
|
|
|
- if bam.file_metadata.modified() > dir_mod {
|
|
|
- fs::remove_dir_all(scan_dir)?;
|
|
|
+ if PathBuf::from(&scan_dir).exists() {
|
|
|
+ let dir_mod = fs::metadata(&scan_dir)?.modified()?;
|
|
|
+ if bam.file_metadata.modified()? > dir_mod {
|
|
|
+ fs::remove_dir_all(&scan_dir)?;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if !PathBuf::from(scan_dir).exists() {
|
|
|
- par_whole_scan();
|
|
|
+ if !PathBuf::from(&scan_dir).exists() {
|
|
|
+ par_whole_scan("/data/ref/hs1/chm13v2.0.dict", bam.path.to_str().context("Cant convert path to string")?, &scan_dir)?;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -237,6 +238,7 @@ impl Collections {
|
|
|
hs.insert(t.to_string(), t);
|
|
|
});
|
|
|
self.tasks = hs.into_values().collect();
|
|
|
+ Ok(())
|
|
|
}
|
|
|
|
|
|
pub fn run(&mut self) -> anyhow::Result<()> {
|