phylojunction.utility package
Submodules
phylojunction.utility.exception_classes module
- exception phylojunction.utility.exception_classes.AnnotatedTreeIncorrectAnnotationError(message: str)
Bases:
Exception
- message: str
- exception phylojunction.utility.exception_classes.AnnotatedTreeMissingNodeName
Bases:
Exception
- message: str
- exception phylojunction.utility.exception_classes.AnnotatedTreeMisspecError(message: str)
Bases:
Exception
- message: str
- exception phylojunction.utility.exception_classes.AnnotatedTreeNodeMissingAttrError(nd_name: str, attr_name: str, message: str)
Bases:
Exception
- message: str
- exception phylojunction.utility.exception_classes.DAGCannotAddNodeError(node_name: str, message: str)
Bases:
Exception
- message: str
- exception phylojunction.utility.exception_classes.DAGCannotInitialize(message: str)
Bases:
Exception
- message: str
- exception phylojunction.utility.exception_classes.DimensionalityError(dn_name: str, par_name: str | None = '')
Bases:
Exception
- dn_name: str
- message: str
- par_name: str
- exception phylojunction.utility.exception_classes.DimensionalityWarning(rv_name: str, dn_name: str, message: str = '')
Bases:
Exception
- dn_name: str
- message: str
- rv_name: str
- exception phylojunction.utility.exception_classes.FunctionArgsMismatchError(fn_name: str, message: str)
Bases:
Exception
- fn_name: str
- message: str
- exception phylojunction.utility.exception_classes.GenerateFailError(dn_name: str, message: str)
Bases:
Exception
- message: str
- exception phylojunction.utility.exception_classes.IncorrectDimensionError(container_name: str, obs_len: int, exp_len: int = 0)
Bases:
Exception
- container_name: str
- exp_len: int
- message: str
- obs_len: int
- exception phylojunction.utility.exception_classes.InexistentVariableError(rv_name: str)
Bases:
Exception
- message: str
- rv_name: str
- exception phylojunction.utility.exception_classes.InvalidMCMCChainLength(message: str)
Bases:
Exception
- message: str
- exception phylojunction.utility.exception_classes.MaxNFailedAttemptsLimit(max_n_attempts: int)
Bases:
Exception
- exception phylojunction.utility.exception_classes.MissingColumnName(col_name: str, message: str)
Bases:
Exception
- message: str
- exception phylojunction.utility.exception_classes.NoPlatingAllowedError(det_name: str, problematic_node_dag_name: str, message: str = '')
Bases:
Exception
- det_name: str
- message: str
- node_dag_name: str
- exception phylojunction.utility.exception_classes.NodeDAGStatCantFloatError(node_name: str)
Bases:
Exception
- message: str
- exception phylojunction.utility.exception_classes.NodeInferenceDimensionalityError(node_name: str)
Bases:
Exception
- message: str
- node_name: str
- exception phylojunction.utility.exception_classes.NotBetweenZeroAndOneError(par_name: str, message: str = '')
Bases:
Exception
- message: str
- par_name: str
- exception phylojunction.utility.exception_classes.ObjInitIncorrectDimensionError(obj_name: str, container_name: str, obs_len: int, exp_len: int = 0, at_least: bool = False)
Bases:
Exception
- at_least: bool
- exp_len: int
- message: str
- obj_name: str
- obs_len: int
- exception phylojunction.utility.exception_classes.ObjInitInvalidArgError(obj_name: str, par_name: str, message: str | None = '')
Bases:
Exception
- message: str
- obj_name: str
- exception phylojunction.utility.exception_classes.ObjInitMissingParameterError(obj_name: str, par_name: str, message: str | None = '')
Bases:
Exception
- message: str
- obj_name: str
- exception phylojunction.utility.exception_classes.ObjInitMissingStateDependentParameterError(epoch_missing_param: int, symmetric_diff_set: Set[Any])
Bases:
Exception
- message: str
- symmetric_diff_str: str
- exception phylojunction.utility.exception_classes.ObjInitRepeatedStateDependentParameterError(epoch_w_repeated_param: int, repeated_param: Tuple[Tuple[int], Enum])
Bases:
Exception
- message: str
- exception phylojunction.utility.exception_classes.ObjInitRequireNonZeroStateDependentParameterError(obj_name: str, dimension_idx: int)
Bases:
Exception
- message: str
- obj_name: str
- exception phylojunction.utility.exception_classes.ObjInitRequireSameParameterTypeError(obj_name: str, n_diff_par: int)
Bases:
Exception
- message: str
- n_diff_par: int
- obj_name: str
- exception phylojunction.utility.exception_classes.PJCLIInvalidInputError(par_name: str, message: str)
Bases:
Exception
- message: str
- par_name: str
- exception phylojunction.utility.exception_classes.PJCLISampleOutOfRangeError(range_str: str)
Bases:
Exception
- exception phylojunction.utility.exception_classes.PJIOFileDoesNotExistError(fn_name: str, file_path: str)
Bases:
Exception
- exception phylojunction.utility.exception_classes.ParseCtFnInitFailError(ct_fn_name: str, message: str)
Bases:
Exception
- ct_fn_name: str
- message: str
- exception phylojunction.utility.exception_classes.ParseDetFnInitFailError(det_fn_name: str, message: str)
Bases:
Exception
- det_fn_name: str
- message: str
- exception phylojunction.utility.exception_classes.ParseDnInitFailError(dn_name: str, message: str)
Bases:
Exception
- dn_name: str
- message: str
- exception phylojunction.utility.exception_classes.ParseFunctionArgError(par_name: str, message: str)
Bases:
Exception
- message: str
- par_name: str
- exception phylojunction.utility.exception_classes.ParseInvalidArgumentError(par_name: str, invalid_arg: str, message: str)
Bases:
Exception
- message: str
- par_name: str
- exception phylojunction.utility.exception_classes.ParseInvalidNewickStringError(par_name: str, message: str = '')
Bases:
Exception
- message: str
- par_name: str
- exception phylojunction.utility.exception_classes.ParseMissingArgumentError(par_name: str, arg_name: str = '')
Bases:
Exception
- message: str
- par_name: str
- exception phylojunction.utility.exception_classes.ParseMissingParameterError(par_name: str)
Bases:
Exception
- message: str
- par_name: str
- exception phylojunction.utility.exception_classes.ParseMissingSpecificationError(obj2spec_name: str)
Bases:
Exception
- message: str
- exception phylojunction.utility.exception_classes.ParseMutuallyExclusiveParametersError(par_name: str, mutually_exclusive_par_name: str, message: str = '')
Bases:
Exception
- message: str
- mutually_exclusive_par_name: str
- par_name: str
- exception phylojunction.utility.exception_classes.ParseNotAParameterError(par_name: str)
Bases:
Exception
- message: str
- par_name: str
- exception phylojunction.utility.exception_classes.ParsePathDoesNotExistError(par_name: str, path_str: str, message: str | None = '')
Bases:
Exception
- message: str
- par_name: str
- path_str: str
- exception phylojunction.utility.exception_classes.ParseRequireIntegerError(obj_name: str, arg: str)
Bases:
Exception
- message: str
- obj_name: str
- exception phylojunction.utility.exception_classes.ParseRequireNumericError(obj_name: str, arg: str)
Bases:
Exception
- message: str
- obj_name: str
- exception phylojunction.utility.exception_classes.ParseRequirePositiveIntegerError(obj_name: str, arg: str)
Bases:
Exception
- message: str
- obj_name: str
- exception phylojunction.utility.exception_classes.ParseRequireSingleValueError(obj_name: str, arg: str)
Bases:
Exception
- message: str
- obj_name: str
- exception phylojunction.utility.exception_classes.ReplicateNumberError(node_name, message='')
Bases:
Exception
- message: str
- node_name: str
- exception phylojunction.utility.exception_classes.RunTimeLimit(runtime_limit: float)
Bases:
Exception
- exception phylojunction.utility.exception_classes.SSEStashMisspec(message: str)
Bases:
Exception
- message: str
- exception phylojunction.utility.exception_classes.ScriptSyntaxError(cmd_line: str, message: str)
Bases:
Exception
- cmd_line: str
- message: str
- exception phylojunction.utility.exception_classes.StateDependentParameterMisspec(message: str = '')
Bases:
Exception
- message: str
phylojunction.utility.helper_functions module
- phylojunction.utility.helper_functions.autovivify(levels=1, final=<class 'dict'>) DefaultDict
- phylojunction.utility.helper_functions.check_and_vectorize_if_must(param_list: int | float | str | List[int | float | str], dn_name: str, size_to_grow: int = 1) List[List[int | float | str]]
Check number of provided values and vectorize if necessary.
- Parameters:
param_list (tuple) – Parameter values (could be scalar
integers –
floats –
strings –
list). (or any of those in a) –
dn_name (str) – Name of the distribution whose parameter values we are checking.
size_to_grow (int) – Number of values we need, which is the specified number of simulations (‘n_samples’ in DistributionDAG). Defaults to 1.
- Returns:
- Two-dimensional list of potentially vectorized
parameter values. First dimension are samples (simulations), second dimension are replicates.
- Return type:
(list)
- phylojunction.utility.helper_functions.create_str_defaultdict() defaultdict
- phylojunction.utility.helper_functions.get_covg(full_cov_df: DataFrame, par_name: str) float
Return coverage from ‘within_hpd’ column in DataFrame.
- Parameters:
full_cov_df (pandas.DataFrame) – DataFrame object containing column named ‘within_hpd’ with 0’s or 1’s for parameters outside and inside an HPD, respectively.
par_name (str) – Name of the focal parameter for error printing.
- Returns:
Bayesian coverage for the parameter
- Return type:
float
- phylojunction.utility.helper_functions.get_ellapsed_time_in_seconds(start: float, end: float) int
Calculate ellapsed time in seconds.
- Parameters:
start (float) – Start of time window
end (float) – End of time window
- Returns:
Ellapsed time in seconds in time window
- Return type:
int
- phylojunction.utility.helper_functions.is_val_in_interval(val: int | float | float64, lower: int | float | float64, upper: int | float | float64) bool
Return True/False if numerical value is in (lower, upper].
- Parameters:
val (ty.Union[int, float, np.float64]t) – Numerical value
lower (ty.Union[int, float, np.float64]) – Lower end of interval
upper (ty.Union[int, float, np.float64]) – Upper end of interval
- Returns:
Whether val is in (lower, upper]
- Return type:
bool
- phylojunction.utility.helper_functions.print_progress(idx: int, iterator_len: int) None
Print progress bar on iteration for longer tests
- Parameters:
idx (int) – Index to keep track of where in iteration one is
iterator_len (int) – Size of the iterator whose progress is keeping track of
- phylojunction.utility.helper_functions.symmetric_difference(set1: Set[Any], set2: Set[Any]) Set[Any]
Return symmetric difference among two sets