kbroman / qtl

R/qtl: A QTL mapping environment
https://rqtl.org
GNU General Public License v3.0
77 stars 45 forks source link

Documentation for sim.cross with 4way seems incomplete #12

Closed timflutre closed 10 years ago

timflutre commented 10 years ago

Here is what I get with the code from CRAN:

> library(qtl)
> map <- sim.map(include.x=FALSE, sex.sp=TRUE)
> model <- rbind(c(1,45,1), c(5,20,-0.5))
> cross <- sim.cross(map, model, n.ind=100, type="4way")
Error in sim.cross.4way(map, model, n.ind, error.prob, missing.prob, partial.missing.prob,  :
  Model must be a matrix with 5 columns (chr, pos and effects).

Should there really be 5 columns, or should the "5" in the code be replaced by "3" to be consistent with the manual (obtained via ?sim.cross)?

kbroman commented 10 years ago

For a backcross, you could use

model <- rbind(c(1,45,1), c(5,20,-0.5))

But for an intercross, you'd need to provide both additive and dominance effects

model <- rbind(c(1,45,1,0), c(5,20,-0.5,0))

And for a 4-way cross, you need to provide 3 effects, since there are four possible genotypes

model <- rbind(c(1,45,1,1,1), c(5,20,-0.5,-0.5,-0.5))

Under "Details", it says:

"For a four-way cross, the effect of a QTL is a set of three numbers, (a,b,c), where, in the case of one QTL, the mean phenotype, conditional on the QTL genotyping being AC, BC, AD or BD, is a, b,c or 0, respectively."

karl

On May 14, 2014, at 8:47 AM, Timothée Flutre notifications@github.com wrote:

Here is what I get with the code from CRAN:

library(qtl) map <- sim.map(include.x=FALSE, sex.sp=TRUE) model <- rbind(c(1,45,1), c(5,20,-0.5)) cross <- sim.cross(map, model, n.ind=100, type="4way") Error in sim.cross.4way(map, model, n.ind, error.prob, missing.prob, partial.missing.prob, : Model must be a matrix with 5 columns (chr, pos and effects).

Should there really be 5 columns, or should the "5" in the code be replaced by "3" to be consistent with the manual (obtained via ?sim.cross)?

— Reply to this email directly or view it on GitHub.

timflutre commented 10 years ago

Thanks, sorry!