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[str | NodeDAG]]) 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': {'epoch_age_ends', '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[str | NodeDAG]]) 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[str | NodeDAG]]) 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[str | NodeDAG]]) 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[str | NodeDAG]]) 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[str | NodeDAG]]) 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[str | NodeDAG]]) 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'}, 'quasse_absolute': {'baseline', 'cap', 'center', 'strength'}, 'quasse_constant': {'cap', 'rate'}, 'quasse_gaussian': {'baseline', 'cap', 'center', 'center_rate', 'width'}, 'quasse_linear': {'cap', 'intercept', 'slope'}, 'quasse_logistic': {'cap', 'midpoint', 'slope', 'y0', 'y1'}, 'quasse_quadratic': {'baseline', 'cap', 'center', 'strength'}, 'quasse_skew_gaussian': {'amplitude', 'baseline', 'cap', 'location', 'skew', 'width'}, 'quasse_step': {'cap', 'left', 'right', 'threshold'}, '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[str | NodeDAG]]) DiscreteStateDependentProbability
- classmethod init_return_state_dep_rate(det_fn_param_dict: Dict[str, List[str | NodeDAG]]) DiscreteStateDependentRate
- classmethod init_return_tree_mapped_with_attr(det_fn_param_dict: Dict[str, List[str | NodeDAG]]) 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[str | NodeDAG]]) 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[str | NodeDAG]]) 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[str | NodeDAG]]) 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, ...]] = {'categorical': ('n', 'nr', 'cats', 'probs'), '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'), 'quasse': ('n', 'nr', 'birth_rate', 'death_rate', 'fossil_rate', 'start_trait', 'drift', 'diffusion', 'stop', 'stop_value', 'method', 'k', 'runtime_limit', 'max_steps', 'max_alive', 'sampling_prob', 'cond_surv', 'cond_spn', 'cond_obs_both_sides', 'min_rec_taxa', 'max_rec_taxa', 'max_n_attempts', 'dt_max', 'max_nodes', 'block_duration', 'bridge_error'), '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[str | NodeDAG]]) 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[str | NodeDAG]]) 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:
phylojunction.interface.grammar.det_fn_quasse_makers module
Construct vectorized continuous-trait rate values for the DAG.
- phylojunction.interface.grammar.det_fn_quasse_makers.make_quasse_rate(det_fn_id, spec)
phylojunction.interface.grammar.dn_quasse_makers module
Convert QuaSSE grammar arguments to distribution parameters.
- phylojunction.interface.grammar.dn_quasse_makers.make_quasse(spec)