參考:Users Guide for New BCsFt Tools for R/qtl
R/qtl: A QTL mapping environment
R/qtl包學(xué)習(xí)(一)
使用R/qtl進行QTL分析
R/qtl包的QTL學(xué)習(xí)
以及師兄給我的數(shù)據(jù)代碼~
一、介紹
QTL圖譜研究方法:回交(backcross)、同胞交配(sib-mating)趴久、自交(selfing)旅择、重組自交系(RI lines)以及種群中隨機交配(generations of random
mating within mapping populations)
QTL比對問題可分為兩個部分:缺失數(shù)據(jù)的處理和模型選擇
1)缺失數(shù)據(jù)處理:重組模型
這其中最簡單的是no crossover interference:recombination events in disjoint intervals are independent. 這樣,染色體上就形成了一個馬爾可夫鏈。也就是判斷基因型的時候,只需要看它兩側(cè)的marker就可以,不需要考慮其他marker撵颊。
2)模型選擇:
常見positive crossover interference,不傾向在相鄰位置發(fā)生重組驼鞭,通過使用HMM模型
二秦驯、流程
install.packegs("qtl")
library(qtl)
setwd("./xxx/xxx")
- 導(dǎo)入數(shù)據(jù)
函數(shù):read.cross
用法:
read.cross(format=c("csv", "csvr", "csvs", "csvsr", "mm", "qtx",
"qtlcart", "gary", "karl", "mapqtl", "tidy"),
dir="", file, genfile, mapfile, phefile, chridfile,
mnamesfile, pnamesfile, na.strings=c("-","NA"),
genotypes=c("A","H","B","D","C"), alleles=c("A","B"),
estimate.map=FALSE, convertXdata=TRUE, error.prob=0.0001,
map.function=c("haldane", "kosambi", "c-f", "morgan"),
BC.gen=0, F.gen=0, crosstype, ...)
基因型文件:
表型文件:
示例:
a <- read.cross("csvs", ".", "gen.csv", "phe.csv", genotypes=c("A","H","B"),crosstype="riself")
##查看輸入文件相關(guān)信息
summary(a)
- 統(tǒng)計對應(yīng)信息函數(shù)
## 樣本數(shù)
nind(a)
## 染色體數(shù)
nchr(a)
## 標記數(shù)
totmar(a)
## 每個染色體上的標記數(shù)
nmar(a)
## 表型數(shù)
nphe(a)
##用圖來展示信息
plot(a)
##展示缺失基因型數(shù)據(jù)(黑色為缺失的基因型)
plotMissing(a)
## 繪制遺傳圖譜
plotMap(a)
## 繪制表型分布直方圖
plotPheno(a, pheno.col=1)
- jittermap()
Jitter the marker positions in a genetic map so that no two markers are on top of each other.
jit.a<-jittermap(a)
- calc.genoprob()
Uses the hidden Markov model technology to calculate the probabilities of the true underlying genotypes given the observed multipoint marker data, with possible allowance for genotyping errors.
利用隱馬爾可夫模型技術(shù),在觀察到的多點標記數(shù)據(jù)的情況下挣棕,計算真正的基本基因型的概率译隘,并可能考慮到基因分型誤差。
calc.a<-calc.genoprob(jit.a)
- sim.geno()
Uses the hidden Markov model technology to simulate from the joint distribution Pr(g | O) where g is the underlying genotype vector and O is the observed multipoint marker data, with possible allowance for genotyping errors.
sim.a<-sim.geno(jit.a)
- cim()
Composite interval mapping by a scheme from QTL Cartographer: forward selection at the markers (here, with filled-in genotype data) to a fixed number, followed by interval mapping with the selected markers as covariates, dropping marker covariates if they are within some fixed window size of the location under test.
lod_result<-cim(sim.a,pheno.col="phe",method="imp",window=1)
per<-cim(sim.a,n.perm=1000,pheno.col="phe",method="imp",window=1)
n.perm
:置換檢驗中置換組數(shù)
- 畫圖
pdf(file="./xxx.chr1.pdf",width=14)
par(mfrow=c(2,1))
plot(lod_result, bandcol="gray70", cex=0.3, pch=21, bg="slateblue",main="xxx",chr='1')
##adds one or more straight lines through the current plot.
abline(h=threshold[2+1],col="lightgray")
scan<-effectscan(sim.a,draw=TRUE,pheno.col="phe",chr='1')
dev.off()
##后面就修改一下chr參數(shù)將所有染色體的圖繪制出來
##繪制總的
pdf(file="./xxx.chr1.pdf",width=14)
par(mfrow=c(2,1))
plot(lod_result, bandcol="gray70", cex=0.3, pch=21, bg="slateblue",main="xxx",chr='1')
##adds one or more straight lines through the current plot.
abline(h=threshold[2+1],col="lightgray")
scan<-effectscan(sim.a,draw=TRUE,pheno.col="phe")
dev.off()
- lodint()
Calculate a LOD support interval for a particular chromosome, using output from scanone.
計算特定染色質(zhì)的LOD區(qū)間
Tips:我們常說的LOD值=log10 (L1/L0) 洛心,L1指該位點含QTL的概率固耘,L0指該位點不含QTL的概率。LOD值為3表示該位點含QLT的概率是不含QTL概率的1000倍词身。