Skip to content
Open
2 changes: 1 addition & 1 deletion shared/lassa_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
data_curation <- function(articles, outbreaks, models, parameters, plotting,switch_first_surname=FALSE) {

articles <- articles %>%
mutate(refs = paste(first_author_first_name," (",year_publication,")",sep="")) %>% #define references
mutate(refs = paste(first_author_surname," (",year_publication,")",sep="")) %>% #define references
group_by(refs) %>% mutate(counter = row_number()) %>% ungroup() %>% #distinguish same-author-same-year references
mutate(new_refs = ifelse(refs %in% refs[duplicated(refs)], paste0(sub("\\)$", "", refs),letters[counter],")"), refs)) %>%
select(-counter,-refs) %>% rename(refs = new_refs)
Expand Down
12 changes: 6 additions & 6 deletions src/db_compilation/lassa_cleaning.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,20 @@ lassa_cleaning <- function(df) {
TRUE ~ paper_copy_only
)) %>%
# name typos
mutate(first_author_surname = case_when(
mutate(first_author_first_name = case_when(
covidence_id %in% 2648 ~ "Shirley C.",
covidence_id %in% 1447 ~ "N.A.",
TRUE ~ first_author_surname
TRUE ~ first_author_first_name
)) %>%
mutate(first_author_first_name = case_when(
mutate(first_author_surname = case_when(
covidence_id %in% 2648 ~ "Nimo-Paintsil",
covidence_id %in% 2585 ~ "Dalhat",
covidence_id %in% 1033 ~ "Ehichioya",
covidence_id %in% 661 ~ "Kerneis",
TRUE ~ first_author_first_name
TRUE ~ first_author_surname
)) %>%
mutate(first_author_first_name = sub(".*\\.(.*)", "\\1", first_author_first_name)) %>%
mutate(first_author_first_name = sub("^\\s+", "", first_author_first_name))
mutate(first_author_surname = sub(".*\\.(.*)", "\\1", first_author_surname)) %>%
mutate(first_author_surname = sub("^\\s+", "", first_author_surname))
# revised qa after parameter removed: now outbreak only
df[df$covidence_id %in% 152, c("qa_m1", "qa_m2", "qa_a3", "qa_a4", "qa_d6", "qa_d7")] <- NA
df
Expand Down
2 changes: 1 addition & 1 deletion src/db_compilation/lassa_qa_fixing.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Article_ID,Pathogen,Covidence_ID,FirstAauthor_Surname,Article_title,DOI,Journal,Year_publication,Volume,Issue,Page_first,Page_last,Name_data_entry,Paper_copy_only,Notes,FirstAuthor_FirstName,QA_M1,QA_M2,QA_A3,QA_A4,QA_D5,QA_D6,QA_D7,ID,Covidence_ID_text,fixed,num_rows,matching
Article_ID,Pathogen,Covidence_ID,FirstAuthor_FirstName,Article_title,DOI,Journal,Year_publication,Volume,Issue,Page_first,Page_last,Name_data_entry,Paper_copy_only,Notes,FirstAauthor_Surname,QA_M1,QA_M2,QA_A3,QA_A4,QA_D5,QA_D6,QA_D7,ID,Covidence_ID_text,fixed,num_rows,matching
1,Lassa mammarenavirus,18,PA,Lassa Fever in Children in Sierra-Leone; West-Africa,NA,Transactions of the Royal Society of Tropical Medicine and Hygiene,1986,80,4,577,582,Christian,FALSE,"Study in Children
Seasonal cluster in April; May and August",Webb,Yes,No,NA,NA,Yes,No,No,9f62e47ed45a53c1336e8e63d7d7f6cb,18,1,,
4,Lassa mammarenavirus,49,Fransje,Hemorrhagic-Fever Virus-Infections in an Isolated Rain-Forest Area of Central Liberia - Limitations of the Indirect Immunofluorescence Slide Test for Antibody Screening in Africa,NA,Tropical and Geographical Medicine,1986,38,1,209,214,Christian,TRUE,"Link with Epilepsy
Expand Down
12 changes: 6 additions & 6 deletions src/db_compilation/sars_cleaning.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,18 @@ sars_cleaning <- function(df) {
# covidence_id %in% c(845,917) ~ FALSE,
# TRUE ~ paper_copy_only)) %>%
#name typos
mutate(first_author_surname = case_when(
mutate(first_author_first_name = case_when(
# covidence_id == 2648 ~ 'Shirley C.',
covidence_id == 6909 ~ 'MEC', #The Chinese SARS Molecular Epidemiology Consortium
TRUE ~ first_author_surname)) %>%
mutate(first_author_first_name = sub(".*\\.(.*)", "\\1", first_author_first_name, useBytes = TRUE)) %>%
mutate(first_author_first_name = sub("^\\s+", "", first_author_first_name, useBytes = TRUE)) %>%
mutate(first_author_first_name = case_when(
TRUE ~ first_author_first_name)) %>%
mutate(first_author_surname = sub(".*\\.(.*)", "\\1", first_author_surname, useBytes = TRUE)) %>%
mutate(first_author_surname = sub("^\\s+", "", first_author_surname, useBytes = TRUE)) %>%
mutate(first_author_surname = case_when(
# covidence_id == 2648 ~ 'Nimo-Paintsil',
# covidence_id == 2585 ~ 'Dalhat',
# covidence_id == 1033 ~ 'Ehichioya',
covidence_id == 6909 ~ 'MEC', #The Chinese SARS Molecular Epidemiology Consortium
TRUE ~ first_author_first_name))
TRUE ~ first_author_surname))
df
}

Expand Down
15 changes: 14 additions & 1 deletion src/db_extraction/orderly.R
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,11 @@ if (pathogen == "EBOLA") {
models$Covidence_ID[ models$Covidence_ID == 3158] <- 3153
params$Covidence_ID[ params$Covidence_ID == 3158] <- 3153

#correct author first/last names
articles <- articles %>% rename(temp_col = FirstAuthor_FirstName,
FirstAuthor_FirstName = FirstAauthor_Surname) %>%
rename(FirstAauthor_Surname = temp_col)

#blank outbreaks
outbreaks <- outbreaks %>% filter(!(Covidence_ID == 845 & Outbreak_ID == 1))

Expand All @@ -343,7 +348,15 @@ if (pathogen == "EBOLA") {

#missing parameter types
params$Parameter_type[params$Covidence_ID==2684&params$access_param_id==37] <- 'Risk factors'
}
} else if (pathogen == "SARS") {

#correct author first/last names
articles <- articles %>% rename(temp_col = FirstAuthor_FirstName,
FirstAuthor_FirstName = FirstAauthor_Surname) %>%
rename(FirstAauthor_Surname = temp_col)

}

# Pathogen-specific cleaning
articles <- clean_articles(articles)
models <- clean_models(models)
Expand Down
24 changes: 17 additions & 7 deletions src/lassa_collate/orderly.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ orderly_parameters(pathogen = NULL)
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_S6.png","figure_S7.png","figure_S8.png",
"figure_S9.png","figure_S10.png","figure_S11.png","figure_S12.png",
"figure_3.pdf","figure_S6.pdf","figure_S7.pdf","figure_S8.pdf",
"figure_S9.pdf","figure_S10.pdf","figure_S11.pdf","figure_S12.pdf"))
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_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_S14.pdf"))
orderly_dependency("lassa_delays", "latest(parameter:pathogen == this:pathogen)",
files = c("figure_4.png","figure_S5.png","figure_4.pdf","figure_S5.pdf"))
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)",
files = c("figure_5.png","figure_5.pdf"))
orderly_dependency("lassa_summary", "latest(parameter:pathogen == this:pathogen)",
Expand All @@ -26,10 +26,12 @@ orderly_artefact("lassa-specific outputs",
"main/figure_2.pdf","main/figure_3.pdf","main/figure_4.pdf","main/figure_5.pdf",
"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_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_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 @@ -86,6 +88,10 @@ file.copy(from = "figure_S11.png",
to = "supp/figure_S11.png")
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 @@ -109,6 +115,10 @@ file.copy(from = "figure_S11.pdf",
to = "supp/figure_S11.pdf")
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
17 changes: 15 additions & 2 deletions src/lassa_delays/orderly.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,24 @@ patchwork <- patchwork + plot_annotation(tag_levels = 'A')
ggsave("figure_4.png", plot = patchwork, width = 12, height = 16)
ggsave("figure_4.pdf", plot = patchwork, width = 12, height = 16)

#figure_S5: hypothetical probability distributions for onset-admission delay
# #figure_S5: hypothetical probability distributions for onset-admission delay
p1 <- pdf_generic(m5$result,"common",c("Gamma","Lognormal","Weibull"),c(-0.2,30),'Onset-Admission Delay (days)')
p2 <- pdf_generic(m5$result,"random",c("Gamma","Lognormal","Weibull"),c(-0.2,30),'Onset-Admission Delay (days)')

patchwork <- (p1 + p2) + plot_layout(ncol = 2, widths = c(1,1))
patchwork <- patchwork + plot_annotation(tag_levels = 'A')
ggsave("figure_S5.png", plot = patchwork, width = 12, height = 6)
ggsave("figure_S5.pdf", plot = patchwork, width = 12, height = 6)
ggsave("figure_S5.pdf", plot = patchwork, width = 12, height = 6)

#figure_S6: meta-analysis funnel plot
png(file = "temp.png", width = 9500, height = 6500, res = 1000)
funnel(m5$result, xlim = c(5,12), ylim = c(0,1.5), common = FALSE,#only plots funnel for either common or random for some reason
pch = 22, bg = "dodgerblue3", 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_S6.png", plot = gg, width = 12, height = 8)
ggsave("figure_S6.pdf", plot = gg, width = 12, height = 8)
28 changes: 22 additions & 6 deletions src/lassa_serology/orderly.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,35 @@ n1 <- data.frame(latitude = c(19.1,18.1,17.1,15.1,15.0,12.5,
"Central\nAfrican\nRepublic","Gabon","Equatorial\nGuinea","Cameroon","Côte d'Ivoire","Ghana",
"Republic\nof Congo","Benin","Togo","Nigeria","Guinea","Gambia",
"Guinea\n-Bissau","Sierra\nLeone","Liberia"))
n2 <- data.frame(latitude = numeric(0), longitude = numeric(0), c_name = character(0))
n2 <- data.frame(latitude = c(16.4,
3.8,4.25,
5.2,3.8,9.0,
7.0,5),
longitude = c(-11.5,
-4.5,-0.5,
2.3,4.5,-15.5,
-14.5,-11.5),
c_name = c("Mali",
"Côte d'Ivoire","Ghana",
"Benin","Nigeria","Guinea",
"Sierra\nLeone","Liberia"))

#specify position of lines pointing to countries (added to map after function call)
ll <- data.frame(lat1 = c(2.50,-3.2,1.0,5.1,3.3,13.4,11.500,7.200,4.5),
lon1 = c(23.5,7.30,7.6,1.6,3.7,-17.8,-17.7,-14.5,-11),
lat2 = c(3.80,-2.5,1.7,6.0,4.5,13.4,11.700,7.900,5.5),
lon2 = c(22.5,9.20,9.4,1.4,5.3,-17,-16.500,-13.2,-10))
ll1 <- data.frame(lat1 = c(2.50,-3.2,1.0,5.1,3.3,13.4,11.500,7.200,4.5),
lon1 = c(23.5,7.30,7.6,1.6,3.7,-17.8,-17.7,-14.5,-11),
lat2 = c(3.80,-2.5,1.7,6.0,4.5,13.4,11.700,7.900,5.5),
lon2 = c(22.5,9.20,9.4,1.4,5.3,-17,-16.500,-13.2,-10))
ll2 <- data.frame(lat1 = c( 16.1, 9.1, 7.45, 5.1, 4.1, 4.5, 5.4, 4),
lon1 = c(-11.4,-14.75,-13.9,-10.8,-4.5,-0.5, 2.3, 4.5),
lat2 = c( 15.3, 9.7, 7.9, 5.7, 5, 5.1, 6.2, 4.8),
lon2 = c(-10.9,-14.0, -13.2,-10.2,-4.9,-0.8, 2.2, 5.3))

#call mapping function
p1 <- map_generic(l0,l1,d1,f1,n1,range_mp=TRUE,summ_dups="mean",c(-23.2,25.1),c(-3.9,22.25),c(0,60),'magma','')
p1 <- p1 + geom_rect(aes(xmin = -18.8, xmax = 14.75, ymin = 2, ymax = 16.75), linetype = 2, color = "grey40", fill = NA)
p1 <- p1 + geom_segment(data = ll, aes(x = lon1, xend = lon2, y = lat1, yend = lat2), size = 0.5, color = "black")
p1 <- p1 + geom_segment(data = ll1, aes(x = lon1, xend = lon2, y = lat1, yend = lat2), size = 0.5, color = "black")
p2 <- map_generic(l0,l1,d2,f2,n2,range_mp=TRUE,summ_dups="mean",c(-18.5,13.13),c(2.75,16.1),c(0,60),'magma','')
p2 <- p2 + geom_segment(data = ll2, aes(x = lon1, xend = lon2, y = lat1, yend = lat2), size = 0.5, color = "black")

patchwork <- p1 / p2
patchwork <- patchwork + plot_layout(heights = c(1,0.75)) + plot_annotation(tag_levels = 'A')
Expand Down
55 changes: 34 additions & 21 deletions src/lassa_severity/orderly.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ orderly_shared_resource("Africa_Boundaries-shp" = "Africa_Boundaries-shp",
"rivers_africa_37333" = "rivers_africa_37333")
orderly_shared_resource("lassa_functions.R" = "lassa_functions.R")
source("lassa_functions.R")
orderly_artefact("lassa-specific figures",c("figure_3.png","figure_S6.png","figure_S7.png",
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_3.pdf","figure_S6.pdf","figure_S7.pdf",
"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_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 All @@ -206,18 +206,18 @@ p3 <- m3$plot
p4 <- m4$plot
p5 <- m5$plot

ggsave("figure_S6.png", plot = p1, width = 12, height = 16)
ggsave("figure_S6.pdf", plot = p1, width = 12, height = 16)
ggsave("figure_S7.png", plot = p2, width = 12, height = 16)
ggsave("figure_S7.pdf", plot = p2, width = 12, height = 16)
ggsave("figure_S8.png", plot = p3, width = 12, height = 16)
ggsave("figure_S8.pdf", plot = p3, width = 12, height = 16)
ggsave("figure_S9.png", plot = p4, width = 12, height = 16)
ggsave("figure_S9.pdf", plot = p4, width = 12, height = 16)
ggsave("figure_S10.png", plot = p5, width = 12, height = 16)
ggsave("figure_S10.pdf", plot = p5, width = 12, height = 16)
ggsave("figure_S7.png", plot = p1, width = 12, height = 16)
ggsave("figure_S7.pdf", plot = p1, width = 12, height = 16)
ggsave("figure_S8.png", plot = p2, width = 12, height = 16)
ggsave("figure_S8.pdf", plot = p2, width = 12, height = 16)
ggsave("figure_S9.png", plot = p3, width = 12, height = 16)
ggsave("figure_S9.pdf", plot = p3, width = 12, height = 16)
ggsave("figure_S10.png", plot = p4, width = 12, height = 16)
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 @@ -240,10 +240,10 @@ 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_S11.png", plot = patchwork, width = 12, height = 12)
ggsave("figure_S11.pdf", plot = patchwork, width = 12, height = 12)
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 @@ -266,5 +266,18 @@ 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_S12.png", plot = patchwork, width = 12, height = 12)
ggsave("figure_S12.pdf", plot = patchwork, width = 12, height = 12)
ggsave("figure_S13.png", 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)
10 changes: 2 additions & 8 deletions src/sars_world_map/orderly.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,12 @@ articles <- read_csv("articles.csv")
models <- read_csv("models.csv")
parameters <- read_csv("parameters.csv")

# to save down for epireview use plotting = FALSE
dfs <- data_curation(articles,tibble(),models,parameters, plotting = FALSE, switch_first_surname = TRUE )

articles <- dfs$articles
models <- dfs$models
parameters <- dfs$parameters

write_csv(articles,'sars_articles.csv')
write_csv(models,'sars_models.csv')
write_csv(parameters,'sars_parameters.csv')

dfs <- data_curation(articles,tibble(),models,parameters, plotting = TRUE, switch_first_surname = TRUE )
# to save down for epireview use plotting = FALSE
dfs <- data_curation(articles,tibble(),models,parameters, plotting = FALSE)

articles <- dfs$articles
models <- dfs$models
Expand Down
Loading