# #——风格,呼应= FALSE,结果=“隐藏”,消息= FALSE,警告= FALSE——BiocStyle:减价()选项(宽度= 100)knitr:: opts_chunk设置美元(缓存= TRUE, autodep = TRUE) # #——开始,缓存= TRUE,消息= FALSE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -库(motifbreakR) pca.snps。文件< -系统。文件(“extdata”、“pca.enhancer。单核苷酸多态性”,包= " motifbreakR”)主成分分析。snp < as.character (read.table (pca.snps.file)[1]) # #——轮廓,eval = FALSE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # #变异< - snps.from.rsid (rsid = pca。单核苷酸多态性,# # dbSNP = SNPlocs.Hsapiens.dbSNP142。GRCh37 # #搜索。基因组= # # motifbreakr BSgenome.Hsapiens.UCSC.hg19)。结果< - motifbreakR (snpList =变体,pwmList = MotifDb阈值= 0.9)# # plotMB(结果= motifbreakR。结果,rsid = " rs7837328 ",效果=“强大”)# #——whichsnps,消息= FALSE,缓存= TRUE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -库(BSgenome) available.SNPs () # #——showbed,消息= FALSE,缓存= TRUE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -单核苷酸多态性。文件< -系统。文件(“extdata”、“单核苷酸多态性。床”,包=“motifbreakR”) read.delim (snps.file,头= FALSE) # #——fromrsid,消息= FALSE,缓存= TRUE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -库(SNPlocs.Hsapiens.dbSNP142.GRCh37) # dbSNP142 hg19图书馆(BSgenome.Hsapiens.UCSC.hg19) # hg19基因组(pca.snps)单核苷酸多态性。mb < - snps.from.rsid (rsid = pca。单核苷酸多态性,dbSNP = SNPlocs.Hsapiens.dbSNP142。GRCh37,搜索。genome = BSgenome.Hsapiens.UCSC.hg19) snps.mb ## ----whichgenome, message=FALSE, cache=TRUE------------------------------ library(BSgenome) genomes <- available.genomes() length(genomes) genomes ## ----showbed2, message=TRUE, cache=TRUE---------------------------------- snps.bed.file <- system.file("extdata", "snps.bed", package = "motifbreakR") # see the contents read.table(snps.bed.file, header = FALSE) ## ----getbedrs, message=FALSE, echo = TRUE, eval = FALSE------------------ ## library(SNPlocs.Hsapiens.dbSNP142.GRCh37) ## #import the BED file ## snps.mb.frombed <- snps.from.file(file = snps.bed.file, ## dbSNP = SNPlocs.Hsapiens.dbSNP142.GRCh37, ## search.genome = BSgenome.Hsapiens.UCSC.hg19, ## format = "bed") ## snps.mb.frombed ## ----getbedrs.t, message=TRUE, echo = FALSE, eval = TRUE, cache=TRUE----- library(SNPlocs.Hsapiens.dbSNP142.GRCh37) example.snpfrombed <- system.file("extdata", "example.snpfrombed.rda", package = "motifbreakR") load(example.snpfrombed) message("Warning message: In snps.from.file(file = snps.bed.file, dbSNP = SNPlocs.Hsapiens.dbSNP142.GRCh37: 7601289 was found as a match for chr2:12594018:G:A; using entry from dbSNP") snps.mb.frombed ## ----getbedcust, message=FALSE, cache=TRUE------------------------------- library(BSgenome.Drerio.UCSC.danRer7) snps.bedfile.nors <- system.file("extdata", "danRer.bed", package = "motifbreakR") read.table(snps.bedfile.nors, header = FALSE) snps.mb.frombed <- snps.from.file(file = snps.bedfile.nors, search.genome = BSgenome.Drerio.UCSC.danRer7, format = "bed") snps.mb.frombed ## ----motifdb, message=FALSE, cache=TRUE---------------------------------- library(MotifDb) MotifDb ## ----motifdbtableshow, message=FALSE, cache=TRUE, eval=FALSE------------- ## ### Here we can see which organisms are availible under which sources ## ### in MotifDb ## table(mcols(MotifDb)$organism, mcols(MotifDb)$dataSource) ## ----motifdbtableres, message=FALSE, cache=TRUE, echo=FALSE-------------- knitr::kable(table(mcols(MotifDb)$organism, mcols(MotifDb)$dataSource), format = "html", table.attr="class=\"table table-striped table-hover\"") ## ----motifbreakrmot, message=FALSE, cache=TRUE--------------------------- data(motifbreakR_motif) motifbreakR_motif ## ----hocomocomot, message=FALSE, cache=TRUE------------------------------ data(hocomoco) hocomoco ## ----runmotifbreakr, message=TRUE, cache=TRUE---------------------------- results <- motifbreakR(snpList = snps.mb[1:5], filterp = TRUE, pwmList = hocomoco, threshold = 1e-4, method = "ic", bkg = c(A=0.25, C=0.25, G=0.25, T=0.25), BPPARAM = BiocParallel::bpparam()) ## ----getonesnp, cache=TRUE----------------------------------------------- rs1006140 <- results[names(results) %in% "rs1006140"] rs1006140 ## ----calcp.show, eval=FALSE---------------------------------------------- ## rs1006140 <- calculatePvalue(rs1006140) ## rs1006140 ## ----calcp, cache=TRUE, echo=FALSE--------------------------------------- example.p <- system.file("extdata", "example.pvalue.rda", package = "motifbreakR") load(example.p) rs1006140 ## ----aboutparallel, message=TRUE, cache=TRUE----------------------------- BiocParallel::registered() BiocParallel::bpparam() ## ----plotting, cache=TRUE, fig.retina=2, fig.align='center', fig.height=8, fig.width=6---- plotMB(results = results, rsid = "rs1006140", effect = "strong") ## ---- cache=TRUE--------------------------------------------------------- sessionInfo()