
The [TransFac](http://www.gene-regulation.com/pub/databases.html) database provides transcription factor targets, which are stored in `ko.list` in the `qtlyeast` package. We now examine how the targets of `r tf.orf` map on chr 2. Clearly, several of them co-map.

```{r}
plot(scan.orf, chr = 2)
for(target in ko.list[[tf.orf]]) {
  tmp <- scanone(yeast.orf, pheno.col = find.pheno(yeast.orf, target), method="hk")
  if(max(tmp)$lod > thr)
    plot(tmp, chr = 2, add = TRUE, col = "gray")
}
plot(scan.orf, chr = 2, add = TRUE)
abline(v = cand.pos, lwd = 3, col = "green")
abline(h = thr, lwd = 3, col = "red", lty = 2)
```

adj.ko.tests <- p.adjust.np(ko.tests)
p.joint <- adj.ko.tests$pvals.j.BIC[match(comap.tf, adj.ko.tests$phenos[,2]),]
p.call <- c("causal","react","indep","corr")[apply(p.joint, 1, which.min)]
p.joint <- apply(p.joint, 1, min)
names(p.joint) <- comap.tf
sort(p.joint[p.joint <= 0.1])

Now look at the scans for the few that have significant p-values.
```{r}
adj.ko.tests <- p.adjust.np(ko.tests)
p.joint <- adj.ko.tests$pvals.j.BIC[match(comap.tf, adj.ko.tests$phenos[,2]),]
p.call <- c("causal","react","indep","corr")[apply(p.joint, 1, which.min)]
p.joint <- apply(p.joint, 1, min)
names(p.joint) <- comap.tf
sort(p.joint[p.joint <= 0.1])
plot(scan.orf, chr = 2)
for(target in names(p.joint)[p.joint <= 0.1]) {
  tmp <- scanone(yeast.orf, pheno.col = find.pheno(yeast.orf, target), method="hk")
  if(max(tmp)$lod > lod.thr) {
    col <- ifelse(target %in% ko.list[[tf.orf]], "blue", "gray")
    plot(tmp, chr = 2, add = TRUE, col = col)    
  }
}
plot(scan.orf, chr = 2, add = TRUE)
abline(v = cand.pos, lwd = 3, col = "green")
abline(h = lod.thr, lwd = 3, col = "red", lty = 2)
```

```{r}
out <- CMSTtests(yeast.orf, tf.orf, comap.tf[match.orf], Q.chr = 2, Q.pos = cand.pos,
                 method="joint", penalty="bic")
target.pval <- apply(out$pvals.j.BIC, 1, min)
target.call <- c("causal","react","indep","corr")[apply(out$pvals.j.BIC, 1, which.min)]
table(target.pval <= 0.1, target.call)
names(target.pval) <- comap.tf
(targets <- target.pval[target.pval <= 0.1 & target.call == "causal"])
```
