Bladeren bron

added should_run for LongphaseHap run

Thomas 6 dagen geleden
bovenliggende
commit
538e30df2e
2 gewijzigde bestanden met toevoegingen van 8 en 2 verwijderingen
  1. 2 0
      src/callers/mod.rs
  2. 6 2
      src/commands/longphase.rs

+ 2 - 0
src/callers/mod.rs

@@ -225,6 +225,8 @@ pub fn run_somatic_callers(id: &str, config: &Config) -> anyhow::Result<()> {
 
     run_phasing_somatic(id, config)?;
 
+
+
     // if slurm send jobs in parallel else run caller sequentially
     if config.slurm_runner {
         let config = Arc::new(config.clone());

+ 6 - 2
src/commands/longphase.rs

@@ -296,6 +296,11 @@ impl Run for LongphaseHap {
             fs::remove_file(&self.bam_hp)?;
         }
 
+        if !self.should_run() {
+            info!("LongphaseHap is up-to-date for {}", self.bam_hp.display());
+            return Ok(());
+        }
+
         if !Path::new(&self.log_dir).exists() {
             fs::create_dir_all(&self.log_dir).context("Failed to create output directory.")?;
         }
@@ -332,9 +337,8 @@ impl Run for LongphaseHap {
 
 impl ShouldRun for LongphaseHap {
     fn should_run(&self) -> bool {
-        let final_bam = PathBuf::from(format!("{}.bam", self.bam_hp.to_string_lossy()));
         is_file_older(
-            final_bam.to_string_lossy().as_ref(),
+             self.bam_hp.to_string_lossy().as_ref(),
             self.bam.to_string_lossy().as_ref(),
             true,
         )