Skip to content

Commit

Permalink
Fix Issue rqtl#157, to have calc_genoprob give better error re missin…
Browse files Browse the repository at this point in the history
…g genetic map
  • Loading branch information
kbroman committed Dec 8, 2020
1 parent d370aa0 commit d740b83
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
- Fix Issue #135, so `plot_scan1()` can take vector input (which is
then converted to a single-column matrix).

- Fix Issue #157, to have `calc_genoprob()` give a better error
message about missing genetic map.


## qtl2 0.22-11 (2020-07-09)

Expand Down
7 changes: 5 additions & 2 deletions R/calc_genoprob.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ function(cross, map=NULL, error_prob=1e-4,
if(!is_nonneg_number(error_prob)) stop("error_prob should be a single non-negative number")
map_function <- match.arg(map_function)

if(!lowmem) # use other version
if(!lowmem) { # use other version
return(calc_genoprob2(cross=cross, map=map,
error_prob=error_prob, map_function=map_function,
quiet=quiet, cores=cores))
}

# set up cluster; set quiet=TRUE if multi-core
cores <- setup_cluster(cores, quiet)
Expand All @@ -87,8 +88,10 @@ function(cross, map=NULL, error_prob=1e-4,
}

# pseudomarker map
if(is.null(map))
if(is.null(map)) {
if(is.null(cross$gmap)) stop("If cross does not contain a genetic map, map must be provided.")
map <- insert_pseudomarkers(cross$gmap)
}
# possibly subset the map
if(length(map) != length(cross$geno) || !all(names(map) == names(cross$geno))) {
chr <- names(cross$geno)
Expand Down
4 changes: 3 additions & 1 deletion R/calc_genoprob2.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ function(cross, map=NULL, error_prob=1e-4,
}

# pseudomarker map
if(is.null(map))
if(is.null(map)) {
if(is.null(cross$gmap)) stop("If cross does not contain a genetic map, map must be provided.")
map <- insert_pseudomarkers(cross$gmap)
}
# possibly subset the map
if(length(map) != length(cross$geno) || !all(names(map) == names(cross$geno))) {
chr <- names(cross$geno)
Expand Down

0 comments on commit d740b83

Please sign in to comment.