treeflow.model.phylo_model module
- treeflow.model.phylo_model.parse_model(model: Dict[str, object] | str) Tuple[str, Dict[str, object | Dict[str, object]] | None]
- exception treeflow.model.phylo_model.PhyloModelParseError
Bases:
ValueError- add_note()
Exception.add_note(note) – add a note to the exception
- args
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- class treeflow.model.phylo_model.PhyloModel(model_dict: Dict[str, str | Dict[str, object]])
Bases:
objectClass to represent the configuration of a basic phylogenetic model
- classmethod check_model_dict(model_dict: Dict[str, str | Dict[str, object]])
- all_params() Dict[str, object]
- free_params() Dict[str, Dict[str, object]]
- relaxed_clock() bool
- treeflow.model.phylo_model.is_scalar_or_vector_of_type(value: object, numeric_type: Type)
- treeflow.model.phylo_model.constant(value: object) Tensor | object
- treeflow.model.phylo_model.get_prior(var_name: str, dist_name: str, params: Dict[str, Tensor | object]) Distribution
- treeflow.model.phylo_model.get_params(params: Dict[str, object | Dict[str, object]] | None) Generator[Root, Tensor, Tuple[Dict[str, Tensor | object], bool]]
Get parameters for part of the model. Builds prior distributions or converts literals to Tensor constants.
- Returns:
dict – Dictionary mapping parameter names to values
has_root – Whether one of the parameters is a root node
- treeflow.model.phylo_model.wrap_in_root_if_needed(dist: Distribution, has_root_param: bool) Distribution | Root
- treeflow.model.phylo_model.get_tree_model(tree_model: str, tree_model_params: Dict[str, object], has_root_param: bool, initial_tree: TensorflowRootedTree, var_name: str = 'tree') Generator[Distribution | Root, TensorflowRootedTree, TensorflowRootedTree]
- treeflow.model.phylo_model.get_subst_model(subst_model: str) EigendecompositionSubstitutionModel
- treeflow.model.phylo_model.get_subst_model_params(subst_model: str, params: Dict[str, object | Dict[str, object]] | None, float_dtype: DType = tf.float64, include_jc_frequencies: bool = True) Generator[Distribution, Tensor, Tuple[Dict[str, Tensor | object], bool]]
- treeflow.model.phylo_model.get_strict_clock_rates(clock_rate: Tensor)
- treeflow.model.phylo_model.get_relaxed_lognormal_clock_rate_distribution(branch_rate_loc: Tensor, branch_rate_scale: Tensor, has_root_param: bool, initial_tree: TensorflowRootedTree) Distribution
- treeflow.model.phylo_model.get_clock_model_rates(clock_model: str, clock_model_params: Dict[str, object], has_root_param: bool, initial_tree: TensorflowRootedTree) Generator[Distribution, Tensor, Tensor]
- treeflow.model.phylo_model.get_discrete_gamma_site_rate_distribution(category_count: Tensor, site_gamma_shape: Tensor) DiscretizedDistribution
- treeflow.model.phylo_model.get_discrete_weibull_site_rate_distribution(category_count: Tensor, site_weibull_concentration: Tensor, site_weibull_scale: Tensor | None = None) DiscretizedDistribution
- treeflow.model.phylo_model.get_site_rate_distribution(site_model, site_model_params) FiniteDiscreteDistribution
- treeflow.model.phylo_model.get_sequence_distribution(alignment: Alignment, tree: TensorflowRootedTree, subst_model: EigendecompositionSubstitutionModel, subst_model_params: Dict[str, Tensor], site_model: str, site_model_params: Dict[str, object], clock_model_rates: Tensor, pattern_counts: Tensor | None = None) Distribution
- treeflow.model.phylo_model.phylo_model_to_joint_distribution(model: PhyloModel, initial_tree: TensorflowRootedTree, initial_alignment: Alignment, pattern_counts: Tensor | None = None) JointDistributionCoroutine