安装使用QTL seqr
QTL-seqr是一个R包。官方文件地址 qtl-seqr参数详解 安装流程 在R环境里
install.packages("devtools") #安装devtools
library(devtools)
install_github("bmansfeld/QTLseqr") #使用devtools安装QTLseqr
目前版本号:QTLseqr v0.7.5.2
#load the package
library("QTLseqr")
#Set sample and file names
LowBulk <- "119-8"
HighBulk <- "2447-20"
file <- "common.table"
#Choose which chromosomes will be included in the analysis (i.e. exclude smaller contigs)
Chroms <- paste0(rep("", 10), 1:10)#此处需要根据物种的染色体数量设定,同时括号中双引号,如果是chr1这种则应修改为rep("chr",10)。如果是1这种类型,则和我的设置一样。
#Import SNP data from file
df <-
importFromGATK(
file = file,
highBulk = HighBulk,
lowBulk = LowBulk,
chromList = Chroms
)
#Filter SNPs based on some criteria
#经过检测,这个REF设置为0.20结果比较理想,可以根据自上述的统计信息自行修改
df_filt <-
filterSNPs(
SNPset = df,
refAlleleFreq = 0.20,
minTotalDepth = 100,
maxTotalDepth = 400,
minSampleDepth = 40,
minGQ = 99
)
#使用ggplot2检测质控之前的读取深度的直方图,用以确定后续Depth的过滤参数
library("ggplot2")
ggplot(data=df)+geom_histogram(aes(x=DP.HIGH+DP.LOW),bins=50)+xlim(0,500)
#检测等位基因频率,应该是正态分布,决定后续过滤参数REF的值。
ggplot(data=df)+geom_histogram(aes(x=REF_FRQ),bins=50)
#检测每个样本的snp-index,我们期望的是正态分布,大部分应该在0.5附近,同时在0和1出现两个小峰
ggplot(data = df) + geom_histogram(aes(x = SNPindex.HIGH))
ggplot(data = df) + geom_histogram(aes(x = SNPindex.LOW))
#Run G' analysis
df_filt <- runGprimeAnalysis(
SNPset = df_filt,
windowSize = 1e6,
outlierFilter = "deltaSNP")
#Run QTLseq analysis
df_filt <- runQTLseqAnalysis(
SNPset = df_filt,
windowSize = 1e6,#如果程序报错,就增大窗口大小
popStruc = "F2",#群体结构F2或者RIL
bulkSize = c(30, 30),#每个池的单株数量
replications = 10000,
intervals = c(95, 99)
)
#Plot
plotQTLStats(SNPset = df_filt, var = "Gprime", plotThreshold = TRUE, q = 0.01)
plotQTLStats(SNPset = df_filt, var = "deltaSNP", plotIntervals = TRUE)
#export summary CSV
getQTLTable(SNPset = df_filt, alpha = 0.01, export = TRUE, fileName = "my_BSA_QTL.csv")