Thomas vor 1 Jahr
Ursprung
Commit
56eb3a92eb
3 geänderte Dateien mit 287 neuen und 148 gelöschten Zeilen
  1. 271 134
      Cargo.lock
  2. 6 6
      src/collection/bam.rs
  3. 10 8
      src/collection/mod.rs

Datei-Diff unterdrückt, da er zu groß ist
+ 271 - 134
Cargo.lock


+ 6 - 6
src/collection/bam.rs

@@ -1,5 +1,4 @@
 use std::{
-    collections::HashMap,
     fs::{self, Metadata},
     path::PathBuf,
     str::FromStr,
@@ -14,9 +13,8 @@ use pandora_lib_bindings::{
     utils::RunBin,
 };
 use rayon::prelude::*;
-use tracing::warn;
 
-#[derive(Debug)]
+#[derive(Debug, Clone)]
 pub struct Bam {
     pub id: String,
     pub time_point: String,
@@ -28,7 +26,7 @@ pub struct Bam {
     pub composition: Vec<(String, f64)>,
 }
 
-#[derive(Debug, PartialEq)]
+#[derive(Debug, PartialEq, Clone)]
 pub enum BamType {
     WGS,
     Panel(String),
@@ -147,10 +145,12 @@ impl BamCollection {
         self.bams
             .iter()
             .filter(|b| matches!(b.bam_type, BamType::WGS))
-            .filter(|b| match b.cramino {
+            .filter(|b| match &b.cramino {
                 Some(cramino) => cramino.mean_length >= 15.0,
                 _ => false,
-            }).collect()
+            })
+            .cloned()
+            .collect()
     }
 }
 

+ 10 - 8
src/collection/mod.rs

@@ -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<()> {

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.