Przeglądaj źródła

scan remove chrM

Thomas 4 dni temu
rodzic
commit
fe19eb6036
3 zmienionych plików z 4 dodań i 2 usunięć
  1. 2 2
      src/commands/longphase.rs
  2. 1 0
      src/helpers.rs
  3. 1 0
      src/variant/variants_stats.rs

+ 2 - 2
src/commands/longphase.rs

@@ -335,7 +335,7 @@ impl ShouldRun for LongphaseHap {
         is_file_older(
              self.bam_hp.to_string_lossy().as_ref(),
             self.bam.to_string_lossy().as_ref(),
-            true,
+            false, // will remove the whole tumoral folder
         )
         .unwrap_or(true)
     }
@@ -440,7 +440,7 @@ impl Initialize for LongphasePhase {
 
 impl ShouldRun for LongphasePhase {
     fn should_run(&self) -> bool {
-        is_file_older(&self.config.germline_phased_vcf(&self.id), &self.bam, true).unwrap_or(true)
+        is_file_older(&self.config.germline_phased_vcf(&self.id), &self.bam, false).unwrap_or(true)
     }
 }
 

+ 1 - 0
src/helpers.rs

@@ -605,6 +605,7 @@ pub fn is_file_older(file1: &str, file2: &str, rm: bool) -> anyhow::Result<bool>
 
     if mtime1 < mtime2 && rm {
         if let Some(file1_dir) = Path::new(file1).parent() {
+            
             warn!("Removing old directory: {}", file1_dir.display());
             fs::remove_dir_all(file1_dir).map_err(|e| {
                 warn!("Failed to remove {}: {}", file1_dir.display(), e);

+ 1 - 0
src/variant/variants_stats.rs

@@ -573,6 +573,7 @@ pub fn somatic_depth_quality_ranges(
     // chr1..chr22 + X,Y,M
     let contigs: Vec<String> = read_dict(&config.dict_file)?
         .into_iter()
+        .filter(|(ctg, _)| ctg != "chrM")
         .map(|(sn, _ln)| sn)
         .collect();