Skip to content

Commit fab09f8

Browse files
committed
feat: calculate confidence interval of evolutionary rate
1 parent 4f8570e commit fab09f8

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

workflow/rules/distances.smk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ rule time_signal_data:
7171
conda: "../envs/renv.yaml"
7272
params:
7373
outgroup_id = config["ALIGNMENT_REFERENCE"],
74+
confidence_interval = 0.95,
7475
input:
7576
tree = report(REPORT_DIR_TABLES/"allele_freq_tree.nwk"),
7677
metadata = config["METADATA"],

workflow/scripts/report/time_signal_data.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,15 @@ write_csv(time.signal, snakemake@output$table)
6060
log_debug("Building linear model")
6161
model <- lm(distance ~ date_interval, data = time.signal)
6262
p.value <- summary(model)$coefficients[2, 4]
63+
ci_models <- confint(model, level = snakemake@params$confidence_interval)
6364

6465
# TREE STATS
6566
log_debug("Saving linear model")
6667
list(
6768
"sub_rate" = model$coefficients[[2]] * 365,
6869
"r2" = summary(model)$r.squared[[1]],
70+
"ci_low" = ci_models[2, 1] * 365,
71+
"ci_high" = ci_models[2, 2] * 365,
6972
"pvalue" = ifelse(p.value < 0.001, "< 0.001", p.value)
7073
) %>%
7174
toJSON() %>%

0 commit comments

Comments
 (0)