美文网首页
RIdeogram绘图

RIdeogram绘图

作者: 所以suoyi | 来源:发表于2021-07-08 13:14 被阅读0次

    RIdeogram

    1、加载包
    > require(RIdeogram)
    
    2、数据

    (1)包内就有的数据集human_karyotype

    > data(human_karyotype, package="RIdeogram")
    > head(human_karyotype)
      Chr Start       End  CE_start    CE_end
    1   1     0 248956422 122026459 124932724
    2   2     0 242193529  92188145  94090557
    3   3     0 198295559  90772458  93655574
    4   4     0 190214555  49712061  51743951
    5   5     0 181538259  46485900  50059807
    6   6     0 170805979  58553888  59829934
    

    (2)包内就有的数据集gene_density

    > data(gene_density, package="RIdeogram")
    > head(gene_density)
      Chr   Start     End Value
    1   1       1 1000000    65
    2   1 1000001 2000000    76
    3   1 2000001 3000000    35
    4   1 3000001 4000000    30
    5   1 4000001 5000000    10
    6   1 5000001 6000000    10
    

    (3)包内就有的数据集Random_RNAs_500

    > data(Random_RNAs_500, package="RIdeogram")
    > head(Random_RNAs_500)
       Type    Shape Chr    Start      End  color
    1  tRNA   circle   6 69204486 69204568 6a3d9a
    2  rRNA      box   3 68882967 68883091 33a02c
    3  rRNA      box   5 55777469 55777587 33a02c
    4  rRNA      box  21 25202207 25202315 33a02c
    5 miRNA triangle   1 86357632 86357687 ff7f00
    6 miRNA triangle  11 74399237 74399333 ff7f00
    
    3、绘图

    (1)只画出人类染色体组型的图

    > ideogram(karyotype = human_karyotype)
    > convertSVG("chromosome.svg", device = "png")
    
    chromosome.png

    (2)不要中间的“拦腰斩” ---- 着丝粒位置

    > human_karyotype <- human_karyotype[,1:3]   # 所以只要前3列的chr, start, end 就行了
    > ideogram(karyotype = human_karyotype)
    > convertSVG("chromosome.svg", device = "png")
    
    chromosome.png

    (3)可视化整个人类基因组的基因密度

    > ideogram(karyotype = human_karyotype, overlaid = gene_density)
    > convertSVG("chromosome.svg", device = "png")
    
    chromosome.png

    换个颜色:

    > ideogram(karyotype = human_karyotype, overlaid = gene_density, colorset1 = c("#fc8d59", "#ffffbf", "#91bfdb"))
    > convertSVG("chromosome.svg", device = "png")
    
    chromosome.png

    (4)染色体表象旁边的轨道标签来映射一些全基因组数据

    > ideogram(karyotype = human_karyotype, label = Random_RNAs_500, label_type = "marker")
    > convertSVG("chromosome.svg", device = "png")
    
    chromosome.png
    仔细查看Random_RNAs_500数据会发现里面是
    可以自定义
         起个名儿    标注形状                                         颜色
         Type           Shape          Chr   Start      End         color
    1   名儿     circle/box/triangle    6    69204486   69204568    6a3d9a
    
    这个形状除了这3种还能不能换其他的???不懂不懂
    

    (5)laber还可以是其他类型
    label_type = "heatmap"

    > ideogram(karyotype = human_karyotype, overlaid = gene_density, label = LTR_density, label_type = "heatmap", colorset1 = c("#f7f7f7", "#e34a33"), colorset2 = c("#f7f7f7", "#2c7fb8"))
    > convertSVG("chromosome.svg", device = "png")
    
    chromosome.png

    label_type = "line"
    这个类型是用来在染色体旁边画折线图的,换一组数据,像如下有 value 的

    > data(liriodendron_karyotype, package="RIdeogram")
    > head(liriodendron_karyotype)
      Chr Start       End
    1   1     0 118073833
    2   2     0  98364873
    3   3     0 207093695
    4   4     0  50051714
    5   5     0  45443526
    6   6     0  35772468
    
    > data(Fst_between_CE_and_CW, package="RIdeogram")
    > head(Fst_between_CE_and_CW)
      Chr   Start     End     Value
    1   1       1 2000000 0.0646357
    2   1 1000001 3000000 0.0626714
    3   1 2000001 4000000 0.0582397
    4   1 3000001 5000000 0.0679570
    5   1 4000001 6000000 0.0965196
    6   1 5000001 7000000 0.0934111
    
    > data(Pi_for_CE, package="RIdeogram")
    > head(Pi_for_CE)
      Chr   Start     End      Value  Color
    1   1       1 2000000 0.00273566 fc8d62
    2   1 1000001 3000000 0.00239580 fc8d62
    3   1 2000001 4000000 0.00319407 fc8d62
    4   1 3000001 5000000 0.00286900 fc8d62
    5   1 4000001 6000000 0.00186596 fc8d62
    6   1 5000001 7000000 0.00186182 fc8d62
    
    > data(Pi_for_CE_and_CW, package="RIdeogram")
    > head(Pi_for_CE_and_CW)
      Chr   Start     End    Value_1 Color_1    Value_2 Color_2
    1   1       1 2000000 0.00273566  fc8d62 0.00385702  8da0cb
    2   1 1000001 3000000 0.00239580  fc8d62 0.00331109  8da0cb
    3   1 2000001 4000000 0.00319407  fc8d62 0.00374530  8da0cb
    4   1 3000001 5000000 0.00286900  fc8d62 0.00339141  8da0cb
    5   1 4000001 6000000 0.00186596  fc8d62 0.00305246  8da0cb
    6   1 5000001 7000000 0.00186182  fc8d62 0.00323655  8da0cb
    

    1个value

    > ideogram(karyotype = liriodendron_karyotype, overlaid = Fst_between_CE_and_CW, label = Pi_for_CE, label_type = "line", colorset1 = c("#e5f5f9", "#99d8c9", "#2ca25f"))
    > convertSVG("chromosome.svg", device = "png")
    
    chromosome.png
    2个value
    > ideogram(karyotype = liriodendron_karyotype, overlaid = Fst_between_CE_and_CW, label = Pi_for_CE_and_CW, label_type = "line", colorset1 = c("#e5f5f9", "#99d8c9", "#2ca25f"))
    > convertSVG("chromosome.svg", device = "png")
    
    chromosome.png

    label_type = "polygon" 多边形
    1个value

    > ideogram(karyotype = liriodendron_karyotype, overlaid = Fst_between_CE_and_CW, label = Pi_for_CE, label_type = "polygon", colorset1 = c("#e5f5f9", "#99d8c9", "#2ca25f"))
    > convertSVG("chromosome.svg", device = "png")
    
    chromosome.png
    2个value
    > ideogram(karyotype = liriodendron_karyotype, overlaid = Fst_between_CE_and_CW, label = Pi_for_CE_and_CW, label_type = "polygon", colorset1 = c("#e5f5f9", "#99d8c9", "#2ca25f"))
    > convertSVG("chromosome.svg", device = "png")
    
    chromosome.png
    (6)可视化两个或三个基因组之间的基因组同线性结果
    先略过 https://cran.r-project.org/web/packages/RIdeogram/vignettes/RIdeogram.html 最下面
    4、输出
    convertSVG("chromosome.svg", device = "png", dpi = 600)
                      名儿   格式:“tiff”、“pdf”、“jpg”    分辨率
    

    相关文章

      网友评论

          本文标题:RIdeogram绘图

          本文链接:https://www.haomeiwen.com/subject/icizultx.html