给定一个基因表达矩阵,完成以下任务:
(1)利用主成分分析(PCA)对基因表达矩阵进行降维,并绘制PCA图。
(2)筛选在所有样本中表达值均大于0的所有基因。
(3)做聚类分析并绘制基因表达热图。
基因表达矩阵范例:
| Gene | SRR8197410 | SRR8197409 | SRR8197412 | SRR8197411 | SRR8197414 |
|---|---|---|---|---|---|
| Zm00001d027236 | 0.7017 | 0.5646 | 0.3444 | 0 | 0.6171 |
| Zm00001d027230 | 2.1550 | 1.9702 | 2.3504 | 1.9531 | 2.3032 |
| Zm00001d027231 | 6.1641 | 6.5401 | 5.8862 | 6.0108 | 6.1277 |
| Zm00001d027239 | 4.9889 | 5.9224 | 5.7381 | 4.9829 | 5.0459 |
library(ggplot2)
library(pheatmap)
library(stats)
data <- read.table("基因表达矩阵", header=TRUE, row.names=1)
res.pca <- prcomp(t(data))
fviz_pca_var(res.pca, col.var = "black")#1
filtered_genes <- rownames(data)[apply(data, 1, function(x) all(x > 0))]
filtered_data <- data[filtered_genes,]#2
pheatmap(log2(filtered_data + 1), scale="row", clustering_method="complete")#3
基于PCA和聚类分析的基因表达数据处理与可视化
本文介绍了如何使用PCA对基因表达矩阵进行降维,并筛选出所有样本中表达值大于0的基因。随后,对筛选后的数据进行了聚类分析并生成了基因表达热图。
443

被折叠的 条评论
为什么被折叠?



