高维转录分析是一种先进的技术,可同时分析单个细胞中数千个基因的基因表达模式。这种方法由单细胞 RNA 测序 (scRNA-seq) 和空间转录组学等技术提供支持,可捕获异质细胞群内复杂的转录景观,从而深入了解组织内或发育阶段的细胞状态、功能和相互作用。
High-dimensional transcriptional profiling of cells | ViaDean
参考文献
在 MATLAB 中进行高维转录分析(例如单细胞 RNA 测序 scRNA-seq 分析)可以使用以下步骤,包括数据导入、预处理、降维、聚类和差异表达分析。 MATLAB 的矩阵操作能力和工具箱(如统计和机器学习工具箱)提供了高效的分析手段。
以下是高维转录分析的步骤:
使用 readmatrix
导入基因表达数据,通常数据表包含基因名称和细胞的表达值。
% 读取数据
data = readmatrix('gene_expression.csv'); % 数据格式:行 = 基因, 列 = 细胞
genes = data(:,1); % 假设第一列为基因名称
counts_matrix = data(:,2:end); % 提取基因表达矩阵
过滤表达较低的细胞和基因以提高分析质量。
% 计算每个细胞和基因的计数
cell_counts = sum(counts_matrix, 1);
gene_counts = sum(counts_matrix, 2);
% 设置过滤标准
min_gene_threshold = 200; % 每个细胞最少基因数
min_cell_threshold = 10; % 每个基因最少细胞数
% 筛选满足条件的细胞和基因
filtered_cells = cell_counts > min_gene_threshold;
filtered_genes = gene_counts > min_cell_threshold;
% 过滤表达矩阵
counts_matrix_filtered = counts_matrix(filtered_genes, filtered_cells);
genes_filtered = genes(filtered_genes);
使用每个细胞的总表达值进行归一化,然后取对数转换。
% 归一化每个细胞的总计数
total_counts_per_cell = sum(counts_matrix_filtered, 1);
normalized_counts = counts_matrix_filtered ./ total_counts_per_cell;
% 对数转换
log_normalized_counts = log1p(normalized_counts);
使用 PCA 降维并可视化。
% 中心化数据
data_centered = log_normalized_counts - mean(log_normalized_counts, 2);
% 执行 PCA
[coeff, score, ~, ~, explained] = pca(data_centered');
% 选择前两个主成分绘制散点图
scatter(score(:,1), score(:,2));
title('PCA of Gene Expression');
xlabel('PC1');
ylabel('PC2');
对 PCA 降维结果进行聚类(如 K-means)。
k = 5; % 假设分为5类
idx = kmeans(score(:,1:10), k); % 使用前10个主成分
% 绘制聚类结果
gscatter(score(:,1), score(:,2), idx);
title('K-means Clustering on PCA-reduced Data');
xlabel('PC1');
ylabel('PC2');