Skip to content

Commit

Permalink
Check for end_pos - start_pos < 1 in rec rates
Browse files Browse the repository at this point in the history
  • Loading branch information
eriqande committed Dec 19, 2023
1 parent 4384af0 commit cc5b664
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions R/check_rec_rates_formatting.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ check_rec_rates_formatting <- function(rr) {
slice(1) %>%
filter(start_pos != 1)

# finally, check to make sure that the end_pos is at least one greater than the start
# pos in each bin
bin_probs <- tmp %>%
filter(end_pos - start_pos < 1)



# Bark some informative errors if any of the above tibbles is not empty
if(nrow(cl_tib) > 0) {
stringy <- paste("\t- Chrom:", cl_tib$chrom, "\n")
err <- paste("* end_pos of right-most bin not 1 greater than chromosome length for chromosomes: \n",
Expand All @@ -42,6 +50,12 @@ check_rec_rates_formatting <- function(rr) {
msg <- paste(msg, err, sep = "")
Flag <- TRUE
}
if(nrow(bin_probs) > 0) {
stringy <- paste("\t- Chrom:", bin_probs$chrom, "start_pos:", bin_probs$start_pos, " end_pos:", bin_probs$end_pos, "\n")
err <- paste("* end_pos of these bins is not at least 1 greater than start_pos: \n", paste(stringy, collapse = ""))
msg <- paste(msg, err, sep = "")
Flag <- TRUE
}
if(nrow(one_starts) > 0) {
stringy <- paste("\t- Chrom:", one_starts$chrom, "\n")
err <- paste("* Left-most bin start position is not 1 for these chromosomes: \n", paste(stringy, collapse = ""))
Expand Down

0 comments on commit cc5b664

Please sign in to comment.