plotGrandLinear(ggbio)
plotGrandLinear()所属R语言包:ggbio
Manhattan for GWAS
曼哈顿的GWAS
译者:生物统计家园网 机器人LoveR
描述----------Description----------
A Manhattan plot is special scatter plot used to visualize data with a large number of data points, with a distribute of some higher-magnitude values. For example, in the GWAS(genome-wide association studies). Here we mainly focus on GWAS Manhattan plots. X-axis is genomic coordinates and Y-axis is negative logarithm of the associated P-value for each single nucleotide polymorphism. So higher the value, more stronger the association they are.
曼哈顿的图是特殊的散点图,用大量的数据点的数据可视化,与分发一些更高的幅度值。例如,在的GWAS(全基因组关联研究)。在这里,我们主要集中在GWAS的曼哈顿图。是基因组的X轴和Y轴的坐标是每个单核苷酸多态性的相关P值的负对数。如此高的价值,更强协会。
用法----------Usage----------
plotGrandLinear(obj, y, title, facet,
size, shape, color, alpha,
...,
geom = c("point", "line"),
color.type = c("twocolor", "identity", "seqnames"),
two.color = c("#0080FF", "#4CC4FF"),
cutoff = NULL,
cutoff.color = "red",
cutoff.size = 1,
legend = FALSE,
xlab = "Chromosome",
ylab = substitute(y),
theme_bw = TRUE)
参数----------Arguments----------
参数:obj
GRanges object which contains extra p value, before users pass this object, they need to make sure the pvalue has been changed to -log10(p).
GRanges对象,它包含额外的P值,用户通过这个对象之前,他们需要确保已改为pvalue LOG10(P)。
参数:y
Unevaluated name which should be one the of the column names indicating the p-value Or other score used as y value in the plot. This is required field.
未计算的名称应该是一个列名显示P-值或其他得分为y值使用中的图。这是必需的领域。
参数:title
Title for the plot, default plot without title.
标题的图,没有标题的默认图。
参数:facet
A facet formula, when provided, should be in two forms. First one, facet = group ~ seqnames, where group should be the name you want to facet by rows, if not, use . instead. this is faceted by seqnames, the different chromosomes will be in different panel. The second form, facet = group ~ . will give you a compact grand linear view, seqnames will not be in different panels, this is a better way to plot a overview, e.g. a Manhattan plot.
一个面的配方,提供时,应该有两种形式。第一位的,facet = group ~ seqnames,其中组应该是你想要的名字排面,如果没有,使用.代替。这是面由seqnames,不同的染色体将在不同的面板。第二种形式,facet = group ~ .会给你一个紧凑的盛大线性认为,seqnames不会在不同的面板,这是一个更好的方法绘制一个概述,如曼哈顿的图。
参数:size
Size for point or lines. Could equal a column name or a fixed number. When it's fixed, please use I() to wrap the value.
为点或线的大小。就相当于列名或一个固定的数字。当它固定的,请使用I()包装的价值。
参数:shape
Shape for point or lines. Could equal a column name or a fixed number. When it's fixed, please use I() to wrap the value.
点或线的形状。就相当于列名或一个固定的数字。当它固定的,请使用I()包装的价值。
参数:color
Color for point for lines. Could equal a column name or a fixed character. When it's fixed, please use I() to wrap the value.
颜色为线的点。就相当于列名或一个固定的字符。当它固定的,请使用I()包装的价值。
参数:alpha
Alpha blending. Could equal a column name or a fixed number. When it's fixed, please use I() to wrap the value.
Alpha混合。就相当于列名或一个固定的数字。当它固定的,请使用I()包装的价值。
参数:...
Extra arguments passed. Will be automatically dispatched to the right place, such as scales, space. When you try to use a faceted seqnames, you need to specify scales = "free" and space = "free", if you want a free scaled x-scale.
额外的参数传递。将自动分派到正确的地方,如尺度,空间。当您尝试使用面seqnames,你需要指定scales = "free"和space = "free",如果你想要一个自由的缩放X-级。
参数:geom
"point"(default) or "line". When it's line, it will make sure the line is not connect cross different chromosomes.
“点”(默认)或“行”。当它的路线,它将确保线连接跨不同的染色体。
参数:color.type
"identity" use single color for all points, when it's enabled, you can specify color in the arguments to equal a character or an unevaluated name, when use specific color, try use I, for instance, color = I("red"); "seqnames" use default discrete color scheme for all chromosomes; "twocolor" use two colors to represent all the chromosomes, could specify color in the two.color argument.
“身份”使用单一颜色,所有的点时,它的启用,您可以指定颜色在参数等于一个字符或一个未计算的名称,使用特定的颜色时,尽量使用I,例如,颜色我(“红色”);“seqnames”使用默认的所有染色体的离散配色方案“twocolor”使用两种颜色来代表所有的染色体,可以指定颜色在two.color参数。
参数:two.color
A character vector of two. Default is chosen from dichromat palette "BluetoOrange.8", make sure it's color-blind safe.
一个两个特征向量。默认是从dichromat调色板“BluetoOrange.8”的选择,确保它是色盲的安全。
参数:cutoff
A numeric vector which used as cutoff for Manhattan plot.
一个数值向量作为截止曼哈顿图使用。
参数:cutoff.color
A character specifying the color used for cutoff. Default is "red".
一个字符指定的截止使用的颜色。默认为“红色”。
参数:cutoff.size
A numeric value which used as cutoff line size.
一个数值,用来作为截止线的大小。
参数:legend
A logical value indicate whether to show legend or not. Default is FALSE which disabled the legend.
一个逻辑值,指明是否显示图例与否。默认值为FALSE,禁用的传说。
参数:xlab
Label for xscale.
为XSCALE的标签。
参数:ylab
Label for yscale.
为yscale的标签。
参数:theme_bw
A logical value indicate whether to show gray background or not. Default is TRUE, use theme_bw() in ggplot2.
一个逻辑值,表明是否显示灰色背景或没有。默认值为true,使用在ggplot2 theme_bw()。
Details
详情----------Details----------
If scales and space are free, then the mapping between position and values in the data will be the same across all panels
如果尺度和空间是免费的,那么之间的位置,并在数据值的映射将是相同的所有小组
值----------Value----------
Return a ggplot object.
返回ggplot对象。
作者(S)----------Author(s)----------
Tengfei Yin
举例----------Examples----------
## Not run: [#无法运行:]
library(GenomicRanges)
library(ggbio)
data(hg19IdeogramCyto)
data(hg19Ideogram)
chrs <- as.character(levels(seqnames(hg19IdeogramCyto)))
seqlths <- seqlengths(hg19Ideogram)[chrs]
set.seed(1)
nchr <- length(chrs)
nsnps <- 1000
gr.snp <- GRanges(rep(chrs,each=nsnps),
IRanges(start = do.call(c, lapply(chrs, function(chr){
N <- seqlths[chr]
runif(nsnps,1,N)
})), width = 1),
SNP=sapply(1 nchr*nsnps), function(x) paste("rs",x,sep='')),
pvalue = -log10(runif(nchr*nsnps)),
group = sample(c("Normal", "Tumor"), size = nchr*nsnps,
replace = TRUE)
)
## processing the name[#处理名称]
nms <- seqnames(seqinfo(gr.snp))
nms.new <- gsub("chr", "", nms)
names(nms.new) <- nms
gr.snp <- renameSeqlevels(gr.snp, nms.new)
## compact view[#紧凑视图]
## no facet by samples, but make sure you want it that way[#无面样品,但要确保你想用那种方式]
## default is two color[#默认是两种颜色]
plotGrandLinear(gr.snp, y = pvalue, geom = "point")
## facet by samples, comparison across groups[#面样本,跨组比较]
plotGrandLinear(gr.snp, y = pvalue, geom = "point",
facet = group ~ ., color.type = "twocolor")
## change two color[#改变两种颜色。]
plotGrandLinear(gr.snp, y = pvalue, geom = "point",
facet = group ~ ., color.type = "twocolor",
two.color = c("red", "blue"))
## geom line[#GEOM行]
plotGrandLinear(gr.snp, y = pvalue,
geom = "line", facet = group ~ .)
## add size and change color[#增加大小和变化的颜色。]
plotGrandLinear(gr.snp, y = pvalue, size = pvalue,geom = "point",
facet = group ~ ., color.type = "seqnames")
plotGrandLinear(gr.snp, y = pvalue, size = I(0.05),
geom = "point", facet = group ~ .)
plotGrandLinear(gr.snp, y = pvalue, color = group, geom = "point",
facet = group ~ .,
color.type = "identity")
plotGrandLinear(gr.snp, y = pvalue, color = I("blue"), geom = "point", facet = group ~ .,
color.type = "identity")
## facet by seqnames, slower[#面seqnames,慢]
plotGrandLinear(gr.snp, y = pvalue,geom = "point",
facet = group ~ seqnames, scales = "free", space = "free")
## End(Not run)[#结束(不运行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|