上一节课中介绍了关于array芯片来源数据的分析,其实感觉array的数据不多了,现在基本都是高通量的数据,不过高通量的数据应该是所谓分类里的转录组数据?
array出来的数据量感觉就比较少吧?RNA-Seq数据是必须要在linux里分析了
芯片和高通量测序(RNA-Seq)的区别?
Expression Profiling by High-Throughput Sequencing (RNA-Seq) and Expression Profiling by Array are two primary methods used to measure gene expression levels.1 While they share the common goal of understanding gene activity, they differ significantly in their underlying technologies and the depth of information they provide.2
Expression Profiling by Array
- Technology:
- Relies on hybridization of labeled cDNA or cRNA (cDNA体外转录的产物,用于体外扩增mRNA)to probes immobilized on a solid surface (the array).3
- Probes are designed to match specific sequences of known genes.4
- Data Generation:
- Measures the intensity of fluorescence or other signals at each probe spot to quantify gene expression levels.5
- Advantages:
- Relatively cost-effective and well-established technology.6
- Can be used to profile a large number of genes simultaneously.7
- Limitations:
- Limited to known genes and transcripts.8
- Less sensitive for detecting low-abundance transcripts.
- Prone to hybridization artifacts and background noise.
Expression Profiling by High-Throughput Sequencing (RNA-Seq)
- Technology:
- Involves converting RNA into cDNA, fragmenting it, and sequencing the fragments.
- The resulting sequence reads are mapped to a reference genome or transcriptome to quantify gene expression levels.9
- Data Generation:
- Counts the number of reads that map to each gene or transcript to determine expression levels.
- Advantages:
- Unbiased and can detect novel transcripts and isoforms.10
- Higher sensitivity and dynamic range for detecting low-abundance transcripts.11
- Can provide information on alternative splicing, gene fusions, and other complex transcriptional events.12
- Limitations:
- More expensive and computationally intensive than microarrays.13
- Requires specialized bioinformatics tools for data analysis.14
Bioinformatics Analysis Methods
While the underlying technologies differ, many bioinformatics analysis methods are shared between RNA-Seq and microarray data:
- Quality Control: Assessing the quality of raw data, removing low-quality reads or probes.15
- Normalization: Adjusting for technical variations between samples to ensure accurate comparisons.16
- Differential Expression Analysis: Identifying genes that are differentially expressed between experimental conditions.17
- Functional Enrichment Analysis: Identifying biological pathways and processes that are enriched among differentially expressed genes.18
- Clustering and Dimensionality Reduction: Grouping samples or genes based on similarity in expression patterns.19
However, RNA-Seq data analysis often involves additional steps:
- Read Mapping: Aligning sequencing reads to a reference genome or transcriptome.20
- Transcript Assembly: Reconstructing full-length transcripts from fragmented reads (for de novo transcriptome assembly).21
- Quantification: Counting the number of reads that map to each gene or transcript.22
In summary, while both RNA-Seq and microarray-based expression profiling aim to understand gene expression patterns, RNA-Seq offers greater sensitivity, specificity, and the ability to discover novel transcripts and isoforms.23 However, microarrays remain a valuable tool for certain applications, especially when cost and sample size are limiting factors.24 The choice of technology depends on the specific research question and available resources.
The core difference between RNA-Seq and microarray-based expression profiling lies in their detection methods, but both techniques are fundamentally used to measure gene expression levels, which is a reflection of transcriptional activity.
Key Points:
- Microarrays:
- Rely on hybridization of labeled cDNA or cRNA to pre-designed probes on a solid surface.
- Can only detect known genes and transcripts.
- Limited dynamic range and sensitivity.
- RNA-Seq:
- Involves sequencing cDNA fragments to directly measure RNA abundance.
- Can detect novel transcripts and isoforms.
- Wider dynamic range and higher sensitivity.
In summary, both methods are powerful tools for transcriptomics, but RNA-Seq offers superior resolution and flexibility, making it the preferred choice for many modern research applications.
芯片array现在用的绝对少了,现在送样测序用的都是RNA-seq了;另外就是背景知识的补充,重温一下Central Dogma,我没找到合适的图自己做了一张简图;后面随着转录后修饰和基因组修饰等的学习,我觉得这个图还可以补充更多
Central Dogma
#(2)提取临床信息
pd <- pData(eSet)
pData函数的作用
在R语言中,特别是处理生物信息学数据的Bioconductor包中,
pData(eSet)
函数主要用于提取ExpressionSet对象中的表型数据。
- ExpressionSet:这是一种在Bioconductor中常用的数据结构,用来存储基因表达数据和其他相关信息。
- 表型数据:指的是样本的特征信息,例如:
- 实验组别:对照组、实验组
- 样本来源:不同组织、个体
- 临床信息:年龄、性别、疾病状态
- 其他实验条件:处理时间、剂量等
简单来说,
pData(eSet)
就是从一个ExpressionSet对象中抽取出关于样本的各种属性信息。函数的语法
代码段pData(object)
- object:一个ExpressionSet对象。
使用示例
代码段# 假设我们已经加载了一个名为'myESet'的ExpressionSet对象 # 提取表型数据并赋值给一个新的数据框 phenoData <- pData(myESet) # 查看表型数据的结构 head(phenoData) # 提取特定列的数据 group <- phenoData$group # 提取分组信息 age <- phenoData$age # 提取年龄信息
示例解读
- head(phenoData):显示表型数据的前几行,让我们快速了解数据结构和内容。
- phenoData$group:提取表型数据中名为"group"的一列,这通常包含样本的分组信息。
- phenoData$age:提取表型数据中名为"age"的一列,这通常包含样本的年龄信息。
pData函数的应用场景
- 数据探索:了解样本的特征,发现潜在的组间差异。
- 数据预处理:根据表型信息进行分组、筛选样本。
- 差异分析:将表型信息作为协变量,进行差异表达分析。
- 可视化:根据表型信息绘制各种类型的图,如箱线图、火山图等。
拓展
- 表型数据结构:通常是一个数据框,每一行代表一个样本,每一列代表一个表型特征。
- 自定义表型数据:可以通过
pData(eSet) <- newdata
来替换或添加新的表型数据。- 其他相关函数:
fData(eSet)
:提取特征(如基因)的注释信息。exprs(eSet)
:提取表达矩阵。
补充理解什么是基因、什么是通路
若干个基因组成通路pathways
GO中(gene oncology,基因本体)GO分析都是用cluster profile 细胞组分、分子功能、生物过程(多种功能,一种功能包括了多种步骤)
GO分析差异分析
富集分析:衡量每个通路里的基因在差异基因里是否足够多
富集分析可视化
- barplot—条状图
- dotplot—气泡图
对于不同的测序手段(芯片、RNA-seq、单细胞)等等,富集分析的过程是一样的(就套同一套这个代码就行了),只是差异基因的分析过程不一样
目前就支持人、小鼠、大鼠
destdir=tempdir()到底什么意思?没听懂
多分组数据
提取分组信息
Group=str_split(pd$title,"-",simplify = T)[,3]
Group=factor(Group,levels = c("NonObese","Obese","MObese"))
pd$title
:这部分指的是数据框pd
中名为title
的列。
str_split(pd$title,"-",simplify = T)
:这是一个来自stringr
包的函数,用于分割字符串。str_split
函数将title
列中的每个字符串按照 "-" 符号分割。参数simplify = T
(或simplify = TRUE
)的意思是返回一个简化版本,即不返回一个列表,而是直接返回分割后的向量。
[,3]
:这部分是一个索引,表示从分割后的向量中选择第三列。在这种情况下,假设title
列中的字符串是由 "-" 分隔的,那么分割后会得到多个部分,这个索引就是选择每个字符串分割后的第三个部分。
Group
:这是左侧变量的名称,表示这个操作将作用于Group
变量。
factor()
:这是R语言中用于创建因子的函数。因子是R中一种特殊的数据类型,用于表示分类数据。因子可以看作是整数的标签,这些整数对应于数据集中的分类水平。
levels = c("NonObese","Obese","MObese")
:这是factor()
函数的一个参数,用于指定因子的水平。levels
参数定义了因子可能取的所有值,这些值按照它们在c()
函数中出现的顺序排列。具体来说,这段代码的作用是:
- 将
Group
变量转换为因子类型,从而赋予了non- obese、obese和M-obese三组“顺序”- 明确指定这个因子的三个水平为
"NonObese"
、"Obese"
和"MObese"
。
什么是因子Factor?
因子(Factor) 是R语言中用于存储分类数据的特殊数据类型。它可以看作是对字符型数据的扩展,赋予了这些数据更多的结构和含义。
为什么使用因子?
- 有序性: 可以指定因子的水平(level)的顺序,例如,学历可以分为“小学”、“初中”、“高中”、“大学”,因子可以明确表示这种顺序关系。通过定义levels的向量来定义factors中的数据
- 唯一性: 因子的每个水平都是唯一的,避免了重复的标签。
- 统计分析: R语言中的许多统计模型和函数都要求变量是因子型,以便进行分类分析、方差分析等。
创建因子
代码段# 创建一个简单的因子 gender <- factor(c("男", "女", "男", "女")) gender # 创建一个有序因子 education <- factor(c("初中", "大学", "小学", "大学"), levels = c("小学", "初中", "高中", "大学"), ordered = TRUE) education
因子的属性
- levels: 因子所有可能的取值。
- class: 始终为"factor"。
- ordered: 表示因子是否是有序的。
因子的应用
- 分类变量的表示: 如性别、种族、学历等。
- 分组分析: 可以根据因子进行分组,计算组内统计量。
- 模型建模: 在线性模型、方差分析、逻辑回归等模型中,因子常作为自变量。
- 可视化: 用于创建箱线图、条形图等可视化图形。
示例代码段
# 生成一些随机数据 set.seed(123) data <- data.frame( group = factor(rep(c("A", "B", "C"), each = 10)), value = rnorm(30) ) # 计算组均值 library(dplyr) data %>% group_by(group) %>% summarize(mean_value = mean(value)) # 绘制箱线图 library(ggplot2) ggplot(data, aes(x = group, y = value)) + geom_boxplot()
小结
因子是R语言中非常重要的数据类型,它为分类数据的分析提供了便利。通过合理地使用因子,可以更好地理解数据,进行更深入的统计分析。
总结来说,因子就是给分类数据加上一层标签,让R知道这些数据不是简单的文字,而是具有特定含义的类别。
差异分析
富集分析
分别做三次或者合集一起做或者2-2做一堆富集分析都可以
多数据联合分析
batch effect一般可以从箱线图或者PCA图看出端倪
利用专门的函数limma removebatcheffect函数
SVA里的combat函数(??是这么写的吗?
右边是去除batch effect之后的
其实可以看着帮助文档自己学
WCGNA加权基因共表达网络
加权共表达网络:1️⃣找到与表型最相关的一组基因2️⃣必须得是数值型
调整软阈值之后,当第一次大概出现无标度网络时就是合适的软阈值
模块的颜色不能太少,灰色事没有分到任何一个基因模块,灰色之外是青涩
把横纵坐标都大于0.8的都拿出来说明有重要关系
给所有的基因打个分,然后获得分数进一步评价
对角线上的红圈圈,拓扑重叠曲,说明相似性是比较好的
数据预处理
表达矩阵数据整理
行是样本、列是基因
后面就没详细讲了,需要做的话就按注释里写的再去详细看详细学习吧
表型数据整理
聚类和热图——
WGCNA正式开始
软阈值
构建网络:提供上一步得到的软阈值
按照给的代码去套就行了
PPI蛋白蛋白互作网络
有个网页工具:string 就用网页工具做就行
输入差异基因
输出ppi图
放入cytoscape进行网络可视化
寻找hub基因和子网络
什么是hub基因:就像前面无标度网络里提到的,一些和别的节点连接比较多的节点,这些节点就称为hub节点或者叫hub基因(比较重要的、牵扯比较多基因的“重要一点的、中心的”基因)
什么是子网络:大网络中的基因数量太多了,需要缩小一下范围,可以使用子网络进行筛选
寻找hub基因-插件cytohubba
自网络-插件Mcode
参考ppt里的截图
网络药理学的扩展
参考ppt
R语言与机器学习
101种机器学习算法组合