| scan1gen | R Documentation |
General genome scan with a single-QTL model, with possible allowance for covariates and a polygeneic effect, but taking a general function that calculates a LOD score at a single position.
scan1gen(
genoprobs,
pheno,
kinship = NULL,
addcovar = NULL,
Xcovar = NULL,
intcovar = NULL,
weights = NULL,
func,
vectorize_func = TRUE,
cores = 1,
...
)
genoprobs |
Genotype probabilities as calculated by
|
pheno |
A numeric matrix of phenotypes, individuals x phenotypes. |
kinship |
Optional kinship matrix, or a list of kinship matrices (one per chromosome), in order to use the LOCO (leave one chromosome out) method. |
addcovar |
An optional numeric matrix of additive covariates. |
Xcovar |
An optional numeric matrix with additional additive covariates used for null hypothesis when scanning the X chromosome. |
intcovar |
An numeric optional matrix of interactive covariates. |
weights |
An optional numeric vector of positive weights for the
individuals. As with the other inputs, it must have |
func |
Function to calculate log10 likelihood. It is called as
|
vectorize_func |
If TRUE (the default), assume that |
cores |
Number of CPU cores to use, for parallel calculations. |
... |
Additional arguments passed to |
An object of class "scan1": a matrix of LOD scores, positions x phenotypes.
scan1(), scan1perm(), scan1max()
# read data
iron <- read_cross2(system.file("extdata", "iron.zip", package="qtl2"))
# insert pseudomarkers into map
map <- insert_pseudomarkers(iron$gmap, step=1)
# calculate genotype probabilities
probs <- calc_genoprob(iron, map, error_prob=0.002)
# covariates for X chr under null
Xcovar <- get_x_covar(iron)
# create binary trait
bin_pheno <- setNames(as.numeric(iron$pheno[,1] > median(iron$pheno[,1])),
rownames(iron$pheno))
ll_glm <-
function(pr, pheno, addcovar=NULL, ...)
{
formula <- ifelse(is.null(pr), "pheno ~ 1", "pheno ~ pr")
if(!is.null(addcovar)) formula <- paste(formula, "+ addcovar")
glm_out <- glm(as.formula(formula), family=binomial(link=probit))
-glm_out$deviance/(2*log(10)) # log10 likelihood
}
# perform genome scan using glm() with probit link function
out <- scan1gen(probs, bin_pheno, Xcovar=Xcovar, func=ll_glm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.