Skip to content

Commit

Permalink
Ran github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
smped committed Apr 4, 2024
1 parent 4eec0e1 commit f2b03a0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: transmogR
Type: Package
Title: Modify a set of reference sequences using a set of variants
Version: 0.99.3
Version: 0.99.5
Authors@R: person("Stevie", "Pederson",
email = "stephen.pederson.au@gmail.com",
role = c("aut", "cre"),
Expand Down
5 changes: 5 additions & 0 deletions R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@
## Deal with NAs
alts <- mcols(var)[[alt_col]]
if (is(alts, "XStringSetList")) alts <- as.character(unlist(alts))
if (length(alts) != length(var))
stop("Some alternate alleles have been specified with multiple values")
is_na <- is.na(alts)
if (any(is_na)) message("NA values found in ", alt_col, ". Removing...")
var <- var[!is_na]
if (all(is_na) & length(is_na) > 0) stop("All NA values in ", alt_col)

if (any(nchar(alts) == 0))
stop("Please set Deletions so that width(REF) > 1 and width(ALT) > 0")

## Check Non-IUPAC alt alleles
iupac <- paste(names(IUPAC_CODE_MAP), collapse = "")
pat <- paste0("^[", iupac, "]+$")
Expand Down
4 changes: 3 additions & 1 deletion tests/testthat/test_helpers.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
test_that(".checkAlts behaves correctly", {
gr <- GenomicRanges::GRanges("chr1:1")
gr$ALT <- ""
expect_error(.checkAlts(gr, "ALT"), "Please set Deletions.+")
gr$ALT <- "x"
expect_error(.checkAlts(gr, "ALT"), "Non-IUPAC.+")

gr$ALT <- NA
Expand Down Expand Up @@ -31,7 +33,7 @@ test_that(".makeIntersectionArgs behaves correctly",{
types <- c(
mapping = "call", counts = "logical", bar_number_threshold = "numeric",
text_colors = "call", text = "call", text_mapping = "call", mode = "character",
position = "call", fill = "character"
position = "call", width = "numeric", fill = "character"
)
expect_equal(vapply(new, \(x) is(x)[[1]], character(1)), types)
expect_true(new$bar_number_threshold == 1)
Expand Down

0 comments on commit f2b03a0

Please sign in to comment.