Skip to content

Commit 6c10baa

Browse files
committed
Fix bug in phyloqtl_scan showing up in R-devel
1 parent fc23dd2 commit 6c10baa

3 files changed

Lines changed: 16 additions & 5 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: qtl
2-
Version: 1.47-6
2+
Version: 1.47-7
33
Date: 2020-12-03
44
Title: Tools for Analyzing QTL Experiments
55
Author: Karl W Broman <broman@wisc.edu> and Hao Wu, with

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ copyright (c) 2001-2020, Karl W Broman
3838

3939
### Bug fixes
4040

41+
- Fix a problem in `inferredpartitions()` that occurs in the devel
42+
version of R.
43+
4144
- Small change to `read.cross()` to avoid warning about length of
4245
`alleles` argument for `crosstype="4way"`. (Fixes Issue #90.)
4346

R/phyloqtl_scan.R

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
######################################################################
22
# phyloqtl_scan.R
33
#
4-
# copyright (c) 2009-2019, Karl W Broman
5-
# last modified Dec, 2019
4+
# copyright (c) 2009-2020, Karl W Broman
5+
# last modified Dec, 2020
66
# first written May, 2009
77
#
88
# This program is free software; you can redistribute it and/or
@@ -327,16 +327,24 @@ inferredpartitions <-
327327
lodthreshold=0
328328
}
329329

330+
if(probthreshold >= 1 || probthreshold <= 0) {
331+
stop("probthreshold should be in (0,1)")
332+
}
333+
330334
output <- output[output[,1]==chr,]
331335
output[,1] <- as.factor(as.character(output[,1]))
332336
output <- summary(output, format="postprob")
333337

334338
if(output$maxlod < lodthreshold) return("null")
335339

336-
prob <- sort(output[,3:(ncol(output)-2)], decreasing=TRUE)
340+
prob <- sort(unlist(output[,3:(ncol(output)-2)]), decreasing=TRUE)
337341
cs <- cumsum(as.numeric(prob))
342+
if(!any(cs >= probthreshold)) {
343+
warning("No values >= probthreshold")
344+
return(NULL)
345+
}
338346
wh <- min(which(cs >= probthreshold))
339-
names(prob)[1:wh]
347+
names(prob)[seq_len(wh)]
340348
}
341349

342350
# end of phyloqtl_scan.R

0 commit comments

Comments
 (0)