实验记录7:脾脏-聚类参数修改

作者: MC学公卫 | 来源:发表于2018-12-22 12:49 被阅读100次

    梗概

    根据实验记录3的结果,调整参数来查看是否有更优的结果。
    方法一:修改PC的选择
    方法二:提高resolution(分辨率)


    方法一:修改PC的选择

    细胞聚类

    resolution还是为0.6,PC选择从前10调整为前5.

    spleen1 <- FindClusters(spleen, reduction.type = "pca", dims.use = 1:5, resolution = 0.6, print.output = 0, save.SNN = TRUE)
    
    PrintFindClustersParams(spleen1)
    
    Parameters used in latest FindClusters calculation run on: 2018-11-14 23:09:41
    =============================================================================
    Resolution: 0.6
    -----------------------------------------------------------------------------
    Modularity Function    Algorithm         n.start         n.iter
         1                   1                 100             10
    -----------------------------------------------------------------------------
    Reduction used          k.param          prune.SNN
         pca                 30                0.0667
    -----------------------------------------------------------------------------
    Dims used in calculation
    =============================================================================
    1 2 3 4 5
    

    tSNE聚类

    spleen1 <- RunTSNE(spleen1, dims.use = 1:5, do.fast= TRUE)
    TSNEPlot(spleen1)
    
    tsne2.jpeg

    (保存图片的长度为900,高为500)
    跟用1-10个聚类结果相比多了一个cluster

    寻找细胞标志物

    spleen1.markers <- FindAllMarkers(object = spleen1, only.pos = TRUE, min.pct = 0.25, thresh.use = 0.25)
    print(x= head(x=spleen1.markers,n = 10))
    

    取每个cluster的最高两个FC值基因作为marker

    spleen1.markers %>% group_by(cluster) %>% top_n(2, avg_logFC)
    
    # A tibble: 20 x 7
    # Groups:   cluster [10]
           p_val avg_logFC pct.1 pct.2 p_val_adj cluster gene      
           <dbl>     <dbl> <dbl> <dbl>     <dbl> <fct>   <chr>     
     1 5.13e-185     1.59  0.971 0.262 8.03e-181 0       MS4A1     
     2 4.38e-175     1.49  0.968 0.274 6.86e-171 0       CD79A     
     3 2.34e- 84     0.882 0.748 0.198 3.66e- 80 1       VPREB3    
     4 3.58e- 81     1.27  0.715 0.219 5.60e- 77 1       CD83      
     5 1.72e- 81     1.14  1     0.815 2.69e- 77 2       HSPA1A    
     6 2.13e- 57     1.05  0.99  0.894 3.34e- 53 2       HSPA8     
     7 1.47e- 70     0.826 0.931 0.639 2.31e- 66 3       LDHB      
     8 1.19e- 64     0.878 0.869 0.354 1.87e- 60 3       TRAC      
     9 2.99e-132     1.84  0.843 0.185 4.67e-128 4       CMC1      
    10 1.43e- 73     2.17  0.628 0.158 2.24e- 69 4       CCL3      
    11 4.25e-125     5.16  0.894 0.186 6.66e-121 5       S100A9    
    12 8.83e-106     5.26  0.845 0.196 1.38e-101 5       S100A8    
    13 4.05e- 55     1.37  0.721 0.174 6.34e- 51 6       AC092580.4
    14 1.21e- 49     1.40  0.877 0.307 1.90e- 45 6       IL7R      
    15 1.92e- 84     2.56  1     0.156 3.01e- 80 7       GZMB      
    16 6.14e- 72     2.46  1     0.226 9.61e- 68 7       PRF1      
    17 2.67e- 57     2.62  1     0.233 4.19e- 53 8       STMN1     
    18 8.81e- 30     2.74  0.865 0.298 1.38e- 25 8       HIST1H4C  
    19 1.36e- 15     5.37  0.893 0.287 2.13e- 11 9       IGHG3     
    20 2.94e-  8     5.14  0.857 0.412 4.61e-  4 9       IGLC3     
    

    作图,查看基因在细胞里的表达情况,看是否与cluster匹配

    FeaturePlot(spleen1,features.plot = c("MS4A1","CD83","HSPA1A","TRAC","CCL3","S100A8","IL7R","GZMB","HIST1H4C","IGHG3"),cols.use = c("grey","blue"),reduction.use = "tsne")
    
    marker2.jpeg

    方法二:提高分辨率(resolution)

    spleen3 <- CreateSeuratObject(raw.data = spleen.data, min.cells = 3, min.genes = 200, project = "10X_spleen")
    spleen3 <- AddMetaData(object = spleen3, metadata = percent.mito, col.name = "percent.mito")
    spleen3 <- FilterCells(spleen3, subset.names = c("nGene", "percent.mito"), low.thresholds = c(300, -Inf), high.thresholds = c(5000,0.10))
    spleen3
    spleen3 <- NormalizeData(object=spleen3, normalization.method = "LogNormalize", scale.factor = 10000)
    spleen3 <- FindVariableGenes(object = spleen3, mean.function = ExpMean, dispersion.function = LogVMR, x.low.cutoff = 0.0125, x.high.cutoff = 3, y.cutoff = 0.5)
    spleen3 <-ScaleData(spleen3, vars.to.regress = c("nUMI","percent.mito"))
    spleen3 <- RunPCA(spleen3, pc.genes = spleen@var.genes, do.print = TRUE, pcs.print = 1:5, genes.print = 5)
    spleen3 <- FindClusters(spleen3, reduction.type = "pca", dims.use = 1:10, resolution = 1.0, print.output = 0, save.SNN = TRUE)
    PrintFindClustersParams(spleen3)
    spleen3 <- RunTSNE(spleen3, dims.use = 1:10, do.fast= TRUE)
    TSNEPlot(spleen3)
    

    步骤与实验记录3相同,但是在执行FindClusters命令时,将resolution=0.6提高为1.0
    结果:

    tSNE3(resolution=1.0).jpeg
    与resolution=0.6聚类形状没有差异,但是多了一个cluster。
    对比resolution=0.6的结果:
    tSNE(resolution=0.6).jpeg

    寻找细胞标志物

    spleen3.markers <- FindAllMarkers(object = spleen3, only.pos = TRUE, min.pct = 0.25, thresh.use = 0.25)
    

    取每个cluster的最高两个FC值基因作为marker

    spleen3.markers %>% group_by(cluster) %>% top_n(2, avg_logFC)
    
    # A tibble: 20 x 7
    # Groups:   cluster [10]
           p_val avg_logFC pct.1 pct.2 p_val_adj cluster gene      
           <dbl>     <dbl> <dbl> <dbl>     <dbl> <fct>   <chr>     
     1 4.75e-189     1.59  0.974 0.259 7.43e-185 0       MS4A1     
     2 2.16e-177     1.49  0.971 0.27  3.38e-173 0       CD79A     
     3 2.14e- 76     1.25  0.709 0.223 3.36e- 72 1       CD83      
     4 2.25e- 31     0.896 0.546 0.258 3.52e- 27 1       MYC       
     5 1.69e- 91     1.30  1     0.817 2.65e- 87 2       HSPA1A    
     6 7.43e- 21     1.39  0.38  0.162 1.16e- 16 2       IFNG      
     7 5.29e- 55     0.960 0.911 0.379 8.27e- 51 3       TRAC      
     8 1.57e- 46     0.836 0.853 0.347 2.46e- 42 3       CD3D      
     9 1.48e- 72     1.56  0.841 0.291 2.32e- 68 4       IL7R      
    10 1.56e- 28     1.15  0.495 0.179 2.44e- 24 4       AC092580.4
    11 1.57e- 89     1.60  0.988 0.328 2.46e- 85 5       CCL5      
    12 2.93e- 41     1.27  0.553 0.158 4.58e- 37 5       GZMK      
    13 3.35e-121     5.14  0.878 0.186 5.25e-117 6       S100A9    
    14 4.17e-104     5.24  0.835 0.195 6.53e-100 6       S100A8    
    15 2.26e- 61     2.13  0.758 0.179 3.53e- 57 7       CCL3      
    16 2.87e- 15     1.92  0.570 0.295 4.49e- 11 7       HIST1H4C  
    17 6.53e-112     2.62  0.926 0.144 1.02e-107 8       GNLY      
    18 5.25e-104     2.34  0.981 0.21  8.22e-100 8       PRF1      
    19 4.39e- 25     5.56  0.923 0.283 6.87e- 21 9       IGHG3     
    20 1.65e- 19     5.22  0.897 0.332 2.59e- 15 9       IGHG1   
    

    作图,查看基因在细胞里的表达情况,看是否与cluster匹配

    FeaturePlot(spleen3,features.plot = c("MS4A1","CD83","IFNG","TRAC","IL7R","CCL5","S100A8","CCL3","GNLY","IGHG3"),cols.use = c("grey","blue"),reduction.use = "tsne")
    

    相关文章

      网友评论

        本文标题:实验记录7:脾脏-聚类参数修改

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