kbroman / qtl

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

stepwiseqtl can't handle missing phenotypes + covariates #74

Closed kbroman closed 5 years ago

kbroman commented 5 years ago

If there are missing phenotypes, stepwiseqtl() seems to subset the phenotypes but not the covariates so you get an error like this:

Error in checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata,  :                     
   Number of rows in additive covariates is incorrect 
kbroman commented 5 years ago

I'm having trouble reproducing this problem.

kbroman commented 5 years ago

Okay now I've got it, for the case of an intercross, and doesn't seem to need covariates to be a problem.

data(fake.f2)                                                                                                         
fake.f2 <- calc.genoprob(fake.f2)                                                                                     
fake.f2$pheno[5,1] <- NA                                                                                              

# this gives an error:                                                                                                
out1 <- stepwiseqtl(fake.f2, method="hk", max.qtl=4, additive.only=TRUE)                                              

# this works:                                                                                                         
qtl <- makeqtl(fake.f2, chr=c(1,4), pos=c(67.8, 29.5), what="prob")                                                   
out2 <- stepwiseqtl(fake.f2, qtl=qtl, method="hk", max.qtl=4, additive.only=TRUE)        
kbroman commented 5 years ago

Okay I see the problem. If there are X-chromosome-specific covariates, need to subset those.