library(SHLR)
####reading in pedigree data
fam <- read.table(system.file("extdata","plink.fam",package="SHLR"),
header=FALSE, stringsAsFactors=FALSE)
colnames(fam) <- c("fam_id","id","dad_id","mom_id","sex","qtrait")
####add simulated covariates to create phenotype table
N <- dim(fam)[1]
cov1 <- rnorm(N, 0, 2)
cov2 <- rbinom(N, 1, 0.7)
phen <- data.frame(fam, cov1=cov1, cov2=cov2)
##Read phased haplotype
shapeit <- read.shapeit.haps(system.file("extdata","phased.haps",package="SHLR"))
haps <- shapeit$haps
marker.map <- shapeit$marker.map
##Initialize parameters for SHLR.scan
outfile <- "out.txt"
outcome <- "qtrait"
cov <- c("sex","cov1","cov2")
famid <- "fam_id"
iid <- "id"
pid <- "dad_id"
mid <- "mom_id"
gender <- "sex"
missid <- "0"
corstr <- "kinship"
out_dist <- "gaussian"
std.err <- "naive"
method <- "SHLR-fam"
window.size <- 35
pca.thres <- 0.8
nSplits <- 1
run.SHLR.scan(haps, phen, marker.map, outfile,
outcome, out.dist=out_dist, cov=cov, missing.id.code=missid,
method=method, nSplits=nSplits, pca.thres=pca.thres, hap.freq.thres=0.001,
window.size=window.size, threads=2, corstr=corstr,
std.err=std.err, gender=gender, fid=famid, iid=iid, pid=pid, mid=mid)
Run the code above in your browser using DataLab