Skip to content

Commit

Permalink
adjust confidence interval names
Browse files Browse the repository at this point in the history
  • Loading branch information
tavareshugo committed Mar 28, 2024
1 parent 4c3dfa0 commit cfff04e
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion course_files/r_demo/lineage_abundances.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sample,name,abundance,boot_lo,boot_hi,date,country,city,latitude,longitude
sample,name,abundance,boot_lo,boot_up,date,country,city,latitude,longitude
SRR18541074,AY.44,0.26583286,0.22062022336636045,0.2971052371373705,2021-12-01,United States,San Diego,32.719875,-117.170082
SRR18541074,AY.3,0.17287380,0.15684817412629423,0.19134365770536377,2021-12-01,United States,San Diego,32.719875,-117.170082
SRR18541074,AY.100,0.06591169,0.0621177963944036,0.07690953917545072,2021-12-01,United States,San Diego,32.719875,-117.170082
Expand Down
2 changes: 1 addition & 1 deletion course_files/r_demo/vocs_abundances.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sample,name,abundance,boot_lo,boot_hi,date,country,city,latitude,longitude
sample,name,abundance,boot_lo,boot_up,date,country,city,latitude,longitude
SRR18541074,Delta,0.9640087907444956,0.9596984293917038,0.9682214940819226,2021-12-01,United States,San Diego,32.719875,-117.170082
SRR18541074,Omicron,0.019682409750709555,0.013233836060878133,0.02276906228234253,2021-12-01,United States,San Diego,32.719875,-117.170082
SRR18541074,Other,0.0012202492036713667,0.0,0.008722550206162935,2021-12-01,United States,San Diego,32.719875,-117.170082
Expand Down
8 changes: 4 additions & 4 deletions materials/04-wastewater/03-ww_visualisation.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ lineages |>
mutate(name = fct_reorder(name, abundance)) |>
# make the plot
ggplot(aes(x = name, y = abundance, colour = abundance < 0.05)) +
geom_pointrange(aes(ymin = boot_lo, ymax = boot_hi)) +
geom_pointrange(aes(ymin = boot_lo, ymax = boot_up)) +
labs(x = "Lineage", y = "Abundance (95% CI)", colour = "< 5%")
```

Expand All @@ -340,7 +340,7 @@ lineages |>
filter(sample == "SRR18541092") |>
mutate(name = fct_reorder(name, abundance)) |>
ggplot(aes(x = name, y = abundance, colour = abundance < 0.05)) +
geom_pointrange(aes(ymin = boot_lo, ymax = boot_hi)) +
geom_pointrange(aes(ymin = boot_lo, ymax = boot_up)) +
scale_x_discrete(guide = guide_axis(angle = 45)) +
labs(x = "Lineage", y = "Abundance (95% CI)", colour = "< 5%",
main = "Sample: SRR18541092")
Expand All @@ -349,7 +349,7 @@ lineages |>
filter(sample == "SRR18541114") |>
mutate(name = fct_reorder(name, abundance)) |>
ggplot(aes(x = name, y = abundance, colour = abundance < 0.05)) +
geom_pointrange(aes(ymin = boot_lo, ymax = boot_hi)) +
geom_pointrange(aes(ymin = boot_lo, ymax = boot_up)) +
scale_x_discrete(guide = guide_axis(angle = 45)) +
labs(x = "Lineage", y = "Abundance (95% CI)", colour = "< 5%",
main = "Sample: SRR18541114")
Expand All @@ -375,7 +375,7 @@ sandiego |>
filter(sample %in% c("SRR18541092", "SRR18541114")) |>
# make the plot
ggplot(aes(x = name, y = abundance, colour = sample)) +
geom_pointrange(aes(ymin = boot_lo, ymax = boot_hi),
geom_pointrange(aes(ymin = boot_lo, ymax = boot_up),
position = position_dodge(width = 0.5))
```

Expand Down
6 changes: 3 additions & 3 deletions materials/04-wastewater/04-ww_mutations.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ In R, we can calculate this as follows:
```{r}
missense <- missense |>
mutate(af_lo = qbeta(0.025, alt_dp + 0.5, (dp - alt_dp) + 0.5),
af_hi = qbeta(0.975, alt_dp + 0.5, (dp - alt_dp) + 0.5))
af_up = qbeta(0.975, alt_dp + 0.5, (dp - alt_dp) + 0.5))
```

One possible visualisation is to consider the mutations in individual samples, shown as a plot across the genome:
Expand All @@ -245,7 +245,7 @@ One possible visualisation is to consider the mutations in individual samples, s
missense |>
filter(sample == "SRR18541114") |>
ggplot(aes(pos, af, colour = gene)) +
geom_pointrange(aes(ymin = af_lo, ymax = af_hi)) +
geom_pointrange(aes(ymin = af_lo, ymax = af_up)) +
scale_y_continuous(limits = c(0, 1))
```

Expand All @@ -255,7 +255,7 @@ Or, we can focus on an individual mutation and plot it over time:
missense |>
filter(aa_change == "p.K856R") |>
ggplot(aes(date, af)) +
geom_pointrange(aes(ymin = af_lo, ymax = af_hi)) +
geom_pointrange(aes(ymin = af_lo, ymax = af_up)) +
scale_y_continuous(limits = c(0, 1))
```

Expand Down
2 changes: 1 addition & 1 deletion materials/04-wastewater/ww_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,4 @@ pagetitle: "SARS Genomic Surveillance"
Trainers:

- Amanda Qvesel (bioinformatics) - [email protected]
-

2 changes: 1 addition & 1 deletion utils/wastewater/tidy_freyja_viralrecon.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def parse_bootstrap(file_path):
# zip them up
boot = list(zip(lineage_names, q1, q7))
# convert to data frame
boot_df = pd.DataFrame(boot, columns=["name", "boot_lo", "boot_hi"])
boot_df = pd.DataFrame(boot, columns=["name", "boot_lo", "boot_up"])

return boot_df

Expand Down

0 comments on commit cfff04e

Please sign in to comment.