Skip to content

Commit

Permalink
Merge pull request #13 from Aggarwal-Ayush/master
Browse files Browse the repository at this point in the history
Rectified Issue #11: specifying chromosome does not map aliases if gene is correct on another chromosome
  • Loading branch information
lwaldron authored Jan 20, 2021
2 parents 177b3c8 + c96df92 commit 2d42d2b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions R/checkGeneSymbols.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ checkGeneSymbols <- function(x,

approved <- x %in% map$Approved.Symbol

if (!is.null(chromosome)) {
approved.chr <- sapply(1:length(chromosome), function(i)
ifelse(chromosome[i] %in% unique(map[map$Approved.Symbol %in% x[i], chromosome]),
TRUE,
FALSE))
approved <- approved & approved.chr
}

if (identical(species, "human")) {
# change to uppercase, then change orfs back to lowercase
x.casecorrected <- toupper(x)
Expand Down
7 changes: 7 additions & 0 deletions tests/testthat/test_checkGeneSymbols.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ expect_equal(res[,3], c("GEMIN2", "SCAF11", "GEMIN2 /// SCAF11 /// ZEB2"))
expect_equal(res[,4], c(14, 12, 3))
expect_equal(res[,5], c("14", "12", "14 /// 12 /// 2"))

# approved symbol alias mapping on different chromosome
expect_warning(res <- checkGeneSymbols(c("TKT", "FFM","ABCA4", "TKT", "AAVS1"), chromosome = c(1, 1, 1, 3, 19)),
"x contains non-approved gene symbols")
expect_equal(res[,2], c(FALSE, FALSE, TRUE, TRUE, TRUE))
expect_equal(res[,3], c("DDR2", "ABCA4", "ABCA4", "TKT", "AAVS1"))
expect_equal(res[,4], c(1, 1, 1, 3, 19))
expect_equal(res[,5], c(1, 1, 1, 3, 19))


## mouse test 1
Expand Down

0 comments on commit 2d42d2b

Please sign in to comment.