# #——回声= FALSE,结果=“隐藏”,警告= FALSE ------------------------------- suppressPackageStartupMessages({库(trackViewer)图书馆(TxDb.Hsapiens.UCSC.hg19.knownGene)图书馆(InteractionSet)}) knitr:: opts_chunk设置美元(警告= FALSE,消息= FALSE) # #——plotback2back ------------------------------------------------------------ 图书馆(trackViewer)图书馆(InteractionSet)胃肠道< - readRDS(系统。文件(“extdata”、“nij.chr6.51120000.53200000.gi。rds", package="trackViewer")) head(gi) ## hicexplorer:hicConvertFormat工具可用于将其他格式转换为GInteractions ##例如:hicConvertFormat -m mESC_rep。hic——inputFormat hic——outputFormat cool -o mESC_rep. hicmcool ## hicConvertFormat -m mESC_rep。mcool::resolutions/10000——inputFormat cool——outputFormat ginteractions -o mESC_rep. mool::resolutions/10000g交互—分辨率10000 ##请注意元数据:分数用于绘图。range <- GRanges("chr6", IRanges(51120000, 53200000)) tr <- gi2track(gi) ctcf <- readRDS(system. GRanges("chr6", IRanges(51120000, 53200000))文件(“extdata”、“ctcf.sample。rds", package="trackViewer")) #viewTracks(trackList(ctcf, tr, heightDist = c(1,3)), # gr=range, autoOptimizeStyle = TRUE) ##查看背对背的交互数据。请确保数据是标准化的。gi2 <- gi set.seed(123) gi2$score <- gi$score + rnorm(length(gi), sd = sd(gi$score)) back2back <- gi2track(gi, gi2) ##更改颜色setTrackStyleParam(back2back, "breaks", c(seq(from=0, to=50, by=10), 200)) setTrackStyleParam(back2back, "color", c("浅蓝色","黄色","红色"))##更改y轴的lim(默认,[0,1])setTrackStyleParam(back2back, "ylim", c(0, .5)) viewTracks(trackList(ctcf, back2back, heightDist=c(1,5)), gr=range, autoOptimizeStyle = TRUE) ## ----plotLinks,图.width=6,图.height=3------------------------------------- setTrackStyleParam(tr, "tracktype", "link") setTrackStyleParam(tr, "breaks", c(seq(from=0, to=50, by=10), 200)) setTrackStyleParam(tr, "color", c("浅蓝色","yellow", "red")) ## filter the links to simulation real data keep <- distance(tr$dat, tr$dat2) > 5e5 & tr$dat$score>20 tr$dat <- tr$dat[keep] tr$dat2 <- tr$dat2[keep] viewTracks(trackList(tr), gr=range,# #——inportHic autoOptimizeStyle = TRUE) ---------------------------------------------------------------- 嗝< -系统。文件(“extdata”、“test_chr22。hic", package = "trackViewer", mustWork=TRUE) if(.Platform$OS.type!="windows"){ importGInteractions(file=hic, format="hic", ranges=GRanges("22", IRanges(50000000, 100000000)), out = "GInteractions") } ## ----importCool, eval=FALSE--------------------------------------------------- # cool <- system.file("extdata", "test.mcool", package = "trackViewer", # mustWork=TRUE) # importGInteractions(file=cool, format="cool", # resolution = 2, # ranges=GRanges("chr1", IRanges(10, 28)), # out = "GInteractions") ## ----plotGInteractions-------------------------------------------------------- library(TxDb.Hsapiens.UCSC.hg19.knownGene) library(InteractionSet) gi <- readRDS(system.file("extdata", "gi.rds", package="trackViewer")) range <- GRanges("chr2", IRanges(234500000, 235000000)) feature.gr <- suppressMessages(genes(TxDb.Hsapiens.UCSC.hg19.knownGene)) feature.gr <- subsetByOverlaps(feature.gr, regions(gi)) feature.gr$col <- sample(1:7, length(feature.gr), replace=TRUE) feature.gr$type <- sample(c("promoter", "enhancer", "gene"), length(feature.gr), replace=TRUE, prob=c(0.1, 0.2, 0.7)) plotGInteractions(gi, range, feature.gr) ## ----sessionInfo, results='asis'---------------------------------------------- sessionInfo()