美文网首页
单细胞测序分析-小测

单细胞测序分析-小测

作者: xmu_zhang_lab | 来源:发表于2019-12-04 11:41 被阅读0次

    https://osca.bioconductor.org/learning-r-and-more.html#getting-help-in-and-out-of-r

    if(!require("scRNAseq")) BiocManager::install("scRNAseq")
    if(!require("scater")) BiocManager::install("scater")
    if(!require("scran")) BiocManager::install("scran")
    
    ## 从scRNA数据包中提取测试数据
    library(scRNAseq)
    sce <- MacoskoRetinaData()
    
    library(scater)
    is.mito <- grepl("^MT-", rownames(sce))
    qcstats <- perCellQCMetrics(sce, subsets=list(Mito=is.mito))
    
    filtered <- quickPerCellQC(qcstats, percent_subsets="subsets_Mito_percent")
    sce <- sce[, !filtered$discard]
    
    # 数据矫正:normalization
    sce <- logNormCounts(sce)
    
    # 特征选择: Feature selection.
    
    if(!require("scran")) BiocManager::install("scran")
    library(scran)
    dec <- modelGeneVar(sce)
    hvg <- getTopHVGs(dec, prop=0.1)
    
    # 降维分析
    set.seed(1234)
    sce <- runPCA(sce, ncomponents=25, subset_row=hvg)
    sce <- runUMAP(sce, dimred = 'PCA', external_neighbors=TRUE)
    
    # 聚类分析
    g <- buildSNNGraph(sce, use.dimred = 'PCA')
    sce$clusters <- factor(igraph::cluster_louvain(g)$membership)
    
    # 可视化
    plotUMAP(sce, colour_by="clusters")
    
    image.png

    相关文章

      网友评论

          本文标题:单细胞测序分析-小测

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