R/create_branch_rate_model_xml.R

Defines functions create_branch_rate_model_xml

Documented in create_branch_rate_model_xml

#' Internal function to create the \code{branchRateModel} section
#' of the XML as text.
#'
#' Creates the \code{branchRateModel} section
#' of the XML as text.
#'
#' The \code{distribution} tag (with ID equals \code{treeLikelihood})
#' has these elements:
#'
#' \preformatted{
#'   <branchRateModel[...]>
#'     [...]
#'   </branchRateModel>
#' }
#'
#' When there is a strict clock,
#'   \link{create_strict_clock_branch_rate_model_xml} is called.
#' When there is an RLN clock,
#'   \link{create_rln_clock_branch_rate_model_xml} is called.
#'
#' Zooming out:
#'
#' \preformatted{
#'   <beast[...]>
#'     <run[...]>
#'       <distribution id="posterior"[...]>
#'         <distribution id="likelihood"[...]>
#'           <distribution id="treeLikelihood"[...]>
#'              [...]
#'
#'              [this section]
#'           </distribution>
#'         </distribution>
#'       </distribution>
#'     </run>
#'   </beast>
#' }
#'
#' @inheritParams default_params_doc
#' @return a character vector of XML strings
#' @author Richèl J.C. Bilderbeek
#' @export
create_branch_rate_model_xml <- function(# nolint long function name, which is fine for a long function
  inference_model
) {
  if (is_strict_clock_model(inference_model$clock_model)) {
    return(create_strict_clock_branch_rate_model_xml(inference_model))
  } else {
    check_true(
      is_rln_clock_model(inference_model$clock_model)
    )
    return(create_rln_clock_branch_rate_model_xml(inference_model))
  }
}

Try the beautier package in your browser

Any scripts or data that you put into this service are public.

beautier documentation built on Nov. 2, 2023, 5:08 p.m.