Skip to content

Commit

Permalink
Reverted progress bar change
Browse files Browse the repository at this point in the history
  • Loading branch information
Shians committed Aug 23, 2024
1 parent 19932d5 commit 2d454d8
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions R/modbam_to_tabix.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,6 @@ modbam_to_tabix <- function(x, out_file, mod_code = NanoMethViz::mod_code(x)) {
invisible(out)
}

create_modbam_progress_bar <- function(i, n_files, fname, total) {
cli::cli_progress_bar(
glue::glue("Converting file {i}/{n_files}: {fname}"),
total = total,
format_done = paste0("{.alert-success Data converted: ", fname, " {.timestamp {cli::pb_elapsed}}}"),
format_failed = paste0("{.alert-danger Data conversion failed: ", fname, " {.timestamp {cli::pb_elapsed}}}"),
clear = FALSE
)
}

run_modbam_to_tsv_converter <- function(x, out_file, mod_code) {
# if .gz at end of output name then trim it so final output
# doesn't end with .bgz.bgz
Expand All @@ -81,7 +71,13 @@ run_modbam_to_tsv_converter <- function(x, out_file, mod_code) {
total <- get_bam_total_reads(path)
fname <- fs::path_file(path)

prog_bar_id <- create_modbam_progress_bar(i, n_files, fname, total)
prog_bar_id <- cli::cli_progress_bar(
glue::glue("Converting file {i}/{n_files}: {fname}"),
total = total,
format_done = paste0("{.alert-success Data converted: ", fname, " {.timestamp {cli::pb_elapsed}}}"),
format_failed = paste0("{.alert-danger Data conversion failed: ", fname, " {.timestamp {cli::pb_elapsed}}}"),
clear = FALSE
)
modbam_file_to_tsv(path, out_file, sample, mod_code, prog_bar_id)
}

Expand Down

0 comments on commit 2d454d8

Please sign in to comment.