emvolz / treedater

Scalable relaxed clock phylogenetic dating
24 stars 11 forks source link

Error when providing multiple initial values for mutation rate #20

Open daileyco opened 8 months ago

daileyco commented 8 months ago

Throws error from the evaluation of the logical operator is.na( omega0 ) saying there are multiple conditions when omega0 is a vector of multiple values. The condition is evaluated in multiple places within .dater() and dater().

reprex

library(treedater)

this.tree <- structure(list(edge = structure(c(8L, 8L, 9L, 10L, 11L, 11L, 
10L, 9L, 12L, 12L, 8L, 1L, 9L, 10L, 11L, 2L, 3L, 4L, 12L, 5L, 
6L, 7L), dim = c(11L, 2L)), edge.length = c(0.0005870302, 0.001771467, 
0.000586391, 2.0761e-06, 2.1467e-06, 2.63e-06, 0.019689715, 0.0023575334, 
1e-06, 1e-06, 0.0011784197), Nnode = 5L, tip.label = c("EPI_ISL_85580_20101028_Alabama", 
"EPI_ISL_85818_20101103_Alabama", "EPI_ISL_85819_20101107_Alabama", 
"EPI_ISL_90804_20110404_Alabama", "EPI_ISL_87729_20101216_Alabama", 
"EPI_ISL_87882_20101216_Alabama", "EPI_ISL_89756_20110105_Alabama"
)), class = "phylo", order = "cladewise")

these.label.dates <- c(EPI_ISL_85580_20101028_Alabama = 2010.82191780822, EPI_ISL_85818_20101103_Alabama = 2010.83835616438, 
EPI_ISL_85819_20101107_Alabama = 2010.84931506849, EPI_ISL_90804_20110404_Alabama = 2011.25479452055, 
EPI_ISL_87729_20101216_Alabama = 2010.95616438356, EPI_ISL_87882_20101216_Alabama = 2010.95616438356, 
EPI_ISL_89756_20110105_Alabama = 2011.01095890411)

this.seqlength <- 1701

dater(tre = this.tree, 
      sts = these.labels.dates, 
      s = this.seqlength
     , omega0 = c(2e-4, 13e-4, 2e-3)
     # , numStartConditions = 0 
     # , clock = "uncorrelated"
     , meanRateLimits = c(1e-4, 3e-3)
     # , quiet = FALSE                       
)

I forked and implemented quick fixes; I'll submit pull request.