1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
| library(QTLseqr) library("ggplot2")
HighBulk <- "SRR834931" LowBulk <- "SRR834927" Chroms <- paste0(rep("Chr", 12), 1:12)
df <- importFromGATK(file = "../data/Yang_et_al_2013.table" , highBulk = HighBulk, lowBulk = LowBulk, chromList = Chroms )
p1 <- ggplot(data = df) + geom_histogram(aes(x = DP.HIGH + DP.LOW)) + xlim(0,800) pdf(file="SNP_depth.pdf") p1 dev.off()
p2 <- ggplot(data = df) + geom_histogram(aes(x = REF_FRQ)) pdf(file="ref_allele_frequency.pdf") p2 dev.off()
p3 <- ggplot(data = df) + geom_histogram(aes(x = SNPindex.HIGH)) pdf(file="SNPindex.HIGH.dis.pdf") p3 dev.off()
p4 <- ggplot(data = df) + geom_histogram(aes(x = SNPindex.LOW))
pdf(file="SNPindex.LOW.dis.pdf") p4 dev.off()
df_filt <- filterSNPs( SNPset = df, refAlleleFreq = 0.20, minTotalDepth = 100, maxTotalDepth = 400, minSampleDepth = 40, minGQ = 99, verbose = TRUE )
df_filt <- runQTLseqAnalysis(df_filt, windowSize = 1e6, popStruc = "F2", bulkSize = c(385, 430), replications = 10000, intervals = c(95, 99) )
p5 <- plotQTLStats(SNPset = df_filt, var = "nSNPs") pdf(file="SNP_filter.window.pdf", width = 20, height = 4) p5 dev.off()
p6 <- plotQTLStats(SNPset = df_filt, var = "deltaSNP", plotIntervals = TRUE) pdf(file="deltaSNPindex.pdf", width = 20, height = 4) p6 dev.off()
QTL <- getSigRegions(SNPset = df_filt, method = "QTLseq", interval = 95)
write.table(QTL[[1]], "QTLseq_result.SigRegions.table", sep="\t",quote=F)
results99 <- getQTLTable( SNPset = df_filt, method = "QTLseq", interval = 99, export = FALSE)
write.table(results99, file="QTLseq_result_deltaSNPindex_CI99.table" , sep="\t", quote = F)
|