Skip to content

Commit

Permalink
Hopefully fix non-ensembl organisms issue. Plus better marker file er…
Browse files Browse the repository at this point in the history
…ror messages
  • Loading branch information
hpliner committed Feb 11, 2019
1 parent 0aaff34 commit f2e1024
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: garnett
Type: Package
Title: Automated cell type classification
Version: 0.1.1
Version: 0.1.2
Author: c(
person("Hannah", "Pliner", email = "[email protected]", role = c("aut", "cre")),
person("Cole", "Trapnell", email = "[email protected]", role = c("aut")))
Expand Down
6 changes: 3 additions & 3 deletions R/parser.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Lexer <- R6::R6Class(
t_ignore = " \t",
t_NEWLINE = "\n",
t_error = function(t) {
cat(sprintf("Illegal character '%s'\n", t$value[1]))
cat(sprintf("Marker file error. Illegal character '%s'\n", t$value[1]))
t$lexer$skip(1)
return(t)
}
Expand Down Expand Up @@ -339,8 +339,8 @@ Parser <- R6::R6Class(
p$set(1, l)
},
p_error = function(p) {
if(is.null(p)) stop("Syntax error at EOF")
else stop(sprintf("Syntax error '%s' at or near line number %s\n",
if(is.null(p)) stop("Marker file error. Syntax error at EOF")
else stop(sprintf("Marker file error. Syntax error '%s' at or near line number %s\n",
p$value, self[["linenum"]]))
}
)
Expand Down
4 changes: 2 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ check_markers <- function(cds,
# Check gene names and keywords
gene_table <- check_marker_conversion(parse_list,
as.character(row.names(fData(cds))),
"ENSEMBL",
classifier_gene_id_type,
marker_file_gene_id_type,
db)
gene_table$nominates <- NA
Expand All @@ -346,7 +346,7 @@ check_markers <- function(cds,
root <- propogate_func(curr_node = "root", parse_list, classifier)
gene_table <- check_marker_conversion(parse_list,
as.character(row.names(fData(cds))),
"ENSEMBL",
classifier_gene_id_type,
marker_file_gene_id_type,
db)
gene_table$nominates <- NA
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-parser.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test_that("basic parsing works", {

test_that("error messages work", {
expect_error(garnett:::parse_input("hannah"),
"Syntax error 'hannah' at or near line number 1")
"Marker file error. Syntax error 'hannah' at or near line number 1")
expect_error(garnett:::parse_input(">hannah\nexpressed below: cole\n"),
paste("Syntax error in marker file at or near line 3: expressed",
"below needs one value"))
Expand All @@ -40,6 +40,6 @@ test_that("error messages work", {
"near line 20."))
expect_error(garnett:::parse_input(paste(">hannah\nexpressed between: cole 3",
"6\n han")),
"Syntax error at EOF")
"Marker file error. Syntax error at EOF")
})

0 comments on commit f2e1024

Please sign in to comment.