如何沿着染色体图形绘制位置 [英] How to plot positions along a chromosome graphic

查看:153
本文介绍了如何沿着染色体图形绘制位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想生成一个图,该图按比例绘制我正在研究的生物的14条线性染色体,并在每个染色体的指定位置上带有彩色条.理想情况下,我想使用R,因为这是我有经验的唯一编程语言.

I would like to generate a plot depicting 14 linear chromosomes for the organism I work on, to scale, with coloured bars at specified locations along each chromosome. Ideally I'd like to use R as this is the only programming language I have experience with.

我已经探索了各种方法,例如GenomeGraphs,但是我发现这比我想要的要复杂得多,显示的数据比我要拥有的要多(例如,显示细胞原性条带),并且通常是人类染色体特有的.

I have explored various ways of doing this e.g. with GenomeGraphs but I have found this is all more complicated than what I want/ displays a lot more data than what I have (e.g. displaying cytogenic bands) and is often specific for human chromosomes.

我基本上想要的是14个以下尺寸的灰色条:

All I essentially want is 14 grey bars of the following sizes:

chromosome           size
         1         640851
         2         947102
         3        1067971
         4        1200490
         5        1343557
         6        1418242
         7        1445207
         8        1472805
         9        1541735
        10        1687656
        11        2038340
        12        2271494
        13        2925236
        14        3291936

然后具有彩色标记,描绘沿着染色体长度散布的约150个位置.例如在这些基因座处标记:

And then to have coloured marks depicting about 150 locations scattered along the chromosome lengths. e.g. marks at these loci:

Chromosome        Position
         3          817702
        12         1556936
        13         1131566

理想情况下,我还希望能够根据基因座指定一些不同的颜色,例如

Ideally I would also like to be able to specify a few different colours depending on the loci, e.g.

Chromosome        Position        Type
         3          817702           A
        12         1556936           A
        13         1131566           A
         5         1041685           B
        11          488717           B
        14         1776463           B

例如,"A"标记为蓝色,而"B"标记为绿色.

Where 'A' was marked in blue and 'B' was marked in green, for example.

此图像中粘贴了一个与我想要产生的图像非常相似的图(摘自Bopp等人,PLOS Genetics 2013; 9(2):e1003293):

A very similar plot to what I would like to produce is pasted in this image (from Bopp et al. PlOS Genetics 2013;9(2):e1003293):

有人可以推荐这样做的方法吗?如果有另一种方法,我可以使用R生成14个具有一定比例大小的条形图,并在条形图上的指定位置标记,则不必一定是生物信息学软件包.例如我一直在考虑从ggplot2修改一个简单的条形图,但是我不知道如何在特定位置沿着条形放置标记.

Can anyone recommend a way of doing this? It doesn't necessarily have to be a bioinformatics package, if there is another way I can use R to generate 14 bars of certain proportional sizes with markings at specified locations along the bars. e.g. I've been thinking about modifying a simple bar chart from ggplot2 but I don't know how to put the markings along the bars at specific locations.

推荐答案

只需保存您的barplot调用,然后调用segments在适当的位置进行标记.例如:

Just save your barplot call and then call segments to make the marks at an appropriate location. E.g.:

bp <- barplot(dat$size, border=NA, col="grey80")

with(marks,
  segments(
    bp[Chromosome,]-0.5,
    Position,
    bp[Chromosome,]+0.5,
    Position,
    col=Type,
    lwd=2, 
    lend=1
   )
)

使用的数据:

dat <- structure(list(chromosome = 1:14, size = c(640851L, 947102L, 
1067971L, 1200490L, 1343557L, 1418242L, 1445207L, 1472805L, 1541735L, 
1687656L, 2038340L, 2271494L, 2925236L, 3291936L)), .Names = c("chromosome", 
"size"), class = "data.frame", row.names = c(NA, -14L))

marks <- structure(list(Chromosome = c(3L, 12L, 13L, 5L, 11L, 14L), Position = c(817702L, 
1556936L, 1131566L, 1041685L, 488717L, 1776463L), Type = structure(c(1L, 
1L, 1L, 2L, 2L, 2L), .Label = c("A", "B"), class = "factor")), .Names = c("Chromosome", 
"Position", "Type"), class = "data.frame", row.names = c(NA, 
-6L))

这篇关于如何沿着染色体图形绘制位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆