Scripts
Run scripts outside the pipeline
You can run workflow helper scripts directly via the CLI without running the full Snakemake pipeline.
General form:
Example (show script help):
Notes:
--envselects the workflow conda environment declared for that script (for examplepython,phylo, orggtree).- The extra
--separatesepisodic script runoptions from the script's own arguments.
date_to_decimal_year(date_str)
Converts a date in the format '%Y-%m-%d' to a decimal year.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
date_str |
str
|
The date in the format '%Y-%m-%d'. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
The decimal year. |
Examples:
Source code in src/episodic/workflow/utils.py
decimal_year_to_date(decimal_year)
Converts a decimal year to a date in the format '%Y-%m-%d'.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
decimal_year |
float
|
The decimal year to convert. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
The date in the format '%Y-%m-%d'. |
Examples:
Source code in src/episodic/workflow/utils.py
analyze_rates(trees_path=typer.Argument(..., help='Path to the BEAST output trees file'), groups_file=typer.Option(..., '--groups-file', help='TSV mapping taxa to group labels'), output_plot_path=typer.Option(..., '--output-plot', help='Output path for the plot file'), output_csv_path=typer.Option(..., '--output-csv', help='Output path for the CSV file'), burnin=typer.Option(0.1, '--burnin', '-b', help='Fraction of trees to discard as burn-in'))
Analyzes rates from a given BEAST output trees file and generates a plot and CSV file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trees_path |
str
|
The path to the BEAST output trees file. |
typer.Argument(..., help='Path to the BEAST output trees file')
|
groups_file |
Path
|
TSV mapping taxa to group labels. |
typer.Option(..., '--groups-file', help='TSV mapping taxa to group labels')
|
output_plot_path |
str
|
The output path for the plot file. |
typer.Option(..., '--output-plot', help='Output path for the plot file')
|
output_csv_path |
str
|
The output path for the CSV file. |
typer.Option(..., '--output-csv', help='Output path for the CSV file')
|
burnin |
float
|
The fraction of trees to discard as burn-in. |
typer.Option(0.1, '--burnin', '-b', help='Fraction of trees to discard as burn-in')
|
Returns:
| Type | Description |
|---|---|
|
None |
Examples:
Source code in src/episodic/workflow/scripts/phylo_rate_quantile_analysis.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
analyze_tree(tree, group_members, group_stats)
Analyzes a given tree and updates group statistics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tree |
dendropy.Tree
|
The tree to analyze. |
required |
group_members |
Dict[str, List[str]]
|
Taxa assigned to each analyzed group. |
required |
group_stats |
Dict[str, Dict[str, List]]
|
A dictionary containing group statistics. |
required |
Returns:
| Type | Description |
|---|---|
|
None |
Examples:
>>> analyze_tree(tree, ['A', 'B'], {'A': {'ranks': [], 'quantiles': []}, 'B': {'ranks': [], 'quantiles': []}})
Source code in src/episodic/workflow/scripts/phylo_rate_quantile_analysis.py
extract_and_sort_rates(tree)
Extracts and sorts rates from a given tree.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tree |
dendropy.Tree
|
The tree to extract rates from. |
required |
Returns:
| Type | Description |
|---|---|
|
List[float]: A list of sorted rates. |
Examples:
Source code in src/episodic/workflow/scripts/phylo_rate_quantile_analysis.py
compare(logs=typer.Argument(..., help='BEAST log files'), output_prefix=typer.Option(..., help='Prefix for output files'), gamma_shape=typer.Option(..., help='Shape parameter for the gamma prior'), gamma_scale=typer.Option(..., help='Scale parameter for the gamma prior'), baseline_rate=typer.Option(None, help='Rate parameter used as baseline for posterior contrasts. Defaults to the first detected rate column.'), burnin=typer.Option(0.1, help='Fraction of the chain to discard as burnin'))
Generate comparison visualizations for model rate parameters.
Source code in src/episodic/workflow/scripts/arviz_output.py
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | |
density_xy(values, bins=100)
Compute density x/y coordinates from histogram bins.
Source code in src/episodic/workflow/scripts/arviz_output.py
display_rate_label(label)
Convert BEAST rate column IDs into concise plot labels.
Source code in src/episodic/workflow/scripts/arviz_output.py
load_log_files(logs, burnin=0.1)
Loads BEAST log files into a single pandas DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logs |
List[Path]
|
A list of paths to the log files. |
required |
burnin |
float
|
The fraction of the chain to discard as burnin. |
0.1
|
Returns:
| Type | Description |
|---|---|
pd.DataFrame
|
pd.DataFrame: A DataFrame containing the log data. |
Source code in src/episodic/workflow/scripts/arviz_output.py
no_browser()
A context manager that temporarily replaces the Bokeh show function with a dummy one.
Yields:
| Name | Type | Description |
|---|---|---|
None |
Allows the code inside the 'with' block to run. |
Notes
This context manager is used to prevent the Bokeh show function from opening a browser window when saving a plot.
Source code in src/episodic/workflow/scripts/arviz_output.py
rate_columns(df)
Return rate-like columns from a loaded trace dataframe.
rates(logs=typer.Argument(..., help='BEAST log files'), output_prefix=typer.Option(..., help='Prefix for output files'), gamma_shape=typer.Option(..., help='Shape parameter for the gamma prior'), gamma_scale=typer.Option(..., help='Scale parameter for the gamma prior'), burnin=typer.Option(0.1, help='Fraction of the chain to discard as burnin'))
Plots the rates from BEAST log files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logs |
List[Path]
|
A list of paths to the log files. |
typer.Argument(..., help='BEAST log files')
|
output_prefix |
Path
|
The prefix for the output files. |
typer.Option(..., help='Prefix for output files')
|
gamma_shape |
float
|
The shape parameter for the gamma prior. |
typer.Option(..., help='Shape parameter for the gamma prior')
|
gamma_scale |
float
|
The scale parameter for the gamma prior. |
typer.Option(..., help='Scale parameter for the gamma prior')
|
burnin |
float
|
The fraction of the chain to discard as burnin. |
typer.Option(0.1, help='Fraction of the chain to discard as burnin')
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
Does not return anything. |
Source code in src/episodic/workflow/scripts/arviz_output.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |
summary(logs=typer.Argument(..., help='BEAST log files'), output=typer.Argument(..., help='Output csv file'), burnin=0.1)
Generates a summary of the BEAST log files and saves it to a csv file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logs |
List[Path]
|
A list of paths to the log files. |
typer.Argument(..., help='BEAST log files')
|
output |
Path
|
The output csv file. |
typer.Argument(..., help='Output csv file')
|
burnin |
float
|
The fraction of the chain to discard as burnin. |
0.1
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
Does not return anything. |
Source code in src/episodic/workflow/scripts/arviz_output.py
trace(logs=typer.Argument(..., help='BEAST log files'), directory=typer.Argument(..., help='Output directory'), burnin=typer.Option(0.1, help='Fraction of the chain to discard as burnin'))
Plots the trace from BEAST log files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logs |
List[Path]
|
A list of paths to the log files. |
typer.Argument(..., help='BEAST log files')
|
directory |
Path
|
The output directory. |
typer.Argument(..., help='Output directory')
|
burnin |
float
|
The fraction of the chain to discard as burnin. |
typer.Option(0.1, help='Fraction of the chain to discard as burnin')
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
Does not return anything. |
Source code in src/episodic/workflow/scripts/arviz_output.py
wrap_label(label, width=28)
Wrap long parameter labels to reduce overlap in plots.
Source code in src/episodic/workflow/scripts/arviz_output.py
wrapped_label_map(labels, width=28)
Build a wrapped display-name mapping while preserving uniqueness.
Source code in src/episodic/workflow/scripts/arviz_output.py
calculate_log_diff(pos_odds, p_odds)
Calculates the log difference of two odds ratios.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pos_odds |
float
|
The posterior odds ratio. |
required |
p_odds |
float
|
The prior odds ratio. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
The log difference of the two odds ratios. |
Examples:
Source code in src/episodic/workflow/scripts/calculate_odds.py
calculate_odds(logs=typer.Argument(..., help='The path to the log CSV file'), output_file=typer.Argument(..., help='The path to the output CSV file where the results will be saved'), gamma_shape=typer.Option(..., help='The shape parameter for the gamma distribution'), gamma_scale=typer.Option(..., help='The scale parameter for the gamma distribution'), foreground_label=typer.Option(None, help='Optional foreground/local-rate label prefix.'), background_label=typer.Option(None, help='Optional background-rate label prefix.'), burnin=typer.Option(0.1, '--burnin', '-b', help='Fraction of trees to discard as burn-in'))
Calculates the odds and log differences for a given set of data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logs |
List[Path]
|
The paths to the log CSV files. |
typer.Argument(..., help='The path to the log CSV file')
|
output_file |
str
|
The path to the output CSV file where the results will be saved. |
typer.Argument(..., help='The path to the output CSV file where the results will be saved')
|
gamma_shape |
float
|
The shape parameter for the gamma distribution. |
typer.Option(..., help='The shape parameter for the gamma distribution')
|
gamma_scale |
float
|
The scale parameter for the gamma distribution. |
typer.Option(..., help='The scale parameter for the gamma distribution')
|
burnin |
float
|
Fraction of trees to discard as burn-in. |
typer.Option(0.1, '--burnin', '-b', help='Fraction of trees to discard as burn-in')
|
Returns:
| Type | Description |
|---|---|
|
None |
Examples:
>>> calculate_odds(['log1.csv', 'log2.csv'], 'results.csv', 2, 1, 0.1)
Calculated odds and log differences saved to results.csv
Source code in src/episodic/workflow/scripts/calculate_odds.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | |
safe_log(x)
Returns the logarithm of x if x is positive, otherwise returns None.
Plot partition-level background vs foreground posterior substitution-rate histograms.
This script consumes one or more posterior sample tables (typically BEAST .log files)
and writes:
- an overlaid frequency histogram of per-partition background and foreground rates
- a long-format CSV table used to generate the plot
Supported input formats:
-
Wide BEAST-style columns, e.g.:
<partition>.clock.rate(background)<partition>.clade.rate,<partition>.stem.rate,<partition>.stem_and_clade.rate, or equivalent
-
Long columns:
partition,background_rate,clade_rate
For current FLC logs used by Episodic, foreground-rate columns are treated as absolute rates.
plot_partition_foreground_rates(posterior_samples=typer.Argument(..., help='Posterior samples files (BEAST .log or CSV/TSV).'), output_plot=typer.Argument(..., help='Output SVG/PDF/PNG path for the frequency histogram.'), output_table=typer.Argument(..., help='Output CSV for long-format rates used in plotting.'), burnin=typer.Option(0.1, '--burnin', '-b', help='Fraction of each chain to discard as burn-in.'), foreground_label=typer.Option(None, help='Optional foreground/foreground-rate label for plot legends.'), background_label=typer.Option(None, help='Optional background-rate label for plot legends.'), bins=typer.Option(220, '--bins', help='Number of histogram bins.'))
Generate partitioned posterior frequency histograms for background vs foreground rates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
posterior_samples |
List[Path]
|
One or more posterior sample files ( |
typer.Argument(..., help='Posterior samples files (BEAST .log or CSV/TSV).')
|
output_plot |
Path
|
Output path for overlaid frequency histogram ( |
typer.Argument(..., help='Output SVG/PDF/PNG path for the frequency histogram.')
|
output_table |
Path
|
Output path for long-format CSV with columns
|
typer.Argument(..., help='Output CSV for long-format rates used in plotting.')
|
burnin |
float
|
Fraction of each input chain to discard from the start. |
typer.Option(0.1, '--burnin', '-b', help='Fraction of each chain to discard as burn-in.')
|
Raises:
| Type | Description |
|---|---|
typer.BadParameter
|
If |
ValueError
|
If required rate columns are missing or no posterior samples remain. |
Source code in src/episodic/workflow/scripts/plot_partition_local_rate_posteriors.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | |
Plot posterior GTR substitution-model relative rates from FLC analyses.
The current Episodic BEAST template estimates one GTR relative-rate vector per alignment partition. FLC models change branch clock rates, not branch-specific substitution-model relative rates, so this plot shows the logged GTR relative rates that are actually estimated for each partition.
plot_flc_substitution_model_rates(logs=typer.Argument(..., help='BEAST log files from a partitioned FLC analysis.'), output_plot=typer.Argument(..., help='Output SVG/PDF/PNG path.'), output_table=typer.Argument(..., help='Output CSV path for long-format logged relative rates.'), burnin=typer.Option(0.1, '--burnin', '-b', help='Fraction of each chain to discard as burn-in.'))
Plot posterior log GTR relative rates by partition and substitution type.
Source code in src/episodic/workflow/scripts/plot_flc_substitution_model_rates.py
add_posterior_summary(ax, mean, median, hdi_low, hdi_high)
Add a compact summary annotation to the histogram panel.
Source code in src/episodic/workflow/scripts/plot_traces.py
camel_to_title_case(column)
Transform camelCase or dotted names into readable title case.
debug_log(enabled, message)
downsample_xy(x, y, max_points)
Evenly downsample paired x/y series for fast plotting.
Source code in src/episodic/workflow/scripts/plot_traces.py
get_axis_limits(values)
Compute padded y-axis limits for a series.
Source code in src/episodic/workflow/scripts/plot_traces.py
plot_single_variable(output_path, variable, burnin_df, posterior_df, max_points, output_format, dpi, debug)
Render and save one trace plot.
Source code in src/episodic/workflow/scripts/plot_traces.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
plot_traces(trace_log=TRACE_LOG_ARGUMENT, output=OUTPUT_ARGUMENT, burnin=0.1, max_points=MAX_POINTS_OPTION, dpi=DPI_OPTION, debug=DEBUG_OPTION, output_format=FORMAT_OPTION)
Produce fast publication-ready trace plots using Matplotlib.
Source code in src/episodic/workflow/scripts/plot_traces.py
split_trace(df, burnin)
Split a trace dataframe into burn-in and posterior segments.
Source code in src/episodic/workflow/scripts/plot_traces.py
style_axis(ax)
Apply a publication-style theme to an axis.
Source code in src/episodic/workflow/scripts/plot_traces.py
get_schema(path)
Gets the schema for a given file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path |
Path
|
The path to the file. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
The schema for the file. |
Raises:
| Type | Description |
|---|---|
Exception
|
If the schema cannot be determined from the file extension. |
Examples:
Source code in src/episodic/workflow/scripts/tree_converter.py
tree_converter(input=typer.Argument(..., help='The path to the tree file in newick format.'), output=typer.Argument(..., help='The path to the tree file in newick format.'), input_schema=typer.Option('', help='The input file schema. If empty then it tries to infer the schema from the file extension.'), output_schema=typer.Option('', help='The output file schema. If empty then it tries to infer the schema from the file extension.'), node_label=typer.Option('', help='Label the nodes from an annotation if present.'))
Converts a tree file from one format to another.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input |
Path
|
The path to the tree file in newick format. |
typer.Argument(..., help='The path to the tree file in newick format.')
|
output |
Path
|
The path to the tree file in newick format. |
typer.Argument(..., help='The path to the tree file in newick format.')
|
input_schema |
str
|
The input file schema. If empty then it tries to infer the schema from the file extension. |
typer.Option('', help='The input file schema. If empty then it tries to infer the schema from the file extension.')
|
output_schema |
str
|
The output file schema. If empty then it tries to infer the schema from the file extension. |
typer.Option('', help='The output file schema. If empty then it tries to infer the schema from the file extension.')
|
node_label |
str
|
Label the nodes from an annotation if present. |
typer.Option('', help='Label the nodes from an annotation if present.')
|
Returns:
| Type | Description |
|---|---|
|
None |
Examples:
>>> tree_converter(Path('input.nwk'), Path('output.nexus'), input_schema='newick', output_schema='nexus', node_label='label')
Source code in src/episodic/workflow/scripts/tree_converter.py
Log
dataclass
Dataclass representing a log file.
Attributes:
| Name | Type | Description |
|---|---|---|
log_every |
int
|
The frequency at which to log. |
file_name |
str
|
The name of the log file. |
Source code in src/episodic/workflow/scripts/populate_beast_template.py
MLE
dataclass
Bases: Log
Dataclass representing a marginal likelihood estimator.
Attributes:
| Name | Type | Description |
|---|---|---|
log_every |
int
|
The frequency at which to log. |
file_name |
str
|
The name of the log file. |
results_file_name |
str
|
The name of the results file. |
chain_length |
int
|
The length of the MCMC chain. |
path_steps |
int
|
The number of path steps for the MLE. |
Source code in src/episodic/workflow/scripts/populate_beast_template.py
Partition
dataclass
Dataclass representing an alignment partition.
Attributes:
| Name | Type | Description |
|---|---|---|
prefix |
str
|
XML-safe prefix used for non-rate IDs. |
background_prefix |
str
|
XML-safe prefix used for background-rate IDs. |
foreground_prefix |
str
|
XML-safe prefix used for foreground/local-rate IDs. |
taxa |
List[Taxon]
|
Partition sequences keyed by shared taxon IDs. |
Source code in src/episodic/workflow/scripts/populate_beast_template.py
Taxon
dataclass
Dataclass representing a taxon.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
The id of the taxon. |
sequence |
str
|
The sequence of the taxon. |
date |
float
|
The date of the taxon. |
uncertainty |
float
|
The uncertainty of the taxon's date. |
Source code in src/episodic/workflow/scripts/populate_beast_template.py
build_partition_prefix(alignment_path, used_prefixes)
Create a unique XML-safe prefix for a partition.
Source code in src/episodic/workflow/scripts/populate_beast_template.py
build_partitions(alignment_paths, date_delimiter, date_index, foreground_label=None, background_label=None)
Parse and validate multiple FASTA alignments into BEAST partitions.
Source code in src/episodic/workflow/scripts/populate_beast_template.py
labeled_rate_prefix(label, partition_prefix, multiple_partitions, default_label=None)
Build the rate-parameter prefix for a partition and optional state label.
Source code in src/episodic/workflow/scripts/populate_beast_template.py
populate_beast_template(work_dir, name, template_path, alignment_paths, clock, groups=None, groups_file=None, rate_gamma_prior_shape=0.5, rate_gamma_prior_scale=0.1, chain_length=100000000, samples=10000, mle_chain_length=1000000, mle_path_steps=100, mle_log_every=10000, date_delimiter='|', date_index=-1, fixed_tree=None, foreground_label=None, background_label=None, *, trace=True, trees=True, mle=True)
Populates a Beast XML template with an alignment file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
work_dir |
Path
|
The path to the working directory. |
required |
name |
str
|
The name of the output file. |
required |
template_path |
Path
|
The path to the input Beast template file. |
required |
alignment_paths |
List[Path]
|
The paths to the input alignment partitions. |
required |
groups |
list
|
A list of groups to include in the analysis. |
None
|
groups_file |
Path
|
Optional TSV mapping taxa to groups. |
None
|
clock |
str
|
The clock model to use in the analysis. |
required |
rate_gamma_prior_shape |
float
|
The shape parameter of the gamma prior on the rate. |
0.5
|
rate_gamma_prior_scale |
float
|
The scale parameter of the gamma prior on the rate. |
0.1
|
chain_length |
int
|
The length of the MCMC chain. |
100000000
|
samples |
int
|
The number of samples to draw from the MCMC chain. |
10000
|
mle_chain_length |
int
|
The length of the MCMC chain for the marginal likelihood estimator. |
1000000
|
mle_path_steps |
int
|
The number of path steps for the marginal likelihood estimator. |
100
|
mle_log_every |
int
|
The log every for the marginal likelihood estimator. |
10000
|
date_delimiter |
str
|
The delimiter for the date in the fasta header. |
'|'
|
date_index |
int
|
The index of the date in the fasta header. |
-1
|
fixed_tree |
Path
|
The path to the fixed tree file. |
None
|
foreground_label |
str
|
Optional label prefix for foreground/local-rate parameters. |
None
|
background_label |
str
|
Optional label prefix for background clock-rate parameters. |
None
|
Other Parameters:
| Name | Type | Description |
|---|---|---|
trace |
bool
|
Whether to enable the trace log. |
trees |
bool
|
Whether to enable the trees log. |
mle |
bool
|
Whether to run the marginal likelihood estimator. |
Returns:
| Name | Type | Description |
|---|---|---|
str |
The rendered Beast XML template. |
Examples:
... work_dir=Path("output"),
... name="my_analysis",
... template_path=Path("template.xml"),
... alignment_paths=[Path("alignment.fasta")],
... groups=["group1", "group2"],
... clock="strict",
... rate_gamma_prior_shape=0.5,
... rate_gamma_prior_scale=0.1,
... chain_length=100000000,
... samples=10000,
... mle_chain_length=1000000,
... mle_path_steps=100,
... mle_log_every=10000,
... date_delimiter="|",
... date_index=-1,
... fixed_tree=Path("fixed_tree.nwk"),
... trace=True,
... trees=True,
... mle=True,
... )
Source code in src/episodic/workflow/scripts/populate_beast_template.py
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | |
taxa_from_fasta(fasta_path, date_delimiter='|', date_index=-1)
Parses a fasta file into a list of Taxon objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fasta_path |
Path
|
The path to the fasta file. |
required |
date_delimiter |
str
|
The delimiter for the date in the fasta header. |
'|'
|
date_index |
int
|
The index of the date in the fasta header. |
-1
|
Returns:
| Type | Description |
|---|---|
List[Taxon]
|
List[Taxon]: A list of Taxon objects representing the taxa in the fasta file. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the fasta file is invalid. |
Source code in src/episodic/workflow/scripts/populate_beast_template.py
xml_safe_label(label)
Return a BEAST/XML-safe label prefix, or None when no label is set.