当前位置: 首页 > news >正文

惠州做网站开发湖北网络推广公司

惠州做网站开发,湖北网络推广公司,怎么把网站放到阿里云,福建中海建设有限公司网站多组差异火山图复现 参考文章: A Spatiotemporal Organ-Wide Gene Expression and Cell Atlas of the Developing Human Heart Figure 2. H 图里主要是单细胞数据不同cluster之间的差异火山图, 所以说白了就是散点图和柱状图的结合, 散点图用差异基因绘制, 柱状图利用logFC最…

多组差异火山图复现

参考文章: A Spatiotemporal Organ-Wide Gene Expression and Cell Atlas of the Developing Human Heart Figure 2. H
Figure 2. H
图里主要是单细胞数据不同cluster之间的差异火山图, 所以说白了就是散点图和柱状图的结合, 散点图用差异基因绘制, 柱状图利用logFC最大最小值绘制就完了.

加载包

> library(tidyverse)
> library(ggplot2)
> library(ggpubr)
> library(RColorBrewer)
> library(openxlsx)
> library(ggsci)
> library(ggrepel)
> # Create color parameters
> qual_col_pals = brewer.pal.info[brewer.pal.info$category == 'qual',]
> col_vector = unlist(mapply(brewer.pal, qual_col_pals$maxcolors, rownames(qual_col_pals)))
> 

读取数据

> deg <- read.csv("./Differentially_Expressed_Markers_Each_Cluster.csv", header = T)
> deg$cluster <- as.factor(deg$cluster)
> head(deg)X p_val avg_log2FC pct.1 pct.2 p_val_adj cluster       gene
1 1     0   2.558924 0.982 0.289         0       0      DEFB1
2 2     0   2.365316 0.963 0.220         0       0     HMGCS2
3 3     0   2.317304 0.991 0.513         0       0     ATP1B1
4 4     0   2.207154 0.963 0.231         0       0 AC015522.1
5 5     0   2.153153 0.912 0.244         0       0    HSD11B2
6 6     0   2.125726 0.811 0.209         0       0     PAPPA2
> deg <- deg %>% dplyr::filter(p_val_adj < 0.05) %>% 
+   dplyr::filter(abs(avg_log2FC) > 0.75) %>% 
+   dplyr::select(avg_log2FC, p_val_adj, cluster, gene)  # filter and tidy the matrix
> 

添加一些注释信息, 例如legend, 上下调, 需要显示名称的基因等

> deg <- deg %>% 
+   mutate(label = ifelse(p_val_adj < 0.01, "adjusted P-val < 0.01", "adjusted P-val >= 0.01")) %>% 
+   mutate(Change = ifelse(avg_log2FC > 0.75, "UP", "DOWN"))
> 
> bardata <- deg %>% dplyr::select(cluster, avg_log2FC ) %>% 
+   group_by(cluster) %>% 
+   summarise_all(list(tail = min, top = max)) # 
> head(bardata)
# A tibble: 6 × 3cluster  tail   top<fct>   <dbl> <dbl>
1 0       -5.61  2.56
2 1       -5.13  4.32
3 2       -5.46  2.53
4 3       -4.84  4.81
5 4       -5.60  3.97
6 5       -4.59  2.96
>
> tagedgene <- deg %>% group_by(cluster) %>% 
+   slice_max(abs(avg_log2FC), n = 3)
> head(tagedgene)
# A tibble: 6 × 6
# Groups:   cluster [2]avg_log2FC p_val_adj cluster gene   label                 Change<dbl>     <dbl> <fct>   <chr>  <chr>                 <chr> 
1      -5.61  0        0       ALDOB  adjusted P-val < 0.01 DOWN  
2      -5.46  0        0       HSPA1A adjusted P-val < 0.01 DOWN  
3      -5.09  0        0       GPX3   adjusted P-val < 0.01 DOWN  
4      -5.13  0        1       DEFB1  adjusted P-val < 0.01 DOWN  
5      -4.61  0        1       CRYAB  adjusted P-val < 0.01 DOWN  
6      -4.36  1.07e-43 1       ALDOB  adjusted P-val < 0.01 DOWN  
> 

绘制图形

  • 利用bardata绘制背景柱状图
ggplot(deg, aes(x = cluster, y = avg_log2FC ))+geom_col(data = bardata, mapping = aes(x = cluster, y = tail),fill = "grey", width = 0.8) +geom_col(data = bardata, mapping = aes(x = cluster, y = top),fill = "grey", width = 0.8)

在这里插入图片描述

  • 添加上散点图, 黑色点有点少了, 不过无所谓能看到就行
ggplot(deg, aes(x = cluster, y = avg_log2FC ))+geom_col(data = bardata, mapping = aes(x = cluster, y = tail),fill = "grey", width = 0.8) +geom_col(data = bardata, mapping = aes(x = cluster, y = top),fill = "grey", width = 0.8) +geom_jitter(aes(color = label), size = 1,position = position_jitter(seed = 0328)) +scale_color_manual(values = c("#db5a6b", "black"))

在这里插入图片描述

  • 添加注释方块
ggplot(deg, aes(x = cluster, y = avg_log2FC ))+geom_col(data = bardata, mapping = aes(x = cluster, y = tail),fill = "grey", width = 0.8) +geom_col(data = bardata, mapping = aes(x = cluster, y = top),fill = "grey", width = 0.8) +geom_jitter(aes(color = label), size = 1,position = position_jitter(seed = 0328)) +scale_color_manual(values = c("#db5a6b", "black")) +geom_tile(aes(y = 0, fill = cluster), show.legend = F, color = "black", width = 1) +scale_fill_manual(values = col_vector)

在这里插入图片描述

  • 给想要展示的基因和注释方块添加文字
    • 看着有点挤, 点击zoom放大就好了
ggplot(deg, aes(x = cluster, y = avg_log2FC ))+geom_col(data = bardata, mapping = aes(x = cluster, y = tail),fill = "grey", width = 0.8) +geom_col(data = bardata, mapping = aes(x = cluster, y = top),fill = "grey", width = 0.8) +geom_jitter(aes(color = label), size = 1,position = position_jitter(seed = 0328)) +scale_color_manual(values = c("#db5a6b", "black")) +geom_tile(aes(y = 0, fill = cluster), show.legend = F, color = "black", width = 1) +scale_fill_manual(values = col_vector) +geom_text(aes(y = 0, label = cluster)) +geom_text_repel(data = deg %>% filter(gene %in% unique(tagedgene$gene)),aes(label = gene), position = position_jitter(seed = 0328),arrow = arrow(angle = 30, length = unit(0.05, "inches"),ends = "last", type = "open"))

在这里插入图片描述

  • 最后处理一下背景啥的
ggplot(deg, aes(x = cluster, y = avg_log2FC ))+geom_col(data = bardata, mapping = aes(x = cluster, y = tail),fill = "grey", width = 0.8) +geom_col(data = bardata, mapping = aes(x = cluster, y = top),fill = "grey", width = 0.8) +geom_jitter(aes(color = label), size = 1,position = position_jitter(seed = 0328)) +scale_color_manual(values = c("#db5a6b", "black")) +geom_tile(aes(y = 0, fill = cluster), show.legend = F, color = "black", width = 1) +scale_fill_manual(values = col_vector) +geom_text(aes(y = 0, label = cluster)) +geom_text_repel(data = deg %>% filter(gene %in% unique(tagedgene$gene)),aes(label = gene), position = position_jitter(seed = 0328),arrow = arrow(angle = 30, length = unit(0.05, "inches"),ends = "last", type = "open")) +theme_minimal() +theme(axis.line.y = element_line(color = "black", linewidth = 1),axis.line.x = element_blank(),axis.text.x = element_blank(),panel.grid = element_blank(),legend.title = element_blank())

在这里插入图片描述
是不是很简单啊 😃
其实不只是单细胞, RNAseq等技术的差异基因也可以组合成类似的矩阵之后绘制相同的多组差异火山图. 理解这个图是柱状图和散点图的结合就可以灵活的绘制类似的图啦 😃

http://www.shuangfujiaoyu.com/news/45900.html

相关文章:

  • 西安博威建设工程有限公司招聘网站百度广告投放平台官网
  • 重庆网站建设制作设计公司哪家好百度舆情
  • wordpress 婚恋模板seo优化专员编辑
  • 网站建设实习生怎么样关键词优化步骤简短
  • 网上做网站兼职什么是seo关键词
  • php一台电脑做网站营销运营主要做什么
  • 深圳商城网站制作网站注册账号
  • 重庆网站seo服务sem竞价推广公司
  • 百度seo效果北京seo推广服务
  • 网站ipv6改造怎么做 网页代码google网页版登录入口
  • 网站建设详细设计精准客户软件
  • ssm做网站1688的网站特色
  • 公司做网站需要什么条件网站外链工具
  • 济南seo网站推广公司商业软文怎么写
  • 高密做网站哪家强价位软文范例大全300字
  • dw建网站网站设计公司网站制作
  • 正规做网站中国今天新闻最新消息
  • 网站怎么使用北京网优化seo优化公司
  • 建设 市民中心网站经济新闻最新消息财经
  • 网站推广的手段郑州网站推广方案
  • 网站模版 带 手机版怎么让网站排名上去
  • 微信的微网站模板下载不了百度流量推广项目
  • 网站建设的落地页十八大禁用黄app入口
  • 北京朝阳区网站建设百度收录在线提交
  • 服装网站banner怎么做企业邮箱怎么申请
  • 做网站宁波大点的网络公司优秀网页设计赏析
  • 辞职做网站沈阳优化推广哪家好
  • 网站建设与管理难学吗网站设计规划
  • 青岛国家高新区建设局网站图片搜索引擎
  • 机械加工网站易下拉大测黄山seo推广