# 5.3.3 scRNA的3大R包对比

> 将主要介绍Seurat V2、V3、Scater、Monocle V2、Monocle V3之间的差异\
> **表格可以左右滑动哦！**

|           用法          |                                Seurat 2.x                               |                                     Seurat 3.x                                     | Scater                                                                                                                     | Monocle2.x                                                                                                                                                                    | Monocle3.x                                                                                                                    |
| :-------------------: | :---------------------------------------------------------------------: | :--------------------------------------------------------------------------------: | -------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
|       创建R包要求的对象       |                           CreateSeuratObject()                          |                    函数不变，参数取消了raw\.data，min.genes更改为min.features                    | SingleCellExperiment()                                                                                                     | newCellDataSet()，其中的phenoData、featureData参数都是用new()建立的AnnotatedDataFrame对象                                                                                                    | new\_cell\_data\_set()，其中的cell\_metadata、gene\_metadata参数都是数据框                                                                |
|         添加注释信息        |                              AddMetaData()                              |                        AddMetaData()或者直接通过object$meta\_name                        | 可以直接使用sce$meta\_name                                                                                                       | addCellType()添加细胞类型                                                                                                                                                           | 可以用基础R函数                                                                                                                      |
| QC and selecting cell |                              <sce@raw.data>                             |                                   GetAssayData()                                   | calculateQCMetrics(),其中的feature\_controls参数可以指定过滤指标，然后有一系列的可视化函数。过滤用filter()或isOutlier()                                   | 用基础R函数进行初步过滤，还可以用detectGenes()函数加上subset()过滤                                                                                                                                  | 用基础R函数进行初步过滤                                                                                                                  |
|      表达量的标准化或者归一化     |                     NormalizeData()，归一化后检测用sce\@data                    |                        NormalizeData()，归一化后检测用sce\[\['RNA']]                       | 计算CPM：calculateCPM()、归一化：normalize()                                                                                       | estimateSizeFactors()还有estimateDispersions                                                                                                                                    | preprocess\_cds()                                                                                                             |
|        寻找重要的基因        |                           FindVariableGenes()                           |                           FindVariableFeatures()，其中算法有变动                           | 没有专门函数                                                                                                                     | differentialGeneTest()函数                                                                                                                                                      | 版本3和版本2的差异分析可以说是完全不同，版本3取代了2中的differentialGeneTest() and BEAM()。它利用fit\_models()或graph\_test()                                |
|         去除干扰因素        |                    ScaleData()，结果存储在<sce@scale.data>中                   |                     ScaleData()，结果存储在sce\[\["RNA"]]@scale.data中                    | limma的removeBatchEffect()、scran的mnnCorrect()                                                                               | 去除干扰因素的功能被包装在降维函数中                                                                                                                                                            | preprocess\_cds()中指定参数residual\_model\_formula\_str                                                                           |
|           降维          | PCA：RunPCA()，参数pc.genes，结果存储在sce\@dr$<pca@gene.loadings> tSNE：RunTSNE() | PCA：RunPCA()，参数features，结果存储在sce\@reductions$<pca@feature.loadings> tSNE：RunTSNE() | PCA：runPCA()，结果在reducedDims中； tSNE：runTSNE()                                                                               | reduceDimension函数，可以选择多种参数                                                                                                                                                    | reduce\_dimension()，算法包括UMAP", "tSNE", "PCA" and "LSI"                                                                        |
|         降维后可视化        |                   VizPCA和PCElbowPlot;PCAPlot或者TSNEPlot                  |                 VizDimLoadings()、DimPlot()、DimHeatmap()、ElbowPlot()                | plotReducedDim()、plotPCA()                                                                                                 | plot\_cell\_clusters()                                                                                                                                                        | plot\_cells()                                                                                                                 |
|          细胞聚类         |                              FindClusters()                             |                          FindNeighbors() + FindClusters()                          | 没有包装聚类函数，可以辅助其它R包，或者R基础函数                                                                                                  | clusterCells()                                                                                                                                                                | cluster\_cells()，依赖一个Python模块louvain                                                                                          |
|       找marker基因       |                      FindMarkers()或FindAllMarkers()                     |              FindMarkers()或FindAllMarkers()，VlnPlot()、FeaturePlot()可视化             | 借助SC3包                                                                                                                     | newCellTypeHierarchy()、 classifyCells()                                                                                                                                       | top\_markers()                                                                                                                |
|          绘图相关         |       基因相关性绘图：GenePlot()；细胞相关性绘图：CellPlot()，选择细胞用<sce@cell.names>       |          基因相关性绘图：FeatureScatter()；细胞相关性绘图：CellScatter()，选择细胞用colnames(sce)         | 基因相关性绘图：绘制基因表达相关plotExpression()；检测高表达基因plotHighestExprs()、表达频率plotExprsFreqVsMean()、细胞质控plotColData()、表达量累计贡献plotScater() | plot\_cell\_trajectory()、plot\_genes\_in\_pseudotime()、plot\_genes\_jitter()、plot\_pseudotime\_heatmap()、plot\_genes\_branched\_heatmap()、plot\_genes\_branched\_pseudotime() | plot\_pc\_variance\_explained()、对每组的marker基因可视化： plot\_genes\_by\_group()、3D发育轨迹plot\_cells\_3d()、画小提琴图：plot\_genes\_violin() |
