Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'pir_params$twinning_params$twin_evidence_filename' must be NA if there is no evidences estimated #407

Closed
richelbilderbeek opened this issue Feb 26, 2020 · 2 comments
Assignees
Labels
high priority Do this first
Projects

Comments

@richelbilderbeek
Copy link
Owner

Describe the bug

Currently, pir_params$twinning_params$twin_evidence_filename is allowed to be a string, even if there is no evidence estimated. This is confusing.

To Reproduce
Script to reproduce the behavior:

test_that("use, twinning, no evidence estimation", {

  pir_params <- create_test_pir_params(
    twinning_params = create_twinning_params()
  )
  filenames <- get_pir_params_filenames(pir_params)

  # Initialize so the tracelog and treelog filenames are filled in
  pir_params <- init_pir_params(pir_params)

  # Evidence is never estimated, thus no evidence files
  expect_false(will_measure_evidence(pir_params))
  expect_false(pir_params$evidence_filename %in% filenames)
  expect_false(pir_params$twinning_params$twin_evidence_filename %in% filenames)
})

Expected behavior

check_pir_params should call stop.

Screenshots
NA

Environment:
Show the results of running the following script:

library(mcbette)
mcbette::mcbette_report()
> mcbette::mcbette_report()
***********
* mcbette *
***********
Can run mcbette: TRUE
OS: unix
****************
* Dependencies *
****************
beautier version: 2.3.5
tracerer version: 2.0.4
beastier version: 2.1.3
mauricer version: 2.0.6
babette version: 2.1.2
**********
* BEAST2 *
**********
Java version: 11.0.6+10-post-Ubuntu-1ubuntu119.10.1
Is BEAST2 installed: TRUE
BEAST2 version: 2.6.1
BEAST2 default path: /home/richel/.local/share/beast/bin/beast
*******************
* BEAST2 packages *
*******************
Is BEAST2 NS package installed: TRUE
BEAST2 NS installed version: 1.1.0
BEAST2 NS latest version: 1.1.0
***************
* sessionInfo *
***************
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 19.10

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0

locale:
 [1] LC_CTYPE=en_US.UTF-8          LC_NUMERIC=C                 
 [3] LC_TIME=en_US.UTF-8           LC_COLLATE=en_US.UTF-8       
 [5] LC_MONETARY=en_US.UTF-8       LC_MESSAGES=en_US.UTF-8      
 [7] LC_PAPER=nl_NL.UTF-8          LC_NAME=nl_NL.UTF-8          
 [9] LC_ADDRESS=nl_NL.UTF-8        LC_TELEPHONE=nl_NL.UTF-8     
[11] LC_MEASUREMENT=en_US.UTF-8    LC_IDENTIFICATION=nl_NL.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] compiler_3.6.1 magrittr_1.5   tools_3.6.1    curl_4.3       rappdirs_0.3.1
 [6] beautier_2.3.5 mcbette_1.8.2  mauricer_2.0.6 stringi_1.4.6  beastier_2.1.3
[11] stringr_1.4.0  testit_0.11    rJava_0.9-11  

Additional context
NA

@richelbilderbeek richelbilderbeek self-assigned this Feb 26, 2020
@richelbilderbeek richelbilderbeek added this to To do in v1.2 via automation Feb 26, 2020
@richelbilderbeek richelbilderbeek added the high priority Do this first label Feb 26, 2020
@richelbilderbeek richelbilderbeek moved this from To do to In progress in v1.2 Feb 26, 2020
@richelbilderbeek
Copy link
Owner Author

Gotcha!

test_that("evidence_filename only when there are candidates", {
  pir_params <- create_test_pir_params_setup(
    has_candidate = FALSE,
    has_twinning = FALSE
  )
  pir_params$evidence_filename <- "should_be_na.csv"
  expect_error(
    check_pir_params(pir_params),
    "'evidence_filename' must be NA if there is no evidence estimation"
  )

  pir_params <- create_test_pir_params_setup(
    has_candidate = TRUE,
    has_twinning = FALSE
  )
  pir_params$evidence_filename <- NA
  expect_error(
    check_pir_params(pir_params),
    "'evidence_filename' must be a string if there is an evidence estimation"
  )


  pir_params <- create_test_pir_params_setup(
    has_candidate = FALSE,
    has_twinning = TRUE
  )
  pir_params$twinning_params$twin_evidence_filename <- "should_be_na.csv"
  expect_error(
    check_pir_params(pir_params),
    paste0(
      "'twinning_params$evidence_filename' must be NA ",
      "if there is no evidence estimation"
    )
  )

  pir_params <- create_test_pir_params_setup(
    has_candidate = TRUE,
    has_twinning = TRUE
  )
  pir_params$twinning_params$twin_evidence_filename <- NA
  expect_error(
    check_pir_params(pir_params),
    paste0(
      "'twinning_params$evidence_filename' must be a string ",
      "if there is an evidence estimation"
    )
  )
})

richelbilderbeek pushed a commit that referenced this issue Feb 26, 2020
…ion and a string if there is an evidence estimation. Fix #407
richelbilderbeek pushed a commit that referenced this issue Feb 26, 2020
…ion and a string if there is an evidence estimation. Fix #407
@richelbilderbeek
Copy link
Owner Author

Done. Closing this one 👍

v1.2 automation moved this from In progress to Done Feb 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
high priority Do this first
Projects
v1.2
  
Done
Development

No branches or pull requests

1 participant