library(devtools)
install_github("jtlovell/qtlTools")
library(qtlTools)library(qtlpvl)
library(data.table)data(multitrait)map<-pullMap(multitrait)
map$bp<-0
for(i in unique(map$chr)){
n<-sum(map$chr==i)
p<-sin((1:n/n)*pi)
map$bp[map$chr==i]<-cumsum(p*1000000)
}gff<-data.frame(chr = rep(paste0("scaffold_",1:5),each = 200),
feature = rep("gene",1000),
start = rep(seq(from = 0, to = max(map$bp), length = 200), 5),
end = rep(seq(from = 0, to = max(map$bp), length = 200))+1000,
strand = rep("+",1000),
attribute = paste0("gene",1:1000,";","gene",1:1000,".1"), stringsAsFactors=F)geneCM<-findGenecM(cross = multitrait, marker.info = map, gff = gff,
gffCols = c("chr","feature","start","end","strand","attribute"))## parsing attributes column of gff file
## culling chromosomes to those in the cross
## inferring mapping position for:
## chr 1 (n. features = 200)
## chr 2 (n. features = 200)
## chr 3 (n. features = 200)
## chr 4 (n. features = 200)
## chr 5 (n. features = 200)
par(mfrow=c(3,2))
for(i in unique(map$chr)){
with(geneCM[geneCM$chr==i,], plot(pos,bp, col="grey",
main = "cM and bp positions of genes and markers",
ylab = "physical position (bp)",
xlab = "mapping position (cM)"))
with(map[map$chr==i,], points(pos,bp, col=i, pch = 19, cex=.8))
}s1<-scanone(multitrait, method="hk", pheno.col=1)
perm<-scanone(multitrait, n.perm=100, method="hk",pheno.col=1, verbose=FALSE)
cis<-calcCis(cross = multitrait, s1.output=s1, perm.output=perm, drop=5)
par(mfrow = c(1,1))
plot(s1)
segmentsOnPeaks(multitrait, s1.output=s1, calcCisOutput = cis, int.y = 13.1)candGenes<-findGenesInterval(findGenecM.output = geneCM, calcCis.output = cis)
print(candGenes)## $`4@9`
## [1] "gene601" "gene602" "gene603" "gene604" "gene605" "gene606" "gene607"
## [8] "gene608" "gene609" "gene610" "gene611" "gene612" "gene613" "gene614"
## [15] "gene615" "gene616" "gene617" "gene618" "gene619" "gene620" "gene621"
## [22] "gene622" "gene623" "gene624" "gene625" "gene626" "gene627" "gene628"
##
## $`5@35`
## [1] "gene854" "gene855" "gene856" "gene857" "gene858" "gene859" "gene860"
## [8] "gene861" "gene862" "gene863" "gene864" "gene865" "gene866" "gene867"
## [15] "gene868" "gene869" "gene870" "gene871" "gene872" "gene873" "gene874"
## [22] "gene875" "gene876" "gene877" "gene878" "gene879" "gene880" "gene881"
## [29] "gene882" "gene883" "gene884" "gene885"