From bf9a65ef112b628c2dccce3cebd3bc80f1090a49 Mon Sep 17 00:00:00 2001 From: saraloo <45245630+saraloo@users.noreply.github.com> Date: Wed, 15 Nov 2023 09:08:29 -0500 Subject: [PATCH] allow for any variant recode contres; --- preprocessing/seir_recode_omicron.R | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/preprocessing/seir_recode_omicron.R b/preprocessing/seir_recode_omicron.R index 421fa77c2..6230a9040 100644 --- a/preprocessing/seir_recode_omicron.R +++ b/preprocessing/seir_recode_omicron.R @@ -81,30 +81,35 @@ seir_dt <- continued_seir %>% mutate(date = lubridate::as_date(date)) %>% summarise(value = sum(value, na.rm = TRUE)) %>% dplyr::mutate(mc_name = paste(mc_infection_stage, mc_vaccination_stage, mc_variant_type, mc_age_strata, sep = "_")) %>% pivot_wider(names_from = geoid, values_from = value) + +# SAVE -------------------------------------------------------------------- + +# rewrite to new init file +new_init_file <- opt$init_filename + +arrow::write_parquet(seir_dt, new_init_file) + +cat(paste0("\nWriting modified init file to: \n -- ", new_init_file, "\n\n")) + # PULL SEED FILES ------------------------------------------------------------------- ## Read in SEED files from resume, and remove other variants -# seir file from continued run +# variants to keep +variant_comp <- config$compartments$variant_type + +# seed file from continued run continued_seed <- readr::read_csv(opt$in_seed_filename) # remove all but Omicron seed_dt <- continued_seed %>% mutate(date = lubridate::as_date(date)) %>% - filter(destination_variant_type == "OMICRON") %>% - mutate(source_variant_type = "OMICRON") + filter(destination_variant_type %in% variant_comp) %>% + mutate(source_variant_type = opt$recode_variant) # SAVE -------------------------------------------------------------------- -# rewrite to new init file -new_init_file <- opt$init_filename - -arrow::write_parquet(seir_dt, new_init_file) - -cat(paste0("\nWriting modified init file to: \n -- ", new_init_file, "\n\n")) - - # rewrite to SAME seed file rewrite_seed_filename <- opt$in_seed_filename