diff --git a/CHANGELOG.md b/CHANGELOG.md index fffdfb21..5cae20a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog The semantic versioning is kind of random. +## 4.3.7 +### BugFix +- When switching from exp. to Moran, do not try to add background mutations to cell if they have their last division time greater than `TIME_AT_BIRTH`. This is a problem when `tau-exp` is not correctly set. + ## 4.3.6 ### BugFix - The previous version didn't match the number of expanded clones from the SDE mode. So, we remove factor 2 and restore solution from `v4.3.4`, even though we initiate fit variants at size 2 instead of 1 (but has small prob. of p squared). diff --git a/Cargo.lock b/Cargo.lock index a197c97b..ae0abbb8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -311,7 +311,7 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hsc" -version = "4.3.6" +version = "4.3.7" dependencies = [ "anyhow", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 3ee8de57..a4c3cd97 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hsc" -version = "4.3.6" +version = "4.3.7" edition = "2021" [dependencies] diff --git a/src/main.rs b/src/main.rs index c5399652..d3ff727c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -136,6 +136,9 @@ fn main() { proliferation, options.gillespie_options.verbosity, ); + if options.gillespie_options.verbosity > 0 { + println!("start simulating exp. phase"); + } let stop = simulate( state, @@ -145,7 +148,7 @@ fn main() { &options.gillespie_options, rng, ); - if options.gillespie_options.verbosity > 1 { + if options.gillespie_options.verbosity > 0 { println!( "exponential simulation {} stopped because {:#?}, nb cells {}", idx, @@ -165,6 +168,9 @@ fn main() { ); let moran_distributions = Distributions::new(probs_moran, app.options_moran.gillespie_options.verbosity); + if options.gillespie_options.verbosity > 0 { + println!("switching to moran"); + } // switch_to_moran start with time 0 exp.switch_to_moran( ProcessOptions { @@ -209,6 +215,9 @@ fn main() { app.options_moran.gillespie_options.verbosity, ) }; + if app.options_moran.gillespie_options.verbosity > 0 { + println!("simulating Moran phase"); + } let stop = simulate( state, diff --git a/src/process.rs b/src/process.rs index d10b4adf..2bb3825a 100644 --- a/src/process.rs +++ b/src/process.rs @@ -123,13 +123,15 @@ impl Exponential { println!("updating the neutral background mutations for all cells"); } for stem_cell in self.subclones.get_mut_cells() { - assign_background_mutations( - stem_cell, - TIME_AT_BIRTH, - &self.distributions.neutral_poisson, - rng, - self.verbosity, - ); + if stem_cell.get_last_division_time() < &TIME_AT_BIRTH { + assign_background_mutations( + stem_cell, + TIME_AT_BIRTH, + &self.distributions.neutral_poisson, + rng, + self.verbosity, + ); + } // this is required as we are restarting the time stem_cell.set_last_division_time(0f32).unwrap(); }