搜索
查看: 467|回复: 0

[software] Gviz

[复制链接]

29

主题

29

帖子

149

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
149
发表于 2018-9-28 16:20:55 | 显示全部楼层 |阅读模式
1) Introduction

为了理解基因组数据,通常旨在在基因组浏览器中绘制这样的数据,以及各种基因组注释特征,例如基因或转录物模型,CpG岛,重复区域等。这些功能可以从ENSEMBL或UCSC等公共数据库中提取,也可以在内部生成或策划。许多当前可用的基因组浏览器在显示基因组注释数据方面做了合理的工作,并且存在从R内部连接到其中一些的选项(例如,使用rtracklayer包)。然而,这些解决方案都没有提供完整的Rgraphics系统以多种不同方式显示大数值数据的灵活性。 Gviz软件包旨在通过提供结构化可视化框架来绘制基因组坐标上的任何类型的数据来缩小这一差距。它松散地基于GenomeGraphs包,但为了提高性能和灵活性,重新构建了完整的类层次结构以及所有绘图方法,所有绘图都是使用网格图形系统完成的,并且几个专门的注释类允许集成来自UCSC或ENSEMBL等来源的公开可用的基因组注释数据。
2)Basic Feature
[Python] 纯文本查看 复制代码
if("Gviz" %in% rownames(installed.packages()) == FALSE) {source("http://bioconductor.org/biocLite.R");biocLite("Gviz")}
suppressMessages(library(Gviz))
ls('package:Gviz')
library(GenomicRanges)
data(cpgIslands)     #以GC岛数据集为例
class(cpgIslands)
chr <- as.character(unique(seqnames(cpgIslands)))
gen <- genome(cpgIslands)
atrack <- AnnotationTrack(cpgIslands, name = "CpG")
plotTracks(atrack)
gtrack <- GenomeAxisTrack()
plotTracks(list(gtrack, atrack))
itrack <- IdeogramTrack(genome = gen, chromosome = chr)
plotTracks(list(itrack, gtrack, atrack))


画genemodel
[Python] 纯文本查看 复制代码
data(geneModels)
grtrack <- GeneRegionTrack(geneModels, genome = gen,chromosome = chr, name = "Gene Model")
plotTracks(list(itrack, gtrack, atrack, grtrack))


[Python] 纯文本查看 复制代码
library(BSgenome.Hsapiens.UCSC.hg19)
strack <- SequenceTrack(Hsapiens, chromosome = chr)
plotTracks(list(itrack, gtrack, atrack, grtrack,
                strack), from = 26591822, to = 26591852, cex = 0.8)


[Python] 纯文本查看 复制代码
set.seed(255)
lim <- c(26700000, 26750000)
coords <- sort(c(lim[1], sample(seq(from = lim[1],to = lim[2]), 99), lim[2]))
dat <- runif(100, min = -10, max = 10)
dtrack <- DataTrack(data = dat, start = coords[-length(coords)],
                    end = coords[-1], chromosome = chr, genome = gen,
                    name = "Uniform")
plotTracks(list(itrack, gtrack, atrack, grtrack,
                 dtrack), from = lim[1], to = lim[2])


3)Plotting parameters
3.1 设置参数
[Python] 纯文本查看 复制代码
grtrack <- GeneRegionTrack(geneModels, genome = gen,
                           chromosome = chr, name = "Gene Model", transcriptAnnotation = "symbol",
                           background.title = "brown")
head(displayPars(grtrack))
plotTracks(list(itrack, gtrack, atrack, grtrack))


3.2 Schemes
[Python] 纯文本查看 复制代码
getOption("Gviz.scheme")
scheme <- getScheme()
scheme$GeneRegionTrack$fill <- "salmon"
scheme$GeneRegionTrack$col <- NULL
scheme$GeneRegionTrack$transcriptAnnotation <- "transcript"
addScheme(scheme, "myScheme")
options(Gviz.scheme = "myScheme")
grtrack <- GeneRegionTrack(geneModels, genome = gen,
                            chromosome = chr, name = "Gene Model")
plotTracks(grtrack)
options(Gviz.scheme = "default")
grtrack <- GeneRegionTrack(geneModels, genome = gen,
                           chromosome = chr, name = "Gene Model", transcriptAnnotation = "symbol")


3.3 Creating tracks from UCSC data
[Python] 纯文本查看 复制代码
from <- 65921878
to <- 65980988
knownGenes <- UcscTrack(genome = "mm9", chromosome = "chrX",
                         track = "knownGene", from = from, to = to, trackType = "GeneRegionTrack",
                        rstarts = "exonStarts", rends = "exonEnds", gene = "name",
                        symbol = "name", transcript = "name", strand = "strand",
                         fill = "#8282d2", name = "UCSC Genes")
refGenes <- UcscTrack(genome = "mm9", chromosome = "chrX",
                      track = "xenoRefGene", from = from, to = to,
                       trackType = "GeneRegionTrack", rstarts = "exonStarts",
                      rends = "exonEnds", gene = "name", symbol = "name2",
                       transcript = "name", strand = "strand", fill = "#8282d2",
                      stacking = "dense", name = "Other RefSeq")
ensGenes <- UcscTrack(genome = "mm9", chromosome = "chrX",
                       track = "ensGene", from = from, to = to, trackType = "GeneRegionTrack",
                       rstarts = "exonStarts", rends = "exonEnds", gene = "name",
                      symbol = "name2", transcript = "name", strand = "strand",
                      fill = "#960000", name = "Ensembl Genes")
cpgIslands <- UcscTrack(genome = "mm9", chromosome = "chrX",
                          track = "cpgIslandExt", from = from, to = to,
                          trackType = "AnnotationTrack", start = "chromStart",
                          end = "chromEnd", id = "name", shape = "box",
                          fill = "#006400", name = "CpG Islands")
snpLocations <- UcscTrack(genome = "mm9", chromosome = "chrX",
                          track = "snp128", from = from, to = to, trackType = "AnnotationTrack",
                           start = "chromStart", end = "chromEnd", id = "name",
                          feature = "func", strand = "strand", shape = "box",
                          stacking = "dense", fill = "black", name = "SNPs")
conservation <- UcscTrack(genome = "mm9", chromosome = "chrX",
                          track = "Conservation", table = "phyloP30wayPlacental",
                           from = from, to = to, trackType = "DataTrack",
                           start = "start", end = "end", data = "score",
                           type = "hist", window = "auto", col.histogram = "darkblue",
                           fill.histogram = "darkblue", ylim = c(-3.7, 4),
                           name = "Conservation")
gcContent <- UcscTrack(genome = "mm9", chromosome = "chrX",
                        track = "GC Percent", table = "gc5Base", from = from,
                        to = to, trackType = "DataTrack", start = "start",
                        end = "end", data = "score", type = "hist", window = -1,
                        windowSize = 1500, fill.histogram = "black",
                        col.histogram = "black", ylim = c(30, 70), name = "GC Percent")
axTrack <- GenomeAxisTrack()
idxTrack <- IdeogramTrack(genome = "mm9", chromosome = "chrX")
plotTracks(list(idxTrack, axTrack, knownGenes, refGenes,
                 ensGenes, cpgIslands, gcContent, conservation,
                 snpLocations), from = from, to = to, showTitle = FALSE)


结束语:我想你们对这个图应该很熟悉吧,难道就不想自己画一下吗。。。。。。。。。。





本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|生信技能树    

GMT+8, 2019-2-21 22:53 , Processed in 0.072095 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.