Skip to content

Commit

Permalink
Fix Issue rqtl#146: revise predict_snpgeno() so it handles homozygous…
Browse files Browse the repository at this point in the history
… populations
  • Loading branch information
kbroman committed Dec 9, 2020
1 parent 5df1feb commit 5ff9f6a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: qtl2
Version: 0.23-11
Date: 2020-12-08
Version: 0.23-12
Date: 2020-12-09
Title: Quantitative Trait Locus Mapping in Experimental Crosses
Description: Provides a set of tools to perform quantitative
trait locus (QTL) analysis in experimental crosses. It is a
Expand Down
15 changes: 9 additions & 6 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## qtl2 0.23-11 (2020-12-08)
## qtl2 0.23-12 (2020-12-09)

### Major changes

Expand Down Expand Up @@ -40,19 +40,22 @@
`genoprob_to_alleleprob()` for general AIL crosses. We had not
implemented the `geno2allele_matrix()` function.

- Fix Issue #164, so `plot_pxg()` can handle a phenotype that is a
- Fixed Issue #164, so `plot_pxg()` can handle a phenotype that is a
single-column data frame.

- Fix Issue #135, so `plot_scan1()` can take vector input (which is
- Fixed 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
- Fixed Issue #157, to have `calc_genoprob()` give a better error
message about missing genetic map.

- Fix Issue #178, to have `read_cross2()` give a warning not an error
- Fixed Issue #178, to have `read_cross2()` give a warning not an error
if incorrect number of alleles.

- Fix Issue #180 re `scan1()` error if phenotypes' rownames have rownames.
- Fixed Issue #180 re `scan1()` error if phenotypes' rownames have rownames.

- Fixed Issue #146, revising `predict_snpgeno()` so that it works for
homozygous populations, like MAGIC lines or the Collaborative Cross.


## qtl2 0.22-11 (2020-07-09)
Expand Down
16 changes: 13 additions & 3 deletions R/predict_snpgeno.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,14 @@ function(cross, geno, cores=1)
geno <- geno[ind,]
}

phase_known <- is_phase_known(cross)

# guess phase
ph <- guess_phase(cross, geno, cores=cores)
if(!phase_known) {
ph <- guess_phase(cross, geno, cores=cores)
} else {
ph <- cross$geno
}

# subset cross chromosomes
cross <- cross[,names(ph)]
Expand All @@ -72,8 +78,12 @@ function(cross, geno, cores=1)
by_chr_func <- function(chr) {
# ensure the same markers
fg <- cross$founder_geno[[chr]]
ph1 <- ph[[chr]][,,1]
ph2 <- ph[[chr]][,,2]
if(phase_known) {
ph1 <- ph2 <- geno[[chr]]
} else {
ph1 <- ph[[chr]][,,1]
ph2 <- ph[[chr]][,,2]
}
if(ncol(fg) != ncol(ph1) ||
any(colnames(fg) != colnames(ph1))) {
mar <- get_common_ids(setNames(colnames(fg), NULL), setNames(colnames(ph1), NULL))
Expand Down

0 comments on commit 5ff9f6a

Please sign in to comment.