From ff5350f3038e68bb91c49e5597d783669980d8c8 Mon Sep 17 00:00:00 2001 From: benj919 <926479+benj919@users.noreply.github.com> Date: Fri, 15 Aug 2025 00:33:56 +0200 Subject: [PATCH 1/2] complete fix #63 fix #70; correct extinction time to the last time step a species was alive at the beginning of a time step. Also fixes the case where a species seemingly can speciate in the time step after it's extinction. --- DESCRIPTION | 2 +- R/simulation.R | 2 +- .../CaseStudy1/reference_saves/phy.nex | 2 +- .../reference_saves/sgen3sis_summary.rds | Bin 2609 -> 2610 bytes tests/testthat/test-gen3sis_main.R | 1 + 5 files changed, 4 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 02d280b..b89916f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: gen3sis Type: Package Title: General Engine for Eco-Evolutionary Simulations -Version: 1.5.11 +Version: 1.5.14 Date: 2023-11-21 Authors@R: c( person("ETH Zürich", role=c("cph")), diff --git a/R/simulation.R b/R/simulation.R index 218f669..197464a 100644 --- a/R/simulation.R +++ b/R/simulation.R @@ -312,7 +312,7 @@ setup_distance_matrix <- function(config, data, vars) { update_extinction_times <- function(config, data, vars) { for (sp in data$all_species) { if(length(sp[["abundance"]])) { - data$phy$"Extinction.Time"[as.integer(sp[["id"]])] <- vars$ti + data$phy$"Extinction.Time"[as.integer(sp[["id"]])] <- vars$ti - 1 } } return(list(config = config, data = data, vars = vars)) diff --git a/inst/extdata/CaseStudy1/reference_saves/phy.nex b/inst/extdata/CaseStudy1/reference_saves/phy.nex index bb672a9..f918b51 100644 --- a/inst/extdata/CaseStudy1/reference_saves/phy.nex +++ b/inst/extdata/CaseStudy1/reference_saves/phy.nex @@ -1,5 +1,5 @@ #NEXUS begin trees; -Tree tree = (((species1:5,species4:1):0,species3:5):0,species2:2):0; +Tree tree = (((species1:5,species4:2):0,species3:5):0,species2:3):0; end; [!Tree generated with the gen3sis R package, following convention of TreeSim and TreeSimGM r-packages] diff --git a/inst/extdata/CaseStudy1/reference_saves/sgen3sis_summary.rds b/inst/extdata/CaseStudy1/reference_saves/sgen3sis_summary.rds index cacbda29bc5eeac85c97710f5867422b9ce120cb..cb6be0bfa252e7415a6874c714de43aa43112a84 100644 GIT binary patch literal 2610 zcmdtk|5MX-9Kdld%Cjqu(@LZrks2Y@@(yCtq_{Gdg~%6+L)w^?1WoxsxiJOy*=4qM zB8OQw5`j6UFhm?Wc9YKsKC4@S+!{#jO9MZC;uvi3VV@~u4mP$=8$Wd3)ervE4|_k~ z_j=#seeXZuomjUvYIQ|BZ?o!JO!4A-Eqg`3oLYY?I`+%wH*aoB^@D6ADc6x)CMzxZ zv3>iQy(iK(1dau0Z_Fp>mM&!Yk=JB}ux#k586ZTs18Fq!5IatvfYJ;SDvcs+p>8 z2!g@I>N`*npV9Lxz`&)7K7N22*O8ORF2=9}T34{n#R3Dw@~_LL<=O8&9h#NOYr5UB zaXXmz#rk32dGvs`veq+yS=cr8N3xx)?GM@vdV9m@NRDzu%3?l;EG~(=+;ytyEEvtf zg*rIk`U}&llq;~$plgU#g563MnS!lM$$VwyUNXgN5%5v3S?VaU%bVX-V`5ARcysWB(u;5DKV2i1fH2UUcw#130pT*XyLjdhs_q46OwZHIXe z_p*c>;#ZU>I%$wMwCRuw;9?VwH~(}X+Ofbvxqp)3mDdwP6f}nhNdayq=4d^_^-@?? z#~i~#gOIWMdH~=amhYrN>?2(5Z3n0x3slSf28MT%#&117bFTD(QQq80GUp3MT*6PR z8SdZGMjsq2nXTt@WQfOoHB;huu;DmqF6j15(AlJEsFF>N>!qnwW$k+Pz{2OIFK*Z- z^TqnYZ5nT~V8Wa2YZs`H<5*jTRWtVy{UYV}m{}2b7qkgI1MFF)Q&hDJmZ7(RGI}p% zJSIdP^fB546wlzC&ne>>)^>%wo%6F9SrUkXdU`3@D4r9c}CS1 z_&f9_aEN}LVhvLc<)I4T1Nvo(seX>Z3v=VY6Az9BZ71>8uF4Ou4x0MbSZqbiPUnC0 zc)ILG#ojcMyW{k~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11 ----------- 3 files changed, 8 insertions(+), 14 deletions(-) delete mode 100644 man/skeleton_config.Rd diff --git a/DESCRIPTION b/DESCRIPTION index b89916f..3708a68 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: gen3sis Type: Package Title: General Engine for Eco-Evolutionary Simulations -Version: 1.5.14 +Version: 1.5.15 Date: 2023-11-21 Authors@R: c( person("ETH Zürich", role=c("cph")), diff --git a/R/skeleton_config.R b/R/skeleton_config.R index b9508c5..1d3a106 100644 --- a/R/skeleton_config.R +++ b/R/skeleton_config.R @@ -5,8 +5,13 @@ # empty skeleton config # internal helper: returns a single compiled string used by write_config_skeleton() +#' create a skeleton config string from scratch +#' @details create a skeleton config string from scratch +#' +#' @return a string containing the skeleton config +#' @noRd skeleton_config <- function(){ -paste0(c(' + paste0(c(' ###################################### ### METADATA ### ###################################### @@ -15,7 +20,7 @@ paste0(c(' # Version: 1.0 # # Author: -#', paste0("# Date: ", format(Sys.Date(), format="%d.%m.%Y")), +# ', paste0("# Date: ", format(Sys.Date(), format="%d.%m.%Y")), '# # Landscape: # diff --git a/man/skeleton_config.Rd b/man/skeleton_config.Rd deleted file mode 100644 index d91e3f5..0000000 --- a/man/skeleton_config.Rd +++ /dev/null @@ -1,11 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/skeleton_config.R -\name{skeleton_config} -\alias{skeleton_config} -\title{, paste0("# Date: ", format(Sys.Date(), format="%d.%m.%Y")),} -\usage{ -skeleton_config() -} -\description{ -, paste0("# Date: ", format(Sys.Date(), format="%d.%m.%Y")), -}