哈佛大学——差异表达分析(十二)可视化

本文介绍了如何使用R语言进行生物信息学中的差异表达分析结果的可视化,包括DESeq2绘制单个基因表达、ggplot2绘制多个基因表达和热图、火山图等。通过实例展示了如何从DESeq2结果中提取数据,利用dplyr和tidyr进行数据处理,并用ggplot2进行美化,以便更好地理解和解释差异表达基因的表达模式。
摘要由CSDN通过智能技术生成

学习目标

  1. 使用数据可视化探索表达数据
  2. 使用火山图来评估DEG统计数据之间的关系
  3. 利用热图绘制重要基因的表达

结果可视化

当我们处理大量数据时,图形化地显示这些信息以获得更深入的了解是很有用的。在这节课中,我们将让你开始一些基本的和更高级的图形,通常用于探索差异基因表达数据,然而,这些图形中的许多也可以帮助可视化其他类型的数据。
我们将使用三个不同的数据对象,我们已经在早期的课程中创建:

  • 我们示例的元数据(一个dataframe):meta
  • 我们每个样本(一个矩阵)中每个基因的归一化表达数据:normalized_counts
  • 我们在上一课中生成的DESeq2结果tibble版本:res_tableOE_tbres_tableKD_tb

首先,让我们从数据框创建一个元数据tibble(不要丢失行名!)

mov10_meta <- meta %>% 
              rownames_to_column(var="samplename") %>% 
              as_tibble()

接下来,让我们将带有gene symbols的列引入normalized_counts对象,这样我们就可以使用它们来标记我们的图。Ensembl ID在很多方面都很有用,但作为生物学家,我们更容易识别这些gene symbols。

# DESeq2 creates a matrix when you use the counts() function
## First convert normalized_counts to a data frame and transfer the row names to a new column called "gene"
normalized_counts <- counts(dds, normalized=T) %>% 
                     data.frame() %>%
                     rownames_to_column(var="gene") 
  
# Next, merge together (ensembl IDs) the normalized counts data frame with a subset of the annotations in the tx2gene data frame (only the columns for ensembl gene IDs and gene symbols)
grch38annot <- tx2gene %>% 
               dplyr::select(ensgene, symbol) %>% 
               dplyr::distinct()

## This will bring in a column of gene symbols
normalized_counts <- merge(normalized_counts, grch38annot, by.x="gene", by.y="ensgene")

# Now create a tibble for the normalized counts
normalized_counts <- normalized_counts %>%
                     as_tibble()
  
normalized_counts 
> normalized_counts
# A tibble: 57,761 x 10
   gene      Irrel_kd_1 Irrel_kd_2 Irrel_kd_3 Mov10_kd_2 Mov10_kd_3 Mov10_oe_1 Mov10_oe_2 Mov10_oe_3 symbol
   <chr>          <dbl>      <dbl>      <dbl>      <dbl>      <dbl>      <dbl>      <dbl>      <dbl> <chr> 
 1 ENSG0000~   3925.       3794.      3961.      3952.      3941.      2727.       2730.     3178.   TSPAN6
 2 ENSG0000~     24.2        30.2       30.7       23.7       13.9       20.4        33.3      33.6  TNMD  
 3 ENSG0000~   1326.       1341.      1180.      1515.      1432.      1542.       1548.     1943.   DPM1  
 4 ENSG0000~    456.        422.       476.       597.       610.       527.        518.      541.   SCYL3 
 5 ENSG0000~   1250.       1212.      1134.      1389.      1300.       965.        999.     1029.   C1orf~
 6 ENSG0000~      0.897       1.04       0          1.28       0          0           0         0    FGR   
 7 ENSG0000~     19.7        18.7        9.34      10.2        2.14       7.34       17.5       6.11 CFH   
 8 ENSG0000~   2922.       2705.      2642.      2942.      2971.      2397.       2786.     2544.   FUCA2 
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
>