Skip to content

Commit

Permalink
Final draft stage for initial submission
Browse files Browse the repository at this point in the history
  • Loading branch information
anetzl committed Aug 12, 2024
1 parent 56ed0bb commit 0880343
Show file tree
Hide file tree
Showing 101 changed files with 729 additions and 282 deletions.
Binary file modified .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions code/3D_landscapes.Rmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "3D Landscapes"
author: "Antonia Netzl"
date: "2024-03-11"
date: "2024-07-31"
output: html_document
---

Expand All @@ -20,7 +20,7 @@ library(htmlwidgets)
set.seed(100)
# set optimization nr to fit BA.4/5 position; optimization nr 56 gives upper BA.4/5
map <- read.acmap(file.path("data", "maps", "map_threshold20_all_ags_singleTP_woXBBBQ11conv_alphaJN1ba286_adjScan.ace"))
map <- read.acmap(file.path("data", "maps", "map_threshold20_all_ags_singleTP_woXBBBQ11conv_woXBB15conv_woJN1BA286_alpha_adj.ace"))
lims <- Racmacs:::mapPlotLims(map, sera = FALSE)
lndscp_list <- readRDS(file.path("data", "landscape_fit", "biv_boosts_ags_all.rds"))
Expand Down
6 changes: 3 additions & 3 deletions code/3D_landscapes.html

Large diffs are not rendered by default.

13 changes: 5 additions & 8 deletions code/ablandscape_fit_multi.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ library(patchwork)
set.seed(100)

fit_ags <- "all" # options are "all", "sub"
sub_ags <- c('CB.1', 'BR.3', 'CH.1.1','BA.5.2.1', 'BE.1.1', 'BF.7', 'BQ.1.3', 'BQ.1.1', 'BQ.1.18', 'XBB.1', 'XBB.1.5', 'XBF')

source("./functions/map_longinfo.R")
source("./functions/sams_landscape_functions.R")
Expand All @@ -27,7 +26,7 @@ suppressWarnings(dir.create(figure_dir, recursive = T))
# if you want to exclude some antigens in the fit
ags_to_exclude <- c("")
# Read the base map
map <- read.acmap("./data/maps/map_threshold20_all_ags_singleTP_woXBBBQ11conv_alphaJN1ba286_adjScan.ace")
map <- read.acmap("./data/maps/map_threshold20_all_ags_singleTP_woXBBBQ11conv_woXBB15conv_woJN1BA286_alpha_adj.ace")

sr_group_gmt <- read.csv("./data/titer_data/sr_group_gmt_threshold20.csv") %>%
select(!X)
Expand Down Expand Up @@ -103,7 +102,7 @@ titerdata %>%
# angle for html page
# angle for html page
angle <- list(
rotation = c(-1.3594,0.0060, -0.0626), #c(-1.3365, 0.0055, -0.0576),# c(-1.4592, 0.0045, -0.0144)
rotation = c(-1.3973,0.0060, -0.4106), #c(-1.3365, 0.0055, -0.0576),# c(-1.4592, 0.0045, -0.0144)
translation = c(0, 0,0), #translation = c(0.0344, 0.0459, 0.1175),
zoom = 1.5
# zoom = 1.1646 # higher is more zoomed out
Expand All @@ -115,8 +114,8 @@ data3js <- base_plot_data3js(map, lndscp_fits, agNames(map), lims, agNames(map))
two_dose_groups <- grep("two doses", titertables_groups$sr_group)

two_dose_landscapes <- plot_landscapes_from_list(data3js, titertables_groups[two_dose_groups, ], lndscp_fits[two_dose_groups], map, gmt_data, highlighted_ags = agNames(map),
ag_plot_names = c("Wuhan", "BA.1", "JN.1", "HK.3"),
ag_labelled = c("Wuhan", "BA.1", "JN.1", "HK.3"),
ag_plot_names = c("Delta", "BA.1", "DV.7.1", "HK.3", "KZ.1.1.1"),
ag_labelled = c("Delta", "BA.1","DV.7.1", "HK.3", "KZ.1.1.1"),
lndscp_colors = sr_colors,
add_ag_label = TRUE)

Expand Down Expand Up @@ -171,6 +170,4 @@ save_name <- file.path(figure_dir, paste0(fit_ags, "_all_gmt_landscapes"))
plot_single_landscape_panel(lndscp, label = "", save_name = save_name, delete_html = FALSE)

lndscp_list[["all"]] <- lndscp
saveRDS(lndscp_list, paste0("data/landscape_fit/biv_boosts_ags_",fit_ags,".rds"))


saveRDS(lndscp_list, paste0("data/landscape_fit/biv_boosts_ags_",fit_ags,".rds"))
47 changes: 22 additions & 25 deletions code/make_map_final.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,28 +93,38 @@ for(map_f in map_files){

}

# optimise reactivity for Alpha. reduce alpha by 2 fold
# remove all XBB.1.5 conv sera
map_files <- list.files(map_dir, pattern = ".ace", full.names = TRUE)
map_files <- map_files[grepl("woXBBBQ11conv.ace", map_files)]


for(map_f in map_files){

map <- read.acmap(map_f)
ag_names <- agNames(map)
map <- removeSera(map, srNames(map)[srGroups(map) == "XBB.1.5 conv."])
map <- optimize_and_realign_map(map, alignment_map, 1000, 2, option_list = list(ignore_disconnected = TRUE,
dim_annealing = TRUE))

start_react <- rep(0, length(ag_names))
start_react[ag_names == "Alpha"] <- -1
save.acmap(map, gsub(".ace", "_woXBB15conv.ace", map_f))

agReactivityAdjustments(map) <- start_react
map <- optimizeMap(map, 2, 1000, options = list(ignore_disconnected = TRUE,
dim_annealing = TRUE))
map <- realignMap(map, alignment_map)
}

# remove JN.1 and BA.2.86
map_files <- list.files(map_dir, pattern = ".ace", full.names = TRUE)
map_files <- map_files[grepl("woXBBBQ11conv", map_files)]
for(map_f in map_files){

save.acmap(map, gsub(".ace", "_alpha_adjM1.ace", map_f))
map <- read.acmap(map_f)
map <- removeAntigens(map, c("JN.1", "BA.2.86"))
map <- optimize_and_realign_map(map, alignment_map, 1000, 2, option_list = list(ignore_disconnected = TRUE,
dim_annealing = TRUE))

save.acmap(map, gsub(".ace", "_woJN1BA286.ace", map_f))

}

# optimise reactivity for Alpha. reduce alpha by 2 fold
map_files <- list.files(map_dir, pattern = ".ace", full.names = TRUE)
map_files <- map_files[grepl("woXBBBQ11conv", map_files)]

# down here automated alpha adjust
for(map_f in map_files){

Expand All @@ -125,7 +135,7 @@ for(map_f in map_files){
start_react[ag_names == "Alpha"] <- NA

map <- optimizeAgReactivity(map, fixed_ag_reactivities = start_react, reoptimize = FALSE, options = list(ignore_disconnected = TRUE, dim_annealing = TRUE))
print(paste(map_f, agReactivityAdjustments(map)))
#print(paste(map_f, agReactivityAdjustments(map)))
map <- optimize_and_realign_map(map, alignment_map, 1000, 2, option_list = list(ignore_disconnected = TRUE,
dim_annealing = TRUE))

Expand All @@ -134,16 +144,3 @@ for(map_f in map_files){

}

if(!file.exists("data/maps/map_threshold20_all_ags_singleTP_woXBBBQ11conv_alphaJN1ba286_adjScan.ace")){

og_map <- read.acmap("data/maps/map_threshold20_all_ags_singleTP_woXBBBQ11conv_alpha_adj.ace")

ag_names <- agNames(og_map)
start_react <- agReactivityAdjustments(og_map)

start_react[ag_names %in% c("JN.1", "BA.2.86")] <- -0.685
adj_map_optim <- optimizeAgReactivity(og_map, fixed_ag_reactivities = start_react, reoptimize = TRUE, options = list(ignore_disconnected = TRUE, dim_annealing = TRUE))

save.acmap(adj_map_optim, "data/maps/map_threshold20_all_ags_singleTP_woXBBBQ11conv_alphaJN1ba286_adjScan.ace")

}
Binary file modified figures/.DS_Store
Binary file not shown.
Binary file modified figures/fig2 roessler_et_al_2024_cartography.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/labelled_map/.DS_Store
Binary file not shown.
Binary file modified figures/labelled_map/alpha_unadj_proc_map_zoom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
62 changes: 11 additions & 51 deletions figures/labelled_map/human_map_procrustes.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ sr_group_colors <- read.csv(file = "./data/metadata/sr_group_colors.csv", header
mapColors <- read.csv(file = './data/metadata/map-colors.csv', row.names = 'Variable', header = TRUE)
mapColors[rownames(sr_group_colors), "Color"] <- sr_group_colors$Color

target_map <- "map_threshold20_all_ags_singleTP_woXBBBQ11conv_alphaJN1ba286_adjScan.ace"
target_map <- "map_threshold20_all_ags_singleTP_woXBBBQ11conv_woXBB15conv_woJN1BA286_alpha_adj.ace"
full_map <-read.acmap(file.path("./data/maps", target_map))
full_map <- change_map_colors(full_map, mapColors)

Expand Down Expand Up @@ -127,10 +127,10 @@ if(file.exists("data/maps/Wilks_et_al_subNHP.ace")){
}

xlim_no_zoom <- read.csv("./data/metadata/xlim_no_zoom.csv")$x
xlim_no_zoom[1] <- xlim_no_zoom[1] + 2
#xlim_no_zoom[1] <- xlim_no_zoom[1] + 2
ylim_no_zoom <- read.csv("./data/metadata/ylim_no_zoom.csv")$x
ylim_no_zoom[1] <- ylim_no_zoom[1] + 1
ylim_no_zoom[2] <- ylim_no_zoom[2] - 1
#ylim_no_zoom[1] <- ylim_no_zoom[1] + 1
#ylim_no_zoom[2] <- ylim_no_zoom[2] - 1

# Setup plotting function
doplot <- function(map, xlims, ylims, show_labels = TRUE) {
Expand Down Expand Up @@ -189,58 +189,18 @@ doplot <- function(map, xlims, ylims, show_labels = TRUE) {



#ylim_no_zoom[1] <- ylim_no_zoom[1] -1
#
#
# png(file.path(figure_dir, "proc_map_threshold20_all_ags_singleTP_woXBBBQ11conv_alpha_adj_wSubset.png"), width = 8, height = 9, units = 'in', res=300, pointsize = 18)
# layout(matrix(c(1:6), ncol = 2, byrow = T))
# par(mar = rep(0.5, 4))
# doplot(procrustesMap(alignment_map, full_map, scaling = TRUE), xlim_no_zoom, ylim_no_zoom, FALSE)
# text(xlim_no_zoom[1]+0.4, ylim_no_zoom[2]-0.4, "A", cex = 1.2)
# doplot(procrustesMap(move_coords(duke_map, at = 1, by = -3), full_map, scaling = TRUE), xlim_no_zoom-3, ylim_no_zoom, FALSE)
# text(xlim_no_zoom[1]-3+0.4, ylim_no_zoom[2]-0.4, "B", cex = 1.2)
# doplot(procrustesMap(sub_align, nhp_kimpel, scaling = TRUE), xlim_no_zoom, ylim_no_zoom, FALSE)
# text(xlim_no_zoom[1]+0.4, ylim_no_zoom[2]-0.4, "C", cex = 1.2)
# doplot(procrustesMap(sub_duke, nhp_duke, scaling = TRUE), xlim_no_zoom, ylim_no_zoom, FALSE)
# text(xlim_no_zoom[1]+0.4, ylim_no_zoom[2]-0.4, "D", cex = 1.2)
# doplot(procrustesMap(nhp_kimpel, full_map, scaling = FALSE, sera = FALSE), xlim_no_zoom, ylim_no_zoom, FALSE)
# text(xlim_no_zoom[1]+0.4, ylim_no_zoom[2]-0.4, "E", cex = 1.2)
# doplot(procrustesMap(nhp_duke, full_map, scaling = FALSE, sera = FALSE), xlim_no_zoom, ylim_no_zoom, FALSE)
# text(xlim_no_zoom[1]+0.4, ylim_no_zoom[2]-0.4, "F", cex = 1.2)
# dev.off()
#
# png(file.path(figure_dir, "proc_map_threshold20_all_ags_singleTP_woXBBBQ11conv_alpha_adj.png"), width = 12, height = 5, units = 'in', res=300, pointsize = 18)
# layout(matrix(c(1:2), ncol = 2, byrow = T))
# par(mar = rep(0.5, 4))
# doplot(procrustesMap(alignment_map, full_map, scaling = TRUE), xlim_no_zoom, ylim_no_zoom, FALSE)
# text(xlim_no_zoom[1]+0.4, ylim_no_zoom[2]-0.4, "A", cex = 1.2)
# text(xlim_no_zoom[2]-0.2, ylim_no_zoom[1]+ 0.2, "Human data set 1", cex = 0.8, adj = c(1, 0), col = "grey30")
# doplot(procrustesMap(move_coords(duke_map, at = 1, by = -3), full_map, scaling = TRUE), xlim_no_zoom-3, ylim_no_zoom, FALSE)
# text(xlim_no_zoom[1]-3+0.4, ylim_no_zoom[2]-0.4, "B", cex = 1.2)
# text(xlim_no_zoom[2]-3- 0.2, ylim_no_zoom[1] + 0.2, "Human data set 2", cex = 0.8, adj = c(1, 0), col = "grey30")
# dev.off()

ylim_no_zoom[2] <-ylim_no_zoom[2] + 1
ylim_no_zoom[2] <-ylim_no_zoom[2] - 2
xlim_no_zoom[2] <-xlim_no_zoom[2] - 2
ylim_no_zoom[1] <-ylim_no_zoom[1] +1

png(file.path(figure_dir, paste0("proc_", gsub(".ace", "", target_map), "_show_only_commonAgs.png")), width = 12, height = 5, units = 'in', res=300, pointsize = 18)
layout(matrix(c(1:2), ncol = 2, byrow = T))
par(mar = rep(0.5, 4))
doplot(procrustesMap(removeAntigens(alignment_map, agNames(alignment_map)[!agNames(alignment_map) %in% agNames(full_map)]), full_map, scaling = TRUE), xlim_no_zoom, ylim_no_zoom, FALSE)
text(xlim_no_zoom[1]+0.4, ylim_no_zoom[2]-0.4, "A", cex = 1.2)
text(xlim_no_zoom[2]-0.2, ylim_no_zoom[1]+ 0.2, "Human data set 1", cex = 0.8, adj = c(1, 0), col = "grey30")
doplot(procrustesMap(move_coords(move_coords(removeAntigens(duke_map, agNames(duke_map)[!agNames(duke_map) %in% agNames(full_map)]), at = 1, by = -2), at =2, by = +2), full_map, scaling = TRUE), xlim_no_zoom-1, ylim_no_zoom+2, FALSE)
text(xlim_no_zoom[1]-1+0.4, ylim_no_zoom[2]+2-0.4, "B", cex = 1.2)
text(xlim_no_zoom[2]-1- 0.2, ylim_no_zoom[1]+2 + 0.2, "Human data set 2", cex = 0.8, adj = c(1, 0), col = "grey30")
doplot(procrustesMap(move_coords(move_coords(removeAntigens(duke_map, agNames(duke_map)[!agNames(duke_map) %in% agNames(full_map)]), at = 1, by = -2), at =2, by = 0), full_map, scaling = TRUE), xlim_no_zoom, ylim_no_zoom, FALSE)
text(xlim_no_zoom[1]+0.4, ylim_no_zoom[2]-0.4, "B", cex = 1.2)
text(xlim_no_zoom[2]- 0.2, ylim_no_zoom[1] + 0.2, "Human data set 2", cex = 0.8, adj = c(1, 0), col = "grey30")
dev.off()


#
# png(file.path(figure_dir, "proc_map_threshold20_all_ags_singleTP_woXBBBQ11conv_alpha_adj_unscaled.png"), width = 12, height = 5, units = 'in', res=300, pointsize = 18)
# layout(matrix(c(1:2), ncol = 2, byrow = T))
# par(mar = rep(0.5, 4))
# doplot(procrustesMap(alignment_map, full_map, scaling = FALSE), xlim_no_zoom, ylim_no_zoom, FALSE)
# text(xlim_no_zoom[1]+0.4, ylim_no_zoom[2]-0.4, "A", cex = 1.2)
# doplot(procrustesMap(duke_map, full_map, scaling = FALSE), xlim_no_zoom, ylim_no_zoom, FALSE)
# text(xlim_no_zoom[1]+0.4, ylim_no_zoom[2]-0.4, "B", cex = 1.2)
# dev.off()
#
#
Binary file modified figures/labelled_map/human_procrustes_labelled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/labelled_map/map_no_zoom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/labelled_map/map_zoom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 4 additions & 7 deletions figures/labelled_map/plot_labelled_map_final.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ move_coords <- function(map, at = 2, by = -0.5){
# map_alpha_unadj <- move_coords(map_alpha_unadj, at = 2, by = -1)


map <- read.acmap("data/maps/map_threshold20_all_ags_singleTP_woXBBBQ11conv_alphaJN1ba286_adjScan.ace")
map_alpha_unadj <- read.acmap("./data/maps/map_threshold20_all_ags_singleTP_woXBBBQ11conv.ace")
map <- read.acmap("data/maps/map_threshold20_all_ags_singleTP_woXBBBQ11conv_woXBB15conv_woJN1BA286_alpha_adj.ace")
map_alpha_unadj <- read.acmap("data/maps/map_threshold20_all_ags_singleTP_woXBBBQ11conv_woXBB15conv_woJN1BA286.ace")

lims <- Racmacs:::mapPlotLims(map, sera = FALSE)
lims_no_zoom <- Racmacs:::mapPlotLims(map, sera = TRUE)
Expand All @@ -38,9 +38,6 @@ write.csv(xlim_no_zoom, "./data/metadata/xlim_no_zoom.csv")
write.csv(ylim_zoom, "./data/metadata/ylim_zoom.csv")
write.csv(xlim_zoom, "./data/metadata/xlim_zoom.csv")

ylim_zoom[2] <- ylim_zoom[2] - 1
xlim_zoom[1] <- xlim_zoom[1] + 1


map <- move_coords(map, at = 2, by = -0.3)
map <- move_coords(map, at = 1, by = 0.2)
Expand Down Expand Up @@ -109,13 +106,13 @@ par(mar = rep(0.5, 4))
doplot(map, xlim_no_zoom, ylim_no_zoom, FALSE)
dev.off()

png("figures/labelled_map/map_zoom.png", 5, 4, units = 'in', res=300, pointsize = 12)
png("figures/labelled_map/map_zoom.png", 4, 5, units = 'in', res=300, pointsize = 12)
par(mar = rep(0.5, 4))
doplot(map, xlim_zoom, ylim_zoom, FALSE)
dev.off()


png("figures/labelled_map/alpha_unadj_proc_map_zoom.png", 8, height = 3, units = 'in', res=300, pointsize = 12)
png("figures/labelled_map/alpha_unadj_proc_map_zoom.png", 5, height = 3, units = 'in', res=300, pointsize = 12)
layout(matrix(c(1:2), ncol = 2, byrow = T))
par(mar = rep(0.5, 4))
doplot(map_alpha_unadj, xlim_zoom, ylim_zoom, FALSE)
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/labelled_map/roessler_map<20_labelled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions figures/landscapes/gmt_landscapes/all_all_gmt_landscapes.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 13 additions & 11 deletions figures/titer_lineplots/titerlineplots.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ data_long %>%

target_groups <- c('Wuhan vax. (single dose)','Beta vax. (single dose)','Wuhan vax. (two doses)', 'XBB.1.5 vax. (two doses)',
'Wuhan conv.', 'alpha conv.','beta conv.',
'gamma conv.', 'delta conv.', 'BA.1 conv.', 'BA.2.12.1 conv.', 'BA.4 conv.', 'BA.5 conv.',
# 'BQ.1.1 conv.', 'XBB conv.',
'XBB.1.5 conv.')
'gamma conv.', 'delta conv.', 'BA.1 conv.', 'BA.2.12.1 conv.', 'BA.4/5 conv.')

paste(target_groups, collapse = "', '")

target_ags <- c('Wuhan', 'Alpha', 'Delta', 'Beta', 'BA.1', 'BA.2', 'BA.5', 'XBB.1.5', 'BA.2.86', 'JN.1', "KP.3", "KP.2", "KZ.1.1.1")
Expand Down Expand Up @@ -80,7 +79,7 @@ titerplot20_a <- do_titer_plot_fc_label(map, 4, thresh = 20, fc_label = FALSE, a
theme(axis.text.x = element_text(angle = 90, vjust = 0.5))

targets_b_main <- target_sr_groups_b
titerplot20_b <- do_titer_plot_fc_label(map, 3, thresh = 20, fc_label = FALSE, adj_titers = FALSE,
titerplot20_b <- do_titer_plot_fc_label(map, 4, thresh = 20, fc_label = FALSE, adj_titers = FALSE,
sr_group_gmt_plotdata = sr_group_gmt %>%
filter(sr_group %in% targets_b_main),
fc_df = fc_df %>%
Expand All @@ -94,13 +93,15 @@ titerplot20_b <- do_titer_plot_fc_label(map, 3, thresh = 20, fc_label = FALSE, a
facet_levels = targets_b_main) +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5))

(plot_spacer() + titerplot20_b + plot_spacer() + plot_layout(widths = c(0.25, 3, 0.4))) / titerplot20_a + plot_layout(heights = c(3.5, 1)) + plot_annotation(tag_levels = 'A') -> titerplot20
# (plot_spacer() + titerplot20_b + plot_spacer() + plot_layout(widths = c(0.25, 3, 0.4))) / titerplot20_a + plot_layout(heights = c(3.5, 1)) + plot_annotation(tag_levels = 'A') -> titerplot20

titerplot20_b / titerplot20_a + plot_layout(heights = c(2.2, 1)) + plot_annotation(tag_levels = 'A') -> titerplot20

ggsave("figures/titer_lineplots/sr_group_titerlineplot_threshold20_map_unadj_noLabel.png", titerplot20, dpi = 300, width = 12, height = 10)
ggsave("figures/titer_lineplots/sr_group_titerlineplot_threshold20_map_unadj_noLabel.png", titerplot20, dpi = 300, width = 12, height = 8)


#--------------------------------------------- Load alpha adjusted data
map <- read.acmap("./data/maps/map_threshold20_all_ags_singleTP_woXBBBQ11conv_alphaJN1ba286_adjScan.ace")
map <- read.acmap("./data/maps/map_threshold20_all_ags_singleTP_woXBBBQ11conv_woXBB15conv_woJN1BA286_alpha_adj.ace")

data_long <- long_map_info(remove_na_coords(map)) %>%
mutate(titer = titer_adjusted,
Expand Down Expand Up @@ -130,7 +131,7 @@ sr_table_np[match(target_groups, sr_table_np$sr_group),] %>%
write.csv(sr_table_np, "data/titer_data/sr_table.csv", row.names = FALSE)


map <- read.acmap("./data/maps/map_threshold20_all_ags_singleTP_woXBBBQ11conv_alphaJN1ba286_adjScan.ace")
map <- read.acmap("./data/maps/map_threshold20_all_ags_singleTP_woXBBBQ11conv_woXBB15conv_woJN1BA286_alpha_adj.ace")

srGroups(map) <- gsub("BA.4 conv.|BA.5 conv.", 'BA.4/5 conv.', srGroups(map))

Expand Down Expand Up @@ -160,6 +161,7 @@ if(file.exists("data/titer_data/fc_from_homologous_threshold20.csv")){
}


ag_order <- ag_order[!grepl("JN.1|BA.2.86", ag_order)]

titerplot20_a <- do_titer_plot_fc_label(map, 4, thresh = 20, fc_label = FALSE, adj_titers = TRUE,
sr_group_gmt_plotdata = sr_group_gmt %>%
Expand All @@ -175,7 +177,7 @@ titerplot20_a <- do_titer_plot_fc_label(map, 4, thresh = 20, fc_label = FALSE, a
show_gmt = TRUE) +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5))

titerplot20_b <- do_titer_plot_fc_label(map, 3, thresh = 20, fc_label = FALSE, adj_titers = TRUE,
titerplot20_b <- do_titer_plot_fc_label(map, 4, thresh = 20, fc_label = FALSE, adj_titers = TRUE,
sr_group_gmt_plotdata = sr_group_gmt %>%
filter(sr_group %in% target_sr_groups_b),
fc_df = fc_df %>%
Expand All @@ -188,6 +190,6 @@ titerplot20_b <- do_titer_plot_fc_label(map, 3, thresh = 20, fc_label = FALSE, a
show_gmt_conf = TRUE)+
theme(axis.text.x = element_text(angle = 90, vjust = 0.5))

(plot_spacer() + titerplot20_b + plot_spacer() + plot_layout(widths = c(0.25, 3, 0.4))) / titerplot20_a + plot_layout(heights = c(3.5, 1)) + plot_annotation(tag_levels = 'A') -> titerplot20
titerplot20_b / titerplot20_a + plot_layout(heights = c(2.2, 1)) + plot_annotation(tag_levels = 'A') -> titerplot20

ggsave("figures/titer_lineplots/sr_group_titerlineplot_threshold20_map_noLabel.png", titerplot20, dpi = 300, width = 12, height = 10)
ggsave("figures/titer_lineplots/sr_group_titerlineplot_threshold20_map_noLabel.png", titerplot20, dpi = 300, width = 12, height = 8)
8 changes: 4 additions & 4 deletions functions/sams_landscape_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,11 @@ plot_landscapes_from_list <- function(data3js, titertables_groups, lndscp_fits,m

)
}
text_x <- c(c(agCoords(map)[agNames(map) %in% ag_labelled, 1] - agSize(map)[agNames(map) %in% ag_labelled]*0.05))
text_x[3] <- text_x[3] + 1.1
text_x[1] <- text_x[1] -0.4
text_x <- c(agCoords(map)[agNames(map) %in% ag_labelled, 1]) - 0.3
text_x[4:5] <- text_x[4:5] + 0.6
# text_x[1] <- text_x[1] -0.4
text_y <- c(c(agCoords(map)[agNames(map) %in% ag_labelled, 2]))

text_y[1:3] <- text_y[1:3]- 0.5
# set points and coordinates of highlighted ags


Expand Down
Binary file modified map_diagnostics/.DS_Store
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 0880343

Please sign in to comment.