# NOT RUN {
## This reproduces Figure 1 exactly.
set.seed(3456789)
tmp <- options(warn=-1)
acyclic.DG <- randomDAG(n = 100, prob = 2 / 99)
options(tmp)
## Simulate cross object using R/qtl routines.
n.ind <- 300
mymap <- sim.map(len=rep(100,20), n.mar=10, eq.spacing=FALSE, include.x=FALSE)
mycross <- sim.cross(map=mymap, n.ind=n.ind, type="f2")
summary(mycross)
mycross <- sim.geno(mycross,n.draws=1)
## Produce 100 QTL at three markers apiece.
acyclic.qtl <- generate.qtl.markers(cross=mycross,n.phe=100)
## Generate data from directed graph.
bp <- runif(100,0.5,1)
stdev <- runif(100,0.1,0.5)
bq <- matrix(0,100,3)
bq[,1] <- runif(100,0.2,0.4)
bq[,2] <- bq[,1]+0.1
bq[,3] <- bq[,2]+0.1
## Generate phenotypes.
acyclic.data <- generate.qtl.pheno("acyclic", cross = mycross,
bp = bp, bq = bq, stdev = stdev, allqtl = acyclic.qtl$allqtl)
acyclic.qdg <- qdg(cross=acyclic.data,
phenotype.names=paste("y",1:100,sep=""),
marker.names=acyclic.qtl$markers,
QTL=acyclic.qtl$allqtl,
alpha=0.005,
n.qdg.random.starts=1,
skel.method="pcskel")
save(acyclic.DG, acyclic.qtl, acyclic.data, acyclic.qdg,
file = "acyclic.RData", compress = TRUE)
data(acyclic)
dims <- dim(acyclic.data$pheno)
SuffStat <- list(C = cor(acyclic.data$pheno), n = dims[1])
pc <- skeleton(SuffStat, gaussCItest, p = dims[2], alpha = 0.005)
summary(pc)
summary(graph.qdg(acyclic.qdg))
gr <- graph.qdg(acyclic.qdg, include.qtl = FALSE)
plot(gr)
# }
Run the code above in your browser using DataLab