Skip to content

Commit 896ba76

Browse files
authored
Merge pull request #188 from kbroman/master
Several small changes
2 parents 6db3a65 + 518bef1 commit 896ba76

28 files changed

Lines changed: 121 additions & 51 deletions

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: qtl2
2-
Version: 0.23-13
3-
Date: 2020-12-10
2+
Version: 0.23-14
3+
Date: 2020-12-15
44
Title: Quantitative Trait Locus Mapping in Experimental Crosses
55
Description: Provides a set of tools to perform quantitative
66
trait locus (QTL) analysis in experimental crosses. It is a

NEWS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
- `fit1()` now returns both fitted values and residuals.
1515

16+
- `fit1()` can be run with genotype probabilities omitted, in which
17+
case an intercept column of 1's is used (Issue #151).
18+
1619
- Updated mouse gene database with 2020-09-07 data from
1720
[MGI](http://www.informatics.jax.org/downloads/mgigff3/archive/monthly/).
1821

@@ -21,6 +24,10 @@
2124
- Make the [vdiffr](https://vdiffr.r-lib.org) package optional: only
2225
test the plots locally, and only if vdiffr is installed.
2326

27+
- `calc_sdp()` can now take a plain vector (Issue #142).
28+
29+
- Added a `lodcolumn` argument to `maxlod()` (Issue #137).
30+
2431
### Bug fixes
2532

2633
- Fixed [Issue #181](https://github.com/rqtl/qtl2/issues/181), where

R/calc_sdp.R

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@ calc_sdp <-
2323
function(geno)
2424
{
2525
# tolerate data frames, but convert to matrix
26-
if(!is.matrix(geno) && is.data.frame(geno))
27-
geno <- as.matrix(geno)
28-
if(!is.matrix(geno)) stop("geno should be a matrix")
26+
if(!is.matrix(geno)) {
27+
if(is.data.frame(geno)) {
28+
geno <- as.matrix(geno)
29+
} else {
30+
geno <- rbind(geno)
31+
dimnames(geno) <- NULL
32+
}
33+
}
2934

3035
n_str <- ncol(geno)
3136

R/fit1.R

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
#' Fit a single-QTL model at a single putative QTL position and get detailed results
44
#' about estimated coefficients and individuals contributions to the LOD score.
55
#'
6-
#' @param genoprobs A matrix of genotype probabilities, individuals x genotypes
6+
#' @param genoprobs A matrix of genotype probabilities, individuals x genotypes.
7+
#' If NULL, we create a single intercept column, matching the individual IDs in `pheno`.
78
#' @param pheno A numeric vector of phenotype values (just one phenotype, not a matrix of them)
89
#' @param kinship Optional kinship matrix.
910
#' @param addcovar An optional numeric matrix of additive covariates.
@@ -122,9 +123,14 @@ fit1 <-
122123
contrasts=NULL, model=c("normal", "binary"),
123124
zerosum=TRUE, se=TRUE, hsq=NULL, reml=TRUE, blup=FALSE, ...)
124125
{
125-
if(is.null(genoprobs)) stop("genoprobs is NULL")
126126
if(is.null(pheno)) stop("pheno is NULL")
127127

128+
if(missing(genoprobs) || is.null(genoprobs)) { # create matrix of 1's
129+
if(!is.matrix(pheno)) pheno <- cbind(pheno)
130+
genoprobs <- matrix(1, ncol=1, nrow=nrow(pheno))
131+
dimnames(genoprobs) <- list(rownames(pheno), "intercept")
132+
}
133+
128134
model <- match.arg(model)
129135

130136
if(blup) {

R/max_scan1.R

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ max.scan1 <-
163163
#' @param map A list of vectors of marker positions, as produced by
164164
#' [insert_pseudomarkers()].
165165
#' @param chr Optional vector of chromosomes to consider.
166+
#' @param lodcolumn An integer or character string indicating the LOD
167+
#' score column, either as a numeric index or column name.
168+
#' If `NULL`, return maximum for all columns.
166169
#'
167170
#' @export
168171
#' @return A single number: the maximum LOD score across all columns and positions for
@@ -193,7 +196,7 @@ max.scan1 <-
193196
#' # maximum on chromosome 2
194197
#' maxlod(out, map, "2")
195198
maxlod <-
196-
function(scan1_output, map=NULL, chr=NULL)
199+
function(scan1_output, map=NULL, chr=NULL, lodcolumn=NULL)
197200
{
198201
if(is.null(scan1_output)) stop("scan1_output is NULL")
199202

@@ -206,6 +209,10 @@ maxlod <-
206209
scan1_output <- subset(scan1_output, map=map, chr=chr)
207210
}
208211

212+
if(!is.null(lodcolumn)) {
213+
scan1_output <- subset(scan1_output, lodcolumn=lodcolumn)
214+
}
215+
209216
# to handle output of either scan1() or scan1coef()
210217
# for coef(), look at the sign
211218
if(inherits(scan1_output, "scan1coef")) {

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### [R/qtl2](https://kbroman.org/qtl2)
1+
### [R/qtl2](https://kbroman.org/qtl2/)
22

33
[![R build status](https://github.com/rqtl/qtl2/workflows/R-CMD-check/badge.svg)](https://github.com/rqtl/qtl2/actions)
44
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/qtl2)](https://cran.r-project.org/package=qtl2)

man/fit1.Rd

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/maxlod.Rd

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-basic_summaries.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ test_that("basic summaries give correct numbers for grav2 data", {
126126

127127
test_that("basic summaries give correct numbers for recla data", {
128128

129-
skip_if(isnt_karl(), "This test only run locally")
129+
skip_if(isnt_karl(), "this test only run locally")
130130

131131
file <- paste0("https://raw.githubusercontent.com/rqtl/",
132132
"qtl2data/master/DO_Recla/recla.zip")

tests/testthat/test-calc_het.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ test_that("calc_het works for an intercross", {
2828

2929
test_that("calc_het works with multi-core", {
3030

31-
skip_if(isnt_karl(), "This test only run locally")
31+
skip_if(isnt_karl(), "this test only run locally")
3232

3333
iron <- read_cross2(system.file("extdata", "iron.zip", package="qtl2"))
3434
pr <- calc_genoprob(iron, err=0.002)

0 commit comments

Comments
 (0)