phylojunction.interface.grammar package
Submodules
phylojunction.interface.grammar.ct_fn_grammar module
- class phylojunction.interface.grammar.ct_fn_grammar.PJCtFnGrammar
Bases:
object
- classmethod create_ct_fn_obj(ct_fn_id: str, ct_fn_param_dict: Dict[str, List[NodeDAG | str]]) ConstantFn | None
Build and return constant function object.
- Parameters:
ct_fn_id (str) – Name of constant function to being called
ct_fn_param_dict (dict) – Dictionary containing constant function parameter names (str) as keys and lists (of either strings or NodeDAGs) as values
- Returns:
one of a variety of objects to be stored within a clamped stochastic node
- Return type:
Object
- ct_fn_grammar_dict: Dict[str, Set[str]] = {'read_tree': {'file_path', 'n', 'node_name_attr', 'nr', 'string'}}
- classmethod grammar_check(ct_fn_id: str, fn_param: str) bool
- classmethod init_return_ann_tr(ct_fn_param_dict: Dict[str, List[NodeDAG | str]]) ConstantFn
phylojunction.interface.grammar.ct_fn_treereader_makers module
- phylojunction.interface.grammar.ct_fn_treereader_makers.make_tree_reader(ct_fn_name: str, ct_fn_param_dict: Dict[str, List[NodeDAG | str]]) ConstantFn
phylojunction.interface.grammar.det_fn_discrete_sse_makers module
- phylojunction.interface.grammar.det_fn_discrete_sse_makers.make_DiscreteStateDependentProbability(det_fn_name: str, det_fn_param_dict: Dict[str, List[NodeDAG | str]]) DiscreteStateDependentProbability
Return SSE probability as prompted by deterministic function call.
- Parameters:
det_fn_name (str) – Name of the function being called.
det_fn_param_dict (dict) – Dictionary containing parameter strings as keys, and lists of either strings or NodeDAGs as value(s).
- Returns:
- Object holding the info
about a discrete state-dependent probability.
- Return type:
- phylojunction.interface.grammar.det_fn_discrete_sse_makers.make_DiscreteStateDependentRate(det_fn_name: str, det_fn_param_dict: Dict[str, List[NodeDAG | str]]) DiscreteStateDependentRate
Create and return DiscreteStateDependentRate as prompted by deterministic function call.
- Parameters:
det_fn_name (str) – Name of the function being called
det_fn_param_dict (dict) – dictionary containing parameter strings as keys, and lists of either strings or NodeDAGs as value(s)
- Returns:
Object holding the info about a discrete state-dependent rate
- phylojunction.interface.grammar.det_fn_discrete_sse_makers.make_SSEStash(det_fn_name: str, det_fn_param_dict: Dict[str, List[NodeDAG | str]]) SSEStash
Create SSEStash as prompted by deterministic function call
- Parameters:
det_fn_name (str) – Name of the function being called
det_fn_param_dict (dict) – dictionary containing parameter strings as keys, and lists of either strings or NodeDAGs
- Returns:
- Object holding all discrete state-dependent rates and
probabilities
phylojunction.interface.grammar.det_fn_grammar module
- class phylojunction.interface.grammar.det_fn_grammar.PJDetFnGrammar
Bases:
object
- classmethod create_det_fn_obj(det_fn_id: str, det_fn_param_dict: Dict[str, List[NodeDAG | str]]) DiscreteStateDependentRate | DiscreteStateDependentProbability | SSEStash | List[AnnotatedTree] | None
Build and return deterministic function object.
- Parameters:
det_fn_id (str) – Name of deterministic function being called
det_fn_param_dict (dict) – Dictionary containing deterministic function parameter names (str) as keys and lists (of either strings or NodeDAGs) as values
- Returns:
- one of a variety of objects containing information for
later building a sampling distribution
- Return type:
Object
- det_fn_grammar_dict: Dict[str, Set[str]] = {'map_attr': {'attr_name', 'fun', 'geo', 'maps_file_path', 'n_regions', 'tip_attr_file_path', 'tree'}, 'sse_prob': {'epoch', 'name', 'state', 'value'}, 'sse_rate': {'epoch', 'event', 'name', 'states', 'value'}, 'sse_stash': {'epoch_age_ends', 'flat_prob_mat', 'flat_rate_mat', 'n_epochs', 'n_states', 'seed_age'}}
- classmethod grammar_check(det_fn_id: str, fn_param: str) bool
- classmethod init_return_state_dep_prob(det_fn_param_dict: Dict[str, List[NodeDAG | str]]) DiscreteStateDependentProbability
- classmethod init_return_state_dep_rate(det_fn_param_dict: Dict[str, List[NodeDAG | str]]) DiscreteStateDependentRate
- classmethod init_return_tree_mapped_with_attr(det_fn_param_dict: Dict[str, List[NodeDAG | str]]) List[AnnotatedTree]
phylojunction.interface.grammar.det_fn_map_attribute module
- phylojunction.interface.grammar.det_fn_map_attribute.make_mapped_ann_tree(det_fn_name: str, det_fn_param_dict: Dict[str, List[NodeDAG | str]]) AnnotatedTree
phylojunction.interface.grammar.dn_discrete_sse_makers module
- phylojunction.interface.grammar.dn_discrete_sse_makers.make_discrete_SSE_dn(dn_name: str, dn_param_dict: Dict[str, List[NodeDAG | str]]) DistrForSampling
Make discrete SSE distribution for sampling.
- Parameters:
dn_name (str) – Name of the distribution.
dn_param_dict (dict) – Dictionary with distribution parameter names as keys, and their values as values.
- Returns:
A DistrForSampling instance.
- Return type:
phylojunction.interface.grammar.dn_grammar module
- class phylojunction.interface.grammar.dn_grammar.PJDnGrammar
Bases:
object
- classmethod create_dn_obj(dn_id: str, dn_param_dict: Dict[str, List[NodeDAG | str]]) DistrForSampling
Create and return prob. distribution (for sampling) object.
- Parameters:
dn_id (str) – Name of the sampling distribution to create.
dn_param_dict (dict) – Dictionary containing distribution parameter names (str) as keys and lists (of either strings or StochasticNodeDAGs) as values.
- Returns:
a DistributionDAG instance.
- Return type:
DistributionDAG
- dn_grammar_dict: Dict[str, Tuple[str, ...]] = {'discrete_sse': ('n', 'nr', 'stop', 'stop_value', 'origin', 'stash', 'start_state', 'eps', 'runtime_limit', 'max_n_attempts', 'cond_spn', 'cond_surv', 'cond_obs_both_sides', 'min_rec_taxa', 'max_rec_taxa', 'abort_at_alive_count'), 'exponential': ('n', 'nr', 'rate', 'rate_parameterization'), 'gamma': ('n', 'nr', 'shape', 'scale', 'rate_parameterization'), 'lognormal': ('n', 'nr', 'meanlog', 'sdlog', 'log_space'), 'normal': ('n', 'nr', 'mean', 'sd'), 'unif': ('n', 'nr', 'min', 'max')}
- classmethod grammar_check(dn_id: str, dn_param: str) bool
Check if specified distribution is supported.
- classmethod init_return_discrete_SSE_dn(dn_param_dict: Dict[str, List[NodeDAG | str]]) DistrForSampling
Create and return SSE distribution for sampling.
- Parameters:
dn_param_dict (dict) – Dictionary with distribution parameter names as keys, and their values as values.
- Returns:
a DistributionDAG instance.
- Return type:
DistributionDAG
- classmethod init_return_parametric_dn(dn_id: str, dn_param_dict: Dict[str, List[NodeDAG | str]]) DistrForSampling
Create and return parametric distributions for sampling.
- Parameters:
dn_id (str) – Name of parametric distribution.
dn_param_dict (dict) – Dictionary with distribution parameter names as keys, and their values as values.
- Returns:
A DistrForSampling instance.
- Return type: