R生信分析R绘图

gganatogram绘制解剖图(3)之细胞结构图

2021-02-23  本文已影响0人  R语言数据分析指南

gganatogram软件包是一个可以快速绘制各种动植物解剖图的R包,今天来介绍如何通过其绘制细胞结构图。喜欢的小伙伴可以关注个人公众号R语言数据分析指南持续分享更多优质资源,在此先行拜谢了!!

加载R包

library(gganatogram)
library(tidyverse)
library(viridis)
library(patchwork)

细胞结构

使用cell_key获取细胞数据

length(cell_key)
#> [1] 1
cell_key
#> $cell
#>                            organ  type    colour       value
#> 1                        cytosol other steelblue  2.07159434
#> 4         intermediate_filaments other   #984EA3 14.89497057
#> 6                actin_filaments other   #FFFF33  5.87440944
#> 8           focal_adhesion_sites other   #F781BF  8.12483660
#> 10 microtubule_organizing_center other   #66C2A5  8.67564889
#> 12                    centrosome other   #8DA0CB  1.02852838
#> 13                  microtubules other   #E78AC3  9.48882657
#> 16              microtubule_ends other   #E5C494  4.80457195
#> 18             secreted_proteins other   #8DD3C7  9.20191105
#> 20                lipid_droplets other   #BEBADA  3.48903574
#> 22                     lysosomes other   #80B1D3  3.73790434
#> 24                   peroxisomes other   #B3DE69  6.79465458
#> 26                     endosomes other   #D9D9D9 13.48636296
#> 28         endoplasmic_reticulum other   #CCEBC5 11.36654344
#> 30               golgi_apparatus other   #7FC97F 11.29225961
#> 32                   nucleoplasm other   #FDC086  2.07964782
#> 34              nuclear_membrane other   #386CB0  7.98595837
#> 36                nuclear_bodies other   #BF5B17  0.05868359
#> 38              nuclear_speckles other   #1B9E77  0.61672243
#> 40                      nucleoli other   #7570B3 14.96900579
#> 42     nucleoli_fibrillar_center other   #66A61E  8.72324527
#> 44                rods_and_rings other   #A6761D  9.53194209
#> 46                  mitochondria other   #A6CEE3  1.29396698
#> 48               plasma_membrane other   #B2DF8A 13.45657571

使用颜色或值进行数据绘制,请使用以下命令。如果要指定背景色,则必须除去细胞质或将细胞质的颜色更改为所需的颜色

gganatogram(data=cell_key[['cell']],outline = T,
            fillOutline='steelblue',organism="cell",fill="colour")+
  theme_void()+coord_fixed()
gganatogram(data=cell_key[['cell']],outline = T,
            fillOutline='lightgray',organism="cell",fill="value")+
  theme_void() +coord_fixed() +scale_fill_viridis()

查看所有的子结构

figureList <- list()
for (i in 1:nrow(cell_key[['cell']])) {
  figureList[[i]] <- gganatogram(data=cell_key[['cell']][i,],
                                 outline = T,fillOutline='steelblue',
                                 organism="cell", fill="colour")+
    theme_void() +
    ggtitle(cell_key[['cell']][i,]$organ) + 
    theme(plot.title = element_text(hjust=0.5, size=16)) + 
    coord_fixed()
}

do.call(grid.arrange,  c(figureList[1:4], ncol=2))
do.call(grid.arrange,  c(figureList[5:8], ncol=2))
do.call(grid.arrange,  c(figureList[9:12], ncol=2))
do.call(grid.arrange,  c(figureList[13:16], ncol=2))
do.call(grid.arrange,  c(figureList[17:20], ncol=2))
do.call(grid.arrange,  c(figureList[21:24], ncol=2))

绘制小白鼠的解剖图

雄性
gganatogram(data=mmMale_key, outline = T,fillOutline='#a6bddb',
            organism='mouse',sex='male',fill="colour")+
  theme_void()+coord_fixed()

按器官类型绘制

gganatogram(data=mmMale_key, outline = T,fillOutline='#a6bddb',
            organism='mouse', sex='male', fill="colour")+
  theme_void()+facet_wrap(~type, ncol=4)

雌性

gganatogram(data=mmFemale_key, outline = T, fillOutline='#a6bddb',
            organism='mouse', sex='female', fill="colour") +
  theme_void()+coord_fixed()
gganatogram(data=mmFemale_key,outline = T,fillOutline='#a6bddb',
            organism='mouse', sex='female',
            fill="colour")+theme_void()+facet_wrap(~type, ncol=4)

原文链接: https://mp.weixin.qq.com/s/KFss50iOH1Ttkpw667Qepw

上一篇 下一篇

猜你喜欢

热点阅读