Skip to content

Commit

Permalink
added cfr funnel plot
Browse files Browse the repository at this point in the history
  • Loading branch information
patcatgit committed Aug 30, 2024
1 parent 06e694d commit be0ae32
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
10 changes: 8 additions & 2 deletions src/lassa_collate/orderly.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ orderly_dependency("lassa_serology", "latest(parameter:pathogen == this:pathogen
files = c("figure_2.png","figure_2.pdf"))
orderly_dependency("lassa_severity", "latest(parameter:pathogen == this:pathogen)",
files = c("figure_3.png","figure_S7.png","figure_S8.png",
"figure_S9.png","figure_S10.png","figure_S11.png","figure_S12.png","figure_S13.png",
"figure_S9.png","figure_S10.png","figure_S11.png","figure_S12.png","figure_S13.png","figure_S14.png",
"figure_3.pdf","figure_S7.pdf","figure_S8.pdf",
"figure_S9.pdf","figure_S10.pdf","figure_S11.pdf","figure_S12.pdf","figure_S13.pdf"))
"figure_S9.pdf","figure_S10.pdf","figure_S11.pdf","figure_S12.pdf","figure_S13.pdf","figure_S14.pdf"))
orderly_dependency("lassa_delays", "latest(parameter:pathogen == this:pathogen)",
files = c("figure_4.png","figure_S5.png","figure_S6.png","figure_4.pdf","figure_S5.pdf","figure_S6.pdf"))
orderly_dependency("lassa_transmission", "latest(parameter:pathogen == this:pathogen)",
Expand All @@ -27,9 +27,11 @@ orderly_artefact("lassa-specific outputs",
"supp/figure_S2.png","supp/figure_S3.png","supp/figure_S4.png",
"supp/figure_S5.png","supp/figure_S6.png","supp/figure_S7.png","supp/figure_S8.png",
"supp/figure_S9.png","supp/figure_S10.png","supp/figure_S11.png","supp/figure_S12.png","supp/figure_S13.png",
"supp/figure_S14.png",
"supp/figure_S2.pdf","supp/figure_S3.pdf","supp/figure_S4.pdf",
"supp/figure_S5.pdf","supp/figure_S6.pdf","supp/figure_S7.pdf","supp/figure_S8.pdf",
"supp/figure_S9.pdf","supp/figure_S10.pdf","supp/figure_S11.pdf","supp/figure_S12.pdf","supp/figure_S13.pdf",
"supp/figure_S14.pdf",
"supp/latex_outbreaks.csv","supp/latex_models.csv",
"supp/latex_transmission.csv","supp/latex_delays.csv","supp/latex_severity.csv",
"supp/latex_seroprevalence.csv","supp/latex_riskfactors.csv"))
Expand Down Expand Up @@ -88,6 +90,8 @@ file.copy(from = "figure_S12.png",
to = "supp/figure_S12.png")
file.copy(from = "figure_S13.png",
to = "supp/figure_S13.png")
file.copy(from = "figure_S14.png",
to = "supp/figure_S14.png")

file.copy(from = "figure_S2.pdf",
to = "supp/figure_S2.pdf")
Expand All @@ -113,6 +117,8 @@ file.copy(from = "figure_S12.pdf",
to = "supp/figure_S12.pdf")
file.copy(from = "figure_S13.pdf",
to = "supp/figure_S13.pdf")
file.copy(from = "figure_S14.pdf",
to = "supp/figure_S14.pdf")

file.copy(from = "latex_outbreaks.csv",
to = "supp/latex_outbreaks.csv")
Expand Down
25 changes: 19 additions & 6 deletions src/lassa_severity/orderly.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ orderly_shared_resource("lassa_functions.R" = "lassa_functions.R")
source("lassa_functions.R")
orderly_artefact("lassa-specific figures",c("figure_3.png","figure_S7.png",
"figure_S8.png","figure_S9.png","figure_S10.png",
"figure_S11.png","figure_S12.png","figure_S13.png",
"figure_S11.png","figure_S12.png","figure_S13.png","figure_S14.png",
"figure_3.pdf","figure_S7.pdf",
"figure_S8.pdf","figure_S9.pdf","figure_S10.pdf",
"figure_S11.pdf","figure_S12.pdf","figure_S13.pdf"))
"figure_S11.pdf","figure_S12.pdf","figure_S13.pdf","figure_S14.pdf"))

###################
## DATA CURATION ##
Expand Down Expand Up @@ -183,7 +183,7 @@ patchwork <- patchwork + plot_annotation(tag_levels = 'A')
ggsave("figure_3.png", plot = patchwork, width = 18, height = 12)
ggsave("figure_3.pdf", plot = patchwork, width = 18, height = 12)

#figure_S6-S10: meta-analysis with all estimates plotted
#figure_S7-S11: meta-analysis with all estimates plotted
m1 <- metaprop_wrap(dataframe = da %>% arrange(-central), subgroup = "lineage",
plot_pooled = TRUE, sort_by_subg = TRUE, plot_study = TRUE, digits = 3, colour = "red",
width = 1200, height = 1600, resolution = 115)
Expand Down Expand Up @@ -217,7 +217,7 @@ ggsave("figure_S10.pdf", plot = p4, width = 12, height = 16)
ggsave("figure_S11.png", plot = p5, width = 12, height = 16)
ggsave("figure_S11.pdf", plot = p5, width = 12, height = 16)

#figure_S11: meta-analysis with only known duplicates excluded
#figure_S12: meta-analysis with only known duplicates excluded
db <- d1 %>% filter(duplicate_cfr %in% c("False","Assumed"))

m1 <- metaprop_wrap(dataframe = db, subgroup = "lineage",
Expand All @@ -243,7 +243,7 @@ patchwork <- patchwork + plot_annotation(tag_levels = 'A')
ggsave("figure_S12.png", plot = patchwork, width = 12, height = 12)
ggsave("figure_S12.pdf", plot = patchwork, width = 12, height = 12)

#figure_S12: meta-analysis without de-duplication
#figure_S13: meta-analysis without de-duplication
dc <- d1

m1 <- metaprop_wrap(dataframe = dc, subgroup = "lineage",
Expand All @@ -267,4 +267,17 @@ p4 <- m4$plot
patchwork <- (p1 + p2 + p3 + p4) + plot_layout(ncol = 2, widths = c(1,1))
patchwork <- patchwork + plot_annotation(tag_levels = 'A')
ggsave("figure_S13.png", plot = patchwork, width = 12, height = 12)
ggsave("figure_S13.pdf", plot = patchwork, width = 12, height = 12)
ggsave("figure_S13.pdf", plot = patchwork, width = 12, height = 12)

#figure_S14: meta-analysis funnel plot
png(file = "temp.png", width = 9500, height = 6500, res = 1000)
funnel(m5$result, xlim = c(-3,2), ylim = c(0,1), common = FALSE,#only plots funnel for either common or random for some reason
pch = 22, bg = "red", level = 0.95,
studlab = TRUE, cex.studlab = 0.75, pos.studlab = 2)
dev.off()
gg <- png::readPNG("temp.png", native = TRUE)
file.remove("temp.png")
gg <- wrap_elements(plot = rasterGrob(gg, interpolate = TRUE))

ggsave("figure_S14.png", plot = gg, width = 12, height = 8)
ggsave("figure_S14.pdf", plot = gg, width = 12, height = 8)

0 comments on commit be0ae32

Please sign in to comment.