美文网首页单细胞测序
R: scRNAseq scater分析单细胞转录组

R: scRNAseq scater分析单细胞转录组

作者: 胡童远 | 来源:发表于2021-08-11 21:09 被阅读0次

来自:Single-cell analysis toolkit for expression in R

1 安装依赖

# scater 数据可视化
if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
BiocManager::install("scater")
library("scater")

BiocManager::install("scRNAseq")
library("scRNAseq")

BioConductor
Collection of Public Single-Cell RNA-Seq Datasets
Single-Cell Analysis Toolkit for Gene Expression Data in R

2 数据获取

example_sce <- ZeiselBrainData()
example_sce

3 质控诊断

library(scater)
example_sce <- 
addPerCellQC(example_sce, 
  subsets=list(Mito=grep("mt-", rownames(example_sce))))
plotColData(example_sce, x = "sum", y="detected", colour_by="tissue") 

基因数随序列数增加而增加,点代表细胞,颜色代表组织

plotColData(example_sce, x = "sum", y="subsets_Mito_percent", 
    other_fields="tissue") + facet_wrap(~tissue)

单细胞中总序列数和线粒体(内参)百分比,好的细胞测序内参应较少

plotHighestExprs(example_sce, exprs_values = "counts")

top50基因在所有细胞中的表达量

example_sce <- logNormCounts(example_sce) 
vars <- getVarianceExplained(example_sce, 
    variables=c("tissue", "total mRNA mol", "sex", "age"))
head(vars)
plotExplanatoryVariables(vars)

各变量对基因表达变异的解释程度,密度图

4 基因表达值

plotExpression(example_sce, rownames(example_sce)[1:6], x = "level1class")

其中6个基因subset的表达值

plotExpression(example_sce, rownames(example_sce)[1:6],
    x = rownames(example_sce)[10])

6个基因subset的表达值与10号指标的关系图

plotExpression(example_sce, rownames(example_sce)[1:6],
    x = "level1class", colour_by="tissue")

着色

plotExpression(example_sce, rownames(example_sce)[1:6])

合并基因subset

5 维度分析

  • 主成分分析
example_sce <- runPCA(example_sce)
str(reducedDim(example_sce, "PCA"))
example_sce <- runPCA(example_sce, name="PCA2",
    subset_row=rownames(example_sce)[1:1000],
    ncomponents=25)
str(reducedDim(example_sce, "PCA2"))
  • 其他降维方法
set.seed(1000)
example_sce <- runTSNE(example_sce, perplexity=10)
head(reducedDim(example_sce, "TSNE"))
set.seed(1000)
example_sce <- runTSNE(example_sce, perplexity=50, 
    dimred="PCA", n_dimred=10)
head(reducedDim(example_sce, "TSNE"))
  • 降维可视化
plotReducedDim(example_sce, dimred = "PCA", colour_by = "level1class")
plotTSNE(example_sce, colour_by = "Snap25")
plotPCA(example_sce, colour_by="Mog")
example_sce <- runPCA(example_sce, ncomponents=20)
plotPCA(example_sce, ncomponents = 4, colour_by = "level1class")

不同组成份组合降维图

6 普通可视化

ggcells(example_sce, mapping=aes(x=level1class, y=Snap25)) + 
    geom_boxplot() +
    facet_wrap(~tissue)

snap25在不同细胞,组织中的表达

ggcells(example_sce, mapping=aes(x=TSNE.1, y=TSNE.2, colour=Snap25)) +
    geom_point() +
    stat_density_2d() +
    facet_wrap(~tissue) +
    scale_colour_distiller(direction=1)

snap25基因在所有细胞中表达降维分布

ggcells(example_sce, mapping=aes(x=sizeFactor, y=Actb)) +
    geom_point() +
    geom_smooth()

尺度与actb基因表达的关系

colnames(example_sce) <- make.names(colnames(example_sce))
ggfeatures(example_sce, mapping=aes(x=featureType, y=X1772062111_E06)) + 
    geom_violin()

指定细胞,feature type与表达值的关系,小提琴图

更多
代码分析 | 单细胞转录组Normalization详解
Single-cell analysis toolkit for expression in R
Assigning cell types with SingleR
Hemberg-lab单细胞转录组数据分析(十一)- Scater单细胞表达谱PCA可视化
scater 文献

相关文章

网友评论

    本文标题:R: scRNAseq scater分析单细胞转录组

    本文链接:https://www.haomeiwen.com/subject/bziqbltx.html