Monocle3+10X(cellranger) scRNA-S

2022-03-21  本文已影响0人  Big圈圈圆圆

导入包

library(monocle3)
library(dplyr)

导入10X表达数据

cds <- load_mm_data(mat_path = "./matrix.mtx.gz", 
                    feature_anno_path = "./features.tsv.gz", 
                    cell_anno_path = "./barcodes.tsv.gz")

数据预处理

cds <- preprocess_cds(cds, num_dim = 100)

去批次效应

# cds <- align_cds(cds, alignment_group = "batch") # 报错:Error: 
cds <- align_cds(cds)

降维和可视化结果

cds <- reduce_dimension(cds)

 alignment_group:subscript contains invalid names
String specifying a column of colData to use for aligning groups of cells. The column specified must be a factor. Alignment can be used to subtract batch effects in a non-linear way. For correcting continuous effects, use residual_model_formula_str. Default is NULL。可以看到需要我们指定一列来作为比对组。
 而我通过cellranger获得的表达矩阵等三个数据中,不包含批次信息。因此我才用默认设置。


barcodes.png
features.png
Matrix.png

细胞聚类

# ln -s /opt/conda/pkgs/libgfortran4-7.5.0-h14aa051_20/lib/libgfortran.so.4.0.0 /usr/lib64/libgfortran.so.4
cds = cluster_cells(cds, resolution=1e-5)

注释细胞类型

colData(cds)$assigned_cell_type <- as.character(clusters(cds))

学习轨迹图

cds <- learn_graph(cds)
cds <- order_cells(cds)
上一篇 下一篇

猜你喜欢

热点阅读