distToNearest could use more better error messages

Issue #55 resolved
Jason Vander Heiden created an issue

See comments for details. The error message states invalid characters, when that is not the problem.

Original problem:
Works fine on linux, but in Windows 7 with R 3.2.4:

> library(shazam)
Loading required package: alakazam
Loading required package: ggplot2
> db <- subset(InfluenzaDb, CPRIMER %in% c("IGHA","IGHM") & 
+              BARCODE %in% c("RL016","RL018","RL019","RL021"))
> 
> # Use genotyped V assignments, HS1F model, and normalize by junction length
> dist_hs1f <- distToNearest(db, vCallColumn="V_CALL_GENOTYPED", 
+                            model="hs1f", first=FALSE, normalize="length")
There were 50 or more warnings (use warnings() to see the first 50)
> warnings()
Warning messages:
1: In value[[3L]](cond) : Invalid character in sequence. Cannot compute distance.
2: In value[[3L]](cond) : Invalid character in sequence. Cannot compute distance.
3: In value[[3L]](cond) : Invalid character in sequence. Cannot compute distance.
4: In value[[3L]](cond) : Invalid character in sequence. Cannot compute distance.
5: In value[[3L]](cond) : Invalid character in sequence. Cannot compute distance.
6: In value[[3L]](cond) : Invalid character in sequence. Cannot compute distance.
7: In value[[3L]](cond) : Invalid character in sequence. Cannot compute distance.
8: In value[[3L]](cond) : Invalid character in sequence. Cannot compute distance.
9: In value[[3L]](cond) : Invalid character in sequence. Cannot compute distance.
...

The rcpp method doesn't work either, but I suspect it's not the C code, but rather the character issue:

> dist_ham <- distToNearest(db, model="ham", rcpp=T)

 Rerun with Debug
 Error: incompatible sizes (1 != 4) 
4 stop(structure(list(message = "incompatible sizes (1 != 4)", 
    call = NULL, cppstack = NULL), .Names = c("message", "call", 
"cppstack"), class = c("Rcpp::exception", "C++Error", "error", 
"condition"))) 
3 rbind_all(x, .id) 
2 dplyr::bind_rows(list_db) at DistToNearest.R#691
1 distToNearest(db, model = "ham", rcpp = T) 

Same issue reported on Mac OS X by a user.

Comments (8)

  1. Jason Vander Heiden reporter

    The error may not be character related at all, as that messages is just the error message of the tryCatch around getSeqDistance.

  2. Jason Vander Heiden reporter

    The error message from the tryCatch is misleading... This was an argument mismatch error, caused by a shazam/alakazam version mismatch (no rcpp option in the non-dev version of alakazam).

    We should find a better way to deal with errors.

  3. Log in to comment