Giter Site home page Giter Site logo

ropensci / beautier Goto Github PK

View Code? Open in Web Editor NEW
13.0 3.0 3.0 11.24 MB

R package to generate the same BEAST2 XML parameter files as generated by BEAUti 2

Home Page: https://docs.ropensci.org/beautier

License: GNU General Public License v3.0

R 99.67% Shell 0.19% Singularity 0.14%
r r-package rstats bayesian beast beast2 phylogenetic-inference phylogenetics beauti

beautier's Introduction

rOpenSci

Project Status: Abandoned

This repository has been archived. The former README is now in README-NOT.md.

beautier's People

Contributors

olivroy avatar richelbilderbeek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

beautier's Issues

Duplicate id 'clockRate.c:anthus_aco' found

When using 2 MRCA priors (#25):

File: bad.xml seed: 1520947802409 threads: 1
Loading package BEAST v2.4.8
Loading package BEAST v2.4.8

Error 104 parsing the xml input file

IDs should be unique. Duplicate id 'clockRate.c:anthus_aco' found

Error detected about here:
  <beast>
      <run id='mcmc' spec='MCMC'>
          <distribution id='posterior' spec='util.CompoundDistribution'>
              <distribution id='likelihood' spec='util.CompoundDistribution'>
                  <distribution id='treeLikelihood.anthus_aco' spec='ThreadedTreeLikelihood'>
                      <branchRateModel id='StrictClock.c:anthus_aco' spec='beast.evolution.branchratemodel.StrictClockModel'>
                          <parameter id='clockRate.c:anthus_aco' name='clock.rate'>

bad.txt

XML should be added on monophyly instead of a strict clock

Feedback bjoelle:

mrca_prior_to_xml_tracelog, mrca_prior_to_xml_operators, mrca_prior_to_xml_prior_distr, mrca_prior_to_xml_state: these functions only add the parts relative to the strict clock if the MRCA prior is monophyletic, whereas in BEAUTi these parts are added if the MRCA prior has a distribution associated with it, whether it is monophyletic or not.

Process feedback dwinter

Feedback dwinter

This package attempts to cover the very large set of parameter values (and their permutations) that can be set for a BEAST2 run. As one might expect, it is not capable of specifying all possible BEAST2 runs, and I appreciate the clear statement about functionality that is currently missing in the package's README. I did not a number of missing use-cases that are not currently mentioned in the README.

  • As far as I can tell it is not possible to estimate one tree from multiple alignments. (i.e. one tree prior, multiple alignments possibly each with its own site model). I suspect this is a common use-case (either specified this way or through a concatenated alignment with partitions). If I have this wrong then a partitioned dataset should be added to the examples vignette. If this is not currently possible it should be a priority for future development

Moved to #69.

  • I don't think it possible to set a shifted gamma distribution (i.e. a gamma distribution with an additional "offset" value) yet. I didn't check others, but these shifted distributions are often helpful for setting node dates

Moved to #70.

Both the user-interface and the code for specifying distributions is very complex, and I am concerned about how easily this package will be to maintain. @bjoelle has made some suggestions about a more modular approach to the internal code and possibly grouping like-functions into files. I think this would be a good idea, I also wonder if you could also consider a more high-level approach to specifying these models in user-exposed code. For instance, how much power/flexibility would be lost by losing the create_*_param() functions and instead doing something like this:

node_calibration <- create_gamma_distr(alpha=1, beta=10, estimate=FALSE)

I appreciate there may be reasons for taking the approach you have, but the current does make for a complex API. Whatever the API, some narrative examples
of setting up these paramaters in the documentation would be helpful.

Moved to #71.

Minor comments about beautier

The function create_beast2_input sets the user's global scipen option. It's not clear from the code exactly where this value is needed, but it would seem a better idea to either store the existing value (old_scipen <- getOption("scipen")) then ensure the value is reset using on.exit.

Moved to #72

Create PDF

setwd(paste(getwd(), "vignettes", sep = "/"))
knit("demo.Rmd")
markdownToHTML('demo.md', 'demo.html', options=c("use_xhml"))
system("pandoc -s demo.html -o demo.pdf")

Interaction kappa1, kappa2 and S in TN93

Feedback bjoelle:

creating a TN93 model with the default settings creates two log-normal distributions as priors for kappa1 and kappa2 where the S parameter has lower=0, upper=0 and value=1.25. This works if S is not estimated, because BEAST2 only checks upper and lower when modifying the value (not when initialising it) but it will break if S is estimated.

Process feedback bjoelle

Feedback bjoelle:

Structure

  • The structure is my main concern with this package, as it contains a lot of code duplication and many functions need to run through all possible types of a certain object to figure out what to do with it. I think this makes the package hard to maintain and to extend to additional models.

  • The main issue in my opinion is that the objects (site models, clock models, etc) do not store their dependencies in a generic way, so that there is no way to know what objects a model depends on unless you know which specific model it is. My suggestion would be to add a list of components to all objects - for instance a TN93 site model would have components = c("kappa_1", "kappa_2"), a HKY would have components = "kappa" and so on. This would allow you to save a lot of code in functions like init_site_models, which could do things such as for(x in model$components) model[[paste0(x,"_param")]] = init_param(model[[paste0(x,"_param")]]) instead of needing one subfunction per type of model.

Moved to #38

  • Separating the different parameters (alpha, beta, gamma, etc) also leads to a lot of code duplication. It is useful for creating parameters as their default priors are different, but I would remove it for the other functions: the many functions is_%sth%_param(x) can be replaced by one function is_named_param(x, name) and the parameter_to_xml functions also have a lot of redundancy.

Moved to #39

  • I found it confusing that the code relative to the interaction of MRCA priors and clock models is in a different place for strict and relaxed clocks, and it seems to have led to different behaviour between the 2 clocks (see comments in Functionality section). I would recommend putting everything in the mrca_prior_to_xml functions.

Moved to #40

  • get_id, get_ids: These functions appear to be duplicated by get_alignment_id and get_alignment_ids.

Moved to #41

  • I think this package contains too many files, many of which contain only one small function. Gathering functions which are strongly linked to each other (for instance, are_site_models, is_site_model, is_site_model_name and get_site_model_names) in one file would make the package easier to read and search in my opinion.

Moved to #42

Functionality

  • the relaxed clock model doesn't work with MRCA priors that have a time calibration distribution: the state, operators, distribution and tracelog sections are all missing elements compared to an XML produced with BEAUti. This issue appears to be linked to clock_models_to_xml_state l24-25: the comment is unclear as to whether it is supposed to be checking for any or no MRCA priors, and no check is performed here for either.

Moved to #43

  • mrca_prior_to_xml_tracelog, mrca_prior_to_xml_operators, mrca_prior_to_xml_prior_distr, mrca_prior_to_xml_state: these functions only add the parts relative to the strict clock if the MRCA prior is monophyletic, whereas in BEAUTi these parts are added if the MRCA prior has a distribution associated with it, whether it is monophyletic or not.

Moved to #44

  • the distribution hyper parameters (alpha, beta, mean etc - all except lambda) can be set with estimate = TRUE, but the xml will not be created correctly with those settings (missing distribution, operators and state sections). I think the code should not allow this setting until this functionality is fully implemented.

Moved to #45

  • creating a TN93 model with the default settings creates two log-normal distributions as priors for kappa1 and kappa2 where the S parameter has lower=0, upper=0 and value=1.25. This works if S is not estimated, because BEAST2 only checks upper and lower when modifying the value (not when initialising it) but it will break if S is estimated.

Moved to #46.

  • get_phylo_crown_age will not work with sampling through time/non-ultrametric trees. I think these are not supported at the moment anyway, but it might be good to keep it in mind.

Moved to #47.

  • is_index_of_first_shared_clock_model: this function will return TRUE if the tested model is the 2nd of 3 shared clock models, in contradiction with the doc. It will also always return TRUE if the clock model at index i has id=NA.

Moved to #48.

  • is_distr: this function just checks if the input has a name attribute, which doesn't match with the name or documentation of the function

Moved to #49.

  • get_site_model_n_params and get_site_model_n_distrs do not check if the site model has gamma rate categories, they just assume it does

Moved to #50.

Documentation

  • kappa_1, kappa_2 and the tree prior parameters are always estimated and this cannot be changed - I think this should be mentioned in the corresponding doc.

Moved to #51.

  • the doc should make it clearer that the function used to build the branchRateModel section is clock_model_to_xml_lh_distr if there are no MRCA priors, and mrca_prior_to_xml_lh_distr if there are MRCA priors, and that mrca_prior_to_xml_lh_distr only supports strict clocks at the moment

Moved to #52.

  • fasta_file_to_sequences: both the documentation and the input variable (fasta_filenames) wrongly indicate that this function can take multiple files

Moved to #53.

  • get_id, get_ids: I don't understand what "conclude the ID" means in this doc. I would replace that with "extract the file names without extensions" or something similar.

Moved to #54.

Minor comments

  • all the functions clock_models_to_xml start by calling get_unlinked_clock_models. This call could be placed earlier (create_beast2_input_run is my suggestion) which would save the repetition.

Moved to #55.

  • there is an empty file to_do.R in the package

Moved to #56.

  • fastas_to_phylos: the main description and @return say this creates a random phylogeny instead of one or more depending on the input

Moved to #57.

  • is_index_of_non_first_shared_clock_model, create_beast2_input_init: wrong doc

Moved to #58.

  • get_site_model_n_params: the doc refers to number of distributions instead of parameters.

Moved to #59.

  • is_in_patterns: mismatched doc ("Create a random beta distribution")

Moved to #60.

  • remove_first_brm_clock_rate: missing doc

Moved to #61.

  • remove_multiline: consequetive -> consecutive

Moved to #62.

  • clock_model_to_xml_tracelog: the seealso links to the same function

Moved to #63.

  • has_xml_closing_tag: opening -> closing

Moved to #64.

  • init_gamma_site_model: the doc refers to "all site models" but the function takes only one as input

Moved to #65.

  • mrca_prior_to_xml_taxonset, mrca_priors_to_xml_prior_distr: the top description of these functions is confusing

Moved to #66.

  • has_xml_short_closing_tag: at the end of the text -> in one of the lines of text

Moved to #67.

  • create_beast2_input_run: state section -> run section

Moved to #68.

Move irregularity

Search for:

# Irregularity: WIP, TODO, to be moved to someplace else

Move someplace better.

No interaction between MRCA prior and clock models

Feedback bjoelle:

the relaxed clock model doesn't work with MRCA priors that have a time calibration distribution: the state, operators, distribution and tracelog sections are all missing elements compared to an XML produced with BEAUti. This issue appears to be linked to clock_models_to_xml_state l24-25: the comment is unclear as to whether it is supposed to be checking for any or no MRCA priors, and no check is performed here for either.

Create examples vignette

At, for example, a1d8693, there was an 'Examples' vignette, close to identical to the Examples markdown file.

It is removed as it gives error when building:

0.34schecking re-building of vignette outputs ... WARNING
Error in re-building vignettes:
  ...
pandoc: Could not fetch all_default.png
all_default.png: openBinaryFile: does not exist (No such file or directory)
Error: processing vignette 'examples.Rmd' failed with diagnostics:
pandoc document conversion failed with error 67

all_default.png does exists. The vignette does build locally with CTRL-K. The vignette also fails when testing the package with CTRL-SHIFT-E.

No idea how to fix this, the minimal example, travis_r_vignette_with_pics, works as expected.

Call BEAST2 directly?

print(Sys.time())
  Rprof("~/profile.txt")

  input_fasta_filenames <- beautier:::get_paths(
    c("anthus_aco.fas", "anthus_nd2.fas"))
  n_fail <- 0

  for (site_model_1 in beautier::create_site_models()) {
    for (site_model_2 in beautier::create_site_models()) {
      for (clock_model_1 in beautier::create_clock_models()) {
        for (clock_model_2 in beautier::create_clock_models()) {
          for (tree_prior in beautier::create_tree_priors()) {

            if (runif(n = 1) < 0.9) next

            output_xml_filename <- "~/invalid.xml"
            create_beast2_input_file(
              input_fasta_filenames = input_fasta_filenames,
              site_models = list(site_model_1, site_model_2),
              clock_models = list(clock_model_1, clock_model_2),
              tree_priors = list(tree_prior, tree_prior),
              output_xml_filename = output_xml_filename
            )
            is_ok <- beautier::is_beast2_input_file(output_xml_filename)
            if (!is_ok) {
              print(paste(site_model_1$name, site_model_2$name,
                clock_model_1$name, clock_model_2$name, tree_prior$name))
              beautier::is_beast2_input_file(output_xml_filename,
                verbose = TRUE)
              n_fail <- n_fail + 1
            }
            # testthat::expect_true(is_ok) # nolint one day will be OK
          }
        }
      }
    }
  }
  testthat::expect_equal(n_fail, 0)
  Rprof()
  print(Sys.time())
  summaryRprof("~/profile.txt")

results in

print(Sys.time())
[1] "2017-12-19 11:04:45 CET"

[code]

>   print(Sys.time())
[1] "2017-12-19 11:06:00 CET"
> summaryRprof("~/profile.txt")
$by.self
                                  self.time self.pct total.time total.pct
"cat"                                  1.20    24.90       1.20     24.90
"getExportedValue"                     0.36     7.47       1.02     21.16
"%in%"                                 0.28     5.81       0.70     14.52
"asNamespace"                          0.20     4.15       0.34      7.05
"system"                               0.18     3.73       0.18      3.73
"::"                                   0.16     3.32       1.20     24.90
"isBaseNamespace"                      0.14     2.90       0.14      2.90
"sub"                                  0.14     2.90       0.14      2.90
"assert2"                              0.12     2.49       1.14     23.65
"get0"                                 0.12     2.49       0.12      2.49
[...]
"writeLines"                           0.02     0.41       0.02      0.41

$by.total
                                           total.time total.pct self.time self.pct
"create_beast2_input_file"                       4.56     94.61      0.00     0.00
"create_beast2_input"                            4.54     94.19      0.00     0.00
"create_beast2_input_beast"                      3.14     65.15      0.00     0.00
"eval"                                           2.28     47.30      0.06     1.24
"create_beast2_input_data"                       1.84     38.17      0.00     0.00
"create_beast2_input_data_sequences"             1.82     37.76      0.00     0.00
"beautier::fasta_file_to_sequences"              1.64     34.02      0.00     0.00
"utils::capture.output"                          1.44     29.88      0.02     0.41
"testit::assert"                                 1.32     27.39      0.06     1.24
"withVisible"                                    1.22     25.31      0.02     0.41
[...]

$sample.interval
[1] 0.02

$sampling.time
[1] 4.82

Thus, out of 75 seconds, only 5 seconds were in the actual code. That means 70 seconds BEAST was called.

Feedback CRAN

Unknown, possibly mis-spelled, fields in DESCRIPTION:
'Remotes'

Please omit this field.

Please single qupte software names such as 'BEAST2' in your Description and give web references in > the form yhttp.....> ifthese are not R packages.

Best,
Uwe Ligges

Reduce code duplication by using more general functions in the back-end

Feedback bjoelle:

Structure

  • The structure is my main concern with this package, as it contains a lot of code duplication and many functions need to run through all possible types of a certain object to figure out what to do with it. I think this makes the package hard to maintain and to extend to additional models.

The main issue [...] (see #38)

Separating the different parameters (alpha, beta, gamma, etc) also leads to a lot of code duplication. It is useful for creating parameters as their default priors are different, but I would remove it for the other functions: the many functions is_%sth%_param(x) can be replaced by one function is_named_param(x, name) and the parameter_to_xml functions also have a lot of redundancy.

Hyper parameters are not estimated

Feedback bjoelle:

the distribution hyper parameters (alpha, beta, mean etc - all except lambda) can be set with estimate = TRUE, but the xml will not be created correctly with those settings (missing distribution, operators and state sections). I think the code should not allow this setting until this functionality is fully implemented.

Interaction between MRCA prior and clock models in one place

Feedback bjoelle

I found it confusing that the code relative to the interaction of MRCA priors and clock models is in a different place for strict and relaxed clocks, and it seems to have led to different behaviour between the 2 clocks (see comments in Functionality section). I would recommend putting everything in the mrca_prior_to_xml functions.

Don't know how to generate a Random Tree for taxon sets that intersect, but are not inclusive

Full error message:

Error 110 parsing the xml input file

validate and intialize error: 333: Don't know how to generate a Random Tree for taxon sets that intersect, but are not inclusive. Taxonset two_and_three.prior and one_and_two.prior

Error detected about here:
  <beast>
      <run id='mcmc' spec='MCMC'>
          <init id='RandomTree.t:test_output_5' spec='beast.evolution.tree.RandomTree'>

Let's break it:

2018-03-13-130936_945x708_scrot

XML file created (that could be created):

should_fail.txt

Detect BEAST2 warnings

When validating file beast2_warning.xml:

WARNING: StateNode (freqParameter.s:anthus_aco) found that has no effect on posterior!

Bundle more functions per file

Feedback bjoelle:

I think this package contains too many files, many of which contain only one small function. Gathering functions which are strongly linked to each other (for instance, are_site_models, is_site_model, is_site_model_name and get_site_model_names) in one file would make the package easier to read and search in my opinion.

There are more groups than coalescent nodes in the tree

validate and intialize error: There are more groups than coalescent nodes in the tree.

Error detected about here:
  <beast>
      <run id='mcmc' spec='MCMC'>
          <distribution id='posterior' spec='util.CompoundDistribution'>
              <distribution id='prior' spec='util.CompoundDistribution'>
                  <distribution id='BayesianSkyline.t:anthus_aco_sub' spec='BayesianSkyline'>

bad.txt

Cannot compute beta density at 1 when beta is negative

[1] "ERROR"
 [1] ""                                                                                  
 [2] "                        BEAST v2.4.7, 2002-2017"                                   
 [3] "             Bayesian Evolutionary Analysis Sampling Trees"                        
 [4] "                       Designed and developed by"                                  
 [5] " Remco Bouckaert, Alexei J. Drummond, Andrew Rambaut & Marc A. Suchard"            
 [6] "                                    "                                              
 [7] "                     Department of Computer Science"                               
 [8] "                         University of Auckland"                                   
 [9] "                        [email protected]"                                   
[10] "                        [email protected]"                                  
[11] "                                    "                                              
[12] "                   Institute of Evolutionary Biology"                              
[13] "                        University of Edinburgh"                                   
[14] "                           [email protected]"                                     
[15] "                                    "                                              
[16] "                    David Geffen School of Medicine"                               
[17] "                 University of California, Los Angeles"                            
[18] "                           [email protected]"                                      
[19] "                                    "                                              
[20] "                      Downloads, Help & Resources:"                                
[21] "                           http://beast2.org/"                                     
[22] "                                    "                                              
[23] "  Source code distributed under the GNU Lesser General Public License:"            
[24] "                   http://github.com/CompEvol/beast2"                              
[25] "                                    "                                              
[26] "                           BEAST developers:"                                      
[27] "   Alex Alekseyenko, Trevor Bedford, Erik Bloomquist, Joseph Heled, "              
[28] " Sebastian Hoehna, Denise Kuehnert, Philippe Lemey, Wai Lok Sibon Li, "            
[29] "Gerton Lunter, Sidney Markowitz, Vladimir Minin, Michael Defoin Platel, "          
[30] "                 Oliver Pybus, Chieh-Hsi Wu, Walter Xie"                           
[31] "                                    "                                              
[32] "                               Thanks to:"                                         
[33] "          Roald Forsberg, Beth Shapiro and Korbinian Strimmer"                     
[34] ""                                                                                  
[35] "Random number seed: 1519987266495"                                                 
[36] ""                                                                                  
[37] "61430_aco: 960 4"                                                                  
[38] "626029_aco: 960 4"                                                                 
[39] "630116_aco: 960 4"                                                                 
[40] "630210_aco: 960 4"                                                                 
[41] "AMNH13589_aco: 960 4"                                                              
[42] "B25702_aco: 960 4"                                                                 
[43] "B41613_aco: 960 4"                                                                 
[44] "B431_aco: 960 4"                                                                   
[45] "B48218_aco: 960 4"                                                                 
[46] "B87109_aco: 960 4"                                                                 
[47] "FALK1_aco: 960 4"                                                                  
[48] "KU21673_aco: 960 4"                                                                
[49] "KU25127_aco: 960 4"                                                                
[50] "KU3604_aco: 960 4"                                                                 
[51] "KU9813_aco: 960 4"                                                                 
[52] "UWBM54394_aco: 960 4"                                                              
[53] "UWBM54511_aco: 960 4"                                                              
[54] "UWBM54556_aco: 960 4"                                                              
[55] "bas3_aco: 960 4"                                                                   
[56] "chacoensis_aco: 960 4"                                                             
[57] "dabbenei_aco: 960 4"                                                               
[58] "meridae_aco: 960 4"                                                                
[59] "Alignment(anthus_aco)"                                                             
[60] "  22 taxa"                                                                         
[61] "  960 sites"                                                                       
[62] "  70 patterns"                                                                     
[63] ""                                                                                  
[64] ""                                                                                  
[65] "Error 110 parsing the xml input file"                                              
[66] ""                                                                                  
[67] "validate and intialize error: Cannot compute beta density at 1 when beta = %.3g"   
[68] ""                                                                                  
[69] "Error detected about here:"                                                        
[70] "  <beast>"                                                                         
[71] "      <run id='mcmc' spec='MCMC'>"                                                 
[72] "          <distribution id='posterior' spec='util.CompoundDistribution'>"          
[73] "              <distribution id='prior' spec='util.CompoundDistribution'>"          
[74] "                  <prior id='YuleBirthRatePrior.t:anthus_aco' name='distribution'>"
[75] ""                                                                                  
attr(,"status")
[1] 1
[1] "site model:"
$name
[1] "JC69"

$id
[1] NA

$gamma_site_model
$gamma_site_model$gamma_cat_count
[1] 0

$gamma_site_model$gamma_shape
[1] 0.8105238

$gamma_site_model$prop_invariant
[1] 0.7663484

$gamma_site_model$gamma_shape_prior_distr
$gamma_site_model$gamma_shape_prior_distr$name
[1] "inv_gamma"

$gamma_site_model$gamma_shape_prior_distr$id
[1] NA

$gamma_site_model$gamma_shape_prior_distr$alpha
$gamma_site_model$gamma_shape_prior_distr$alpha$name
[1] "alpha"

$gamma_site_model$gamma_shape_prior_distr$alpha$id
[1] NA

$gamma_site_model$gamma_shape_prior_distr$alpha$estimate
[1] FALSE

$gamma_site_model$gamma_shape_prior_distr$alpha$value
[1] 92.08046


$gamma_site_model$gamma_shape_prior_distr$beta
$gamma_site_model$gamma_shape_prior_distr$beta$name
[1] "beta"

$gamma_site_model$gamma_shape_prior_distr$beta$id
[1] NA

$gamma_site_model$gamma_shape_prior_distr$beta$estimate
[1] FALSE

$gamma_site_model$gamma_shape_prior_distr$beta$value
[1] -41.83111




[1] "clock model:"
$name
[1] "strict"

$id
[1] NA

$clock_rate_param
$clock_rate_param$name
[1] "clock_rate"

$clock_rate_param$id
[1] NA

$clock_rate_param$estimate
[1] FALSE

$clock_rate_param$value
[1] 66.6412


$clock_rate_distr
$clock_rate_distr$name
[1] "laplace"

$clock_rate_distr$id
[1] NA

$clock_rate_distr$mu
$clock_rate_distr$mu$name
[1] "mu"

$clock_rate_distr$mu$id
[1] NA

$clock_rate_distr$mu$estimate
[1] TRUE

$clock_rate_distr$mu$value
[1] 9.882322


$clock_rate_distr$scale
$clock_rate_distr$scale$name
[1] "scale"

$clock_rate_distr$scale$id
[1] NA

$clock_rate_distr$scale$estimate
[1] TRUE

$clock_rate_distr$scale$value
[1] -98.63774



[1] "tree prior:"
$name
[1] "yule"

$id
[1] NA

$birth_rate_distr
$birth_rate_distr$name
[1] "beta"

$birth_rate_distr$id
[1] NA

$birth_rate_distr$alpha
$birth_rate_distr$alpha$name
[1] "alpha"

$birth_rate_distr$alpha$id
[1] NA

$birth_rate_distr$alpha$estimate
[1] TRUE

$birth_rate_distr$alpha$value
[1] -4.153554


$birth_rate_distr$beta
$birth_rate_distr$beta$name
[1] "beta"

$birth_rate_distr$beta$id
[1] NA

$birth_rate_distr$beta$estimate
[1] FALSE

$birth_rate_distr$beta$value
[1] -93.9874

Objects do not store dependencies in a general way

Feedback bjoelle:

Structure

The structure is my main concern with this package, as it contains a lot of code duplication and many functions need to run through all possible types of a certain object to figure out what to do with it. I think this makes the package hard to maintain and to extend to additional models.

The main issue in my opinion is that the objects (site models, clock models, etc) do not store their dependencies in a generic way, so that there is no way to know what objects a model depends on unless you know which specific model it is. My suggestion would be to add a list of components to all objects - for instance a TN93 site model would have components = c("kappa_1", "kappa_2"), a HKY would have components = "kappa" and so on. This would allow you to save a lot of code in functions like init_site_models, which could do things such as for(x in model$components) model[[paste0(x,"_param")]] = init_param(model[[paste0(x,"_param")]]) instead of needing one subfunction per type of model.

Again: Cannot compute beta density at 1 when beta = %.3g"

p230198@peregrine:scripts cat test_random_nonsense_1_698476.log 

The following have been reloaded with a version change:
  1) ncurses/6.0 => ncurses/6.0-foss-2016a

[1] "seed: 1720902764"
[1] 1
...
[1] 182
[1] 183
[1] 184
[1] "ERROR"
 [1] ""                                                                                   
 [2] "                        BEAST v2.4.0, 2002-2016"                                    
 [3] "             Bayesian Evolutionary Analysis Sampling Trees"                         
 [4] "                       Designed and developed by"                                   
 [5] " Remco Bouckaert, Alexei J. Drummond, Andrew Rambaut & Marc A. Suchard"             
 [6] "                                    "                                               
 [7] "                     Department of Computer Science"                                
 [8] "                         University of Auckland"                                    
 [9] "                        [email protected]"                                    
[10] "                        [email protected]"                                   
[11] "                                    "                                               
[12] "                   Institute of Evolutionary Biology"                               
[13] "                        University of Edinburgh"                                    
[14] "                           [email protected]"                                      
[15] "                                    "                                               
[16] "                    David Geffen School of Medicine"                                
[17] "                 University of California, Los Angeles"                             
[18] "                           [email protected]"                                       
[19] "                                    "                                               
[20] "                      Downloads, Help & Resources:"                                 
[21] "                           http://beast2.org/"                                      
[22] "                                    "                                               
[23] "  Source code distributed under the GNU Lesser General Public License:"             
[24] "                   http://github.com/CompEvol/beast2"                               
[25] "                                    "                                               
[26] "                           BEAST developers:"                                       
[27] "   Alex Alekseyenko, Trevor Bedford, Erik Bloomquist, Joseph Heled, "               
[28] " Sebastian Hoehna, Denise Kuehnert, Philippe Lemey, Wai Lok Sibon Li, "             
[29] "Gerton Lunter, Sidney Markowitz, Vladimir Minin, Michael Defoin Platel, "           
[30] "                 Oliver Pybus, Chieh-Hsi Wu, Walter Xie"                            
[31] "                                    "                                               
[32] "                               Thanks to:"                                          
[33] "          Roald Forsberg, Beth Shapiro and Korbinian Strimmer"                      
[34] ""                                                                                   
[35] "Random number seed: 1519993479561"                                                  
[36] ""                                                                                   
[37] "Loading package BEAST v2.4.0"                                                       
[38] "61430_aco: 960 4"                                                                   
[39] "626029_aco: 960 4"                                                                  
[40] "630116_aco: 960 4"                                                                  
[41] "630210_aco: 960 4"                                                                  
[42] "AMNH13589_aco: 960 4"                                                               
[43] "B25702_aco: 960 4"                                                                  
[44] "B41613_aco: 960 4"                                                                  
[45] "B431_aco: 960 4"                                                                    
[46] "B48218_aco: 960 4"                                                                  
[47] "B87109_aco: 960 4"                                                                  
[48] "FALK1_aco: 960 4"                                                                   
[49] "KU21673_aco: 960 4"                                                                 
[50] "KU25127_aco: 960 4"                                                                 
[51] "KU3604_aco: 960 4"                                                                  
[52] "KU9813_aco: 960 4"                                                                  
[53] "UWBM54394_aco: 960 4"                                                               
[54] "UWBM54511_aco: 960 4"                                                               
[55] "UWBM54556_aco: 960 4"                                                               
[56] "bas3_aco: 960 4"                                                                    
[57] "chacoensis_aco: 960 4"                                                              
[58] "dabbenei_aco: 960 4"                                                                
[59] "meridae_aco: 960 4"                                                                 
[60] "Alignment(anthus_aco)"                                                              
[61] "  22 taxa"                                                                          
[62] "  960 sites"                                                                        
[63] "  70 patterns"                                                                      
[64] ""                                                                                   
[65] ""                                                                                   
[66] "Error 110 parsing the xml input file"                                               
[67] ""                                                                                   
[68] "nullvalidate and intialize error: Cannot compute beta density at 1 when beta = %.3g"
[69] ""                                                                                   
[70] "Error detected about here:"                                                         
[71] "  <beast>"                                                                          
[72] "      <run id='mcmc' spec='MCMC'>"                                                  
[73] "          <distribution id='posterior' spec='util.CompoundDistribution'>"           
[74] "              <distribution id='prior' spec='util.CompoundDistribution'>"           
[75] "                  <prior id='YuleBirthRatePrior.t:anthus_aco' name='distribution'>" 
[76] ""                                                                                   
attr(,"status")
[1] 1
[1] "site model:"
Error in print(site_model) : object 'site_model' not found
Calls: source ... withVisible -> eval -> eval -> create_random -> print
In addition: Warning messages:
1: running command 'java -jar ~/Programs/beast/lib/beast.jar -validate /local/698476/RtmpOuJCwU/file210862f948c7 2>/dev/null' had status 1 
2: In file.create(to[okay]) :
  cannot create file '/home/richel/bad.xml', reason 'No such file or directory'
3: running command 'java -jar ~/Programs/beast/lib/beast.jar -validate /local/698476/RtmpOuJCwU/file210862f948c7 2>/dev/null' had status 1 
Execution halted

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.