# # # R代码从装饰图案来源的小插曲motifRG /本月/ doc / motifRG。Rnw“# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块1号:motifRG。Rnw: 66 - 70 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #库(motifRG) MD.motifs < - findMotifFasta(系统。文件(“extdata”、“MD.peak.fa”、包=“motifRG”),系统。文件(“extdata”、“MD.control。足总”,包= " motifRG”), max.motif = 3,丰富= T) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块2号:motifRG。Rnw: 74 - 75 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # motifLatexTable(主要= MyoD图案”MD.motifs前缀= MyoD”) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块3号:motifRG。Rnw: 80 - 86 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # (YY1.peak)数据(YY1.control)库(BSgenome.Hsapiens.UCSC.hg19) YY1.peak。seq < - getSequence (YY1。峰,基因组= YY1.control Hsapiens)。seq < - getSequence (YY1。控制,基因组= Hsapiens) YY1.motif。1 < - findMotifFgBg (YY1.peak。seq, YY1.control。seq,丰富= T) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块数量4:motifRG。Rnw: 91 - 92 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # motifLatexTable(主要=“YY1图案”,YY1.motif。= 1,前缀“YY1-1”) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块5号:motifRG。Rnw: 96 - 98 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # (letterFrequency (YY1.peak摘要。seq,“重心”,as.prob = T)总结(letterFrequency (YY1.control。seq,“重心”,as.prob = T) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #代码块6号:motifRG。Rnw:103-104 ################################################### summary(width(YY1.peak.seq)) ################################################### ### code chunk number 7: motifRG.Rnw:112-119 ################################################### YY1.narrow.seq <- subseq(YY1.peak.seq, pmax(round((width(YY1.peak.seq) - 200)/2), 1), width=pmin(200, width(YY1.peak.seq))) YY1.control.narrow.seq <- subseq(YY1.control.seq, pmax(round((width(YY1.control.seq) - 200)/2),1), width=pmin(200, width(YY1.control.seq))) category=c(rep(1, length(YY1.narrow.seq)), rep(0, length(YY1.control.narrow.seq))) ################################################### ### code chunk number 8: motifRG.Rnw:123-126 ################################################### all.seq <- append(YY1.narrow.seq, YY1.control.narrow.seq) gc <- as.integer(cut(letterFrequency(all.seq, "CG", as.prob=T), c(-1, 0.4, 0.45, 0.5, 0.55, 0.6, 2))) ################################################### ### code chunk number 9: motifRG.Rnw:130-131 ################################################### all.weights = c(YY1.peak$weight, rep(1, length(YY1.control.seq))) ################################################### ### code chunk number 10: motifRG.Rnw:135-137 ################################################### YY1.motif.2 <- findMotif(all.seq,category, other.data=gc, max.motif=5,enriched=T, weights=all.weights) ################################################### ### code chunk number 11: motifRG.Rnw:140-141 ################################################### motifLatexTable(main="Refined YY1 motifs", YY1.motif.2,prefix="YY1-2") ################################################### ### code chunk number 12: motifRG.Rnw:145-145 ################################################### ################################################### ### code chunk number 13: motifRG.Rnw:157-161 ################################################### data(ctcf.motifs) ctcf.seq <- readDNAStringSet(system.file("extdata", "ctcf.fa",package="motifRG")) pwm.match <- refinePWMMotif(ctcf.motifs$motifs[[1]]@match$pattern, ctcf.seq) library(seqLogo) ################################################### ### code chunk number 14: motifRG.Rnw:166-167 ################################################### seqLogo(pwm.match$model$prob) ################################################### ### code chunk number 15: motifRG.Rnw:174-176 ################################################### pwm.match.extend <- refinePWMMotifExtend(ctcf.motifs$motifs[[1]]@match$pattern, ctcf.seq) ################################################### ### code chunk number 16: motifRG.Rnw:181-182 ################################################### seqLogo(pwm.match.extend$model$prob) ################################################### ### code chunk number 17: motifRG.Rnw:189-190 ################################################### plotMotif(pwm.match.extend$match$pattern)