-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'december-2024' into sequence-extracts-tests-writing
- Loading branch information
Showing
21 changed files
with
173 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#' Write a temp data to disk in parquet format for debugging purpose | ||
#' | ||
#' @description Write a temp data in parquet format to disk for debugging purpose. | ||
#' @param data The data to be written | ||
#' @param year year variable | ||
#' @param file_name The file name to be written | ||
#' @param write_temp_to_disk Boolean type, write temp data to disk or not | ||
#' | ||
#' @return the data for next step as a [tibble][tibble::tibble-package]. | ||
#' @export | ||
write_temp_data <- | ||
function(data, year, file_name, write_temp_to_disk) { | ||
if (write_temp_to_disk) { | ||
full_file_name <- stringr::str_glue("{file_name}.parquet") | ||
file_path <- file.path( | ||
get_year_dir(year), | ||
full_file_name | ||
) | ||
|
||
cli::cli_alert_info(stringr::str_glue("Writing {full_file_name} to disk started at {Sys.time()}")) | ||
|
||
write_file(data, | ||
path = file_path | ||
) | ||
} | ||
return(data) | ||
} | ||
|
||
|
||
#' Read a temp data from disk for debugging purpose | ||
#' | ||
#' @description Read a temp data to disk for debugging purpose. | ||
#' @param year year variable | ||
#' @param file_name The file name to be read | ||
#' | ||
#' @return the data for next step as a [tibble][tibble::tibble-package]. | ||
#' @export | ||
read_temp_data <- function(year, file_name) { | ||
full_file_name <- stringr::str_glue("{file_name}.parquet") | ||
file_path <- file.path( | ||
get_year_dir(year), | ||
full_file_name | ||
) | ||
|
||
return(read_file(file_path)) | ||
} | ||
|
||
#' Clean temp data from disk | ||
#' | ||
#' @description Clean temp data from disk to save storage. | ||
#' @param year year variable | ||
#' @param file_type ep or ind files | ||
#' | ||
#' @return the data for next step as a [tibble][tibble::tibble-package]. | ||
#' @export | ||
clean_temp_data <- function(year, file_type = c("ep", "ind")) { | ||
list.files( | ||
path = get_year_dir(year), | ||
pattern = stringr::str_glue("^{file_type}_temp") | ||
) %>% | ||
file.remove() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.