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-4,P1-5,P2-1,P2-3,P2-4,P2-5,P3-1,P3-2,P3-3,P3-4,P3-5,P4-1,P4-2,P4-3,P4-4,P4-5
计算
library(qtl)
data <- read.cross("csvsr", ".", "gene_bin_r.csv", "phe_r.csv")
jit<-jittermap(data) #去除overlap标记,如无重叠则可跳过
calc <- calc.genoprob(jit, step=2) #用calc.genprob,step以2cM距离。
scan1<-scanone(calc,pheno.col=1) #使用scanone扫描,第一个表型
scan2<-scanone(calc,pheno.col=2) #使用scanone扫描,第二个表型
summary(scan1,threshold = 3) #查看qtl,筛选lod>3的标记
#输出
chr pos lod
contig4_14106258 2 35.5 3.21
contig2_8539402 4 67.7 3.32
contig17_6098339 17 49.1 14.94
sim <- sim.geno(calc, step=2, err=0.001)
qtl_filt<-summary(scan1,threshold = 3)
qtl1<-makeqtl(sim,qtl_filt$chr,qtl_filt$pos,row.names(qtl_filt)) #生成qtl
fit1<-fitqtl(sim,qtl=qtl1) #拟合qtl模型
summary(fit1) #查看qtl
#输出
fitqtl summary
Method: multiple imputation
Model: normal phenotype
Number of observations : 100
Full model result
----------------------------------
Model formula: y ~ Q1 + Q2 + Q3
df SS MS LOD %var Pvalue(Chi2) Pvalue(F)
Model 6 75.17876 12.5297927 19.97477 60.143 0 1.110223e-16
Error 93 49.82124 0.5357123
Total 99 125.00000
Drop one QTL at a time ANOVA table:
----------------------------------
df Type III SS LOD %var F value Pvalue(Chi2) Pvalue(F)
contig4_14106258 2 6.859 2.801 5.487 6.402 0.002 0.00248 **
contig2_8539402 2 3.810 1.600 3.048 3.556 0.025 0.03249 *
contig17_6098339 2 46.825 14.389 37.460 43.704 0.000 4.15e-14 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#%var即解释率
#多个性状qtl类似
#保存结果
write.csv(scan1,file='phe1_lod.csv')
write.csv(fit1[["result.full"]],file='phe1_qtl_full.csv')
write.csv(fit1[["result.drop"]],file='phe1_qtl_drop.csv')
#画图
pdf('phe1.pdf',w=8,h=6)
plot(scan1)
dev.off()
网友评论