cola Report for GDS4762

Date: 2019-12-25 21:48:35 CET, cola version: 1.3.2

Document is loading...


Summary

All available functions which can be applied to this res_list object:

res_list
#> A 'ConsensusPartitionList' object with 24 methods.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows are extracted by 'SD, CV, MAD, ATC' methods.
#>   Subgroups are detected by 'hclust, kmeans, skmeans, pam, mclust, NMF' method.
#>   Number of partitions are tried for k = 2, 3, 4, 5, 6.
#>   Performed in total 30000 partitions by row resampling.
#> 
#> Following methods can be applied to this 'ConsensusPartitionList' object:
#>  [1] "cola_report"           "collect_classes"       "collect_plots"         "collect_stats"        
#>  [5] "colnames"              "functional_enrichment" "get_anno_col"          "get_anno"             
#>  [9] "get_classes"           "get_matrix"            "get_membership"        "get_stats"            
#> [13] "is_best_k"             "is_stable_k"           "ncol"                  "nrow"                 
#> [17] "rownames"              "show"                  "suggest_best_k"        "test_to_known_factors"
#> [21] "top_rows_heatmap"      "top_rows_overlap"     
#> 
#> You can get result for a single method by, e.g. object["SD", "hclust"] or object["SD:hclust"]
#> or a subset of methods by object[c("SD", "CV")], c("hclust", "kmeans")]

The call of run_all_consensus_partition_methods() was:

#> run_all_consensus_partition_methods(data = mat, mc.cores = 4, anno = anno)

Dimension of the input matrix:

mat = get_matrix(res_list)
dim(mat)
#> [1] 31589    80

Density distribution

The density distribution for each sample is visualized as in one column in the following heatmap. The clustering is based on the distance which is the Kolmogorov-Smirnov statistic between two distributions.

library(ComplexHeatmap)
densityHeatmap(mat, top_annotation = HeatmapAnnotation(df = get_anno(res_list), 
    col = get_anno_col(res_list)), ylab = "value", cluster_columns = TRUE, show_column_names = FALSE,
    mc.cores = 4)

plot of chunk density-heatmap

Suggest the best k

Folowing table shows the best k (number of partitions) for each combination of top-value methods and partition methods. Clicking on the method name in the table goes to the section for a single combination of methods.

The cola vignette explains the definition of the metrics used for determining the best number of partitions.

suggest_best_k(res_list)
The best k 1-PAC Mean silhouette Concordance Optional k
SD:skmeans 3 1.000 0.999 1.000 ** 2
CV:skmeans 3 1.000 1.000 1.000 ** 2
MAD:hclust 6 1.000 0.999 1.000 ** 3
MAD:skmeans 2 1.000 0.962 0.985 **
MAD:pam 6 1.000 0.961 0.980 ** 3,4,5
ATC:kmeans 2 1.000 1.000 1.000 **
ATC:pam 6 1.000 0.964 0.985 ** 2,4,5
ATC:NMF 2 1.000 0.994 0.997 **
SD:NMF 4 0.988 0.955 0.966 ** 2,3
MAD:NMF 2 0.974 0.975 0.988 **
ATC:skmeans 4 0.968 0.974 0.972 ** 2,3
CV:pam 3 0.962 0.957 0.982 **
ATC:mclust 6 0.958 0.956 0.945 ** 5
SD:pam 3 0.926 0.927 0.969 *
CV:NMF 5 0.916 0.867 0.916 * 3,4
SD:hclust 6 0.915 0.883 0.939 *
ATC:hclust 6 0.912 0.873 0.915 * 3,4
MAD:kmeans 2 0.902 0.947 0.966 *
MAD:mclust 5 0.876 0.908 0.942
SD:mclust 5 0.817 0.798 0.888
CV:mclust 5 0.803 0.863 0.902
CV:hclust 3 0.795 0.879 0.946
CV:kmeans 3 0.666 0.899 0.878
SD:kmeans 2 0.487 0.784 0.874

**: 1-PAC > 0.95, *: 1-PAC > 0.9

CDF of consensus matrices

Cumulative distribution function curves of consensus matrix for all methods.

collect_plots(res_list, fun = plot_ecdf)

plot of chunk collect-plots

Consensus heatmap

Consensus heatmaps for all methods. (What is a consensus heatmap?)

collect_plots(res_list, k = 2, fun = consensus_heatmap, mc.cores = 4)

plot of chunk tab-collect-consensus-heatmap-1

collect_plots(res_list, k = 3, fun = consensus_heatmap, mc.cores = 4)

plot of chunk tab-collect-consensus-heatmap-2

collect_plots(res_list, k = 4, fun = consensus_heatmap, mc.cores = 4)

plot of chunk tab-collect-consensus-heatmap-3

collect_plots(res_list, k = 5, fun = consensus_heatmap, mc.cores = 4)

plot of chunk tab-collect-consensus-heatmap-4

collect_plots(res_list, k = 6, fun = consensus_heatmap, mc.cores = 4)

plot of chunk tab-collect-consensus-heatmap-5

Membership heatmap

Membership heatmaps for all methods. (What is a membership heatmap?)

collect_plots(res_list, k = 2, fun = membership_heatmap, mc.cores = 4)

plot of chunk tab-collect-membership-heatmap-1

collect_plots(res_list, k = 3, fun = membership_heatmap, mc.cores = 4)

plot of chunk tab-collect-membership-heatmap-2

collect_plots(res_list, k = 4, fun = membership_heatmap, mc.cores = 4)

plot of chunk tab-collect-membership-heatmap-3

collect_plots(res_list, k = 5, fun = membership_heatmap, mc.cores = 4)

plot of chunk tab-collect-membership-heatmap-4

collect_plots(res_list, k = 6, fun = membership_heatmap, mc.cores = 4)

plot of chunk tab-collect-membership-heatmap-5

Signature heatmap

Signature heatmaps for all methods. (What is a signature heatmap?)

Note in following heatmaps, rows are scaled.

collect_plots(res_list, k = 2, fun = get_signatures, mc.cores = 4)

plot of chunk tab-collect-get-signatures-1

collect_plots(res_list, k = 3, fun = get_signatures, mc.cores = 4)

plot of chunk tab-collect-get-signatures-2

collect_plots(res_list, k = 4, fun = get_signatures, mc.cores = 4)

plot of chunk tab-collect-get-signatures-3

collect_plots(res_list, k = 5, fun = get_signatures, mc.cores = 4)

plot of chunk tab-collect-get-signatures-4

collect_plots(res_list, k = 6, fun = get_signatures, mc.cores = 4)

plot of chunk tab-collect-get-signatures-5

Statistics table

The statistics used for measuring the stability of consensus partitioning. (How are they defined?)

get_stats(res_list, k = 2)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      2 0.948           0.927       0.972          0.505 0.494   0.494
#> CV:NMF      2 0.866           0.928       0.961          0.496 0.499   0.499
#> MAD:NMF     2 0.974           0.975       0.988          0.506 0.495   0.495
#> ATC:NMF     2 1.000           0.994       0.997          0.492 0.509   0.509
#> SD:skmeans  2 0.924           0.955       0.981          0.505 0.494   0.494
#> CV:skmeans  2 1.000           0.957       0.983          0.505 0.494   0.494
#> MAD:skmeans 2 1.000           0.962       0.985          0.506 0.495   0.495
#> ATC:skmeans 2 1.000           1.000       1.000          0.491 0.509   0.509
#> SD:mclust   2 0.339           0.812       0.865          0.364 0.724   0.724
#> CV:mclust   2 0.379           0.891       0.893          0.441 0.556   0.556
#> MAD:mclust  2 0.357           0.817       0.871          0.456 0.509   0.509
#> ATC:mclust  2 0.519           0.874       0.868          0.435 0.509   0.509
#> SD:kmeans   2 0.487           0.784       0.874          0.475 0.494   0.494
#> CV:kmeans   2 0.452           0.319       0.726          0.476 0.539   0.539
#> MAD:kmeans  2 0.902           0.947       0.966          0.500 0.495   0.495
#> ATC:kmeans  2 1.000           1.000       1.000          0.491 0.509   0.509
#> SD:pam      2 0.814           0.918       0.964          0.504 0.495   0.495
#> CV:pam      2 0.810           0.896       0.954          0.504 0.495   0.495
#> MAD:pam     2 0.898           0.964       0.981          0.504 0.495   0.495
#> ATC:pam     2 1.000           1.000       1.000          0.491 0.509   0.509
#> SD:hclust   2 0.400           0.831       0.896          0.463 0.495   0.495
#> CV:hclust   2 0.473           0.862       0.905          0.471 0.495   0.495
#> MAD:hclust  2 0.838           0.914       0.959          0.500 0.502   0.502
#> ATC:hclust  2 0.624           0.914       0.957          0.483 0.509   0.509
get_stats(res_list, k = 3)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      3 0.927           0.922       0.969          0.323 0.710   0.480
#> CV:NMF      3 1.000           0.966       0.986          0.348 0.748   0.534
#> MAD:NMF     3 0.747           0.822       0.923          0.309 0.717   0.491
#> ATC:NMF     3 0.736           0.888       0.875          0.248 0.867   0.739
#> SD:skmeans  3 1.000           0.999       1.000          0.322 0.750   0.535
#> CV:skmeans  3 1.000           1.000       1.000          0.323 0.750   0.535
#> MAD:skmeans 3 0.641           0.734       0.792          0.283 0.830   0.669
#> ATC:skmeans 3 1.000           0.999       0.999          0.270 0.867   0.739
#> SD:mclust   3 0.685           0.740       0.880          0.832 0.478   0.335
#> CV:mclust   3 0.522           0.738       0.873          0.452 0.714   0.512
#> MAD:mclust  3 0.574           0.754       0.858          0.399 0.740   0.525
#> ATC:mclust  3 0.789           0.834       0.887          0.480 0.835   0.685
#> SD:kmeans   3 0.655           0.844       0.855          0.362 0.750   0.535
#> CV:kmeans   3 0.666           0.899       0.878          0.362 0.718   0.511
#> MAD:kmeans  3 0.566           0.657       0.739          0.274 0.836   0.679
#> ATC:kmeans  3 0.788           0.943       0.912          0.247 0.867   0.739
#> SD:pam      3 0.926           0.927       0.969          0.318 0.689   0.452
#> CV:pam      3 0.962           0.957       0.982          0.324 0.689   0.452
#> MAD:pam     3 0.906           0.941       0.975          0.278 0.796   0.612
#> ATC:pam     3 0.830           0.910       0.940          0.297 0.853   0.714
#> SD:hclust   3 0.703           0.860       0.929          0.381 0.862   0.721
#> CV:hclust   3 0.795           0.879       0.946          0.368 0.862   0.721
#> MAD:hclust  3 0.926           0.927       0.968          0.205 0.916   0.832
#> ATC:hclust  3 0.926           0.929       0.969          0.315 0.867   0.739
get_stats(res_list, k = 4)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      4 0.988           0.955       0.966         0.0880 0.893   0.701
#> CV:NMF      4 1.000           0.985       0.991         0.0835 0.893   0.701
#> MAD:NMF     4 0.744           0.829       0.895         0.1158 0.836   0.570
#> ATC:NMF     4 0.793           0.833       0.884         0.1693 0.862   0.647
#> SD:skmeans  4 0.777           0.451       0.613         0.1005 0.721   0.400
#> CV:skmeans  4 0.861           0.862       0.854         0.0974 0.947   0.840
#> MAD:skmeans 4 0.777           0.877       0.892         0.1293 0.853   0.621
#> ATC:skmeans 4 0.968           0.974       0.972         0.0855 0.949   0.864
#> SD:mclust   4 0.633           0.670       0.820         0.0848 0.767   0.434
#> CV:mclust   4 0.791           0.799       0.875         0.1451 0.797   0.485
#> MAD:mclust  4 0.656           0.694       0.832         0.1443 0.733   0.373
#> ATC:mclust  4 0.881           0.905       0.951         0.0936 0.902   0.749
#> SD:kmeans   4 0.728           0.774       0.804         0.1208 1.000   1.000
#> CV:kmeans   4 0.748           0.808       0.827         0.1168 1.000   1.000
#> MAD:kmeans  4 0.617           0.695       0.723         0.1256 0.851   0.613
#> ATC:kmeans  4 0.803           0.720       0.819         0.1369 0.949   0.864
#> SD:pam      4 0.840           0.919       0.916         0.1121 0.914   0.744
#> CV:pam      4 0.865           0.928       0.912         0.1070 0.914   0.744
#> MAD:pam     4 0.955           0.945       0.977         0.1449 0.894   0.705
#> ATC:pam     4 1.000           0.957       0.961         0.1330 0.903   0.738
#> SD:hclust   4 0.792           0.833       0.895         0.1273 0.939   0.830
#> CV:hclust   4 0.849           0.874       0.923         0.1130 0.939   0.830
#> MAD:hclust  4 0.785           0.825       0.849         0.1558 0.901   0.763
#> ATC:hclust  4 0.973           0.902       0.965         0.0869 0.932   0.818
get_stats(res_list, k = 5)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      5 0.892           0.866       0.906         0.0619 0.930   0.749
#> CV:NMF      5 0.916           0.867       0.916         0.0586 0.934   0.763
#> MAD:NMF     5 0.801           0.732       0.858         0.0450 0.935   0.760
#> ATC:NMF     5 0.660           0.615       0.767         0.0671 0.916   0.724
#> SD:skmeans  5 0.802           0.865       0.897         0.0773 0.850   0.554
#> CV:skmeans  5 0.813           0.861       0.894         0.0790 0.904   0.665
#> MAD:skmeans 5 0.874           0.866       0.911         0.0805 0.937   0.763
#> ATC:skmeans 5 0.829           0.963       0.938         0.1166 0.904   0.704
#> SD:mclust   5 0.817           0.798       0.888         0.0917 0.923   0.716
#> CV:mclust   5 0.803           0.863       0.902         0.0680 0.973   0.895
#> MAD:mclust  5 0.876           0.908       0.942         0.0846 0.891   0.616
#> ATC:mclust  5 0.938           0.955       0.974         0.1363 0.867   0.584
#> SD:kmeans   5 0.744           0.561       0.730         0.0607 0.891   0.676
#> CV:kmeans   5 0.728           0.676       0.715         0.0656 0.886   0.658
#> MAD:kmeans  5 0.693           0.782       0.787         0.0723 0.930   0.738
#> ATC:kmeans  5 0.768           0.673       0.745         0.0720 0.905   0.708
#> SD:pam      5 0.841           0.831       0.910         0.0683 0.938   0.765
#> CV:pam      5 0.840           0.782       0.864         0.0640 0.962   0.852
#> MAD:pam     5 1.000           1.000       1.000         0.0786 0.930   0.738
#> ATC:pam     5 1.000           0.963       0.985         0.0861 0.933   0.757
#> SD:hclust   5 0.792           0.797       0.885         0.0482 0.929   0.767
#> CV:hclust   5 0.798           0.789       0.831         0.0524 0.981   0.936
#> MAD:hclust  5 0.886           0.925       0.910         0.0831 0.913   0.726
#> ATC:hclust  5 0.864           0.893       0.870         0.0991 0.905   0.692
get_stats(res_list, k = 6)
#>             k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> SD:NMF      6 0.837           0.773       0.855         0.0393 0.981   0.914
#> CV:NMF      6 0.836           0.770       0.870         0.0493 0.981   0.916
#> MAD:NMF     6 0.789           0.740       0.822         0.0417 0.929   0.704
#> ATC:NMF     6 0.655           0.558       0.664         0.0362 0.896   0.618
#> SD:skmeans  6 0.848           0.817       0.891         0.0404 0.977   0.888
#> CV:skmeans  6 0.843           0.828       0.887         0.0431 0.937   0.704
#> MAD:skmeans 6 0.881           0.858       0.907         0.0358 0.974   0.877
#> ATC:skmeans 6 0.940           0.897       0.896         0.0422 0.990   0.956
#> SD:mclust   6 0.864           0.774       0.882         0.0371 0.939   0.727
#> CV:mclust   6 0.876           0.874       0.923         0.0506 0.920   0.666
#> MAD:mclust  6 0.885           0.905       0.919         0.0274 0.987   0.933
#> ATC:mclust  6 0.958           0.956       0.945         0.0236 0.987   0.933
#> SD:kmeans   6 0.721           0.616       0.718         0.0468 0.901   0.623
#> CV:kmeans   6 0.715           0.646       0.731         0.0468 0.952   0.785
#> MAD:kmeans  6 0.701           0.749       0.758         0.0466 0.992   0.963
#> ATC:kmeans  6 0.723           0.811       0.796         0.0604 0.903   0.631
#> SD:pam      6 0.891           0.897       0.946         0.0470 0.942   0.737
#> CV:pam      6 0.893           0.901       0.946         0.0512 0.938   0.726
#> MAD:pam     6 1.000           0.961       0.980         0.0347 0.952   0.774
#> ATC:pam     6 1.000           0.964       0.985         0.0577 0.957   0.798
#> SD:hclust   6 0.915           0.883       0.939         0.0786 0.910   0.658
#> CV:hclust   6 0.840           0.828       0.847         0.0515 0.949   0.820
#> MAD:hclust  6 1.000           0.999       1.000         0.0704 0.962   0.836
#> ATC:hclust  6 0.912           0.873       0.915         0.0616 0.965   0.839

Following heatmap plots the partition for each combination of methods and the lightness correspond to the silhouette scores for samples in each method. On top the consensus subgroup is inferred from all methods by taking the mean silhouette scores as weight.

collect_stats(res_list, k = 2)

plot of chunk tab-collect-stats-from-consensus-partition-list-1

collect_stats(res_list, k = 3)

plot of chunk tab-collect-stats-from-consensus-partition-list-2

collect_stats(res_list, k = 4)

plot of chunk tab-collect-stats-from-consensus-partition-list-3

collect_stats(res_list, k = 5)

plot of chunk tab-collect-stats-from-consensus-partition-list-4

collect_stats(res_list, k = 6)

plot of chunk tab-collect-stats-from-consensus-partition-list-5

Partition from all methods

Collect partitions from all methods:

collect_classes(res_list, k = 2)

plot of chunk tab-collect-classes-from-consensus-partition-list-1

collect_classes(res_list, k = 3)

plot of chunk tab-collect-classes-from-consensus-partition-list-2

collect_classes(res_list, k = 4)

plot of chunk tab-collect-classes-from-consensus-partition-list-3

collect_classes(res_list, k = 5)

plot of chunk tab-collect-classes-from-consensus-partition-list-4

collect_classes(res_list, k = 6)

plot of chunk tab-collect-classes-from-consensus-partition-list-5

Top rows overlap

Overlap of top rows from different top-row methods:

top_rows_overlap(res_list, top_n = 1000, method = "euler")

plot of chunk tab-top-rows-overlap-by-euler-1

top_rows_overlap(res_list, top_n = 2000, method = "euler")

plot of chunk tab-top-rows-overlap-by-euler-2

top_rows_overlap(res_list, top_n = 3000, method = "euler")

plot of chunk tab-top-rows-overlap-by-euler-3

top_rows_overlap(res_list, top_n = 4000, method = "euler")

plot of chunk tab-top-rows-overlap-by-euler-4

top_rows_overlap(res_list, top_n = 5000, method = "euler")

plot of chunk tab-top-rows-overlap-by-euler-5

Also visualize the correspondance of rankings between different top-row methods:

top_rows_overlap(res_list, top_n = 1000, method = "correspondance")

plot of chunk tab-top-rows-overlap-by-correspondance-1

top_rows_overlap(res_list, top_n = 2000, method = "correspondance")

plot of chunk tab-top-rows-overlap-by-correspondance-2

top_rows_overlap(res_list, top_n = 3000, method = "correspondance")

plot of chunk tab-top-rows-overlap-by-correspondance-3

top_rows_overlap(res_list, top_n = 4000, method = "correspondance")

plot of chunk tab-top-rows-overlap-by-correspondance-4

top_rows_overlap(res_list, top_n = 5000, method = "correspondance")

plot of chunk tab-top-rows-overlap-by-correspondance-5

Heatmaps of the top rows:

top_rows_heatmap(res_list, top_n = 1000)

plot of chunk tab-top-rows-heatmap-1

top_rows_heatmap(res_list, top_n = 2000)

plot of chunk tab-top-rows-heatmap-2

top_rows_heatmap(res_list, top_n = 3000)

plot of chunk tab-top-rows-heatmap-3

top_rows_heatmap(res_list, top_n = 4000)

plot of chunk tab-top-rows-heatmap-4

top_rows_heatmap(res_list, top_n = 5000)

plot of chunk tab-top-rows-heatmap-5

Test to known annotations

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res_list, k = 2)
#>              n protocol(p) cell.type(p) k
#> SD:NMF      76    6.05e-07     3.68e-06 2
#> CV:NMF      79    3.39e-05     1.50e-08 2
#> MAD:NMF     80    1.22e-07     6.13e-05 2
#> ATC:NMF     80    1.10e-11     4.22e-01 2
#> SD:skmeans  80    1.36e-06     2.28e-06 2
#> CV:skmeans  77    4.63e-06     1.59e-07 2
#> MAD:skmeans 77    4.05e-07     8.12e-06 2
#> ATC:skmeans 80    1.10e-11     4.22e-01 2
#> SD:mclust   80    1.22e-07     8.06e-04 2
#> CV:mclust   80    9.82e-09     1.94e-03 2
#> MAD:mclust  80    1.10e-11     4.22e-01 2
#> ATC:mclust  80    1.10e-11     4.22e-01 2
#> SD:kmeans   73    2.04e-06     2.19e-07 2
#> CV:kmeans   50    1.35e-04     4.90e-09 2
#> MAD:kmeans  80    1.22e-07     6.13e-05 2
#> ATC:kmeans  80    1.10e-11     4.22e-01 2
#> SD:pam      74    1.36e-06     6.10e-07 2
#> CV:pam      72    3.06e-06     7.12e-08 2
#> MAD:pam     80    1.22e-07     6.13e-05 2
#> ATC:pam     80    1.10e-11     4.22e-01 2
#> SD:hclust   76    6.05e-07     3.68e-06 2
#> CV:hclust   80    3.07e-06     6.59e-07 2
#> MAD:hclust  73    1.81e-07     1.42e-05 2
#> ATC:hclust  80    1.10e-11     4.22e-01 2
test_to_known_factors(res_list, k = 3)
#>              n protocol(p) cell.type(p) k
#> SD:NMF      77    5.49e-11     2.79e-10 3
#> CV:NMF      79    1.78e-10     2.17e-10 3
#> MAD:NMF     73    5.52e-12     1.39e-07 3
#> ATC:NMF     79    1.71e-14     1.03e-04 3
#> SD:skmeans  80    2.40e-10     5.36e-11 3
#> CV:skmeans  80    2.40e-10     5.36e-11 3
#> MAD:skmeans 70    7.45e-12     3.09e-09 3
#> ATC:skmeans 80    9.12e-15     1.26e-04 3
#> SD:mclust   65    3.09e-11     7.96e-10 3
#> CV:mclust   68    1.93e-10     2.24e-08 3
#> MAD:mclust  73    3.39e-15     1.25e-05 3
#> ATC:mclust  76    1.17e-12     3.47e-03 3
#> SD:kmeans   80    2.40e-10     5.36e-11 3
#> CV:kmeans   80    2.40e-10     5.36e-11 3
#> MAD:kmeans  70    1.92e-12     5.88e-08 3
#> ATC:kmeans  80    9.12e-15     1.26e-04 3
#> SD:pam      78    1.82e-10     2.94e-10 3
#> CV:pam      79    1.78e-10     2.17e-10 3
#> MAD:pam     79    4.03e-14     1.29e-05 3
#> ATC:pam     79    1.71e-14     1.03e-04 3
#> SD:hclust   76    5.29e-11     1.09e-07 3
#> CV:hclust   74    4.44e-09     1.12e-11 3
#> MAD:hclust  74    3.24e-08     4.57e-10 3
#> ATC:hclust  74    3.84e-13     1.93e-05 3
test_to_known_factors(res_list, k = 4)
#>              n protocol(p) cell.type(p) k
#> SD:NMF      80    5.59e-11     3.07e-17 4
#> CV:NMF      80    5.59e-11     3.07e-17 4
#> MAD:NMF     78    6.04e-11     8.24e-17 4
#> ATC:NMF     73    8.77e-19     1.04e-06 4
#> SD:skmeans  35    5.66e-08     5.81e-06 4
#> CV:skmeans  77    6.46e-16     2.62e-14 4
#> MAD:skmeans 77    1.00e-19     7.99e-06 4
#> ATC:skmeans 80    8.27e-16     2.47e-06 4
#> SD:mclust   59    5.91e-12     9.61e-13 4
#> CV:mclust   73    6.10e-14     9.98e-13 4
#> MAD:mclust  76    1.02e-13     7.08e-08 4
#> ATC:mclust  76    3.99e-13     8.00e-10 4
#> SD:kmeans   80    2.40e-10     5.36e-11 4
#> CV:kmeans   80    2.40e-10     5.36e-11 4
#> MAD:kmeans  70    9.95e-17     1.58e-08 4
#> ATC:kmeans  73    4.00e-13     4.34e-09 4
#> SD:pam      78    2.64e-15     5.77e-10 4
#> CV:pam      80    2.97e-15     3.00e-10 4
#> MAD:pam     78    2.47e-19     6.14e-06 4
#> ATC:pam     79    5.15e-21     3.63e-04 4
#> SD:hclust   76    6.81e-12     2.19e-11 4
#> CV:hclust   80    8.66e-12     2.68e-12 4
#> MAD:hclust  74    3.92e-13     2.44e-09 4
#> ATC:hclust  73    4.00e-13     4.34e-09 4
test_to_known_factors(res_list, k = 5)
#>              n protocol(p) cell.type(p) k
#> SD:NMF      77    1.74e-15     7.52e-16 5
#> CV:NMF      77    7.58e-16     7.52e-16 5
#> MAD:NMF     74    4.45e-13     3.24e-15 5
#> ATC:NMF     66    1.34e-18     3.00e-07 5
#> SD:skmeans  77    1.84e-20     1.36e-13 5
#> CV:skmeans  77    1.84e-20     1.36e-13 5
#> MAD:skmeans 80    7.64e-20     2.66e-10 5
#> ATC:skmeans 80    1.46e-23     6.83e-06 5
#> SD:mclust   73    1.85e-14     5.28e-15 5
#> CV:mclust   80    1.34e-16     1.37e-13 5
#> MAD:mclust  80    3.30e-17     1.92e-14 5
#> ATC:mclust  80    1.08e-20     3.36e-10 5
#> SD:kmeans   59    1.11e-14     1.26e-08 5
#> CV:kmeans   65    3.37e-18     4.76e-11 5
#> MAD:kmeans  74    1.38e-18     3.80e-11 5
#> ATC:kmeans  69    7.62e-19     1.51e-09 5
#> SD:pam      76    2.03e-19     2.15e-09 5
#> CV:pam      76    3.70e-19     2.02e-09 5
#> MAD:pam     80    7.64e-20     2.66e-10 5
#> ATC:pam     78    1.86e-20     7.15e-07 5
#> SD:hclust   69    2.12e-11     6.74e-10 5
#> CV:hclust   77    6.34e-15     6.01e-11 5
#> MAD:hclust  80    5.03e-20     9.50e-08 5
#> ATC:hclust  73    9.57e-20     9.15e-09 5
test_to_known_factors(res_list, k = 6)
#>              n protocol(p) cell.type(p) k
#> SD:NMF      68    7.13e-15     6.00e-14 6
#> CV:NMF      66    2.67e-15     1.58e-13 6
#> MAD:NMF     71    1.25e-23     6.35e-14 6
#> ATC:NMF     54    3.20e-15     2.10e-09 6
#> SD:skmeans  73    2.24e-30     3.99e-10 6
#> CV:skmeans  74    8.39e-29     1.48e-11 6
#> MAD:skmeans 80    2.76e-23     8.50e-10 6
#> ATC:skmeans 77    2.26e-25     3.15e-06 6
#> SD:mclust   65    3.84e-21     5.29e-11 6
#> CV:mclust   77    2.13e-24     5.97e-13 6
#> MAD:mclust  79    1.54e-20     1.39e-13 6
#> ATC:mclust  80    2.52e-23     1.29e-09 6
#> SD:kmeans   52    1.51e-16     1.38e-10 6
#> CV:kmeans   58    3.59e-17     1.78e-09 6
#> MAD:kmeans  74    8.86e-21     1.52e-10 6
#> ATC:kmeans  80    1.08e-20     3.36e-10 6
#> SD:pam      79    6.42e-28     6.93e-08 6
#> CV:pam      80    1.08e-28     1.03e-07 6
#> MAD:pam     79    5.39e-26     2.50e-08 6
#> ATC:pam     78    1.97e-26     1.09e-06 6
#> SD:hclust   73    1.69e-24     1.43e-09 6
#> CV:hclust   80    8.72e-22     2.76e-13 6
#> MAD:hclust  80    3.12e-20     5.27e-11 6
#> ATC:hclust  73    9.57e-20     9.15e-09 6

Results for each method


SD:hclust*

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["SD", "hclust"]
# you can also extract it by
# res = res_list["SD:hclust"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk SD-hclust-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk SD-hclust-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.400           0.831       0.896         0.4626 0.495   0.495
#> 3 3 0.703           0.860       0.929         0.3811 0.862   0.721
#> 4 4 0.792           0.833       0.895         0.1273 0.939   0.830
#> 5 5 0.792           0.797       0.885         0.0482 0.929   0.767
#> 6 6 0.915           0.883       0.939         0.0786 0.910   0.658

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 6

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1022325     2   0.000      0.894 0.000 1.000
#> GSM1022326     2   0.000      0.894 0.000 1.000
#> GSM1022327     2   0.000      0.894 0.000 1.000
#> GSM1022331     1   0.000      0.844 1.000 0.000
#> GSM1022332     1   0.000      0.844 1.000 0.000
#> GSM1022333     1   0.000      0.844 1.000 0.000
#> GSM1022328     2   0.000      0.894 0.000 1.000
#> GSM1022329     2   0.000      0.894 0.000 1.000
#> GSM1022330     2   0.000      0.894 0.000 1.000
#> GSM1022337     2   0.278      0.872 0.048 0.952
#> GSM1022338     2   0.278      0.872 0.048 0.952
#> GSM1022339     2   0.278      0.872 0.048 0.952
#> GSM1022334     2   0.000      0.894 0.000 1.000
#> GSM1022335     2   0.000      0.894 0.000 1.000
#> GSM1022336     2   0.000      0.894 0.000 1.000
#> GSM1022340     1   0.615      0.884 0.848 0.152
#> GSM1022341     1   0.615      0.884 0.848 0.152
#> GSM1022342     1   0.615      0.884 0.848 0.152
#> GSM1022343     1   0.615      0.884 0.848 0.152
#> GSM1022347     1   0.000      0.844 1.000 0.000
#> GSM1022348     1   0.000      0.844 1.000 0.000
#> GSM1022349     1   0.000      0.844 1.000 0.000
#> GSM1022350     1   0.000      0.844 1.000 0.000
#> GSM1022344     1   0.615      0.884 0.848 0.152
#> GSM1022345     1   0.615      0.884 0.848 0.152
#> GSM1022346     1   0.615      0.884 0.848 0.152
#> GSM1022355     1   0.615      0.884 0.848 0.152
#> GSM1022356     1   0.615      0.884 0.848 0.152
#> GSM1022357     1   0.615      0.884 0.848 0.152
#> GSM1022358     1   0.615      0.884 0.848 0.152
#> GSM1022351     1   0.615      0.884 0.848 0.152
#> GSM1022352     1   0.615      0.884 0.848 0.152
#> GSM1022353     1   0.615      0.884 0.848 0.152
#> GSM1022354     1   0.615      0.884 0.848 0.152
#> GSM1022359     2   0.000      0.894 0.000 1.000
#> GSM1022360     2   0.000      0.894 0.000 1.000
#> GSM1022361     2   0.000      0.894 0.000 1.000
#> GSM1022362     2   0.000      0.894 0.000 1.000
#> GSM1022367     1   0.990      0.377 0.560 0.440
#> GSM1022368     1   0.990      0.377 0.560 0.440
#> GSM1022369     1   0.990      0.377 0.560 0.440
#> GSM1022370     1   0.990      0.377 0.560 0.440
#> GSM1022363     2   0.000      0.894 0.000 1.000
#> GSM1022364     2   0.000      0.894 0.000 1.000
#> GSM1022365     2   0.000      0.894 0.000 1.000
#> GSM1022366     2   0.000      0.894 0.000 1.000
#> GSM1022374     2   0.278      0.872 0.048 0.952
#> GSM1022375     2   0.278      0.872 0.048 0.952
#> GSM1022376     2   0.278      0.872 0.048 0.952
#> GSM1022371     2   0.000      0.894 0.000 1.000
#> GSM1022372     2   0.000      0.894 0.000 1.000
#> GSM1022373     2   0.000      0.894 0.000 1.000
#> GSM1022377     2   0.775      0.740 0.228 0.772
#> GSM1022378     2   0.775      0.740 0.228 0.772
#> GSM1022379     2   0.775      0.740 0.228 0.772
#> GSM1022380     2   0.775      0.740 0.228 0.772
#> GSM1022385     1   0.000      0.844 1.000 0.000
#> GSM1022386     1   0.000      0.844 1.000 0.000
#> GSM1022387     1   0.000      0.844 1.000 0.000
#> GSM1022388     1   0.000      0.844 1.000 0.000
#> GSM1022381     2   0.775      0.740 0.228 0.772
#> GSM1022382     2   0.775      0.740 0.228 0.772
#> GSM1022383     2   0.775      0.740 0.228 0.772
#> GSM1022384     2   0.775      0.740 0.228 0.772
#> GSM1022393     1   0.615      0.884 0.848 0.152
#> GSM1022394     1   0.615      0.884 0.848 0.152
#> GSM1022395     1   0.615      0.884 0.848 0.152
#> GSM1022396     1   0.615      0.884 0.848 0.152
#> GSM1022389     2   0.775      0.740 0.228 0.772
#> GSM1022390     2   0.775      0.740 0.228 0.772
#> GSM1022391     2   0.775      0.740 0.228 0.772
#> GSM1022392     2   0.775      0.740 0.228 0.772
#> GSM1022397     1   0.000      0.844 1.000 0.000
#> GSM1022398     1   0.000      0.844 1.000 0.000
#> GSM1022399     1   0.000      0.844 1.000 0.000
#> GSM1022400     1   0.000      0.844 1.000 0.000
#> GSM1022401     1   0.615      0.884 0.848 0.152
#> GSM1022402     1   0.615      0.884 0.848 0.152
#> GSM1022403     1   0.615      0.884 0.848 0.152
#> GSM1022404     1   0.615      0.884 0.848 0.152

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2   p3
#> GSM1022325     2   0.000      0.864 0.000 1.000 0.00
#> GSM1022326     2   0.000      0.864 0.000 1.000 0.00
#> GSM1022327     2   0.000      0.864 0.000 1.000 0.00
#> GSM1022331     3   0.000      0.889 0.000 0.000 1.00
#> GSM1022332     3   0.000      0.889 0.000 0.000 1.00
#> GSM1022333     3   0.000      0.889 0.000 0.000 1.00
#> GSM1022328     2   0.000      0.864 0.000 1.000 0.00
#> GSM1022329     2   0.000      0.864 0.000 1.000 0.00
#> GSM1022330     2   0.000      0.864 0.000 1.000 0.00
#> GSM1022337     2   0.455      0.743 0.200 0.800 0.00
#> GSM1022338     2   0.455      0.743 0.200 0.800 0.00
#> GSM1022339     2   0.455      0.743 0.200 0.800 0.00
#> GSM1022334     2   0.000      0.864 0.000 1.000 0.00
#> GSM1022335     2   0.000      0.864 0.000 1.000 0.00
#> GSM1022336     2   0.000      0.864 0.000 1.000 0.00
#> GSM1022340     1   0.000      1.000 1.000 0.000 0.00
#> GSM1022341     1   0.000      1.000 1.000 0.000 0.00
#> GSM1022342     1   0.000      1.000 1.000 0.000 0.00
#> GSM1022343     1   0.000      1.000 1.000 0.000 0.00
#> GSM1022347     3   0.000      0.889 0.000 0.000 1.00
#> GSM1022348     3   0.000      0.889 0.000 0.000 1.00
#> GSM1022349     3   0.000      0.889 0.000 0.000 1.00
#> GSM1022350     3   0.000      0.889 0.000 0.000 1.00
#> GSM1022344     1   0.000      1.000 1.000 0.000 0.00
#> GSM1022345     1   0.000      1.000 1.000 0.000 0.00
#> GSM1022346     1   0.000      1.000 1.000 0.000 0.00
#> GSM1022355     1   0.000      1.000 1.000 0.000 0.00
#> GSM1022356     1   0.000      1.000 1.000 0.000 0.00
#> GSM1022357     1   0.000      1.000 1.000 0.000 0.00
#> GSM1022358     1   0.000      1.000 1.000 0.000 0.00
#> GSM1022351     1   0.000      1.000 1.000 0.000 0.00
#> GSM1022352     1   0.000      1.000 1.000 0.000 0.00
#> GSM1022353     1   0.000      1.000 1.000 0.000 0.00
#> GSM1022354     1   0.000      1.000 1.000 0.000 0.00
#> GSM1022359     2   0.000      0.864 0.000 1.000 0.00
#> GSM1022360     2   0.000      0.864 0.000 1.000 0.00
#> GSM1022361     2   0.000      0.864 0.000 1.000 0.00
#> GSM1022362     2   0.000      0.864 0.000 1.000 0.00
#> GSM1022367     3   0.624      0.322 0.000 0.440 0.56
#> GSM1022368     3   0.624      0.322 0.000 0.440 0.56
#> GSM1022369     3   0.624      0.322 0.000 0.440 0.56
#> GSM1022370     3   0.624      0.322 0.000 0.440 0.56
#> GSM1022363     2   0.000      0.864 0.000 1.000 0.00
#> GSM1022364     2   0.000      0.864 0.000 1.000 0.00
#> GSM1022365     2   0.000      0.864 0.000 1.000 0.00
#> GSM1022366     2   0.000      0.864 0.000 1.000 0.00
#> GSM1022374     2   0.455      0.743 0.200 0.800 0.00
#> GSM1022375     2   0.455      0.743 0.200 0.800 0.00
#> GSM1022376     2   0.455      0.743 0.200 0.800 0.00
#> GSM1022371     2   0.000      0.864 0.000 1.000 0.00
#> GSM1022372     2   0.000      0.864 0.000 1.000 0.00
#> GSM1022373     2   0.000      0.864 0.000 1.000 0.00
#> GSM1022377     2   0.489      0.784 0.228 0.772 0.00
#> GSM1022378     2   0.489      0.784 0.228 0.772 0.00
#> GSM1022379     2   0.489      0.784 0.228 0.772 0.00
#> GSM1022380     2   0.489      0.784 0.228 0.772 0.00
#> GSM1022385     3   0.000      0.889 0.000 0.000 1.00
#> GSM1022386     3   0.000      0.889 0.000 0.000 1.00
#> GSM1022387     3   0.000      0.889 0.000 0.000 1.00
#> GSM1022388     3   0.000      0.889 0.000 0.000 1.00
#> GSM1022381     2   0.489      0.784 0.228 0.772 0.00
#> GSM1022382     2   0.489      0.784 0.228 0.772 0.00
#> GSM1022383     2   0.489      0.784 0.228 0.772 0.00
#> GSM1022384     2   0.489      0.784 0.228 0.772 0.00
#> GSM1022393     1   0.000      1.000 1.000 0.000 0.00
#> GSM1022394     1   0.000      1.000 1.000 0.000 0.00
#> GSM1022395     1   0.000      1.000 1.000 0.000 0.00
#> GSM1022396     1   0.000      1.000 1.000 0.000 0.00
#> GSM1022389     2   0.489      0.784 0.228 0.772 0.00
#> GSM1022390     2   0.489      0.784 0.228 0.772 0.00
#> GSM1022391     2   0.489      0.784 0.228 0.772 0.00
#> GSM1022392     2   0.489      0.784 0.228 0.772 0.00
#> GSM1022397     3   0.000      0.889 0.000 0.000 1.00
#> GSM1022398     3   0.000      0.889 0.000 0.000 1.00
#> GSM1022399     3   0.000      0.889 0.000 0.000 1.00
#> GSM1022400     3   0.000      0.889 0.000 0.000 1.00
#> GSM1022401     1   0.000      1.000 1.000 0.000 0.00
#> GSM1022402     1   0.000      1.000 1.000 0.000 0.00
#> GSM1022403     1   0.000      1.000 1.000 0.000 0.00
#> GSM1022404     1   0.000      1.000 1.000 0.000 0.00

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2   p3    p4
#> GSM1022325     2   0.000      0.841 0.000 1.000 0.00 0.000
#> GSM1022326     2   0.000      0.841 0.000 1.000 0.00 0.000
#> GSM1022327     2   0.000      0.841 0.000 1.000 0.00 0.000
#> GSM1022331     3   0.000      0.887 0.000 0.000 1.00 0.000
#> GSM1022332     3   0.000      0.887 0.000 0.000 1.00 0.000
#> GSM1022333     3   0.000      0.887 0.000 0.000 1.00 0.000
#> GSM1022328     2   0.000      0.841 0.000 1.000 0.00 0.000
#> GSM1022329     2   0.000      0.841 0.000 1.000 0.00 0.000
#> GSM1022330     2   0.000      0.841 0.000 1.000 0.00 0.000
#> GSM1022337     4   0.419      1.000 0.008 0.228 0.00 0.764
#> GSM1022338     4   0.419      1.000 0.008 0.228 0.00 0.764
#> GSM1022339     4   0.419      1.000 0.008 0.228 0.00 0.764
#> GSM1022334     2   0.000      0.841 0.000 1.000 0.00 0.000
#> GSM1022335     2   0.000      0.841 0.000 1.000 0.00 0.000
#> GSM1022336     2   0.000      0.841 0.000 1.000 0.00 0.000
#> GSM1022340     1   0.000      0.925 1.000 0.000 0.00 0.000
#> GSM1022341     1   0.000      0.925 1.000 0.000 0.00 0.000
#> GSM1022342     1   0.000      0.925 1.000 0.000 0.00 0.000
#> GSM1022343     1   0.000      0.925 1.000 0.000 0.00 0.000
#> GSM1022347     3   0.000      0.887 0.000 0.000 1.00 0.000
#> GSM1022348     3   0.000      0.887 0.000 0.000 1.00 0.000
#> GSM1022349     3   0.000      0.887 0.000 0.000 1.00 0.000
#> GSM1022350     3   0.000      0.887 0.000 0.000 1.00 0.000
#> GSM1022344     1   0.000      0.925 1.000 0.000 0.00 0.000
#> GSM1022345     1   0.000      0.925 1.000 0.000 0.00 0.000
#> GSM1022346     1   0.000      0.925 1.000 0.000 0.00 0.000
#> GSM1022355     1   0.000      0.925 1.000 0.000 0.00 0.000
#> GSM1022356     1   0.000      0.925 1.000 0.000 0.00 0.000
#> GSM1022357     1   0.000      0.925 1.000 0.000 0.00 0.000
#> GSM1022358     1   0.000      0.925 1.000 0.000 0.00 0.000
#> GSM1022351     1   0.000      0.925 1.000 0.000 0.00 0.000
#> GSM1022352     1   0.000      0.925 1.000 0.000 0.00 0.000
#> GSM1022353     1   0.000      0.925 1.000 0.000 0.00 0.000
#> GSM1022354     1   0.000      0.925 1.000 0.000 0.00 0.000
#> GSM1022359     2   0.000      0.841 0.000 1.000 0.00 0.000
#> GSM1022360     2   0.000      0.841 0.000 1.000 0.00 0.000
#> GSM1022361     2   0.000      0.841 0.000 1.000 0.00 0.000
#> GSM1022362     2   0.000      0.841 0.000 1.000 0.00 0.000
#> GSM1022367     3   0.715      0.390 0.000 0.220 0.56 0.220
#> GSM1022368     3   0.715      0.390 0.000 0.220 0.56 0.220
#> GSM1022369     3   0.715      0.390 0.000 0.220 0.56 0.220
#> GSM1022370     3   0.715      0.390 0.000 0.220 0.56 0.220
#> GSM1022363     2   0.380      0.551 0.000 0.780 0.00 0.220
#> GSM1022364     2   0.380      0.551 0.000 0.780 0.00 0.220
#> GSM1022365     2   0.380      0.551 0.000 0.780 0.00 0.220
#> GSM1022366     2   0.380      0.551 0.000 0.780 0.00 0.220
#> GSM1022374     4   0.419      1.000 0.008 0.228 0.00 0.764
#> GSM1022375     4   0.419      1.000 0.008 0.228 0.00 0.764
#> GSM1022376     4   0.419      1.000 0.008 0.228 0.00 0.764
#> GSM1022371     2   0.000      0.841 0.000 1.000 0.00 0.000
#> GSM1022372     2   0.000      0.841 0.000 1.000 0.00 0.000
#> GSM1022373     2   0.000      0.841 0.000 1.000 0.00 0.000
#> GSM1022377     2   0.387      0.791 0.000 0.772 0.00 0.228
#> GSM1022378     2   0.387      0.791 0.000 0.772 0.00 0.228
#> GSM1022379     2   0.387      0.791 0.000 0.772 0.00 0.228
#> GSM1022380     2   0.387      0.791 0.000 0.772 0.00 0.228
#> GSM1022385     3   0.000      0.887 0.000 0.000 1.00 0.000
#> GSM1022386     3   0.000      0.887 0.000 0.000 1.00 0.000
#> GSM1022387     3   0.000      0.887 0.000 0.000 1.00 0.000
#> GSM1022388     3   0.000      0.887 0.000 0.000 1.00 0.000
#> GSM1022381     2   0.387      0.791 0.000 0.772 0.00 0.228
#> GSM1022382     2   0.387      0.791 0.000 0.772 0.00 0.228
#> GSM1022383     2   0.387      0.791 0.000 0.772 0.00 0.228
#> GSM1022384     2   0.387      0.791 0.000 0.772 0.00 0.228
#> GSM1022393     1   0.353      0.844 0.808 0.000 0.00 0.192
#> GSM1022394     1   0.353      0.844 0.808 0.000 0.00 0.192
#> GSM1022395     1   0.353      0.844 0.808 0.000 0.00 0.192
#> GSM1022396     1   0.353      0.844 0.808 0.000 0.00 0.192
#> GSM1022389     2   0.387      0.791 0.000 0.772 0.00 0.228
#> GSM1022390     2   0.387      0.791 0.000 0.772 0.00 0.228
#> GSM1022391     2   0.387      0.791 0.000 0.772 0.00 0.228
#> GSM1022392     2   0.387      0.791 0.000 0.772 0.00 0.228
#> GSM1022397     3   0.000      0.887 0.000 0.000 1.00 0.000
#> GSM1022398     3   0.000      0.887 0.000 0.000 1.00 0.000
#> GSM1022399     3   0.000      0.887 0.000 0.000 1.00 0.000
#> GSM1022400     3   0.000      0.887 0.000 0.000 1.00 0.000
#> GSM1022401     1   0.353      0.844 0.808 0.000 0.00 0.192
#> GSM1022402     1   0.353      0.844 0.808 0.000 0.00 0.192
#> GSM1022403     1   0.353      0.844 0.808 0.000 0.00 0.192
#> GSM1022404     1   0.353      0.844 0.808 0.000 0.00 0.192

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette  p1    p2    p3    p4    p5
#> GSM1022325     4  0.3366     0.8490 0.0 0.000 0.000 0.768 0.232
#> GSM1022326     4  0.3366     0.8490 0.0 0.000 0.000 0.768 0.232
#> GSM1022327     4  0.3366     0.8490 0.0 0.000 0.000 0.768 0.232
#> GSM1022331     2  0.4283    -0.0345 0.0 0.544 0.456 0.000 0.000
#> GSM1022332     2  0.4283    -0.0345 0.0 0.544 0.456 0.000 0.000
#> GSM1022333     2  0.4283    -0.0345 0.0 0.544 0.456 0.000 0.000
#> GSM1022328     4  0.3366     0.8490 0.0 0.000 0.000 0.768 0.232
#> GSM1022329     4  0.3366     0.8490 0.0 0.000 0.000 0.768 0.232
#> GSM1022330     4  0.3366     0.8490 0.0 0.000 0.000 0.768 0.232
#> GSM1022337     5  0.0162     1.0000 0.0 0.004 0.000 0.000 0.996
#> GSM1022338     5  0.0162     1.0000 0.0 0.004 0.000 0.000 0.996
#> GSM1022339     5  0.0162     1.0000 0.0 0.004 0.000 0.000 0.996
#> GSM1022334     4  0.3366     0.8490 0.0 0.000 0.000 0.768 0.232
#> GSM1022335     4  0.3366     0.8490 0.0 0.000 0.000 0.768 0.232
#> GSM1022336     4  0.3366     0.8490 0.0 0.000 0.000 0.768 0.232
#> GSM1022340     1  0.0000     0.9215 1.0 0.000 0.000 0.000 0.000
#> GSM1022341     1  0.0000     0.9215 1.0 0.000 0.000 0.000 0.000
#> GSM1022342     1  0.0000     0.9215 1.0 0.000 0.000 0.000 0.000
#> GSM1022343     1  0.0000     0.9215 1.0 0.000 0.000 0.000 0.000
#> GSM1022347     3  0.0000     1.0000 0.0 0.000 1.000 0.000 0.000
#> GSM1022348     3  0.0000     1.0000 0.0 0.000 1.000 0.000 0.000
#> GSM1022349     3  0.0000     1.0000 0.0 0.000 1.000 0.000 0.000
#> GSM1022350     3  0.0000     1.0000 0.0 0.000 1.000 0.000 0.000
#> GSM1022344     1  0.0000     0.9215 1.0 0.000 0.000 0.000 0.000
#> GSM1022345     1  0.0000     0.9215 1.0 0.000 0.000 0.000 0.000
#> GSM1022346     1  0.0000     0.9215 1.0 0.000 0.000 0.000 0.000
#> GSM1022355     1  0.0000     0.9215 1.0 0.000 0.000 0.000 0.000
#> GSM1022356     1  0.0000     0.9215 1.0 0.000 0.000 0.000 0.000
#> GSM1022357     1  0.0000     0.9215 1.0 0.000 0.000 0.000 0.000
#> GSM1022358     1  0.0000     0.9215 1.0 0.000 0.000 0.000 0.000
#> GSM1022351     1  0.0000     0.9215 1.0 0.000 0.000 0.000 0.000
#> GSM1022352     1  0.0000     0.9215 1.0 0.000 0.000 0.000 0.000
#> GSM1022353     1  0.0000     0.9215 1.0 0.000 0.000 0.000 0.000
#> GSM1022354     1  0.0000     0.9215 1.0 0.000 0.000 0.000 0.000
#> GSM1022359     4  0.3366     0.8490 0.0 0.000 0.000 0.768 0.232
#> GSM1022360     4  0.3366     0.8490 0.0 0.000 0.000 0.768 0.232
#> GSM1022361     4  0.3366     0.8490 0.0 0.000 0.000 0.768 0.232
#> GSM1022362     4  0.3366     0.8490 0.0 0.000 0.000 0.768 0.232
#> GSM1022367     2  0.0510     0.4551 0.0 0.984 0.016 0.000 0.000
#> GSM1022368     2  0.0510     0.4551 0.0 0.984 0.016 0.000 0.000
#> GSM1022369     2  0.0510     0.4551 0.0 0.984 0.016 0.000 0.000
#> GSM1022370     2  0.0510     0.4551 0.0 0.984 0.016 0.000 0.000
#> GSM1022363     2  0.6530     0.0884 0.0 0.440 0.000 0.360 0.200
#> GSM1022364     2  0.6530     0.0884 0.0 0.440 0.000 0.360 0.200
#> GSM1022365     2  0.6530     0.0884 0.0 0.440 0.000 0.360 0.200
#> GSM1022366     2  0.6530     0.0884 0.0 0.440 0.000 0.360 0.200
#> GSM1022374     5  0.0162     1.0000 0.0 0.004 0.000 0.000 0.996
#> GSM1022375     5  0.0162     1.0000 0.0 0.004 0.000 0.000 0.996
#> GSM1022376     5  0.0162     1.0000 0.0 0.004 0.000 0.000 0.996
#> GSM1022371     4  0.3366     0.8490 0.0 0.000 0.000 0.768 0.232
#> GSM1022372     4  0.3366     0.8490 0.0 0.000 0.000 0.768 0.232
#> GSM1022373     4  0.3366     0.8490 0.0 0.000 0.000 0.768 0.232
#> GSM1022377     4  0.0510     0.7977 0.0 0.016 0.000 0.984 0.000
#> GSM1022378     4  0.0510     0.7977 0.0 0.016 0.000 0.984 0.000
#> GSM1022379     4  0.0510     0.7977 0.0 0.016 0.000 0.984 0.000
#> GSM1022380     4  0.0510     0.7977 0.0 0.016 0.000 0.984 0.000
#> GSM1022385     3  0.0000     1.0000 0.0 0.000 1.000 0.000 0.000
#> GSM1022386     3  0.0000     1.0000 0.0 0.000 1.000 0.000 0.000
#> GSM1022387     3  0.0000     1.0000 0.0 0.000 1.000 0.000 0.000
#> GSM1022388     3  0.0000     1.0000 0.0 0.000 1.000 0.000 0.000
#> GSM1022381     4  0.0510     0.7977 0.0 0.016 0.000 0.984 0.000
#> GSM1022382     4  0.0510     0.7977 0.0 0.016 0.000 0.984 0.000
#> GSM1022383     4  0.0510     0.7977 0.0 0.016 0.000 0.984 0.000
#> GSM1022384     4  0.0510     0.7977 0.0 0.016 0.000 0.984 0.000
#> GSM1022393     1  0.3109     0.8340 0.8 0.000 0.000 0.000 0.200
#> GSM1022394     1  0.3109     0.8340 0.8 0.000 0.000 0.000 0.200
#> GSM1022395     1  0.3109     0.8340 0.8 0.000 0.000 0.000 0.200
#> GSM1022396     1  0.3109     0.8340 0.8 0.000 0.000 0.000 0.200
#> GSM1022389     4  0.0510     0.7977 0.0 0.016 0.000 0.984 0.000
#> GSM1022390     4  0.0510     0.7977 0.0 0.016 0.000 0.984 0.000
#> GSM1022391     4  0.0510     0.7977 0.0 0.016 0.000 0.984 0.000
#> GSM1022392     4  0.0510     0.7977 0.0 0.016 0.000 0.984 0.000
#> GSM1022397     3  0.0000     1.0000 0.0 0.000 1.000 0.000 0.000
#> GSM1022398     3  0.0000     1.0000 0.0 0.000 1.000 0.000 0.000
#> GSM1022399     3  0.0000     1.0000 0.0 0.000 1.000 0.000 0.000
#> GSM1022400     3  0.0000     1.0000 0.0 0.000 1.000 0.000 0.000
#> GSM1022401     1  0.3109     0.8340 0.8 0.000 0.000 0.000 0.200
#> GSM1022402     1  0.3109     0.8340 0.8 0.000 0.000 0.000 0.200
#> GSM1022403     1  0.3109     0.8340 0.8 0.000 0.000 0.000 0.200
#> GSM1022404     1  0.3109     0.8340 0.8 0.000 0.000 0.000 0.200

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2   p3    p4  p5   p6
#> GSM1022325     2  0.3828      0.904 0.000 0.560 0.00 0.000 0.0 0.44
#> GSM1022326     2  0.3828      0.904 0.000 0.560 0.00 0.000 0.0 0.44
#> GSM1022327     2  0.3828      0.904 0.000 0.560 0.00 0.000 0.0 0.44
#> GSM1022331     6  0.3828      0.424 0.000 0.000 0.44 0.000 0.0 0.56
#> GSM1022332     6  0.3828      0.424 0.000 0.000 0.44 0.000 0.0 0.56
#> GSM1022333     6  0.3828      0.424 0.000 0.000 0.44 0.000 0.0 0.56
#> GSM1022328     2  0.3828      0.904 0.000 0.560 0.00 0.000 0.0 0.44
#> GSM1022329     2  0.3828      0.904 0.000 0.560 0.00 0.000 0.0 0.44
#> GSM1022330     2  0.3828      0.904 0.000 0.560 0.00 0.000 0.0 0.44
#> GSM1022337     5  0.0000      1.000 0.000 0.000 0.00 0.000 1.0 0.00
#> GSM1022338     5  0.0000      1.000 0.000 0.000 0.00 0.000 1.0 0.00
#> GSM1022339     5  0.0000      1.000 0.000 0.000 0.00 0.000 1.0 0.00
#> GSM1022334     2  0.3828      0.904 0.000 0.560 0.00 0.000 0.0 0.44
#> GSM1022335     2  0.3828      0.904 0.000 0.560 0.00 0.000 0.0 0.44
#> GSM1022336     2  0.3828      0.904 0.000 0.560 0.00 0.000 0.0 0.44
#> GSM1022340     1  0.0363      0.914 0.988 0.000 0.00 0.012 0.0 0.00
#> GSM1022341     1  0.0363      0.914 0.988 0.000 0.00 0.012 0.0 0.00
#> GSM1022342     1  0.0363      0.914 0.988 0.000 0.00 0.012 0.0 0.00
#> GSM1022343     1  0.0363      0.914 0.988 0.000 0.00 0.012 0.0 0.00
#> GSM1022347     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.0 0.00
#> GSM1022348     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.0 0.00
#> GSM1022349     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.0 0.00
#> GSM1022350     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.0 0.00
#> GSM1022344     1  0.0363      0.914 0.988 0.000 0.00 0.012 0.0 0.00
#> GSM1022345     1  0.0363      0.914 0.988 0.000 0.00 0.012 0.0 0.00
#> GSM1022346     1  0.0363      0.914 0.988 0.000 0.00 0.012 0.0 0.00
#> GSM1022355     1  0.0000      0.916 1.000 0.000 0.00 0.000 0.0 0.00
#> GSM1022356     1  0.0000      0.916 1.000 0.000 0.00 0.000 0.0 0.00
#> GSM1022357     1  0.0000      0.916 1.000 0.000 0.00 0.000 0.0 0.00
#> GSM1022358     1  0.0000      0.916 1.000 0.000 0.00 0.000 0.0 0.00
#> GSM1022351     1  0.0000      0.916 1.000 0.000 0.00 0.000 0.0 0.00
#> GSM1022352     1  0.0000      0.916 1.000 0.000 0.00 0.000 0.0 0.00
#> GSM1022353     1  0.0000      0.916 1.000 0.000 0.00 0.000 0.0 0.00
#> GSM1022354     1  0.0000      0.916 1.000 0.000 0.00 0.000 0.0 0.00
#> GSM1022359     2  0.3828      0.904 0.000 0.560 0.00 0.000 0.0 0.44
#> GSM1022360     2  0.3828      0.904 0.000 0.560 0.00 0.000 0.0 0.44
#> GSM1022361     2  0.3828      0.904 0.000 0.560 0.00 0.000 0.0 0.44
#> GSM1022362     2  0.3828      0.904 0.000 0.560 0.00 0.000 0.0 0.44
#> GSM1022367     6  0.3828      0.696 0.000 0.440 0.00 0.000 0.0 0.56
#> GSM1022368     6  0.3828      0.696 0.000 0.440 0.00 0.000 0.0 0.56
#> GSM1022369     6  0.3828      0.696 0.000 0.440 0.00 0.000 0.0 0.56
#> GSM1022370     6  0.3828      0.696 0.000 0.440 0.00 0.000 0.0 0.56
#> GSM1022363     2  0.0000      0.448 0.000 1.000 0.00 0.000 0.0 0.00
#> GSM1022364     2  0.0000      0.448 0.000 1.000 0.00 0.000 0.0 0.00
#> GSM1022365     2  0.0000      0.448 0.000 1.000 0.00 0.000 0.0 0.00
#> GSM1022366     2  0.0000      0.448 0.000 1.000 0.00 0.000 0.0 0.00
#> GSM1022374     5  0.0000      1.000 0.000 0.000 0.00 0.000 1.0 0.00
#> GSM1022375     5  0.0000      1.000 0.000 0.000 0.00 0.000 1.0 0.00
#> GSM1022376     5  0.0000      1.000 0.000 0.000 0.00 0.000 1.0 0.00
#> GSM1022371     2  0.3828      0.904 0.000 0.560 0.00 0.000 0.0 0.44
#> GSM1022372     2  0.3828      0.904 0.000 0.560 0.00 0.000 0.0 0.44
#> GSM1022373     2  0.3828      0.904 0.000 0.560 0.00 0.000 0.0 0.44
#> GSM1022377     4  0.0363      1.000 0.000 0.012 0.00 0.988 0.0 0.00
#> GSM1022378     4  0.0363      1.000 0.000 0.012 0.00 0.988 0.0 0.00
#> GSM1022379     4  0.0363      1.000 0.000 0.012 0.00 0.988 0.0 0.00
#> GSM1022380     4  0.0363      1.000 0.000 0.012 0.00 0.988 0.0 0.00
#> GSM1022385     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.0 0.00
#> GSM1022386     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.0 0.00
#> GSM1022387     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.0 0.00
#> GSM1022388     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.0 0.00
#> GSM1022381     4  0.0363      1.000 0.000 0.012 0.00 0.988 0.0 0.00
#> GSM1022382     4  0.0363      1.000 0.000 0.012 0.00 0.988 0.0 0.00
#> GSM1022383     4  0.0363      1.000 0.000 0.012 0.00 0.988 0.0 0.00
#> GSM1022384     4  0.0363      1.000 0.000 0.012 0.00 0.988 0.0 0.00
#> GSM1022393     1  0.2793      0.828 0.800 0.000 0.00 0.000 0.2 0.00
#> GSM1022394     1  0.2793      0.828 0.800 0.000 0.00 0.000 0.2 0.00
#> GSM1022395     1  0.2793      0.828 0.800 0.000 0.00 0.000 0.2 0.00
#> GSM1022396     1  0.2793      0.828 0.800 0.000 0.00 0.000 0.2 0.00
#> GSM1022389     4  0.0363      1.000 0.000 0.012 0.00 0.988 0.0 0.00
#> GSM1022390     4  0.0363      1.000 0.000 0.012 0.00 0.988 0.0 0.00
#> GSM1022391     4  0.0363      1.000 0.000 0.012 0.00 0.988 0.0 0.00
#> GSM1022392     4  0.0363      1.000 0.000 0.012 0.00 0.988 0.0 0.00
#> GSM1022397     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.0 0.00
#> GSM1022398     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.0 0.00
#> GSM1022399     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.0 0.00
#> GSM1022400     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.0 0.00
#> GSM1022401     1  0.2793      0.828 0.800 0.000 0.00 0.000 0.2 0.00
#> GSM1022402     1  0.2793      0.828 0.800 0.000 0.00 0.000 0.2 0.00
#> GSM1022403     1  0.2793      0.828 0.800 0.000 0.00 0.000 0.2 0.00
#> GSM1022404     1  0.2793      0.828 0.800 0.000 0.00 0.000 0.2 0.00

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-hclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-SD-hclust-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-SD-hclust-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-SD-hclust-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-SD-hclust-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-SD-hclust-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-SD-hclust-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-SD-hclust-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-SD-hclust-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-SD-hclust-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-SD-hclust-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-SD-hclust-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-SD-hclust-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-SD-hclust-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-SD-hclust-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-SD-hclust-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-SD-hclust-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-SD-hclust-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-SD-hclust-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-SD-hclust-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-hclust-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-SD-hclust-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-SD-hclust-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-SD-hclust-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-SD-hclust-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-SD-hclust-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-hclust-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>            n protocol(p) cell.type(p) k
#> SD:hclust 76    6.05e-07     3.68e-06 2
#> SD:hclust 76    5.29e-11     1.09e-07 3
#> SD:hclust 76    6.81e-12     2.19e-11 4
#> SD:hclust 69    2.12e-11     6.74e-10 5
#> SD:hclust 73    1.69e-24     1.43e-09 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


SD:kmeans

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["SD", "kmeans"]
# you can also extract it by
# res = res_list["SD:kmeans"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk SD-kmeans-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk SD-kmeans-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.487           0.784       0.874         0.4746 0.494   0.494
#> 3 3 0.655           0.844       0.855         0.3622 0.750   0.535
#> 4 4 0.728           0.774       0.804         0.1208 1.000   1.000
#> 5 5 0.744           0.561       0.730         0.0607 0.891   0.676
#> 6 6 0.721           0.616       0.718         0.0468 0.901   0.623

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 2

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1022325     2   0.000      0.902 0.000 1.000
#> GSM1022326     2   0.000      0.902 0.000 1.000
#> GSM1022327     2   0.000      0.902 0.000 1.000
#> GSM1022331     1   0.311      0.785 0.944 0.056
#> GSM1022332     1   0.311      0.785 0.944 0.056
#> GSM1022333     1   0.311      0.785 0.944 0.056
#> GSM1022328     2   0.000      0.902 0.000 1.000
#> GSM1022329     2   0.000      0.902 0.000 1.000
#> GSM1022330     2   0.000      0.902 0.000 1.000
#> GSM1022337     1   1.000      0.295 0.508 0.492
#> GSM1022338     1   1.000      0.295 0.508 0.492
#> GSM1022339     1   1.000      0.295 0.508 0.492
#> GSM1022334     2   0.000      0.902 0.000 1.000
#> GSM1022335     2   0.000      0.902 0.000 1.000
#> GSM1022336     2   0.000      0.902 0.000 1.000
#> GSM1022340     1   0.775      0.799 0.772 0.228
#> GSM1022341     1   0.775      0.799 0.772 0.228
#> GSM1022342     1   0.775      0.799 0.772 0.228
#> GSM1022343     1   0.775      0.799 0.772 0.228
#> GSM1022347     1   0.311      0.785 0.944 0.056
#> GSM1022348     1   0.311      0.785 0.944 0.056
#> GSM1022349     1   0.311      0.785 0.944 0.056
#> GSM1022350     1   0.311      0.785 0.944 0.056
#> GSM1022344     1   0.141      0.781 0.980 0.020
#> GSM1022345     1   0.141      0.781 0.980 0.020
#> GSM1022346     1   0.141      0.781 0.980 0.020
#> GSM1022355     1   0.788      0.797 0.764 0.236
#> GSM1022356     1   0.788      0.797 0.764 0.236
#> GSM1022357     1   0.788      0.797 0.764 0.236
#> GSM1022358     1   0.788      0.797 0.764 0.236
#> GSM1022351     1   0.788      0.797 0.764 0.236
#> GSM1022352     1   0.788      0.797 0.764 0.236
#> GSM1022353     1   0.788      0.797 0.764 0.236
#> GSM1022354     1   0.788      0.797 0.764 0.236
#> GSM1022359     2   0.000      0.902 0.000 1.000
#> GSM1022360     2   0.000      0.902 0.000 1.000
#> GSM1022361     2   0.000      0.902 0.000 1.000
#> GSM1022362     2   0.000      0.902 0.000 1.000
#> GSM1022367     2   0.981      0.371 0.420 0.580
#> GSM1022368     2   0.981      0.371 0.420 0.580
#> GSM1022369     2   0.981      0.371 0.420 0.580
#> GSM1022370     2   0.981      0.371 0.420 0.580
#> GSM1022363     2   0.000      0.902 0.000 1.000
#> GSM1022364     2   0.000      0.902 0.000 1.000
#> GSM1022365     2   0.000      0.902 0.000 1.000
#> GSM1022366     2   0.000      0.902 0.000 1.000
#> GSM1022374     2   0.861      0.516 0.284 0.716
#> GSM1022375     2   0.861      0.516 0.284 0.716
#> GSM1022376     2   0.861      0.516 0.284 0.716
#> GSM1022371     2   0.000      0.902 0.000 1.000
#> GSM1022372     2   0.000      0.902 0.000 1.000
#> GSM1022373     2   0.000      0.902 0.000 1.000
#> GSM1022377     2   0.242      0.890 0.040 0.960
#> GSM1022378     2   0.242      0.890 0.040 0.960
#> GSM1022379     2   0.242      0.890 0.040 0.960
#> GSM1022380     2   0.242      0.890 0.040 0.960
#> GSM1022385     1   0.311      0.785 0.944 0.056
#> GSM1022386     1   0.311      0.785 0.944 0.056
#> GSM1022387     1   0.311      0.785 0.944 0.056
#> GSM1022388     1   0.311      0.785 0.944 0.056
#> GSM1022381     2   0.242      0.890 0.040 0.960
#> GSM1022382     2   0.242      0.890 0.040 0.960
#> GSM1022383     2   0.242      0.890 0.040 0.960
#> GSM1022384     2   0.242      0.890 0.040 0.960
#> GSM1022393     1   0.788      0.797 0.764 0.236
#> GSM1022394     1   0.788      0.797 0.764 0.236
#> GSM1022395     1   0.788      0.797 0.764 0.236
#> GSM1022396     1   0.788      0.797 0.764 0.236
#> GSM1022389     2   0.242      0.890 0.040 0.960
#> GSM1022390     2   0.242      0.890 0.040 0.960
#> GSM1022391     2   0.242      0.890 0.040 0.960
#> GSM1022392     2   0.242      0.890 0.040 0.960
#> GSM1022397     1   0.311      0.785 0.944 0.056
#> GSM1022398     1   0.311      0.785 0.944 0.056
#> GSM1022399     1   0.311      0.785 0.944 0.056
#> GSM1022400     1   0.311      0.785 0.944 0.056
#> GSM1022401     1   0.788      0.797 0.764 0.236
#> GSM1022402     1   0.788      0.797 0.764 0.236
#> GSM1022403     1   0.788      0.797 0.764 0.236
#> GSM1022404     1   0.788      0.797 0.764 0.236

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1022325     2  0.0747      0.915 0.016 0.984 0.000
#> GSM1022326     2  0.0747      0.915 0.016 0.984 0.000
#> GSM1022327     2  0.0747      0.915 0.016 0.984 0.000
#> GSM1022331     3  0.4351      0.773 0.168 0.004 0.828
#> GSM1022332     3  0.4351      0.773 0.168 0.004 0.828
#> GSM1022333     3  0.4351      0.773 0.168 0.004 0.828
#> GSM1022328     2  0.0747      0.915 0.016 0.984 0.000
#> GSM1022329     2  0.0747      0.915 0.016 0.984 0.000
#> GSM1022330     2  0.0747      0.915 0.016 0.984 0.000
#> GSM1022337     1  0.6968      0.681 0.732 0.120 0.148
#> GSM1022338     1  0.6968      0.681 0.732 0.120 0.148
#> GSM1022339     1  0.6968      0.681 0.732 0.120 0.148
#> GSM1022334     2  0.0747      0.915 0.016 0.984 0.000
#> GSM1022335     2  0.0747      0.915 0.016 0.984 0.000
#> GSM1022336     2  0.0747      0.915 0.016 0.984 0.000
#> GSM1022340     1  0.0237      0.896 0.996 0.000 0.004
#> GSM1022341     1  0.0237      0.896 0.996 0.000 0.004
#> GSM1022342     1  0.0237      0.896 0.996 0.000 0.004
#> GSM1022343     1  0.0237      0.896 0.996 0.000 0.004
#> GSM1022347     3  0.5845      0.854 0.308 0.004 0.688
#> GSM1022348     3  0.5845      0.854 0.308 0.004 0.688
#> GSM1022349     3  0.5845      0.854 0.308 0.004 0.688
#> GSM1022350     3  0.5845      0.854 0.308 0.004 0.688
#> GSM1022344     3  0.5733      0.836 0.324 0.000 0.676
#> GSM1022345     3  0.5733      0.836 0.324 0.000 0.676
#> GSM1022346     3  0.5733      0.836 0.324 0.000 0.676
#> GSM1022355     1  0.0237      0.896 0.996 0.000 0.004
#> GSM1022356     1  0.0237      0.896 0.996 0.000 0.004
#> GSM1022357     1  0.0237      0.896 0.996 0.000 0.004
#> GSM1022358     1  0.0237      0.896 0.996 0.000 0.004
#> GSM1022351     1  0.0237      0.896 0.996 0.000 0.004
#> GSM1022352     1  0.0237      0.896 0.996 0.000 0.004
#> GSM1022353     1  0.0237      0.896 0.996 0.000 0.004
#> GSM1022354     1  0.0237      0.896 0.996 0.000 0.004
#> GSM1022359     2  0.2031      0.911 0.016 0.952 0.032
#> GSM1022360     2  0.2031      0.911 0.016 0.952 0.032
#> GSM1022361     2  0.2031      0.911 0.016 0.952 0.032
#> GSM1022362     2  0.2031      0.911 0.016 0.952 0.032
#> GSM1022367     3  0.5956      0.530 0.016 0.264 0.720
#> GSM1022368     3  0.5956      0.530 0.016 0.264 0.720
#> GSM1022369     3  0.5956      0.530 0.016 0.264 0.720
#> GSM1022370     3  0.5956      0.530 0.016 0.264 0.720
#> GSM1022363     2  0.2625      0.881 0.000 0.916 0.084
#> GSM1022364     2  0.2625      0.881 0.000 0.916 0.084
#> GSM1022365     2  0.2625      0.881 0.000 0.916 0.084
#> GSM1022366     2  0.2625      0.881 0.000 0.916 0.084
#> GSM1022374     1  0.8199      0.584 0.640 0.200 0.160
#> GSM1022375     1  0.8199      0.584 0.640 0.200 0.160
#> GSM1022376     1  0.8199      0.584 0.640 0.200 0.160
#> GSM1022371     2  0.0983      0.914 0.016 0.980 0.004
#> GSM1022372     2  0.0983      0.914 0.016 0.980 0.004
#> GSM1022373     2  0.0983      0.914 0.016 0.980 0.004
#> GSM1022377     2  0.6191      0.872 0.084 0.776 0.140
#> GSM1022378     2  0.6191      0.872 0.084 0.776 0.140
#> GSM1022379     2  0.6191      0.872 0.084 0.776 0.140
#> GSM1022380     2  0.6191      0.872 0.084 0.776 0.140
#> GSM1022385     3  0.5845      0.854 0.308 0.004 0.688
#> GSM1022386     3  0.5845      0.854 0.308 0.004 0.688
#> GSM1022387     3  0.5845      0.854 0.308 0.004 0.688
#> GSM1022388     3  0.5845      0.854 0.308 0.004 0.688
#> GSM1022381     2  0.6393      0.869 0.088 0.764 0.148
#> GSM1022382     2  0.6393      0.869 0.088 0.764 0.148
#> GSM1022383     2  0.6393      0.869 0.088 0.764 0.148
#> GSM1022384     2  0.6393      0.869 0.088 0.764 0.148
#> GSM1022393     1  0.0000      0.896 1.000 0.000 0.000
#> GSM1022394     1  0.0000      0.896 1.000 0.000 0.000
#> GSM1022395     1  0.0000      0.896 1.000 0.000 0.000
#> GSM1022396     1  0.0000      0.896 1.000 0.000 0.000
#> GSM1022389     2  0.5874      0.869 0.088 0.796 0.116
#> GSM1022390     2  0.5874      0.869 0.088 0.796 0.116
#> GSM1022391     2  0.5874      0.869 0.088 0.796 0.116
#> GSM1022392     2  0.5874      0.869 0.088 0.796 0.116
#> GSM1022397     3  0.5845      0.854 0.308 0.004 0.688
#> GSM1022398     3  0.5845      0.854 0.308 0.004 0.688
#> GSM1022399     3  0.5845      0.854 0.308 0.004 0.688
#> GSM1022400     3  0.5845      0.854 0.308 0.004 0.688
#> GSM1022401     1  0.0000      0.896 1.000 0.000 0.000
#> GSM1022402     1  0.0000      0.896 1.000 0.000 0.000
#> GSM1022403     1  0.0000      0.896 1.000 0.000 0.000
#> GSM1022404     1  0.0000      0.896 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3 p4
#> GSM1022325     2   0.000      0.821 0.000 1.000 0.000 NA
#> GSM1022326     2   0.000      0.821 0.000 1.000 0.000 NA
#> GSM1022327     2   0.000      0.821 0.000 1.000 0.000 NA
#> GSM1022331     3   0.332      0.774 0.012 0.000 0.852 NA
#> GSM1022332     3   0.332      0.774 0.012 0.000 0.852 NA
#> GSM1022333     3   0.332      0.774 0.012 0.000 0.852 NA
#> GSM1022328     2   0.000      0.821 0.000 1.000 0.000 NA
#> GSM1022329     2   0.000      0.821 0.000 1.000 0.000 NA
#> GSM1022330     2   0.000      0.821 0.000 1.000 0.000 NA
#> GSM1022337     1   0.701      0.708 0.600 0.040 0.064 NA
#> GSM1022338     1   0.701      0.708 0.600 0.040 0.064 NA
#> GSM1022339     1   0.701      0.708 0.600 0.040 0.064 NA
#> GSM1022334     2   0.000      0.821 0.000 1.000 0.000 NA
#> GSM1022335     2   0.000      0.821 0.000 1.000 0.000 NA
#> GSM1022336     2   0.000      0.821 0.000 1.000 0.000 NA
#> GSM1022340     1   0.238      0.810 0.920 0.000 0.028 NA
#> GSM1022341     1   0.238      0.810 0.920 0.000 0.028 NA
#> GSM1022342     1   0.238      0.810 0.920 0.000 0.028 NA
#> GSM1022343     1   0.238      0.810 0.920 0.000 0.028 NA
#> GSM1022347     3   0.215      0.840 0.088 0.000 0.912 NA
#> GSM1022348     3   0.215      0.840 0.088 0.000 0.912 NA
#> GSM1022349     3   0.215      0.840 0.088 0.000 0.912 NA
#> GSM1022350     3   0.215      0.840 0.088 0.000 0.912 NA
#> GSM1022344     3   0.564      0.664 0.260 0.000 0.680 NA
#> GSM1022345     3   0.564      0.664 0.260 0.000 0.680 NA
#> GSM1022346     3   0.564      0.664 0.260 0.000 0.680 NA
#> GSM1022355     1   0.000      0.839 1.000 0.000 0.000 NA
#> GSM1022356     1   0.000      0.839 1.000 0.000 0.000 NA
#> GSM1022357     1   0.000      0.839 1.000 0.000 0.000 NA
#> GSM1022358     1   0.000      0.839 1.000 0.000 0.000 NA
#> GSM1022351     1   0.158      0.825 0.948 0.000 0.004 NA
#> GSM1022352     1   0.158      0.825 0.948 0.000 0.004 NA
#> GSM1022353     1   0.158      0.825 0.948 0.000 0.004 NA
#> GSM1022354     1   0.158      0.825 0.948 0.000 0.004 NA
#> GSM1022359     2   0.215      0.811 0.000 0.912 0.000 NA
#> GSM1022360     2   0.215      0.811 0.000 0.912 0.000 NA
#> GSM1022361     2   0.215      0.811 0.000 0.912 0.000 NA
#> GSM1022362     2   0.215      0.811 0.000 0.912 0.000 NA
#> GSM1022367     3   0.703      0.523 0.000 0.136 0.528 NA
#> GSM1022368     3   0.703      0.523 0.000 0.136 0.528 NA
#> GSM1022369     3   0.703      0.523 0.000 0.136 0.528 NA
#> GSM1022370     3   0.703      0.523 0.000 0.136 0.528 NA
#> GSM1022363     2   0.410      0.755 0.000 0.784 0.012 NA
#> GSM1022364     2   0.410      0.755 0.000 0.784 0.012 NA
#> GSM1022365     2   0.410      0.755 0.000 0.784 0.012 NA
#> GSM1022366     2   0.410      0.755 0.000 0.784 0.012 NA
#> GSM1022374     1   0.779      0.655 0.540 0.084 0.064 NA
#> GSM1022375     1   0.779      0.655 0.540 0.084 0.064 NA
#> GSM1022376     1   0.779      0.655 0.540 0.084 0.064 NA
#> GSM1022371     2   0.156      0.809 0.000 0.944 0.000 NA
#> GSM1022372     2   0.156      0.809 0.000 0.944 0.000 NA
#> GSM1022373     2   0.156      0.809 0.000 0.944 0.000 NA
#> GSM1022377     2   0.565      0.726 0.028 0.580 0.000 NA
#> GSM1022378     2   0.565      0.726 0.028 0.580 0.000 NA
#> GSM1022379     2   0.565      0.726 0.028 0.580 0.000 NA
#> GSM1022380     2   0.565      0.726 0.028 0.580 0.000 NA
#> GSM1022385     3   0.273      0.840 0.088 0.000 0.896 NA
#> GSM1022386     3   0.273      0.840 0.088 0.000 0.896 NA
#> GSM1022387     3   0.273      0.840 0.088 0.000 0.896 NA
#> GSM1022388     3   0.273      0.840 0.088 0.000 0.896 NA
#> GSM1022381     2   0.573      0.714 0.028 0.544 0.000 NA
#> GSM1022382     2   0.573      0.714 0.028 0.544 0.000 NA
#> GSM1022383     2   0.573      0.714 0.028 0.544 0.000 NA
#> GSM1022384     2   0.573      0.714 0.028 0.544 0.000 NA
#> GSM1022393     1   0.297      0.841 0.856 0.000 0.000 NA
#> GSM1022394     1   0.297      0.841 0.856 0.000 0.000 NA
#> GSM1022395     1   0.297      0.841 0.856 0.000 0.000 NA
#> GSM1022396     1   0.297      0.841 0.856 0.000 0.000 NA
#> GSM1022389     2   0.567      0.728 0.028 0.620 0.004 NA
#> GSM1022390     2   0.567      0.728 0.028 0.620 0.004 NA
#> GSM1022391     2   0.567      0.728 0.028 0.620 0.004 NA
#> GSM1022392     2   0.567      0.728 0.028 0.620 0.004 NA
#> GSM1022397     3   0.215      0.840 0.088 0.000 0.912 NA
#> GSM1022398     3   0.215      0.840 0.088 0.000 0.912 NA
#> GSM1022399     3   0.215      0.840 0.088 0.000 0.912 NA
#> GSM1022400     3   0.215      0.840 0.088 0.000 0.912 NA
#> GSM1022401     1   0.297      0.841 0.856 0.000 0.000 NA
#> GSM1022402     1   0.297      0.841 0.856 0.000 0.000 NA
#> GSM1022403     1   0.297      0.841 0.856 0.000 0.000 NA
#> GSM1022404     1   0.297      0.841 0.856 0.000 0.000 NA

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1022325     2  0.0000      0.674 0.000 1.000 0.000 0.000 0.000
#> GSM1022326     2  0.0000      0.674 0.000 1.000 0.000 0.000 0.000
#> GSM1022327     2  0.0000      0.674 0.000 1.000 0.000 0.000 0.000
#> GSM1022331     3  0.4656      0.550 0.004 0.000 0.700 0.040 0.256
#> GSM1022332     3  0.4656      0.550 0.004 0.000 0.700 0.040 0.256
#> GSM1022333     3  0.4656      0.550 0.004 0.000 0.700 0.040 0.256
#> GSM1022328     2  0.0000      0.674 0.000 1.000 0.000 0.000 0.000
#> GSM1022329     2  0.0000      0.674 0.000 1.000 0.000 0.000 0.000
#> GSM1022330     2  0.0000      0.674 0.000 1.000 0.000 0.000 0.000
#> GSM1022337     1  0.6709      0.219 0.448 0.016 0.000 0.152 0.384
#> GSM1022338     1  0.6709      0.219 0.448 0.016 0.000 0.152 0.384
#> GSM1022339     1  0.6709      0.219 0.448 0.016 0.000 0.152 0.384
#> GSM1022334     2  0.0162      0.673 0.000 0.996 0.000 0.004 0.000
#> GSM1022335     2  0.0162      0.673 0.000 0.996 0.000 0.004 0.000
#> GSM1022336     2  0.0162      0.673 0.000 0.996 0.000 0.004 0.000
#> GSM1022340     1  0.4404      0.653 0.788 0.004 0.016 0.136 0.056
#> GSM1022341     1  0.4404      0.653 0.788 0.004 0.016 0.136 0.056
#> GSM1022342     1  0.4404      0.653 0.788 0.004 0.016 0.136 0.056
#> GSM1022343     1  0.4404      0.653 0.788 0.004 0.016 0.136 0.056
#> GSM1022347     3  0.1041      0.817 0.032 0.000 0.964 0.004 0.000
#> GSM1022348     3  0.1041      0.817 0.032 0.000 0.964 0.004 0.000
#> GSM1022349     3  0.1041      0.817 0.032 0.000 0.964 0.004 0.000
#> GSM1022350     3  0.1041      0.817 0.032 0.000 0.964 0.004 0.000
#> GSM1022344     3  0.6987      0.422 0.264 0.000 0.540 0.136 0.060
#> GSM1022345     3  0.6987      0.422 0.264 0.000 0.540 0.136 0.060
#> GSM1022346     3  0.6987      0.422 0.264 0.000 0.540 0.136 0.060
#> GSM1022355     1  0.0324      0.715 0.992 0.004 0.000 0.004 0.000
#> GSM1022356     1  0.0324      0.715 0.992 0.004 0.000 0.004 0.000
#> GSM1022357     1  0.0324      0.715 0.992 0.004 0.000 0.004 0.000
#> GSM1022358     1  0.0324      0.715 0.992 0.004 0.000 0.004 0.000
#> GSM1022351     1  0.2940      0.690 0.876 0.004 0.000 0.072 0.048
#> GSM1022352     1  0.2940      0.690 0.876 0.004 0.000 0.072 0.048
#> GSM1022353     1  0.2940      0.690 0.876 0.004 0.000 0.072 0.048
#> GSM1022354     1  0.2940      0.690 0.876 0.004 0.000 0.072 0.048
#> GSM1022359     2  0.2731      0.591 0.000 0.876 0.004 0.104 0.016
#> GSM1022360     2  0.2731      0.591 0.000 0.876 0.004 0.104 0.016
#> GSM1022361     2  0.2731      0.591 0.000 0.876 0.004 0.104 0.016
#> GSM1022362     2  0.2731      0.591 0.000 0.876 0.004 0.104 0.016
#> GSM1022367     5  0.5960      0.263 0.000 0.060 0.348 0.028 0.564
#> GSM1022368     5  0.5960      0.263 0.000 0.060 0.348 0.028 0.564
#> GSM1022369     5  0.5960      0.263 0.000 0.060 0.348 0.028 0.564
#> GSM1022370     5  0.5960      0.263 0.000 0.060 0.348 0.028 0.564
#> GSM1022363     2  0.5828      0.401 0.000 0.596 0.004 0.116 0.284
#> GSM1022364     2  0.5828      0.401 0.000 0.596 0.004 0.116 0.284
#> GSM1022365     2  0.5828      0.401 0.000 0.596 0.004 0.116 0.284
#> GSM1022366     2  0.5828      0.401 0.000 0.596 0.004 0.116 0.284
#> GSM1022374     5  0.6992     -0.253 0.404 0.028 0.000 0.160 0.408
#> GSM1022375     5  0.6992     -0.253 0.404 0.028 0.000 0.160 0.408
#> GSM1022376     5  0.6992     -0.253 0.404 0.028 0.000 0.160 0.408
#> GSM1022371     2  0.2529      0.643 0.000 0.900 0.004 0.056 0.040
#> GSM1022372     2  0.2529      0.643 0.000 0.900 0.004 0.056 0.040
#> GSM1022373     2  0.2529      0.643 0.000 0.900 0.004 0.056 0.040
#> GSM1022377     4  0.4779      0.952 0.004 0.448 0.000 0.536 0.012
#> GSM1022378     4  0.4779      0.952 0.004 0.448 0.000 0.536 0.012
#> GSM1022379     4  0.4779      0.952 0.004 0.448 0.000 0.536 0.012
#> GSM1022380     4  0.4779      0.952 0.004 0.448 0.000 0.536 0.012
#> GSM1022385     3  0.2499      0.804 0.036 0.000 0.908 0.040 0.016
#> GSM1022386     3  0.2499      0.804 0.036 0.000 0.908 0.040 0.016
#> GSM1022387     3  0.2499      0.804 0.036 0.000 0.908 0.040 0.016
#> GSM1022388     3  0.2499      0.804 0.036 0.000 0.908 0.040 0.016
#> GSM1022381     4  0.5071      0.953 0.004 0.420 0.000 0.548 0.028
#> GSM1022382     4  0.5071      0.953 0.004 0.420 0.000 0.548 0.028
#> GSM1022383     4  0.5071      0.953 0.004 0.420 0.000 0.548 0.028
#> GSM1022384     4  0.5071      0.953 0.004 0.420 0.000 0.548 0.028
#> GSM1022393     1  0.4741      0.671 0.740 0.004 0.000 0.096 0.160
#> GSM1022394     1  0.4741      0.671 0.740 0.004 0.000 0.096 0.160
#> GSM1022395     1  0.4741      0.671 0.740 0.004 0.000 0.096 0.160
#> GSM1022396     1  0.4741      0.671 0.740 0.004 0.000 0.096 0.160
#> GSM1022389     2  0.5939     -0.469 0.004 0.520 0.016 0.404 0.056
#> GSM1022390     2  0.5939     -0.469 0.004 0.520 0.016 0.404 0.056
#> GSM1022391     2  0.5939     -0.469 0.004 0.520 0.016 0.404 0.056
#> GSM1022392     2  0.5939     -0.469 0.004 0.520 0.016 0.404 0.056
#> GSM1022397     3  0.0880      0.818 0.032 0.000 0.968 0.000 0.000
#> GSM1022398     3  0.0880      0.818 0.032 0.000 0.968 0.000 0.000
#> GSM1022399     3  0.0880      0.818 0.032 0.000 0.968 0.000 0.000
#> GSM1022400     3  0.0880      0.818 0.032 0.000 0.968 0.000 0.000
#> GSM1022401     1  0.4741      0.671 0.740 0.004 0.000 0.096 0.160
#> GSM1022402     1  0.4741      0.671 0.740 0.004 0.000 0.096 0.160
#> GSM1022403     1  0.4741      0.671 0.740 0.004 0.000 0.096 0.160
#> GSM1022404     1  0.4741      0.671 0.740 0.004 0.000 0.096 0.160

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1022325     2  0.0000     0.8029 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022326     2  0.0000     0.8029 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022327     2  0.0000     0.8029 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022331     3  0.5775     0.3963 0.000 0.000 0.628 0.068 0.108 0.196
#> GSM1022332     3  0.5775     0.3963 0.000 0.000 0.628 0.068 0.108 0.196
#> GSM1022333     3  0.5775     0.3963 0.000 0.000 0.628 0.068 0.108 0.196
#> GSM1022328     2  0.0000     0.8029 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022329     2  0.0000     0.8029 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022330     2  0.0000     0.8029 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022337     1  0.4481     0.4152 0.520 0.016 0.000 0.008 0.000 0.456
#> GSM1022338     1  0.4481     0.4152 0.520 0.016 0.000 0.008 0.000 0.456
#> GSM1022339     1  0.4481     0.4152 0.520 0.016 0.000 0.008 0.000 0.456
#> GSM1022334     2  0.0146     0.8022 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM1022335     2  0.0146     0.8022 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM1022336     2  0.0146     0.8022 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM1022340     5  0.4588     0.3854 0.420 0.000 0.024 0.008 0.548 0.000
#> GSM1022341     5  0.4588     0.3854 0.420 0.000 0.024 0.008 0.548 0.000
#> GSM1022342     5  0.4588     0.3854 0.420 0.000 0.024 0.008 0.548 0.000
#> GSM1022343     5  0.4588     0.3854 0.420 0.000 0.024 0.008 0.548 0.000
#> GSM1022347     3  0.1879     0.8465 0.008 0.000 0.932 0.016 0.028 0.016
#> GSM1022348     3  0.1879     0.8465 0.008 0.000 0.932 0.016 0.028 0.016
#> GSM1022349     3  0.1879     0.8465 0.008 0.000 0.932 0.016 0.028 0.016
#> GSM1022350     3  0.1879     0.8465 0.008 0.000 0.932 0.016 0.028 0.016
#> GSM1022344     5  0.5548     0.3524 0.024 0.000 0.400 0.020 0.520 0.036
#> GSM1022345     5  0.5548     0.3524 0.024 0.000 0.400 0.020 0.520 0.036
#> GSM1022346     5  0.5548     0.3524 0.024 0.000 0.400 0.020 0.520 0.036
#> GSM1022355     1  0.5178     0.2020 0.624 0.000 0.000 0.064 0.284 0.028
#> GSM1022356     1  0.5178     0.2020 0.624 0.000 0.000 0.064 0.284 0.028
#> GSM1022357     1  0.5178     0.2020 0.624 0.000 0.000 0.064 0.284 0.028
#> GSM1022358     1  0.5178     0.2020 0.624 0.000 0.000 0.064 0.284 0.028
#> GSM1022351     1  0.5512    -0.0806 0.504 0.000 0.000 0.064 0.404 0.028
#> GSM1022352     1  0.5512    -0.0806 0.504 0.000 0.000 0.064 0.404 0.028
#> GSM1022353     1  0.5512    -0.0806 0.504 0.000 0.000 0.064 0.404 0.028
#> GSM1022354     1  0.5512    -0.0806 0.504 0.000 0.000 0.064 0.404 0.028
#> GSM1022359     2  0.2831     0.7599 0.000 0.872 0.000 0.048 0.064 0.016
#> GSM1022360     2  0.2831     0.7599 0.000 0.872 0.000 0.048 0.064 0.016
#> GSM1022361     2  0.2831     0.7599 0.000 0.872 0.000 0.048 0.064 0.016
#> GSM1022362     2  0.2831     0.7599 0.000 0.872 0.000 0.048 0.064 0.016
#> GSM1022367     6  0.7645     1.0000 0.000 0.060 0.196 0.128 0.132 0.484
#> GSM1022368     6  0.7645     1.0000 0.000 0.060 0.196 0.128 0.132 0.484
#> GSM1022369     6  0.7645     1.0000 0.000 0.060 0.196 0.128 0.132 0.484
#> GSM1022370     6  0.7645     1.0000 0.000 0.060 0.196 0.128 0.132 0.484
#> GSM1022363     2  0.6895     0.3849 0.000 0.484 0.000 0.140 0.128 0.248
#> GSM1022364     2  0.6895     0.3849 0.000 0.484 0.000 0.140 0.128 0.248
#> GSM1022365     2  0.6895     0.3849 0.000 0.484 0.000 0.140 0.128 0.248
#> GSM1022366     2  0.6895     0.3849 0.000 0.484 0.000 0.140 0.128 0.248
#> GSM1022374     1  0.4473     0.3993 0.492 0.028 0.000 0.000 0.000 0.480
#> GSM1022375     1  0.4473     0.3993 0.492 0.028 0.000 0.000 0.000 0.480
#> GSM1022376     1  0.4473     0.3993 0.492 0.028 0.000 0.000 0.000 0.480
#> GSM1022371     2  0.3199     0.7483 0.000 0.852 0.000 0.052 0.068 0.028
#> GSM1022372     2  0.3199     0.7483 0.000 0.852 0.000 0.052 0.068 0.028
#> GSM1022373     2  0.3199     0.7483 0.000 0.852 0.000 0.052 0.068 0.028
#> GSM1022377     4  0.4595     0.8566 0.004 0.280 0.004 0.672 0.024 0.016
#> GSM1022378     4  0.4595     0.8566 0.004 0.280 0.004 0.672 0.024 0.016
#> GSM1022379     4  0.4600     0.8566 0.004 0.280 0.004 0.672 0.020 0.020
#> GSM1022380     4  0.4600     0.8566 0.004 0.280 0.004 0.672 0.020 0.020
#> GSM1022385     3  0.1684     0.8550 0.008 0.000 0.940 0.016 0.028 0.008
#> GSM1022386     3  0.1684     0.8550 0.008 0.000 0.940 0.016 0.028 0.008
#> GSM1022387     3  0.1684     0.8550 0.008 0.000 0.940 0.016 0.028 0.008
#> GSM1022388     3  0.1684     0.8550 0.008 0.000 0.940 0.016 0.028 0.008
#> GSM1022381     4  0.3771     0.8568 0.004 0.252 0.000 0.728 0.004 0.012
#> GSM1022382     4  0.3771     0.8568 0.004 0.252 0.000 0.728 0.004 0.012
#> GSM1022383     4  0.3771     0.8568 0.004 0.252 0.000 0.728 0.004 0.012
#> GSM1022384     4  0.3771     0.8568 0.004 0.252 0.000 0.728 0.004 0.012
#> GSM1022393     1  0.0000     0.5515 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022394     1  0.0000     0.5515 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022395     1  0.0000     0.5515 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022396     1  0.0000     0.5515 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022389     4  0.6132     0.7539 0.004 0.304 0.000 0.528 0.132 0.032
#> GSM1022390     4  0.6132     0.7539 0.004 0.304 0.000 0.528 0.132 0.032
#> GSM1022391     4  0.6132     0.7539 0.004 0.304 0.000 0.528 0.132 0.032
#> GSM1022392     4  0.6132     0.7539 0.004 0.304 0.000 0.528 0.132 0.032
#> GSM1022397     3  0.0260     0.8635 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM1022398     3  0.0260     0.8635 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM1022399     3  0.0260     0.8635 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM1022400     3  0.0260     0.8635 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM1022401     1  0.0000     0.5515 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022402     1  0.0000     0.5515 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022403     1  0.0000     0.5515 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022404     1  0.0000     0.5515 1.000 0.000 0.000 0.000 0.000 0.000

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-kmeans-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-SD-kmeans-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-SD-kmeans-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-SD-kmeans-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-SD-kmeans-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-SD-kmeans-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-SD-kmeans-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-SD-kmeans-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-SD-kmeans-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-SD-kmeans-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-SD-kmeans-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-SD-kmeans-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-SD-kmeans-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-SD-kmeans-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-SD-kmeans-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-SD-kmeans-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-SD-kmeans-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-SD-kmeans-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-SD-kmeans-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-SD-kmeans-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-kmeans-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-SD-kmeans-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-SD-kmeans-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-SD-kmeans-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-SD-kmeans-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-SD-kmeans-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-kmeans-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>            n protocol(p) cell.type(p) k
#> SD:kmeans 73    2.04e-06     2.19e-07 2
#> SD:kmeans 80    2.40e-10     5.36e-11 3
#> SD:kmeans 80    2.40e-10     5.36e-11 4
#> SD:kmeans 59    1.11e-14     1.26e-08 5
#> SD:kmeans 52    1.51e-16     1.38e-10 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


SD:skmeans**

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["SD", "skmeans"]
# you can also extract it by
# res = res_list["SD:skmeans"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk SD-skmeans-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk SD-skmeans-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.924           0.955       0.981         0.5048 0.494   0.494
#> 3 3 1.000           0.999       1.000         0.3220 0.750   0.535
#> 4 4 0.777           0.451       0.613         0.1005 0.721   0.400
#> 5 5 0.802           0.865       0.897         0.0773 0.850   0.554
#> 6 6 0.848           0.817       0.891         0.0404 0.977   0.888

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 3
#> attr(,"optional")
#> [1] 2

There is also optional best \(k\) = 2 that is worth to check.

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1022325     2   0.000      0.974 0.000 1.000
#> GSM1022326     2   0.000      0.974 0.000 1.000
#> GSM1022327     2   0.000      0.974 0.000 1.000
#> GSM1022331     1   0.000      0.985 1.000 0.000
#> GSM1022332     1   0.000      0.985 1.000 0.000
#> GSM1022333     1   0.000      0.985 1.000 0.000
#> GSM1022328     2   0.000      0.974 0.000 1.000
#> GSM1022329     2   0.000      0.974 0.000 1.000
#> GSM1022330     2   0.000      0.974 0.000 1.000
#> GSM1022337     1   0.697      0.769 0.812 0.188
#> GSM1022338     1   0.697      0.769 0.812 0.188
#> GSM1022339     1   0.697      0.769 0.812 0.188
#> GSM1022334     2   0.000      0.974 0.000 1.000
#> GSM1022335     2   0.000      0.974 0.000 1.000
#> GSM1022336     2   0.000      0.974 0.000 1.000
#> GSM1022340     1   0.000      0.985 1.000 0.000
#> GSM1022341     1   0.000      0.985 1.000 0.000
#> GSM1022342     1   0.000      0.985 1.000 0.000
#> GSM1022343     1   0.000      0.985 1.000 0.000
#> GSM1022347     1   0.000      0.985 1.000 0.000
#> GSM1022348     1   0.000      0.985 1.000 0.000
#> GSM1022349     1   0.000      0.985 1.000 0.000
#> GSM1022350     1   0.000      0.985 1.000 0.000
#> GSM1022344     1   0.000      0.985 1.000 0.000
#> GSM1022345     1   0.000      0.985 1.000 0.000
#> GSM1022346     1   0.000      0.985 1.000 0.000
#> GSM1022355     1   0.000      0.985 1.000 0.000
#> GSM1022356     1   0.000      0.985 1.000 0.000
#> GSM1022357     1   0.000      0.985 1.000 0.000
#> GSM1022358     1   0.000      0.985 1.000 0.000
#> GSM1022351     1   0.000      0.985 1.000 0.000
#> GSM1022352     1   0.000      0.985 1.000 0.000
#> GSM1022353     1   0.000      0.985 1.000 0.000
#> GSM1022354     1   0.000      0.985 1.000 0.000
#> GSM1022359     2   0.000      0.974 0.000 1.000
#> GSM1022360     2   0.000      0.974 0.000 1.000
#> GSM1022361     2   0.000      0.974 0.000 1.000
#> GSM1022362     2   0.000      0.974 0.000 1.000
#> GSM1022367     2   0.000      0.974 0.000 1.000
#> GSM1022368     2   0.000      0.974 0.000 1.000
#> GSM1022369     2   0.000      0.974 0.000 1.000
#> GSM1022370     2   0.000      0.974 0.000 1.000
#> GSM1022363     2   0.000      0.974 0.000 1.000
#> GSM1022364     2   0.000      0.974 0.000 1.000
#> GSM1022365     2   0.000      0.974 0.000 1.000
#> GSM1022366     2   0.000      0.974 0.000 1.000
#> GSM1022374     2   0.904      0.538 0.320 0.680
#> GSM1022375     2   0.904      0.538 0.320 0.680
#> GSM1022376     2   0.904      0.538 0.320 0.680
#> GSM1022371     2   0.000      0.974 0.000 1.000
#> GSM1022372     2   0.000      0.974 0.000 1.000
#> GSM1022373     2   0.000      0.974 0.000 1.000
#> GSM1022377     2   0.000      0.974 0.000 1.000
#> GSM1022378     2   0.000      0.974 0.000 1.000
#> GSM1022379     2   0.000      0.974 0.000 1.000
#> GSM1022380     2   0.000      0.974 0.000 1.000
#> GSM1022385     1   0.000      0.985 1.000 0.000
#> GSM1022386     1   0.000      0.985 1.000 0.000
#> GSM1022387     1   0.000      0.985 1.000 0.000
#> GSM1022388     1   0.000      0.985 1.000 0.000
#> GSM1022381     2   0.000      0.974 0.000 1.000
#> GSM1022382     2   0.000      0.974 0.000 1.000
#> GSM1022383     2   0.000      0.974 0.000 1.000
#> GSM1022384     2   0.000      0.974 0.000 1.000
#> GSM1022393     1   0.000      0.985 1.000 0.000
#> GSM1022394     1   0.000      0.985 1.000 0.000
#> GSM1022395     1   0.000      0.985 1.000 0.000
#> GSM1022396     1   0.000      0.985 1.000 0.000
#> GSM1022389     2   0.000      0.974 0.000 1.000
#> GSM1022390     2   0.000      0.974 0.000 1.000
#> GSM1022391     2   0.000      0.974 0.000 1.000
#> GSM1022392     2   0.000      0.974 0.000 1.000
#> GSM1022397     1   0.000      0.985 1.000 0.000
#> GSM1022398     1   0.000      0.985 1.000 0.000
#> GSM1022399     1   0.000      0.985 1.000 0.000
#> GSM1022400     1   0.000      0.985 1.000 0.000
#> GSM1022401     1   0.000      0.985 1.000 0.000
#> GSM1022402     1   0.000      0.985 1.000 0.000
#> GSM1022403     1   0.000      0.985 1.000 0.000
#> GSM1022404     1   0.000      0.985 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1022325     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022326     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022327     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022331     3  0.0000      0.999 0.000 0.000 1.000
#> GSM1022332     3  0.0000      0.999 0.000 0.000 1.000
#> GSM1022333     3  0.0000      0.999 0.000 0.000 1.000
#> GSM1022328     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022329     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022330     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022337     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022338     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022339     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022334     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022335     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022336     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022340     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022341     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022342     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022343     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022347     3  0.0000      0.999 0.000 0.000 1.000
#> GSM1022348     3  0.0000      0.999 0.000 0.000 1.000
#> GSM1022349     3  0.0000      0.999 0.000 0.000 1.000
#> GSM1022350     3  0.0000      0.999 0.000 0.000 1.000
#> GSM1022344     3  0.0000      0.999 0.000 0.000 1.000
#> GSM1022345     3  0.0000      0.999 0.000 0.000 1.000
#> GSM1022346     3  0.0000      0.999 0.000 0.000 1.000
#> GSM1022355     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022356     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022357     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022358     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022351     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022352     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022353     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022354     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022359     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022360     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022361     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022362     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022367     3  0.0237      0.996 0.000 0.004 0.996
#> GSM1022368     3  0.0237      0.996 0.000 0.004 0.996
#> GSM1022369     3  0.0237      0.996 0.000 0.004 0.996
#> GSM1022370     3  0.0237      0.996 0.000 0.004 0.996
#> GSM1022363     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022364     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022365     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022366     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022374     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022375     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022376     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022371     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022372     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022373     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022377     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022378     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022379     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022380     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022385     3  0.0000      0.999 0.000 0.000 1.000
#> GSM1022386     3  0.0000      0.999 0.000 0.000 1.000
#> GSM1022387     3  0.0000      0.999 0.000 0.000 1.000
#> GSM1022388     3  0.0000      0.999 0.000 0.000 1.000
#> GSM1022381     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022382     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022383     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022384     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022393     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022394     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022395     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022396     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022389     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022390     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022391     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022392     2  0.0000      1.000 0.000 1.000 0.000
#> GSM1022397     3  0.0000      0.999 0.000 0.000 1.000
#> GSM1022398     3  0.0000      0.999 0.000 0.000 1.000
#> GSM1022399     3  0.0000      0.999 0.000 0.000 1.000
#> GSM1022400     3  0.0000      0.999 0.000 0.000 1.000
#> GSM1022401     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022402     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022403     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022404     1  0.0000      0.999 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1022325     2   0.491     0.1244 0.000 0.580 0.000 0.420
#> GSM1022326     2   0.491     0.1244 0.000 0.580 0.000 0.420
#> GSM1022327     2   0.491     0.1244 0.000 0.580 0.000 0.420
#> GSM1022331     2   0.785     0.2778 0.304 0.404 0.292 0.000
#> GSM1022332     2   0.785     0.2778 0.304 0.404 0.292 0.000
#> GSM1022333     2   0.785     0.2778 0.304 0.404 0.292 0.000
#> GSM1022328     2   0.491     0.1244 0.000 0.580 0.000 0.420
#> GSM1022329     2   0.491     0.1244 0.000 0.580 0.000 0.420
#> GSM1022330     2   0.491     0.1244 0.000 0.580 0.000 0.420
#> GSM1022337     1   0.480     0.7623 0.696 0.012 0.292 0.000
#> GSM1022338     1   0.480     0.7623 0.696 0.012 0.292 0.000
#> GSM1022339     1   0.480     0.7623 0.696 0.012 0.292 0.000
#> GSM1022334     2   0.491     0.1244 0.000 0.580 0.000 0.420
#> GSM1022335     2   0.491     0.1244 0.000 0.580 0.000 0.420
#> GSM1022336     2   0.491     0.1244 0.000 0.580 0.000 0.420
#> GSM1022340     3   0.425     0.5542 0.276 0.000 0.724 0.000
#> GSM1022341     3   0.425     0.5542 0.276 0.000 0.724 0.000
#> GSM1022342     3   0.425     0.5542 0.276 0.000 0.724 0.000
#> GSM1022343     3   0.425     0.5542 0.276 0.000 0.724 0.000
#> GSM1022347     2   0.785     0.2778 0.304 0.404 0.292 0.000
#> GSM1022348     2   0.785     0.2778 0.304 0.404 0.292 0.000
#> GSM1022349     2   0.785     0.2778 0.304 0.404 0.292 0.000
#> GSM1022350     2   0.785     0.2778 0.304 0.404 0.292 0.000
#> GSM1022344     3   0.714    -0.0481 0.304 0.160 0.536 0.000
#> GSM1022345     3   0.707    -0.0373 0.304 0.152 0.544 0.000
#> GSM1022346     3   0.710    -0.0423 0.304 0.156 0.540 0.000
#> GSM1022355     3   0.443     0.5358 0.304 0.000 0.696 0.000
#> GSM1022356     3   0.443     0.5358 0.304 0.000 0.696 0.000
#> GSM1022357     3   0.443     0.5358 0.304 0.000 0.696 0.000
#> GSM1022358     3   0.443     0.5358 0.304 0.000 0.696 0.000
#> GSM1022351     3   0.436     0.5514 0.292 0.000 0.708 0.000
#> GSM1022352     3   0.436     0.5514 0.292 0.000 0.708 0.000
#> GSM1022353     3   0.436     0.5514 0.292 0.000 0.708 0.000
#> GSM1022354     3   0.436     0.5514 0.292 0.000 0.708 0.000
#> GSM1022359     2   0.491     0.1244 0.000 0.580 0.000 0.420
#> GSM1022360     2   0.491     0.1244 0.000 0.580 0.000 0.420
#> GSM1022361     2   0.491     0.1244 0.000 0.580 0.000 0.420
#> GSM1022362     2   0.491     0.1244 0.000 0.580 0.000 0.420
#> GSM1022367     2   0.419     0.3160 0.000 0.732 0.268 0.000
#> GSM1022368     2   0.419     0.3160 0.000 0.732 0.268 0.000
#> GSM1022369     2   0.419     0.3160 0.000 0.732 0.268 0.000
#> GSM1022370     2   0.419     0.3160 0.000 0.732 0.268 0.000
#> GSM1022363     2   0.487     0.1249 0.000 0.596 0.000 0.404
#> GSM1022364     2   0.487     0.1249 0.000 0.596 0.000 0.404
#> GSM1022365     2   0.487     0.1249 0.000 0.596 0.000 0.404
#> GSM1022366     2   0.487     0.1249 0.000 0.596 0.000 0.404
#> GSM1022374     1   0.470     0.4252 0.644 0.356 0.000 0.000
#> GSM1022375     1   0.470     0.4252 0.644 0.356 0.000 0.000
#> GSM1022376     1   0.470     0.4252 0.644 0.356 0.000 0.000
#> GSM1022371     2   0.491     0.1244 0.000 0.580 0.000 0.420
#> GSM1022372     2   0.491     0.1244 0.000 0.580 0.000 0.420
#> GSM1022373     2   0.491     0.1244 0.000 0.580 0.000 0.420
#> GSM1022377     4   0.000     1.0000 0.000 0.000 0.000 1.000
#> GSM1022378     4   0.000     1.0000 0.000 0.000 0.000 1.000
#> GSM1022379     4   0.000     1.0000 0.000 0.000 0.000 1.000
#> GSM1022380     4   0.000     1.0000 0.000 0.000 0.000 1.000
#> GSM1022385     2   0.785     0.2778 0.304 0.404 0.292 0.000
#> GSM1022386     2   0.785     0.2778 0.304 0.404 0.292 0.000
#> GSM1022387     2   0.785     0.2778 0.304 0.404 0.292 0.000
#> GSM1022388     2   0.785     0.2778 0.304 0.404 0.292 0.000
#> GSM1022381     4   0.000     1.0000 0.000 0.000 0.000 1.000
#> GSM1022382     4   0.000     1.0000 0.000 0.000 0.000 1.000
#> GSM1022383     4   0.000     1.0000 0.000 0.000 0.000 1.000
#> GSM1022384     4   0.000     1.0000 0.000 0.000 0.000 1.000
#> GSM1022393     1   0.450     0.7701 0.684 0.000 0.316 0.000
#> GSM1022394     1   0.450     0.7701 0.684 0.000 0.316 0.000
#> GSM1022395     1   0.450     0.7701 0.684 0.000 0.316 0.000
#> GSM1022396     1   0.450     0.7701 0.684 0.000 0.316 0.000
#> GSM1022389     4   0.000     1.0000 0.000 0.000 0.000 1.000
#> GSM1022390     4   0.000     1.0000 0.000 0.000 0.000 1.000
#> GSM1022391     4   0.000     1.0000 0.000 0.000 0.000 1.000
#> GSM1022392     4   0.000     1.0000 0.000 0.000 0.000 1.000
#> GSM1022397     2   0.785     0.2778 0.304 0.404 0.292 0.000
#> GSM1022398     2   0.785     0.2778 0.304 0.404 0.292 0.000
#> GSM1022399     2   0.785     0.2778 0.304 0.404 0.292 0.000
#> GSM1022400     2   0.785     0.2778 0.304 0.404 0.292 0.000
#> GSM1022401     1   0.450     0.7701 0.684 0.000 0.316 0.000
#> GSM1022402     1   0.450     0.7701 0.684 0.000 0.316 0.000
#> GSM1022403     1   0.450     0.7701 0.684 0.000 0.316 0.000
#> GSM1022404     1   0.450     0.7701 0.684 0.000 0.316 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1022325     2  0.1851      0.971 0.000 0.912 0.000 0.088 0.000
#> GSM1022326     2  0.1851      0.971 0.000 0.912 0.000 0.088 0.000
#> GSM1022327     2  0.1851      0.971 0.000 0.912 0.000 0.088 0.000
#> GSM1022331     3  0.1216      0.853 0.020 0.000 0.960 0.000 0.020
#> GSM1022332     3  0.1216      0.853 0.020 0.000 0.960 0.000 0.020
#> GSM1022333     3  0.1216      0.853 0.020 0.000 0.960 0.000 0.020
#> GSM1022328     2  0.1851      0.971 0.000 0.912 0.000 0.088 0.000
#> GSM1022329     2  0.1851      0.971 0.000 0.912 0.000 0.088 0.000
#> GSM1022330     2  0.1851      0.971 0.000 0.912 0.000 0.088 0.000
#> GSM1022337     5  0.1168      0.761 0.032 0.008 0.000 0.000 0.960
#> GSM1022338     5  0.1168      0.761 0.032 0.008 0.000 0.000 0.960
#> GSM1022339     5  0.1168      0.761 0.032 0.008 0.000 0.000 0.960
#> GSM1022334     2  0.1851      0.971 0.000 0.912 0.000 0.088 0.000
#> GSM1022335     2  0.1851      0.971 0.000 0.912 0.000 0.088 0.000
#> GSM1022336     2  0.1851      0.971 0.000 0.912 0.000 0.088 0.000
#> GSM1022340     1  0.0992      0.955 0.968 0.000 0.024 0.008 0.000
#> GSM1022341     1  0.0992      0.955 0.968 0.000 0.024 0.008 0.000
#> GSM1022342     1  0.0992      0.955 0.968 0.000 0.024 0.008 0.000
#> GSM1022343     1  0.0992      0.955 0.968 0.000 0.024 0.008 0.000
#> GSM1022347     3  0.0000      0.866 0.000 0.000 1.000 0.000 0.000
#> GSM1022348     3  0.0000      0.866 0.000 0.000 1.000 0.000 0.000
#> GSM1022349     3  0.0000      0.866 0.000 0.000 1.000 0.000 0.000
#> GSM1022350     3  0.0000      0.866 0.000 0.000 1.000 0.000 0.000
#> GSM1022344     3  0.4455      0.340 0.404 0.000 0.588 0.008 0.000
#> GSM1022345     3  0.4481      0.312 0.416 0.000 0.576 0.008 0.000
#> GSM1022346     3  0.4464      0.331 0.408 0.000 0.584 0.008 0.000
#> GSM1022355     1  0.1357      0.956 0.948 0.000 0.000 0.004 0.048
#> GSM1022356     1  0.1357      0.956 0.948 0.000 0.000 0.004 0.048
#> GSM1022357     1  0.1357      0.956 0.948 0.000 0.000 0.004 0.048
#> GSM1022358     1  0.1357      0.956 0.948 0.000 0.000 0.004 0.048
#> GSM1022351     1  0.0703      0.968 0.976 0.000 0.000 0.000 0.024
#> GSM1022352     1  0.0703      0.968 0.976 0.000 0.000 0.000 0.024
#> GSM1022353     1  0.0703      0.968 0.976 0.000 0.000 0.000 0.024
#> GSM1022354     1  0.0703      0.968 0.976 0.000 0.000 0.000 0.024
#> GSM1022359     2  0.1908      0.970 0.000 0.908 0.000 0.092 0.000
#> GSM1022360     2  0.1908      0.970 0.000 0.908 0.000 0.092 0.000
#> GSM1022361     2  0.1908      0.970 0.000 0.908 0.000 0.092 0.000
#> GSM1022362     2  0.1908      0.970 0.000 0.908 0.000 0.092 0.000
#> GSM1022367     3  0.6100      0.635 0.024 0.196 0.632 0.000 0.148
#> GSM1022368     3  0.6100      0.635 0.024 0.196 0.632 0.000 0.148
#> GSM1022369     3  0.6100      0.635 0.024 0.196 0.632 0.000 0.148
#> GSM1022370     3  0.6100      0.635 0.024 0.196 0.632 0.000 0.148
#> GSM1022363     2  0.0932      0.889 0.004 0.972 0.000 0.004 0.020
#> GSM1022364     2  0.0932      0.889 0.004 0.972 0.000 0.004 0.020
#> GSM1022365     2  0.0932      0.889 0.004 0.972 0.000 0.004 0.020
#> GSM1022366     2  0.0932      0.889 0.004 0.972 0.000 0.004 0.020
#> GSM1022374     5  0.1117      0.753 0.016 0.020 0.000 0.000 0.964
#> GSM1022375     5  0.1117      0.753 0.016 0.020 0.000 0.000 0.964
#> GSM1022376     5  0.1117      0.753 0.016 0.020 0.000 0.000 0.964
#> GSM1022371     2  0.1851      0.971 0.000 0.912 0.000 0.088 0.000
#> GSM1022372     2  0.1851      0.971 0.000 0.912 0.000 0.088 0.000
#> GSM1022373     2  0.1851      0.971 0.000 0.912 0.000 0.088 0.000
#> GSM1022377     4  0.0404      0.960 0.000 0.012 0.000 0.988 0.000
#> GSM1022378     4  0.0404      0.960 0.000 0.012 0.000 0.988 0.000
#> GSM1022379     4  0.0404      0.960 0.000 0.012 0.000 0.988 0.000
#> GSM1022380     4  0.0404      0.960 0.000 0.012 0.000 0.988 0.000
#> GSM1022385     3  0.0000      0.866 0.000 0.000 1.000 0.000 0.000
#> GSM1022386     3  0.0000      0.866 0.000 0.000 1.000 0.000 0.000
#> GSM1022387     3  0.0000      0.866 0.000 0.000 1.000 0.000 0.000
#> GSM1022388     3  0.0000      0.866 0.000 0.000 1.000 0.000 0.000
#> GSM1022381     4  0.0404      0.960 0.000 0.012 0.000 0.988 0.000
#> GSM1022382     4  0.0404      0.960 0.000 0.012 0.000 0.988 0.000
#> GSM1022383     4  0.0404      0.960 0.000 0.012 0.000 0.988 0.000
#> GSM1022384     4  0.0404      0.960 0.000 0.012 0.000 0.988 0.000
#> GSM1022393     5  0.4101      0.777 0.332 0.000 0.000 0.004 0.664
#> GSM1022394     5  0.4101      0.777 0.332 0.000 0.000 0.004 0.664
#> GSM1022395     5  0.4101      0.777 0.332 0.000 0.000 0.004 0.664
#> GSM1022396     5  0.4101      0.777 0.332 0.000 0.000 0.004 0.664
#> GSM1022389     4  0.2233      0.917 0.000 0.104 0.000 0.892 0.004
#> GSM1022390     4  0.2233      0.917 0.000 0.104 0.000 0.892 0.004
#> GSM1022391     4  0.2233      0.917 0.000 0.104 0.000 0.892 0.004
#> GSM1022392     4  0.2233      0.917 0.000 0.104 0.000 0.892 0.004
#> GSM1022397     3  0.0000      0.866 0.000 0.000 1.000 0.000 0.000
#> GSM1022398     3  0.0000      0.866 0.000 0.000 1.000 0.000 0.000
#> GSM1022399     3  0.0000      0.866 0.000 0.000 1.000 0.000 0.000
#> GSM1022400     3  0.0000      0.866 0.000 0.000 1.000 0.000 0.000
#> GSM1022401     5  0.4101      0.777 0.332 0.000 0.000 0.004 0.664
#> GSM1022402     5  0.4101      0.777 0.332 0.000 0.000 0.004 0.664
#> GSM1022403     5  0.4101      0.777 0.332 0.000 0.000 0.004 0.664
#> GSM1022404     5  0.4101      0.777 0.332 0.000 0.000 0.004 0.664

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1022325     2  0.0000      0.901 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022326     2  0.0000      0.901 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022327     2  0.0000      0.901 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022331     3  0.3756      0.225 0.000 0.000 0.600 0.000 0.000 0.400
#> GSM1022332     3  0.3756      0.225 0.000 0.000 0.600 0.000 0.000 0.400
#> GSM1022333     3  0.3756      0.225 0.000 0.000 0.600 0.000 0.000 0.400
#> GSM1022328     2  0.0000      0.901 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022329     2  0.0000      0.901 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022330     2  0.0000      0.901 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022337     5  0.1267      0.734 0.000 0.000 0.000 0.000 0.940 0.060
#> GSM1022338     5  0.1267      0.734 0.000 0.000 0.000 0.000 0.940 0.060
#> GSM1022339     5  0.1267      0.734 0.000 0.000 0.000 0.000 0.940 0.060
#> GSM1022334     2  0.0000      0.901 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022335     2  0.0000      0.901 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022336     2  0.0000      0.901 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022340     1  0.1624      0.920 0.936 0.000 0.004 0.020 0.000 0.040
#> GSM1022341     1  0.1624      0.920 0.936 0.000 0.004 0.020 0.000 0.040
#> GSM1022342     1  0.1624      0.920 0.936 0.000 0.004 0.020 0.000 0.040
#> GSM1022343     1  0.1624      0.920 0.936 0.000 0.004 0.020 0.000 0.040
#> GSM1022347     3  0.0000      0.861 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022348     3  0.0000      0.861 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022349     3  0.0000      0.861 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022350     3  0.0000      0.861 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022344     3  0.3568      0.704 0.128 0.000 0.812 0.020 0.000 0.040
#> GSM1022345     3  0.3838      0.674 0.156 0.000 0.784 0.020 0.000 0.040
#> GSM1022346     3  0.3726      0.688 0.144 0.000 0.796 0.020 0.000 0.040
#> GSM1022355     1  0.1556      0.902 0.920 0.000 0.000 0.000 0.080 0.000
#> GSM1022356     1  0.1556      0.902 0.920 0.000 0.000 0.000 0.080 0.000
#> GSM1022357     1  0.1556      0.902 0.920 0.000 0.000 0.000 0.080 0.000
#> GSM1022358     1  0.1556      0.902 0.920 0.000 0.000 0.000 0.080 0.000
#> GSM1022351     1  0.0000      0.937 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022352     1  0.0000      0.937 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022353     1  0.0000      0.937 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022354     1  0.0000      0.937 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022359     2  0.0405      0.896 0.000 0.988 0.000 0.008 0.000 0.004
#> GSM1022360     2  0.0405      0.896 0.000 0.988 0.000 0.008 0.000 0.004
#> GSM1022361     2  0.0405      0.896 0.000 0.988 0.000 0.008 0.000 0.004
#> GSM1022362     2  0.0405      0.896 0.000 0.988 0.000 0.008 0.000 0.004
#> GSM1022367     6  0.2668      1.000 0.000 0.004 0.168 0.000 0.000 0.828
#> GSM1022368     6  0.2668      1.000 0.000 0.004 0.168 0.000 0.000 0.828
#> GSM1022369     6  0.2668      1.000 0.000 0.004 0.168 0.000 0.000 0.828
#> GSM1022370     6  0.2668      1.000 0.000 0.004 0.168 0.000 0.000 0.828
#> GSM1022363     2  0.3817      0.407 0.000 0.568 0.000 0.000 0.000 0.432
#> GSM1022364     2  0.3817      0.407 0.000 0.568 0.000 0.000 0.000 0.432
#> GSM1022365     2  0.3817      0.407 0.000 0.568 0.000 0.000 0.000 0.432
#> GSM1022366     2  0.3817      0.407 0.000 0.568 0.000 0.000 0.000 0.432
#> GSM1022374     5  0.1327      0.731 0.000 0.000 0.000 0.000 0.936 0.064
#> GSM1022375     5  0.1327      0.731 0.000 0.000 0.000 0.000 0.936 0.064
#> GSM1022376     5  0.1327      0.731 0.000 0.000 0.000 0.000 0.936 0.064
#> GSM1022371     2  0.0000      0.901 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022372     2  0.0000      0.901 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022373     2  0.0000      0.901 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022377     4  0.0547      0.919 0.000 0.020 0.000 0.980 0.000 0.000
#> GSM1022378     4  0.0547      0.919 0.000 0.020 0.000 0.980 0.000 0.000
#> GSM1022379     4  0.0547      0.919 0.000 0.020 0.000 0.980 0.000 0.000
#> GSM1022380     4  0.0547      0.919 0.000 0.020 0.000 0.980 0.000 0.000
#> GSM1022385     3  0.0000      0.861 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022386     3  0.0000      0.861 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022387     3  0.0000      0.861 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022388     3  0.0000      0.861 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022381     4  0.0547      0.919 0.000 0.020 0.000 0.980 0.000 0.000
#> GSM1022382     4  0.0547      0.919 0.000 0.020 0.000 0.980 0.000 0.000
#> GSM1022383     4  0.0547      0.919 0.000 0.020 0.000 0.980 0.000 0.000
#> GSM1022384     4  0.0547      0.919 0.000 0.020 0.000 0.980 0.000 0.000
#> GSM1022393     5  0.3371      0.766 0.292 0.000 0.000 0.000 0.708 0.000
#> GSM1022394     5  0.3371      0.766 0.292 0.000 0.000 0.000 0.708 0.000
#> GSM1022395     5  0.3371      0.766 0.292 0.000 0.000 0.000 0.708 0.000
#> GSM1022396     5  0.3371      0.766 0.292 0.000 0.000 0.000 0.708 0.000
#> GSM1022389     4  0.3772      0.832 0.000 0.160 0.000 0.772 0.000 0.068
#> GSM1022390     4  0.3772      0.832 0.000 0.160 0.000 0.772 0.000 0.068
#> GSM1022391     4  0.3772      0.832 0.000 0.160 0.000 0.772 0.000 0.068
#> GSM1022392     4  0.3772      0.832 0.000 0.160 0.000 0.772 0.000 0.068
#> GSM1022397     3  0.0000      0.861 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022398     3  0.0000      0.861 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022399     3  0.0000      0.861 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022400     3  0.0000      0.861 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022401     5  0.3371      0.766 0.292 0.000 0.000 0.000 0.708 0.000
#> GSM1022402     5  0.3371      0.766 0.292 0.000 0.000 0.000 0.708 0.000
#> GSM1022403     5  0.3371      0.766 0.292 0.000 0.000 0.000 0.708 0.000
#> GSM1022404     5  0.3371      0.766 0.292 0.000 0.000 0.000 0.708 0.000

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-skmeans-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-SD-skmeans-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-SD-skmeans-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-SD-skmeans-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-SD-skmeans-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-SD-skmeans-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-SD-skmeans-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-SD-skmeans-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-SD-skmeans-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-SD-skmeans-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-SD-skmeans-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-SD-skmeans-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-SD-skmeans-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-SD-skmeans-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-SD-skmeans-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-SD-skmeans-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-SD-skmeans-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-SD-skmeans-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-SD-skmeans-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-SD-skmeans-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-skmeans-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-SD-skmeans-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-SD-skmeans-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-SD-skmeans-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-SD-skmeans-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-SD-skmeans-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-skmeans-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>             n protocol(p) cell.type(p) k
#> SD:skmeans 80    1.36e-06     2.28e-06 2
#> SD:skmeans 80    2.40e-10     5.36e-11 3
#> SD:skmeans 35    5.66e-08     5.81e-06 4
#> SD:skmeans 77    1.84e-20     1.36e-13 5
#> SD:skmeans 73    2.24e-30     3.99e-10 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


SD:pam*

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["SD", "pam"]
# you can also extract it by
# res = res_list["SD:pam"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'pam' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk SD-pam-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk SD-pam-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.814           0.918       0.964         0.5040 0.495   0.495
#> 3 3 0.926           0.927       0.969         0.3176 0.689   0.452
#> 4 4 0.840           0.919       0.916         0.1121 0.914   0.744
#> 5 5 0.841           0.831       0.910         0.0683 0.938   0.765
#> 6 6 0.891           0.897       0.946         0.0470 0.942   0.737

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 3

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1022325     2  0.0000      0.926 0.000 1.000
#> GSM1022326     2  0.0000      0.926 0.000 1.000
#> GSM1022327     2  0.0000      0.926 0.000 1.000
#> GSM1022331     1  0.0000      1.000 1.000 0.000
#> GSM1022332     1  0.0000      1.000 1.000 0.000
#> GSM1022333     1  0.0000      1.000 1.000 0.000
#> GSM1022328     2  0.0000      0.926 0.000 1.000
#> GSM1022329     2  0.0000      0.926 0.000 1.000
#> GSM1022330     2  0.0000      0.926 0.000 1.000
#> GSM1022337     2  0.9732      0.415 0.404 0.596
#> GSM1022338     2  0.9732      0.415 0.404 0.596
#> GSM1022339     2  0.9732      0.415 0.404 0.596
#> GSM1022334     2  0.0000      0.926 0.000 1.000
#> GSM1022335     2  0.0000      0.926 0.000 1.000
#> GSM1022336     2  0.0000      0.926 0.000 1.000
#> GSM1022340     1  0.0000      1.000 1.000 0.000
#> GSM1022341     1  0.0000      1.000 1.000 0.000
#> GSM1022342     1  0.0000      1.000 1.000 0.000
#> GSM1022343     1  0.0000      1.000 1.000 0.000
#> GSM1022347     1  0.0000      1.000 1.000 0.000
#> GSM1022348     1  0.0000      1.000 1.000 0.000
#> GSM1022349     1  0.0000      1.000 1.000 0.000
#> GSM1022350     1  0.0000      1.000 1.000 0.000
#> GSM1022344     1  0.0000      1.000 1.000 0.000
#> GSM1022345     1  0.0000      1.000 1.000 0.000
#> GSM1022346     1  0.0000      1.000 1.000 0.000
#> GSM1022355     1  0.0000      1.000 1.000 0.000
#> GSM1022356     1  0.0000      1.000 1.000 0.000
#> GSM1022357     1  0.0000      1.000 1.000 0.000
#> GSM1022358     1  0.0000      1.000 1.000 0.000
#> GSM1022351     1  0.0000      1.000 1.000 0.000
#> GSM1022352     1  0.0000      1.000 1.000 0.000
#> GSM1022353     1  0.0000      1.000 1.000 0.000
#> GSM1022354     1  0.0000      1.000 1.000 0.000
#> GSM1022359     2  0.0000      0.926 0.000 1.000
#> GSM1022360     2  0.0000      0.926 0.000 1.000
#> GSM1022361     2  0.0000      0.926 0.000 1.000
#> GSM1022362     2  0.0000      0.926 0.000 1.000
#> GSM1022367     2  0.0000      0.926 0.000 1.000
#> GSM1022368     2  0.6712      0.764 0.176 0.824
#> GSM1022369     2  0.7299      0.729 0.204 0.796
#> GSM1022370     2  0.0000      0.926 0.000 1.000
#> GSM1022363     2  0.0000      0.926 0.000 1.000
#> GSM1022364     2  0.0000      0.926 0.000 1.000
#> GSM1022365     2  0.0000      0.926 0.000 1.000
#> GSM1022366     2  0.0000      0.926 0.000 1.000
#> GSM1022374     2  0.9732      0.415 0.404 0.596
#> GSM1022375     2  0.9732      0.415 0.404 0.596
#> GSM1022376     2  0.9732      0.415 0.404 0.596
#> GSM1022371     2  0.0000      0.926 0.000 1.000
#> GSM1022372     2  0.0000      0.926 0.000 1.000
#> GSM1022373     2  0.0000      0.926 0.000 1.000
#> GSM1022377     2  0.0000      0.926 0.000 1.000
#> GSM1022378     2  0.0000      0.926 0.000 1.000
#> GSM1022379     2  0.0000      0.926 0.000 1.000
#> GSM1022380     2  0.0000      0.926 0.000 1.000
#> GSM1022385     1  0.0000      1.000 1.000 0.000
#> GSM1022386     1  0.0000      1.000 1.000 0.000
#> GSM1022387     1  0.0000      1.000 1.000 0.000
#> GSM1022388     1  0.0000      1.000 1.000 0.000
#> GSM1022381     2  0.0000      0.926 0.000 1.000
#> GSM1022382     2  0.0000      0.926 0.000 1.000
#> GSM1022383     2  0.0000      0.926 0.000 1.000
#> GSM1022384     2  0.0000      0.926 0.000 1.000
#> GSM1022393     1  0.0000      1.000 1.000 0.000
#> GSM1022394     1  0.0000      1.000 1.000 0.000
#> GSM1022395     1  0.0000      1.000 1.000 0.000
#> GSM1022396     1  0.0000      1.000 1.000 0.000
#> GSM1022389     2  0.0000      0.926 0.000 1.000
#> GSM1022390     2  0.0938      0.918 0.012 0.988
#> GSM1022391     2  0.0000      0.926 0.000 1.000
#> GSM1022392     2  0.4022      0.866 0.080 0.920
#> GSM1022397     1  0.0000      1.000 1.000 0.000
#> GSM1022398     1  0.0000      1.000 1.000 0.000
#> GSM1022399     1  0.0000      1.000 1.000 0.000
#> GSM1022400     1  0.0000      1.000 1.000 0.000
#> GSM1022401     1  0.0000      1.000 1.000 0.000
#> GSM1022402     1  0.0000      1.000 1.000 0.000
#> GSM1022403     1  0.0000      1.000 1.000 0.000
#> GSM1022404     1  0.0000      1.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1022325     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022326     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022327     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022331     3   0.000      0.954 0.000 0.000 1.000
#> GSM1022332     3   0.000      0.954 0.000 0.000 1.000
#> GSM1022333     3   0.000      0.954 0.000 0.000 1.000
#> GSM1022328     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022329     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022330     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022337     1   0.000      0.933 1.000 0.000 0.000
#> GSM1022338     1   0.000      0.933 1.000 0.000 0.000
#> GSM1022339     1   0.000      0.933 1.000 0.000 0.000
#> GSM1022334     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022335     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022336     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022340     1   0.000      0.933 1.000 0.000 0.000
#> GSM1022341     1   0.000      0.933 1.000 0.000 0.000
#> GSM1022342     1   0.000      0.933 1.000 0.000 0.000
#> GSM1022343     1   0.000      0.933 1.000 0.000 0.000
#> GSM1022347     3   0.000      0.954 0.000 0.000 1.000
#> GSM1022348     3   0.000      0.954 0.000 0.000 1.000
#> GSM1022349     3   0.000      0.954 0.000 0.000 1.000
#> GSM1022350     3   0.000      0.954 0.000 0.000 1.000
#> GSM1022344     3   0.000      0.954 0.000 0.000 1.000
#> GSM1022345     3   0.000      0.954 0.000 0.000 1.000
#> GSM1022346     3   0.000      0.954 0.000 0.000 1.000
#> GSM1022355     1   0.000      0.933 1.000 0.000 0.000
#> GSM1022356     1   0.000      0.933 1.000 0.000 0.000
#> GSM1022357     1   0.000      0.933 1.000 0.000 0.000
#> GSM1022358     1   0.000      0.933 1.000 0.000 0.000
#> GSM1022351     1   0.000      0.933 1.000 0.000 0.000
#> GSM1022352     1   0.000      0.933 1.000 0.000 0.000
#> GSM1022353     1   0.000      0.933 1.000 0.000 0.000
#> GSM1022354     1   0.000      0.933 1.000 0.000 0.000
#> GSM1022359     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022360     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022361     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022362     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022367     3   0.588      0.506 0.000 0.348 0.652
#> GSM1022368     3   0.455      0.753 0.000 0.200 0.800
#> GSM1022369     3   0.103      0.936 0.000 0.024 0.976
#> GSM1022370     3   0.556      0.601 0.000 0.300 0.700
#> GSM1022363     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022364     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022365     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022366     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022374     1   0.593      0.484 0.644 0.356 0.000
#> GSM1022375     1   0.568      0.564 0.684 0.316 0.000
#> GSM1022376     1   0.455      0.741 0.800 0.200 0.000
#> GSM1022371     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022372     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022373     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022377     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022378     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022379     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022380     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022385     3   0.000      0.954 0.000 0.000 1.000
#> GSM1022386     3   0.000      0.954 0.000 0.000 1.000
#> GSM1022387     3   0.000      0.954 0.000 0.000 1.000
#> GSM1022388     3   0.000      0.954 0.000 0.000 1.000
#> GSM1022381     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022382     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022383     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022384     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022393     1   0.000      0.933 1.000 0.000 0.000
#> GSM1022394     1   0.000      0.933 1.000 0.000 0.000
#> GSM1022395     1   0.000      0.933 1.000 0.000 0.000
#> GSM1022396     1   0.000      0.933 1.000 0.000 0.000
#> GSM1022389     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022390     1   0.610      0.397 0.608 0.392 0.000
#> GSM1022391     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022392     1   0.573      0.546 0.676 0.324 0.000
#> GSM1022397     3   0.000      0.954 0.000 0.000 1.000
#> GSM1022398     3   0.000      0.954 0.000 0.000 1.000
#> GSM1022399     3   0.000      0.954 0.000 0.000 1.000
#> GSM1022400     3   0.000      0.954 0.000 0.000 1.000
#> GSM1022401     1   0.000      0.933 1.000 0.000 0.000
#> GSM1022402     1   0.000      0.933 1.000 0.000 0.000
#> GSM1022403     1   0.000      0.933 1.000 0.000 0.000
#> GSM1022404     1   0.000      0.933 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1022325     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022326     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022327     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022331     3  0.0000      0.953 0.000 0.000 1.000 0.000
#> GSM1022332     3  0.0000      0.953 0.000 0.000 1.000 0.000
#> GSM1022333     3  0.0000      0.953 0.000 0.000 1.000 0.000
#> GSM1022328     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022329     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022330     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022337     1  0.0000      0.869 1.000 0.000 0.000 0.000
#> GSM1022338     1  0.0000      0.869 1.000 0.000 0.000 0.000
#> GSM1022339     1  0.0000      0.869 1.000 0.000 0.000 0.000
#> GSM1022334     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022335     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022336     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022340     1  0.3688      0.869 0.792 0.000 0.000 0.208
#> GSM1022341     1  0.3688      0.869 0.792 0.000 0.000 0.208
#> GSM1022342     1  0.3688      0.869 0.792 0.000 0.000 0.208
#> GSM1022343     1  0.3688      0.869 0.792 0.000 0.000 0.208
#> GSM1022347     3  0.0000      0.953 0.000 0.000 1.000 0.000
#> GSM1022348     3  0.0000      0.953 0.000 0.000 1.000 0.000
#> GSM1022349     3  0.0000      0.953 0.000 0.000 1.000 0.000
#> GSM1022350     3  0.0000      0.953 0.000 0.000 1.000 0.000
#> GSM1022344     3  0.0000      0.953 0.000 0.000 1.000 0.000
#> GSM1022345     3  0.0000      0.953 0.000 0.000 1.000 0.000
#> GSM1022346     3  0.0000      0.953 0.000 0.000 1.000 0.000
#> GSM1022355     1  0.3688      0.869 0.792 0.000 0.000 0.208
#> GSM1022356     1  0.3688      0.869 0.792 0.000 0.000 0.208
#> GSM1022357     1  0.3688      0.869 0.792 0.000 0.000 0.208
#> GSM1022358     1  0.3688      0.869 0.792 0.000 0.000 0.208
#> GSM1022351     1  0.3688      0.869 0.792 0.000 0.000 0.208
#> GSM1022352     1  0.3688      0.869 0.792 0.000 0.000 0.208
#> GSM1022353     1  0.3688      0.869 0.792 0.000 0.000 0.208
#> GSM1022354     1  0.3688      0.869 0.792 0.000 0.000 0.208
#> GSM1022359     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022360     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022361     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022362     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022367     3  0.4661      0.510 0.000 0.348 0.652 0.000
#> GSM1022368     3  0.3610      0.753 0.000 0.200 0.800 0.000
#> GSM1022369     3  0.0817      0.933 0.000 0.024 0.976 0.000
#> GSM1022370     3  0.4406      0.603 0.000 0.300 0.700 0.000
#> GSM1022363     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022364     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022365     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022366     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022374     1  0.4697      0.409 0.644 0.356 0.000 0.000
#> GSM1022375     1  0.4500      0.496 0.684 0.316 0.000 0.000
#> GSM1022376     1  0.3610      0.689 0.800 0.200 0.000 0.000
#> GSM1022371     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022372     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022373     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022377     4  0.3688      1.000 0.000 0.208 0.000 0.792
#> GSM1022378     4  0.3688      1.000 0.000 0.208 0.000 0.792
#> GSM1022379     4  0.3688      1.000 0.000 0.208 0.000 0.792
#> GSM1022380     4  0.3688      1.000 0.000 0.208 0.000 0.792
#> GSM1022385     3  0.0000      0.953 0.000 0.000 1.000 0.000
#> GSM1022386     3  0.0000      0.953 0.000 0.000 1.000 0.000
#> GSM1022387     3  0.0000      0.953 0.000 0.000 1.000 0.000
#> GSM1022388     3  0.0000      0.953 0.000 0.000 1.000 0.000
#> GSM1022381     4  0.3688      1.000 0.000 0.208 0.000 0.792
#> GSM1022382     4  0.3688      1.000 0.000 0.208 0.000 0.792
#> GSM1022383     4  0.3688      1.000 0.000 0.208 0.000 0.792
#> GSM1022384     4  0.3688      1.000 0.000 0.208 0.000 0.792
#> GSM1022393     1  0.0000      0.869 1.000 0.000 0.000 0.000
#> GSM1022394     1  0.0000      0.869 1.000 0.000 0.000 0.000
#> GSM1022395     1  0.0000      0.869 1.000 0.000 0.000 0.000
#> GSM1022396     1  0.0000      0.869 1.000 0.000 0.000 0.000
#> GSM1022389     4  0.3688      1.000 0.000 0.208 0.000 0.792
#> GSM1022390     4  0.3688      1.000 0.000 0.208 0.000 0.792
#> GSM1022391     4  0.3688      1.000 0.000 0.208 0.000 0.792
#> GSM1022392     4  0.3688      1.000 0.000 0.208 0.000 0.792
#> GSM1022397     3  0.0000      0.953 0.000 0.000 1.000 0.000
#> GSM1022398     3  0.0000      0.953 0.000 0.000 1.000 0.000
#> GSM1022399     3  0.0000      0.953 0.000 0.000 1.000 0.000
#> GSM1022400     3  0.0000      0.953 0.000 0.000 1.000 0.000
#> GSM1022401     1  0.0000      0.869 1.000 0.000 0.000 0.000
#> GSM1022402     1  0.0000      0.869 1.000 0.000 0.000 0.000
#> GSM1022403     1  0.0000      0.869 1.000 0.000 0.000 0.000
#> GSM1022404     1  0.0000      0.869 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1022325     2  0.0000     0.9524 0.000 1.000 0.000 0.000 0.000
#> GSM1022326     2  0.0000     0.9524 0.000 1.000 0.000 0.000 0.000
#> GSM1022327     2  0.0000     0.9524 0.000 1.000 0.000 0.000 0.000
#> GSM1022331     3  0.3210     0.7368 0.000 0.000 0.788 0.000 0.212
#> GSM1022332     3  0.3210     0.7368 0.000 0.000 0.788 0.000 0.212
#> GSM1022333     3  0.3210     0.7368 0.000 0.000 0.788 0.000 0.212
#> GSM1022328     2  0.0000     0.9524 0.000 1.000 0.000 0.000 0.000
#> GSM1022329     2  0.0000     0.9524 0.000 1.000 0.000 0.000 0.000
#> GSM1022330     2  0.0000     0.9524 0.000 1.000 0.000 0.000 0.000
#> GSM1022337     5  0.3210     0.6280 0.212 0.000 0.000 0.000 0.788
#> GSM1022338     5  0.3210     0.6280 0.212 0.000 0.000 0.000 0.788
#> GSM1022339     5  0.3210     0.6280 0.212 0.000 0.000 0.000 0.788
#> GSM1022334     2  0.0000     0.9524 0.000 1.000 0.000 0.000 0.000
#> GSM1022335     2  0.0000     0.9524 0.000 1.000 0.000 0.000 0.000
#> GSM1022336     2  0.0000     0.9524 0.000 1.000 0.000 0.000 0.000
#> GSM1022340     1  0.0000     0.8903 1.000 0.000 0.000 0.000 0.000
#> GSM1022341     1  0.0000     0.8903 1.000 0.000 0.000 0.000 0.000
#> GSM1022342     1  0.0000     0.8903 1.000 0.000 0.000 0.000 0.000
#> GSM1022343     1  0.0000     0.8903 1.000 0.000 0.000 0.000 0.000
#> GSM1022347     3  0.0000     0.9198 0.000 0.000 1.000 0.000 0.000
#> GSM1022348     3  0.0000     0.9198 0.000 0.000 1.000 0.000 0.000
#> GSM1022349     3  0.0000     0.9198 0.000 0.000 1.000 0.000 0.000
#> GSM1022350     3  0.0000     0.9198 0.000 0.000 1.000 0.000 0.000
#> GSM1022344     3  0.0963     0.8961 0.036 0.000 0.964 0.000 0.000
#> GSM1022345     3  0.0963     0.8961 0.036 0.000 0.964 0.000 0.000
#> GSM1022346     3  0.0963     0.8961 0.036 0.000 0.964 0.000 0.000
#> GSM1022355     1  0.0000     0.8903 1.000 0.000 0.000 0.000 0.000
#> GSM1022356     1  0.0000     0.8903 1.000 0.000 0.000 0.000 0.000
#> GSM1022357     1  0.0000     0.8903 1.000 0.000 0.000 0.000 0.000
#> GSM1022358     1  0.0000     0.8903 1.000 0.000 0.000 0.000 0.000
#> GSM1022351     1  0.0000     0.8903 1.000 0.000 0.000 0.000 0.000
#> GSM1022352     1  0.0000     0.8903 1.000 0.000 0.000 0.000 0.000
#> GSM1022353     1  0.0000     0.8903 1.000 0.000 0.000 0.000 0.000
#> GSM1022354     1  0.0000     0.8903 1.000 0.000 0.000 0.000 0.000
#> GSM1022359     2  0.0000     0.9524 0.000 1.000 0.000 0.000 0.000
#> GSM1022360     2  0.0000     0.9524 0.000 1.000 0.000 0.000 0.000
#> GSM1022361     2  0.0000     0.9524 0.000 1.000 0.000 0.000 0.000
#> GSM1022362     2  0.0000     0.9524 0.000 1.000 0.000 0.000 0.000
#> GSM1022367     5  0.4990     0.1159 0.000 0.000 0.384 0.036 0.580
#> GSM1022368     5  0.5010     0.0971 0.000 0.000 0.392 0.036 0.572
#> GSM1022369     3  0.5111     0.1372 0.000 0.000 0.500 0.036 0.464
#> GSM1022370     5  0.5010     0.0971 0.000 0.000 0.392 0.036 0.572
#> GSM1022363     2  0.4119     0.7517 0.000 0.752 0.000 0.036 0.212
#> GSM1022364     2  0.4119     0.7517 0.000 0.752 0.000 0.036 0.212
#> GSM1022365     2  0.4119     0.7517 0.000 0.752 0.000 0.036 0.212
#> GSM1022366     2  0.3064     0.8471 0.000 0.856 0.000 0.036 0.108
#> GSM1022374     5  0.3848     0.6514 0.172 0.040 0.000 0.000 0.788
#> GSM1022375     5  0.3848     0.6514 0.172 0.040 0.000 0.000 0.788
#> GSM1022376     5  0.3848     0.6514 0.172 0.040 0.000 0.000 0.788
#> GSM1022371     2  0.0000     0.9524 0.000 1.000 0.000 0.000 0.000
#> GSM1022372     2  0.0000     0.9524 0.000 1.000 0.000 0.000 0.000
#> GSM1022373     2  0.0000     0.9524 0.000 1.000 0.000 0.000 0.000
#> GSM1022377     4  0.0963     0.9159 0.000 0.036 0.000 0.964 0.000
#> GSM1022378     4  0.0963     0.9159 0.000 0.036 0.000 0.964 0.000
#> GSM1022379     4  0.0963     0.9159 0.000 0.036 0.000 0.964 0.000
#> GSM1022380     4  0.0963     0.9159 0.000 0.036 0.000 0.964 0.000
#> GSM1022385     3  0.0000     0.9198 0.000 0.000 1.000 0.000 0.000
#> GSM1022386     3  0.0000     0.9198 0.000 0.000 1.000 0.000 0.000
#> GSM1022387     3  0.0000     0.9198 0.000 0.000 1.000 0.000 0.000
#> GSM1022388     3  0.0000     0.9198 0.000 0.000 1.000 0.000 0.000
#> GSM1022381     4  0.0000     0.9046 0.000 0.000 0.000 1.000 0.000
#> GSM1022382     4  0.0000     0.9046 0.000 0.000 0.000 1.000 0.000
#> GSM1022383     4  0.0000     0.9046 0.000 0.000 0.000 1.000 0.000
#> GSM1022384     4  0.0000     0.9046 0.000 0.000 0.000 1.000 0.000
#> GSM1022393     1  0.3177     0.8172 0.792 0.000 0.000 0.000 0.208
#> GSM1022394     1  0.3177     0.8172 0.792 0.000 0.000 0.000 0.208
#> GSM1022395     1  0.3177     0.8172 0.792 0.000 0.000 0.000 0.208
#> GSM1022396     1  0.3177     0.8172 0.792 0.000 0.000 0.000 0.208
#> GSM1022389     4  0.2966     0.8434 0.000 0.184 0.000 0.816 0.000
#> GSM1022390     4  0.2929     0.8477 0.000 0.180 0.000 0.820 0.000
#> GSM1022391     4  0.2813     0.8582 0.000 0.168 0.000 0.832 0.000
#> GSM1022392     4  0.2813     0.8582 0.000 0.168 0.000 0.832 0.000
#> GSM1022397     3  0.0000     0.9198 0.000 0.000 1.000 0.000 0.000
#> GSM1022398     3  0.0000     0.9198 0.000 0.000 1.000 0.000 0.000
#> GSM1022399     3  0.0000     0.9198 0.000 0.000 1.000 0.000 0.000
#> GSM1022400     3  0.0000     0.9198 0.000 0.000 1.000 0.000 0.000
#> GSM1022401     1  0.3177     0.8172 0.792 0.000 0.000 0.000 0.208
#> GSM1022402     1  0.3177     0.8172 0.792 0.000 0.000 0.000 0.208
#> GSM1022403     1  0.3177     0.8172 0.792 0.000 0.000 0.000 0.208
#> GSM1022404     1  0.3177     0.8172 0.792 0.000 0.000 0.000 0.208

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1022325     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022326     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022327     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022331     6   0.285      0.752 0.000 0.000 0.208 0.000 0.000 0.792
#> GSM1022332     6   0.297      0.738 0.000 0.000 0.224 0.000 0.000 0.776
#> GSM1022333     6   0.285      0.752 0.000 0.000 0.208 0.000 0.000 0.792
#> GSM1022328     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022329     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022330     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022337     5   0.000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022338     5   0.000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022339     5   0.000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022334     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022335     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022336     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022340     1   0.000      0.879 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022341     1   0.000      0.879 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022342     1   0.000      0.879 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022343     1   0.000      0.879 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022347     3   0.000      0.949 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022348     3   0.000      0.949 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022349     3   0.000      0.949 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022350     3   0.000      0.949 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022344     3   0.276      0.781 0.196 0.000 0.804 0.000 0.000 0.000
#> GSM1022345     3   0.276      0.781 0.196 0.000 0.804 0.000 0.000 0.000
#> GSM1022346     3   0.276      0.781 0.196 0.000 0.804 0.000 0.000 0.000
#> GSM1022355     1   0.000      0.879 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022356     1   0.000      0.879 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022357     1   0.000      0.879 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022358     1   0.000      0.879 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022351     1   0.000      0.879 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022352     1   0.000      0.879 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022353     1   0.000      0.879 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022354     1   0.000      0.879 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022359     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022360     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022361     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022362     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022367     6   0.000      0.865 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1022368     6   0.000      0.865 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1022369     6   0.000      0.865 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1022370     6   0.000      0.865 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1022363     6   0.000      0.865 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1022364     6   0.000      0.865 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1022365     6   0.000      0.865 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1022366     6   0.383      0.186 0.000 0.440 0.000 0.000 0.000 0.560
#> GSM1022374     5   0.000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022375     5   0.000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022376     5   0.000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022371     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022372     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022373     2   0.000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022377     4   0.000      0.921 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022378     4   0.000      0.921 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022379     4   0.000      0.921 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022380     4   0.000      0.921 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022385     3   0.000      0.949 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022386     3   0.000      0.949 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022387     3   0.000      0.949 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022388     3   0.000      0.949 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022381     4   0.000      0.921 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022382     4   0.000      0.921 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022383     4   0.000      0.921 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022384     4   0.000      0.921 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022393     1   0.310      0.789 0.756 0.000 0.000 0.000 0.244 0.000
#> GSM1022394     1   0.310      0.789 0.756 0.000 0.000 0.000 0.244 0.000
#> GSM1022395     1   0.310      0.789 0.756 0.000 0.000 0.000 0.244 0.000
#> GSM1022396     1   0.310      0.789 0.756 0.000 0.000 0.000 0.244 0.000
#> GSM1022389     4   0.263      0.827 0.000 0.180 0.000 0.820 0.000 0.000
#> GSM1022390     4   0.263      0.827 0.000 0.180 0.000 0.820 0.000 0.000
#> GSM1022391     4   0.249      0.841 0.000 0.164 0.000 0.836 0.000 0.000
#> GSM1022392     4   0.249      0.841 0.000 0.164 0.000 0.836 0.000 0.000
#> GSM1022397     3   0.000      0.949 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022398     3   0.000      0.949 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022399     3   0.000      0.949 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022400     3   0.000      0.949 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022401     1   0.310      0.789 0.756 0.000 0.000 0.000 0.244 0.000
#> GSM1022402     1   0.310      0.789 0.756 0.000 0.000 0.000 0.244 0.000
#> GSM1022403     1   0.310      0.789 0.756 0.000 0.000 0.000 0.244 0.000
#> GSM1022404     1   0.310      0.789 0.756 0.000 0.000 0.000 0.244 0.000

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-pam-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-SD-pam-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-SD-pam-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-SD-pam-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-SD-pam-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-SD-pam-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-SD-pam-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-SD-pam-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-SD-pam-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-SD-pam-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-SD-pam-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-SD-pam-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-SD-pam-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-SD-pam-get-signatures-4

get_signatures(res, k = 6)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

plot of chunk tab-SD-pam-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-SD-pam-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-SD-pam-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-SD-pam-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-SD-pam-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-SD-pam-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-pam-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-SD-pam-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-SD-pam-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-SD-pam-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-SD-pam-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-SD-pam-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-pam-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>         n protocol(p) cell.type(p) k
#> SD:pam 74    1.36e-06     6.10e-07 2
#> SD:pam 78    1.82e-10     2.94e-10 3
#> SD:pam 78    2.64e-15     5.77e-10 4
#> SD:pam 76    2.03e-19     2.15e-09 5
#> SD:pam 79    6.42e-28     6.93e-08 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


SD:mclust

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["SD", "mclust"]
# you can also extract it by
# res = res_list["SD:mclust"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 5.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk SD-mclust-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk SD-mclust-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.339           0.812       0.865         0.3636 0.724   0.724
#> 3 3 0.685           0.740       0.880         0.8322 0.478   0.335
#> 4 4 0.633           0.670       0.820         0.0848 0.767   0.434
#> 5 5 0.817           0.798       0.888         0.0917 0.923   0.716
#> 6 6 0.864           0.774       0.882         0.0371 0.939   0.727

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 5

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1022325     2   0.584      0.915 0.140 0.860
#> GSM1022326     2   0.625      0.893 0.156 0.844
#> GSM1022327     2   0.416      0.969 0.084 0.916
#> GSM1022331     1   0.946      0.690 0.636 0.364
#> GSM1022332     1   0.946      0.690 0.636 0.364
#> GSM1022333     1   0.946      0.690 0.636 0.364
#> GSM1022328     2   0.469      0.959 0.100 0.900
#> GSM1022329     2   0.416      0.969 0.084 0.916
#> GSM1022330     2   0.388      0.968 0.076 0.924
#> GSM1022337     1   0.494      0.792 0.892 0.108
#> GSM1022338     1   0.494      0.792 0.892 0.108
#> GSM1022339     1   0.494      0.792 0.892 0.108
#> GSM1022334     2   0.430      0.968 0.088 0.912
#> GSM1022335     2   0.430      0.968 0.088 0.912
#> GSM1022336     2   0.402      0.968 0.080 0.920
#> GSM1022340     1   0.118      0.834 0.984 0.016
#> GSM1022341     1   0.118      0.834 0.984 0.016
#> GSM1022342     1   0.118      0.834 0.984 0.016
#> GSM1022343     1   0.118      0.834 0.984 0.016
#> GSM1022347     1   0.814      0.766 0.748 0.252
#> GSM1022348     1   0.814      0.766 0.748 0.252
#> GSM1022349     1   0.814      0.766 0.748 0.252
#> GSM1022350     1   0.814      0.766 0.748 0.252
#> GSM1022344     1   0.814      0.766 0.748 0.252
#> GSM1022345     1   0.814      0.766 0.748 0.252
#> GSM1022346     1   0.814      0.766 0.748 0.252
#> GSM1022355     1   0.000      0.834 1.000 0.000
#> GSM1022356     1   0.000      0.834 1.000 0.000
#> GSM1022357     1   0.000      0.834 1.000 0.000
#> GSM1022358     1   0.000      0.834 1.000 0.000
#> GSM1022351     1   0.000      0.834 1.000 0.000
#> GSM1022352     1   0.000      0.834 1.000 0.000
#> GSM1022353     1   0.000      0.834 1.000 0.000
#> GSM1022354     1   0.000      0.834 1.000 0.000
#> GSM1022359     2   0.311      0.954 0.056 0.944
#> GSM1022360     2   0.327      0.959 0.060 0.940
#> GSM1022361     2   0.343      0.961 0.064 0.936
#> GSM1022362     2   0.327      0.959 0.060 0.940
#> GSM1022367     1   0.946      0.690 0.636 0.364
#> GSM1022368     1   0.946      0.690 0.636 0.364
#> GSM1022369     1   0.946      0.690 0.636 0.364
#> GSM1022370     1   0.946      0.690 0.636 0.364
#> GSM1022363     1   0.971      0.664 0.600 0.400
#> GSM1022364     1   0.971      0.664 0.600 0.400
#> GSM1022365     1   0.971      0.664 0.600 0.400
#> GSM1022366     1   0.971      0.664 0.600 0.400
#> GSM1022374     1   0.494      0.792 0.892 0.108
#> GSM1022375     1   0.494      0.792 0.892 0.108
#> GSM1022376     1   0.494      0.792 0.892 0.108
#> GSM1022371     1   0.706      0.724 0.808 0.192
#> GSM1022372     1   0.706      0.724 0.808 0.192
#> GSM1022373     1   0.706      0.724 0.808 0.192
#> GSM1022377     1   0.242      0.827 0.960 0.040
#> GSM1022378     1   0.242      0.827 0.960 0.040
#> GSM1022379     1   0.242      0.827 0.960 0.040
#> GSM1022380     1   0.242      0.827 0.960 0.040
#> GSM1022385     1   0.814      0.766 0.748 0.252
#> GSM1022386     1   0.814      0.766 0.748 0.252
#> GSM1022387     1   0.814      0.766 0.748 0.252
#> GSM1022388     1   0.814      0.766 0.748 0.252
#> GSM1022381     1   0.343      0.831 0.936 0.064
#> GSM1022382     1   0.343      0.831 0.936 0.064
#> GSM1022383     1   0.343      0.831 0.936 0.064
#> GSM1022384     1   0.343      0.831 0.936 0.064
#> GSM1022393     1   0.000      0.834 1.000 0.000
#> GSM1022394     1   0.000      0.834 1.000 0.000
#> GSM1022395     1   0.000      0.834 1.000 0.000
#> GSM1022396     1   0.000      0.834 1.000 0.000
#> GSM1022389     1   0.242      0.827 0.960 0.040
#> GSM1022390     1   0.242      0.827 0.960 0.040
#> GSM1022391     1   0.242      0.827 0.960 0.040
#> GSM1022392     1   0.242      0.827 0.960 0.040
#> GSM1022397     1   0.814      0.766 0.748 0.252
#> GSM1022398     1   0.814      0.766 0.748 0.252
#> GSM1022399     1   0.814      0.766 0.748 0.252
#> GSM1022400     1   0.814      0.766 0.748 0.252
#> GSM1022401     1   0.000      0.834 1.000 0.000
#> GSM1022402     1   0.000      0.834 1.000 0.000
#> GSM1022403     1   0.000      0.834 1.000 0.000
#> GSM1022404     1   0.000      0.834 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1022325     2  0.0000      0.828 0.000 1.000 0.000
#> GSM1022326     2  0.0000      0.828 0.000 1.000 0.000
#> GSM1022327     2  0.0000      0.828 0.000 1.000 0.000
#> GSM1022331     3  0.6090      0.601 0.020 0.264 0.716
#> GSM1022332     3  0.6090      0.601 0.020 0.264 0.716
#> GSM1022333     3  0.6090      0.601 0.020 0.264 0.716
#> GSM1022328     2  0.0000      0.828 0.000 1.000 0.000
#> GSM1022329     2  0.0000      0.828 0.000 1.000 0.000
#> GSM1022330     2  0.0000      0.828 0.000 1.000 0.000
#> GSM1022337     1  0.0000      0.928 1.000 0.000 0.000
#> GSM1022338     1  0.0000      0.928 1.000 0.000 0.000
#> GSM1022339     1  0.0000      0.928 1.000 0.000 0.000
#> GSM1022334     2  0.0000      0.828 0.000 1.000 0.000
#> GSM1022335     2  0.0000      0.828 0.000 1.000 0.000
#> GSM1022336     2  0.0000      0.828 0.000 1.000 0.000
#> GSM1022340     3  0.6225      0.332 0.432 0.000 0.568
#> GSM1022341     3  0.6225      0.332 0.432 0.000 0.568
#> GSM1022342     3  0.6225      0.332 0.432 0.000 0.568
#> GSM1022343     3  0.6225      0.332 0.432 0.000 0.568
#> GSM1022347     3  0.0000      0.793 0.000 0.000 1.000
#> GSM1022348     3  0.0000      0.793 0.000 0.000 1.000
#> GSM1022349     3  0.0000      0.793 0.000 0.000 1.000
#> GSM1022350     3  0.0000      0.793 0.000 0.000 1.000
#> GSM1022344     3  0.2165      0.765 0.064 0.000 0.936
#> GSM1022345     3  0.2165      0.765 0.064 0.000 0.936
#> GSM1022346     3  0.2165      0.765 0.064 0.000 0.936
#> GSM1022355     1  0.0000      0.928 1.000 0.000 0.000
#> GSM1022356     1  0.0000      0.928 1.000 0.000 0.000
#> GSM1022357     1  0.0000      0.928 1.000 0.000 0.000
#> GSM1022358     1  0.0000      0.928 1.000 0.000 0.000
#> GSM1022351     1  0.0000      0.928 1.000 0.000 0.000
#> GSM1022352     1  0.0000      0.928 1.000 0.000 0.000
#> GSM1022353     1  0.0000      0.928 1.000 0.000 0.000
#> GSM1022354     1  0.0000      0.928 1.000 0.000 0.000
#> GSM1022359     2  0.0000      0.828 0.000 1.000 0.000
#> GSM1022360     2  0.0000      0.828 0.000 1.000 0.000
#> GSM1022361     2  0.0000      0.828 0.000 1.000 0.000
#> GSM1022362     2  0.0000      0.828 0.000 1.000 0.000
#> GSM1022367     3  0.6865      0.458 0.020 0.384 0.596
#> GSM1022368     3  0.6865      0.458 0.020 0.384 0.596
#> GSM1022369     3  0.6865      0.458 0.020 0.384 0.596
#> GSM1022370     3  0.6865      0.458 0.020 0.384 0.596
#> GSM1022363     2  0.0892      0.822 0.020 0.980 0.000
#> GSM1022364     2  0.0892      0.822 0.020 0.980 0.000
#> GSM1022365     2  0.0892      0.822 0.020 0.980 0.000
#> GSM1022366     2  0.0892      0.822 0.020 0.980 0.000
#> GSM1022374     1  0.0000      0.928 1.000 0.000 0.000
#> GSM1022375     1  0.0000      0.928 1.000 0.000 0.000
#> GSM1022376     1  0.0000      0.928 1.000 0.000 0.000
#> GSM1022371     2  0.6553      0.443 0.324 0.656 0.020
#> GSM1022372     2  0.6553      0.443 0.324 0.656 0.020
#> GSM1022373     2  0.6553      0.443 0.324 0.656 0.020
#> GSM1022377     2  0.7233      0.622 0.064 0.672 0.264
#> GSM1022378     2  0.7233      0.622 0.064 0.672 0.264
#> GSM1022379     2  0.7233      0.622 0.064 0.672 0.264
#> GSM1022380     2  0.7233      0.622 0.064 0.672 0.264
#> GSM1022385     3  0.0000      0.793 0.000 0.000 1.000
#> GSM1022386     3  0.0000      0.793 0.000 0.000 1.000
#> GSM1022387     3  0.0000      0.793 0.000 0.000 1.000
#> GSM1022388     3  0.0000      0.793 0.000 0.000 1.000
#> GSM1022381     2  0.7233      0.622 0.064 0.672 0.264
#> GSM1022382     2  0.7233      0.622 0.064 0.672 0.264
#> GSM1022383     2  0.7233      0.622 0.064 0.672 0.264
#> GSM1022384     2  0.7233      0.622 0.064 0.672 0.264
#> GSM1022393     1  0.0000      0.928 1.000 0.000 0.000
#> GSM1022394     1  0.0000      0.928 1.000 0.000 0.000
#> GSM1022395     1  0.0000      0.928 1.000 0.000 0.000
#> GSM1022396     1  0.0000      0.928 1.000 0.000 0.000
#> GSM1022389     1  0.7037      0.419 0.636 0.328 0.036
#> GSM1022390     1  0.7037      0.419 0.636 0.328 0.036
#> GSM1022391     1  0.7037      0.419 0.636 0.328 0.036
#> GSM1022392     1  0.7037      0.419 0.636 0.328 0.036
#> GSM1022397     3  0.0000      0.793 0.000 0.000 1.000
#> GSM1022398     3  0.0000      0.793 0.000 0.000 1.000
#> GSM1022399     3  0.0000      0.793 0.000 0.000 1.000
#> GSM1022400     3  0.0000      0.793 0.000 0.000 1.000
#> GSM1022401     1  0.0000      0.928 1.000 0.000 0.000
#> GSM1022402     1  0.0000      0.928 1.000 0.000 0.000
#> GSM1022403     1  0.0000      0.928 1.000 0.000 0.000
#> GSM1022404     1  0.0000      0.928 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1022325     2  0.0000     0.9173 0.000 1.000 0.000 0.000
#> GSM1022326     2  0.0000     0.9173 0.000 1.000 0.000 0.000
#> GSM1022327     2  0.0000     0.9173 0.000 1.000 0.000 0.000
#> GSM1022331     1  0.7856     0.2794 0.420 0.004 0.224 0.352
#> GSM1022332     1  0.7856     0.2794 0.420 0.004 0.224 0.352
#> GSM1022333     1  0.7856     0.2794 0.420 0.004 0.224 0.352
#> GSM1022328     2  0.0000     0.9173 0.000 1.000 0.000 0.000
#> GSM1022329     2  0.0000     0.9173 0.000 1.000 0.000 0.000
#> GSM1022330     2  0.0000     0.9173 0.000 1.000 0.000 0.000
#> GSM1022337     1  0.4382     0.4222 0.704 0.000 0.000 0.296
#> GSM1022338     1  0.4382     0.4222 0.704 0.000 0.000 0.296
#> GSM1022339     1  0.4382     0.4222 0.704 0.000 0.000 0.296
#> GSM1022334     2  0.0000     0.9173 0.000 1.000 0.000 0.000
#> GSM1022335     2  0.0000     0.9173 0.000 1.000 0.000 0.000
#> GSM1022336     2  0.0000     0.9173 0.000 1.000 0.000 0.000
#> GSM1022340     4  0.4719     0.7431 0.180 0.000 0.048 0.772
#> GSM1022341     4  0.4719     0.7431 0.180 0.000 0.048 0.772
#> GSM1022342     4  0.4719     0.7431 0.180 0.000 0.048 0.772
#> GSM1022343     4  0.4719     0.7431 0.180 0.000 0.048 0.772
#> GSM1022347     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> GSM1022348     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> GSM1022349     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> GSM1022350     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> GSM1022344     4  0.4955     0.7634 0.144 0.000 0.084 0.772
#> GSM1022345     4  0.4955     0.7634 0.144 0.000 0.084 0.772
#> GSM1022346     4  0.4955     0.7634 0.144 0.000 0.084 0.772
#> GSM1022355     1  0.4992     0.0408 0.524 0.000 0.000 0.476
#> GSM1022356     1  0.4992     0.0408 0.524 0.000 0.000 0.476
#> GSM1022357     1  0.4992     0.0408 0.524 0.000 0.000 0.476
#> GSM1022358     1  0.4992     0.0408 0.524 0.000 0.000 0.476
#> GSM1022351     1  0.4992     0.0408 0.524 0.000 0.000 0.476
#> GSM1022352     1  0.4992     0.0408 0.524 0.000 0.000 0.476
#> GSM1022353     1  0.4992     0.0408 0.524 0.000 0.000 0.476
#> GSM1022354     1  0.4992     0.0408 0.524 0.000 0.000 0.476
#> GSM1022359     2  0.0000     0.9173 0.000 1.000 0.000 0.000
#> GSM1022360     2  0.0000     0.9173 0.000 1.000 0.000 0.000
#> GSM1022361     2  0.0000     0.9173 0.000 1.000 0.000 0.000
#> GSM1022362     2  0.0000     0.9173 0.000 1.000 0.000 0.000
#> GSM1022367     1  0.8933     0.3053 0.420 0.072 0.200 0.308
#> GSM1022368     1  0.8933     0.3053 0.420 0.072 0.200 0.308
#> GSM1022369     1  0.8933     0.3053 0.420 0.072 0.200 0.308
#> GSM1022370     1  0.8933     0.3053 0.420 0.072 0.200 0.308
#> GSM1022363     2  0.5416     0.6095 0.048 0.692 0.000 0.260
#> GSM1022364     2  0.5416     0.6095 0.048 0.692 0.000 0.260
#> GSM1022365     2  0.5416     0.6095 0.048 0.692 0.000 0.260
#> GSM1022366     2  0.5416     0.6095 0.048 0.692 0.000 0.260
#> GSM1022374     1  0.4382     0.4222 0.704 0.000 0.000 0.296
#> GSM1022375     1  0.4382     0.4222 0.704 0.000 0.000 0.296
#> GSM1022376     1  0.4382     0.4222 0.704 0.000 0.000 0.296
#> GSM1022371     2  0.0469     0.9116 0.000 0.988 0.000 0.012
#> GSM1022372     2  0.0469     0.9116 0.000 0.988 0.000 0.012
#> GSM1022373     2  0.0469     0.9116 0.000 0.988 0.000 0.012
#> GSM1022377     4  0.0469     0.8399 0.000 0.000 0.012 0.988
#> GSM1022378     4  0.0469     0.8399 0.000 0.000 0.012 0.988
#> GSM1022379     4  0.0469     0.8399 0.000 0.000 0.012 0.988
#> GSM1022380     4  0.0469     0.8399 0.000 0.000 0.012 0.988
#> GSM1022385     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> GSM1022386     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> GSM1022387     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> GSM1022388     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> GSM1022381     4  0.0469     0.8399 0.000 0.000 0.012 0.988
#> GSM1022382     4  0.0469     0.8399 0.000 0.000 0.012 0.988
#> GSM1022383     4  0.0469     0.8399 0.000 0.000 0.012 0.988
#> GSM1022384     4  0.0469     0.8399 0.000 0.000 0.012 0.988
#> GSM1022393     1  0.1389     0.5241 0.952 0.000 0.000 0.048
#> GSM1022394     1  0.1389     0.5241 0.952 0.000 0.000 0.048
#> GSM1022395     1  0.1389     0.5241 0.952 0.000 0.000 0.048
#> GSM1022396     1  0.1389     0.5241 0.952 0.000 0.000 0.048
#> GSM1022389     4  0.1716     0.8423 0.064 0.000 0.000 0.936
#> GSM1022390     4  0.1716     0.8423 0.064 0.000 0.000 0.936
#> GSM1022391     4  0.1716     0.8423 0.064 0.000 0.000 0.936
#> GSM1022392     4  0.1716     0.8423 0.064 0.000 0.000 0.936
#> GSM1022397     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> GSM1022398     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> GSM1022399     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> GSM1022400     3  0.0000     1.0000 0.000 0.000 1.000 0.000
#> GSM1022401     1  0.1389     0.5241 0.952 0.000 0.000 0.048
#> GSM1022402     1  0.1389     0.5241 0.952 0.000 0.000 0.048
#> GSM1022403     1  0.1389     0.5241 0.952 0.000 0.000 0.048
#> GSM1022404     1  0.1389     0.5241 0.952 0.000 0.000 0.048

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1022325     2   0.000      0.941 0.000 1.000 0.000 0.000 0.000
#> GSM1022326     2   0.000      0.941 0.000 1.000 0.000 0.000 0.000
#> GSM1022327     2   0.000      0.941 0.000 1.000 0.000 0.000 0.000
#> GSM1022331     5   0.424      0.783 0.428 0.000 0.000 0.000 0.572
#> GSM1022332     5   0.424      0.783 0.428 0.000 0.000 0.000 0.572
#> GSM1022333     5   0.424      0.783 0.428 0.000 0.000 0.000 0.572
#> GSM1022328     2   0.000      0.941 0.000 1.000 0.000 0.000 0.000
#> GSM1022329     2   0.000      0.941 0.000 1.000 0.000 0.000 0.000
#> GSM1022330     2   0.000      0.941 0.000 1.000 0.000 0.000 0.000
#> GSM1022337     5   0.000      0.697 0.000 0.000 0.000 0.000 1.000
#> GSM1022338     5   0.000      0.697 0.000 0.000 0.000 0.000 1.000
#> GSM1022339     5   0.000      0.697 0.000 0.000 0.000 0.000 1.000
#> GSM1022334     2   0.000      0.941 0.000 1.000 0.000 0.000 0.000
#> GSM1022335     2   0.000      0.941 0.000 1.000 0.000 0.000 0.000
#> GSM1022336     2   0.000      0.941 0.000 1.000 0.000 0.000 0.000
#> GSM1022340     4   0.323      0.785 0.196 0.000 0.004 0.800 0.000
#> GSM1022341     4   0.323      0.785 0.196 0.000 0.004 0.800 0.000
#> GSM1022342     4   0.323      0.785 0.196 0.000 0.004 0.800 0.000
#> GSM1022343     4   0.323      0.785 0.196 0.000 0.004 0.800 0.000
#> GSM1022347     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022348     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022349     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022350     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022344     4   0.452      0.779 0.164 0.000 0.088 0.748 0.000
#> GSM1022345     4   0.452      0.779 0.164 0.000 0.088 0.748 0.000
#> GSM1022346     4   0.452      0.779 0.164 0.000 0.088 0.748 0.000
#> GSM1022355     1   0.424      0.413 0.572 0.000 0.000 0.428 0.000
#> GSM1022356     1   0.424      0.413 0.572 0.000 0.000 0.428 0.000
#> GSM1022357     1   0.424      0.413 0.572 0.000 0.000 0.428 0.000
#> GSM1022358     1   0.424      0.413 0.572 0.000 0.000 0.428 0.000
#> GSM1022351     4   0.311      0.781 0.200 0.000 0.000 0.800 0.000
#> GSM1022352     1   0.424      0.413 0.572 0.000 0.000 0.428 0.000
#> GSM1022353     1   0.424      0.413 0.572 0.000 0.000 0.428 0.000
#> GSM1022354     1   0.424      0.413 0.572 0.000 0.000 0.428 0.000
#> GSM1022359     2   0.000      0.941 0.000 1.000 0.000 0.000 0.000
#> GSM1022360     2   0.000      0.941 0.000 1.000 0.000 0.000 0.000
#> GSM1022361     2   0.000      0.941 0.000 1.000 0.000 0.000 0.000
#> GSM1022362     2   0.000      0.941 0.000 1.000 0.000 0.000 0.000
#> GSM1022367     5   0.424      0.783 0.428 0.000 0.000 0.000 0.572
#> GSM1022368     5   0.424      0.783 0.428 0.000 0.000 0.000 0.572
#> GSM1022369     5   0.424      0.783 0.428 0.000 0.000 0.000 0.572
#> GSM1022370     5   0.424      0.783 0.428 0.000 0.000 0.000 0.572
#> GSM1022363     2   0.437      0.699 0.052 0.740 0.000 0.000 0.208
#> GSM1022364     2   0.437      0.699 0.052 0.740 0.000 0.000 0.208
#> GSM1022365     2   0.437      0.699 0.052 0.740 0.000 0.000 0.208
#> GSM1022366     2   0.437      0.699 0.052 0.740 0.000 0.000 0.208
#> GSM1022374     5   0.000      0.697 0.000 0.000 0.000 0.000 1.000
#> GSM1022375     5   0.000      0.697 0.000 0.000 0.000 0.000 1.000
#> GSM1022376     5   0.000      0.697 0.000 0.000 0.000 0.000 1.000
#> GSM1022371     2   0.000      0.941 0.000 1.000 0.000 0.000 0.000
#> GSM1022372     2   0.000      0.941 0.000 1.000 0.000 0.000 0.000
#> GSM1022373     2   0.000      0.941 0.000 1.000 0.000 0.000 0.000
#> GSM1022377     4   0.029      0.841 0.008 0.000 0.000 0.992 0.000
#> GSM1022378     4   0.029      0.841 0.008 0.000 0.000 0.992 0.000
#> GSM1022379     4   0.029      0.841 0.008 0.000 0.000 0.992 0.000
#> GSM1022380     4   0.029      0.841 0.008 0.000 0.000 0.992 0.000
#> GSM1022385     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022386     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022387     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022388     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022381     4   0.141      0.821 0.044 0.008 0.000 0.948 0.000
#> GSM1022382     4   0.141      0.821 0.044 0.008 0.000 0.948 0.000
#> GSM1022383     4   0.141      0.821 0.044 0.008 0.000 0.948 0.000
#> GSM1022384     4   0.141      0.821 0.044 0.008 0.000 0.948 0.000
#> GSM1022393     1   0.424      0.639 0.572 0.000 0.000 0.000 0.428
#> GSM1022394     1   0.424      0.639 0.572 0.000 0.000 0.000 0.428
#> GSM1022395     1   0.424      0.639 0.572 0.000 0.000 0.000 0.428
#> GSM1022396     1   0.424      0.639 0.572 0.000 0.000 0.000 0.428
#> GSM1022389     4   0.173      0.853 0.080 0.000 0.000 0.920 0.000
#> GSM1022390     4   0.173      0.853 0.080 0.000 0.000 0.920 0.000
#> GSM1022391     4   0.173      0.853 0.080 0.000 0.000 0.920 0.000
#> GSM1022392     4   0.173      0.853 0.080 0.000 0.000 0.920 0.000
#> GSM1022397     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022398     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022399     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022400     3   0.000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022401     1   0.424      0.639 0.572 0.000 0.000 0.000 0.428
#> GSM1022402     1   0.424      0.639 0.572 0.000 0.000 0.000 0.428
#> GSM1022403     1   0.424      0.639 0.572 0.000 0.000 0.000 0.428
#> GSM1022404     1   0.424      0.639 0.572 0.000 0.000 0.000 0.428

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1022325     2   0.000     0.9456 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022326     2   0.000     0.9456 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022327     2   0.000     0.9456 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022331     6   0.000     1.0000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1022332     6   0.000     1.0000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1022333     6   0.000     1.0000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1022328     2   0.000     0.9456 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022329     2   0.000     0.9456 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022330     2   0.000     0.9456 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022337     5   0.000     1.0000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022338     5   0.000     1.0000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022339     5   0.000     1.0000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022334     2   0.000     0.9456 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022335     2   0.000     0.9456 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022336     2   0.000     0.9456 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022340     1   0.382    -0.0497 0.564 0.000 0.000 0.436 0.000 0.000
#> GSM1022341     1   0.382    -0.0497 0.564 0.000 0.000 0.436 0.000 0.000
#> GSM1022342     1   0.382    -0.0497 0.564 0.000 0.000 0.436 0.000 0.000
#> GSM1022343     1   0.382    -0.0497 0.564 0.000 0.000 0.436 0.000 0.000
#> GSM1022347     3   0.000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022348     3   0.000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022349     3   0.000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022350     3   0.000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022344     4   0.586     0.2361 0.368 0.000 0.196 0.436 0.000 0.000
#> GSM1022345     4   0.586     0.2361 0.368 0.000 0.196 0.436 0.000 0.000
#> GSM1022346     4   0.586     0.2361 0.368 0.000 0.196 0.436 0.000 0.000
#> GSM1022355     1   0.133     0.6439 0.936 0.000 0.000 0.064 0.000 0.000
#> GSM1022356     1   0.133     0.6439 0.936 0.000 0.000 0.064 0.000 0.000
#> GSM1022357     1   0.133     0.6439 0.936 0.000 0.000 0.064 0.000 0.000
#> GSM1022358     1   0.133     0.6439 0.936 0.000 0.000 0.064 0.000 0.000
#> GSM1022351     1   0.150     0.6338 0.924 0.000 0.000 0.076 0.000 0.000
#> GSM1022352     1   0.133     0.6439 0.936 0.000 0.000 0.064 0.000 0.000
#> GSM1022353     1   0.133     0.6439 0.936 0.000 0.000 0.064 0.000 0.000
#> GSM1022354     1   0.133     0.6439 0.936 0.000 0.000 0.064 0.000 0.000
#> GSM1022359     2   0.000     0.9456 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022360     2   0.000     0.9456 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022361     2   0.000     0.9456 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022362     2   0.000     0.9456 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022367     6   0.000     1.0000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1022368     6   0.000     1.0000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1022369     6   0.000     1.0000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1022370     6   0.000     1.0000 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1022363     2   0.310     0.7282 0.000 0.756 0.000 0.000 0.000 0.244
#> GSM1022364     2   0.310     0.7282 0.000 0.756 0.000 0.000 0.000 0.244
#> GSM1022365     2   0.310     0.7282 0.000 0.756 0.000 0.000 0.000 0.244
#> GSM1022366     2   0.310     0.7282 0.000 0.756 0.000 0.000 0.000 0.244
#> GSM1022374     5   0.000     1.0000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022375     5   0.000     1.0000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022376     5   0.000     1.0000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022371     2   0.000     0.9456 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022372     2   0.000     0.9456 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022373     2   0.000     0.9456 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022377     4   0.000     0.8241 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022378     4   0.000     0.8241 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022379     4   0.000     0.8241 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022380     4   0.000     0.8241 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022385     3   0.000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022386     3   0.000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022387     3   0.000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022388     3   0.000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022381     4   0.000     0.8241 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022382     4   0.000     0.8241 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022383     4   0.000     0.8241 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022384     4   0.000     0.8241 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022393     1   0.366     0.4386 0.636 0.000 0.000 0.000 0.364 0.000
#> GSM1022394     1   0.366     0.4386 0.636 0.000 0.000 0.000 0.364 0.000
#> GSM1022395     1   0.366     0.4386 0.636 0.000 0.000 0.000 0.364 0.000
#> GSM1022396     1   0.366     0.4386 0.636 0.000 0.000 0.000 0.364 0.000
#> GSM1022389     4   0.205     0.7816 0.120 0.000 0.000 0.880 0.000 0.000
#> GSM1022390     4   0.205     0.7816 0.120 0.000 0.000 0.880 0.000 0.000
#> GSM1022391     4   0.205     0.7816 0.120 0.000 0.000 0.880 0.000 0.000
#> GSM1022392     4   0.205     0.7816 0.120 0.000 0.000 0.880 0.000 0.000
#> GSM1022397     3   0.000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022398     3   0.000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022399     3   0.000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022400     3   0.000     1.0000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022401     1   0.366     0.4386 0.636 0.000 0.000 0.000 0.364 0.000
#> GSM1022402     1   0.366     0.4386 0.636 0.000 0.000 0.000 0.364 0.000
#> GSM1022403     1   0.366     0.4386 0.636 0.000 0.000 0.000 0.364 0.000
#> GSM1022404     1   0.366     0.4386 0.636 0.000 0.000 0.000 0.364 0.000

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-mclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-SD-mclust-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-SD-mclust-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-SD-mclust-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-SD-mclust-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-SD-mclust-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-SD-mclust-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-SD-mclust-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-SD-mclust-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-SD-mclust-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-SD-mclust-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-SD-mclust-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-SD-mclust-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-SD-mclust-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-SD-mclust-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-SD-mclust-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-SD-mclust-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-SD-mclust-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-SD-mclust-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-SD-mclust-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-mclust-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-SD-mclust-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-SD-mclust-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-SD-mclust-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-SD-mclust-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-SD-mclust-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-mclust-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>            n protocol(p) cell.type(p) k
#> SD:mclust 80    1.22e-07     8.06e-04 2
#> SD:mclust 65    3.09e-11     7.96e-10 3
#> SD:mclust 59    5.91e-12     9.61e-13 4
#> SD:mclust 73    1.85e-14     5.28e-15 5
#> SD:mclust 65    3.84e-21     5.29e-11 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


SD:NMF**

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["SD", "NMF"]
# you can also extract it by
# res = res_list["SD:NMF"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk SD-NMF-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk SD-NMF-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.948           0.927       0.972         0.5050 0.494   0.494
#> 3 3 0.927           0.922       0.969         0.3228 0.710   0.480
#> 4 4 0.988           0.955       0.966         0.0880 0.893   0.701
#> 5 5 0.892           0.866       0.906         0.0619 0.930   0.749
#> 6 6 0.837           0.773       0.855         0.0393 0.981   0.914

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 4
#> attr(,"optional")
#> [1] 2 3

There is also optional best \(k\) = 2 3 that is worth to check.

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1022325     2  0.0000     0.9668 0.000 1.000
#> GSM1022326     2  0.0000     0.9668 0.000 1.000
#> GSM1022327     2  0.0000     0.9668 0.000 1.000
#> GSM1022331     1  0.0000     0.9740 1.000 0.000
#> GSM1022332     1  0.0000     0.9740 1.000 0.000
#> GSM1022333     1  0.0000     0.9740 1.000 0.000
#> GSM1022328     2  0.0000     0.9668 0.000 1.000
#> GSM1022329     2  0.0000     0.9668 0.000 1.000
#> GSM1022330     2  0.0000     0.9668 0.000 1.000
#> GSM1022337     2  0.6247     0.8088 0.156 0.844
#> GSM1022338     2  0.6343     0.8040 0.160 0.840
#> GSM1022339     2  0.3114     0.9180 0.056 0.944
#> GSM1022334     2  0.0000     0.9668 0.000 1.000
#> GSM1022335     2  0.0000     0.9668 0.000 1.000
#> GSM1022336     2  0.0000     0.9668 0.000 1.000
#> GSM1022340     1  0.0376     0.9727 0.996 0.004
#> GSM1022341     1  0.0000     0.9740 1.000 0.000
#> GSM1022342     1  0.0000     0.9740 1.000 0.000
#> GSM1022343     1  0.0000     0.9740 1.000 0.000
#> GSM1022347     1  0.0000     0.9740 1.000 0.000
#> GSM1022348     1  0.0000     0.9740 1.000 0.000
#> GSM1022349     1  0.0000     0.9740 1.000 0.000
#> GSM1022350     1  0.0000     0.9740 1.000 0.000
#> GSM1022344     1  0.0000     0.9740 1.000 0.000
#> GSM1022345     1  0.0000     0.9740 1.000 0.000
#> GSM1022346     1  0.0000     0.9740 1.000 0.000
#> GSM1022355     1  0.0376     0.9727 0.996 0.004
#> GSM1022356     1  0.0938     0.9668 0.988 0.012
#> GSM1022357     1  0.0376     0.9727 0.996 0.004
#> GSM1022358     1  0.0938     0.9668 0.988 0.012
#> GSM1022351     1  0.0672     0.9699 0.992 0.008
#> GSM1022352     1  0.0376     0.9727 0.996 0.004
#> GSM1022353     1  0.0000     0.9740 1.000 0.000
#> GSM1022354     1  0.0376     0.9727 0.996 0.004
#> GSM1022359     2  0.0000     0.9668 0.000 1.000
#> GSM1022360     2  0.0000     0.9668 0.000 1.000
#> GSM1022361     2  0.0000     0.9668 0.000 1.000
#> GSM1022362     2  0.0000     0.9668 0.000 1.000
#> GSM1022367     2  0.9661     0.3605 0.392 0.608
#> GSM1022368     1  0.9988     0.0267 0.520 0.480
#> GSM1022369     1  0.9608     0.3407 0.616 0.384
#> GSM1022370     2  0.9963     0.1412 0.464 0.536
#> GSM1022363     2  0.0000     0.9668 0.000 1.000
#> GSM1022364     2  0.0000     0.9668 0.000 1.000
#> GSM1022365     2  0.0000     0.9668 0.000 1.000
#> GSM1022366     2  0.0000     0.9668 0.000 1.000
#> GSM1022374     2  0.0672     0.9610 0.008 0.992
#> GSM1022375     2  0.0376     0.9640 0.004 0.996
#> GSM1022376     2  0.0672     0.9610 0.008 0.992
#> GSM1022371     2  0.0000     0.9668 0.000 1.000
#> GSM1022372     2  0.0000     0.9668 0.000 1.000
#> GSM1022373     2  0.0000     0.9668 0.000 1.000
#> GSM1022377     2  0.0000     0.9668 0.000 1.000
#> GSM1022378     2  0.0000     0.9668 0.000 1.000
#> GSM1022379     2  0.0000     0.9668 0.000 1.000
#> GSM1022380     2  0.0000     0.9668 0.000 1.000
#> GSM1022385     1  0.0000     0.9740 1.000 0.000
#> GSM1022386     1  0.0000     0.9740 1.000 0.000
#> GSM1022387     1  0.0000     0.9740 1.000 0.000
#> GSM1022388     1  0.0000     0.9740 1.000 0.000
#> GSM1022381     2  0.0000     0.9668 0.000 1.000
#> GSM1022382     2  0.0000     0.9668 0.000 1.000
#> GSM1022383     2  0.0000     0.9668 0.000 1.000
#> GSM1022384     2  0.0000     0.9668 0.000 1.000
#> GSM1022393     1  0.1184     0.9631 0.984 0.016
#> GSM1022394     1  0.0000     0.9740 1.000 0.000
#> GSM1022395     1  0.0938     0.9668 0.988 0.012
#> GSM1022396     1  0.0376     0.9727 0.996 0.004
#> GSM1022389     2  0.0000     0.9668 0.000 1.000
#> GSM1022390     2  0.0000     0.9668 0.000 1.000
#> GSM1022391     2  0.0000     0.9668 0.000 1.000
#> GSM1022392     2  0.0000     0.9668 0.000 1.000
#> GSM1022397     1  0.0000     0.9740 1.000 0.000
#> GSM1022398     1  0.0000     0.9740 1.000 0.000
#> GSM1022399     1  0.0000     0.9740 1.000 0.000
#> GSM1022400     1  0.0000     0.9740 1.000 0.000
#> GSM1022401     1  0.0000     0.9740 1.000 0.000
#> GSM1022402     1  0.0376     0.9727 0.996 0.004
#> GSM1022403     1  0.0376     0.9727 0.996 0.004
#> GSM1022404     1  0.0000     0.9740 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1022325     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022326     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022327     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022331     3  0.0000     0.9805 0.000 0.000 1.000
#> GSM1022332     3  0.0000     0.9805 0.000 0.000 1.000
#> GSM1022333     3  0.0000     0.9805 0.000 0.000 1.000
#> GSM1022328     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022329     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022330     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022337     1  0.0000     0.9485 1.000 0.000 0.000
#> GSM1022338     1  0.0000     0.9485 1.000 0.000 0.000
#> GSM1022339     1  0.0000     0.9485 1.000 0.000 0.000
#> GSM1022334     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022335     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022336     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022340     1  0.0000     0.9485 1.000 0.000 0.000
#> GSM1022341     1  0.0000     0.9485 1.000 0.000 0.000
#> GSM1022342     1  0.0000     0.9485 1.000 0.000 0.000
#> GSM1022343     1  0.0000     0.9485 1.000 0.000 0.000
#> GSM1022347     3  0.0000     0.9805 0.000 0.000 1.000
#> GSM1022348     3  0.0000     0.9805 0.000 0.000 1.000
#> GSM1022349     3  0.0000     0.9805 0.000 0.000 1.000
#> GSM1022350     3  0.0000     0.9805 0.000 0.000 1.000
#> GSM1022344     3  0.0000     0.9805 0.000 0.000 1.000
#> GSM1022345     3  0.5810     0.4858 0.336 0.000 0.664
#> GSM1022346     3  0.2066     0.9219 0.060 0.000 0.940
#> GSM1022355     1  0.0000     0.9485 1.000 0.000 0.000
#> GSM1022356     1  0.0000     0.9485 1.000 0.000 0.000
#> GSM1022357     1  0.0000     0.9485 1.000 0.000 0.000
#> GSM1022358     1  0.0000     0.9485 1.000 0.000 0.000
#> GSM1022351     1  0.0000     0.9485 1.000 0.000 0.000
#> GSM1022352     1  0.0000     0.9485 1.000 0.000 0.000
#> GSM1022353     1  0.0000     0.9485 1.000 0.000 0.000
#> GSM1022354     1  0.0000     0.9485 1.000 0.000 0.000
#> GSM1022359     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022360     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022361     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022362     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022367     3  0.0000     0.9805 0.000 0.000 1.000
#> GSM1022368     3  0.0000     0.9805 0.000 0.000 1.000
#> GSM1022369     3  0.0000     0.9805 0.000 0.000 1.000
#> GSM1022370     3  0.0000     0.9805 0.000 0.000 1.000
#> GSM1022363     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022364     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022365     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022366     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022374     1  0.4654     0.7416 0.792 0.208 0.000
#> GSM1022375     1  0.4750     0.7307 0.784 0.216 0.000
#> GSM1022376     1  0.4291     0.7772 0.820 0.180 0.000
#> GSM1022371     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022372     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022373     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022377     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022378     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022379     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022380     2  0.0592     0.9578 0.012 0.988 0.000
#> GSM1022385     3  0.0000     0.9805 0.000 0.000 1.000
#> GSM1022386     3  0.0000     0.9805 0.000 0.000 1.000
#> GSM1022387     3  0.0000     0.9805 0.000 0.000 1.000
#> GSM1022388     3  0.0000     0.9805 0.000 0.000 1.000
#> GSM1022381     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022382     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022383     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022384     2  0.0000     0.9693 0.000 1.000 0.000
#> GSM1022393     1  0.0000     0.9485 1.000 0.000 0.000
#> GSM1022394     1  0.0000     0.9485 1.000 0.000 0.000
#> GSM1022395     1  0.0000     0.9485 1.000 0.000 0.000
#> GSM1022396     1  0.0000     0.9485 1.000 0.000 0.000
#> GSM1022389     2  0.6302     0.0434 0.480 0.520 0.000
#> GSM1022390     1  0.5785     0.5021 0.668 0.332 0.000
#> GSM1022391     2  0.5859     0.4545 0.344 0.656 0.000
#> GSM1022392     1  0.5560     0.5697 0.700 0.300 0.000
#> GSM1022397     3  0.0000     0.9805 0.000 0.000 1.000
#> GSM1022398     3  0.0000     0.9805 0.000 0.000 1.000
#> GSM1022399     3  0.0000     0.9805 0.000 0.000 1.000
#> GSM1022400     3  0.0000     0.9805 0.000 0.000 1.000
#> GSM1022401     1  0.0000     0.9485 1.000 0.000 0.000
#> GSM1022402     1  0.0000     0.9485 1.000 0.000 0.000
#> GSM1022403     1  0.0000     0.9485 1.000 0.000 0.000
#> GSM1022404     1  0.0000     0.9485 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1022325     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> GSM1022326     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> GSM1022327     2  0.0469      0.971 0.012 0.988 0.000 0.000
#> GSM1022331     3  0.0000      0.985 0.000 0.000 1.000 0.000
#> GSM1022332     3  0.0000      0.985 0.000 0.000 1.000 0.000
#> GSM1022333     3  0.0000      0.985 0.000 0.000 1.000 0.000
#> GSM1022328     2  0.1022      0.968 0.032 0.968 0.000 0.000
#> GSM1022329     2  0.0592      0.971 0.016 0.984 0.000 0.000
#> GSM1022330     2  0.0592      0.971 0.016 0.984 0.000 0.000
#> GSM1022337     1  0.0336      0.927 0.992 0.000 0.000 0.008
#> GSM1022338     1  0.0336      0.927 0.992 0.000 0.000 0.008
#> GSM1022339     1  0.0000      0.922 1.000 0.000 0.000 0.000
#> GSM1022334     2  0.0336      0.970 0.008 0.992 0.000 0.000
#> GSM1022335     2  0.0469      0.971 0.012 0.988 0.000 0.000
#> GSM1022336     2  0.0469      0.971 0.012 0.988 0.000 0.000
#> GSM1022340     4  0.0188      0.973 0.004 0.000 0.000 0.996
#> GSM1022341     4  0.0188      0.973 0.004 0.000 0.000 0.996
#> GSM1022342     4  0.0188      0.973 0.004 0.000 0.000 0.996
#> GSM1022343     4  0.0188      0.973 0.004 0.000 0.000 0.996
#> GSM1022347     3  0.0000      0.985 0.000 0.000 1.000 0.000
#> GSM1022348     3  0.0000      0.985 0.000 0.000 1.000 0.000
#> GSM1022349     3  0.0000      0.985 0.000 0.000 1.000 0.000
#> GSM1022350     3  0.0000      0.985 0.000 0.000 1.000 0.000
#> GSM1022344     4  0.1867      0.922 0.000 0.000 0.072 0.928
#> GSM1022345     4  0.1389      0.944 0.000 0.000 0.048 0.952
#> GSM1022346     4  0.1637      0.934 0.000 0.000 0.060 0.940
#> GSM1022355     1  0.3444      0.865 0.816 0.000 0.000 0.184
#> GSM1022356     1  0.3172      0.887 0.840 0.000 0.000 0.160
#> GSM1022357     1  0.3528      0.856 0.808 0.000 0.000 0.192
#> GSM1022358     1  0.3219      0.884 0.836 0.000 0.000 0.164
#> GSM1022351     4  0.0469      0.971 0.012 0.000 0.000 0.988
#> GSM1022352     4  0.0469      0.971 0.012 0.000 0.000 0.988
#> GSM1022353     4  0.0469      0.971 0.012 0.000 0.000 0.988
#> GSM1022354     4  0.0592      0.968 0.016 0.000 0.000 0.984
#> GSM1022359     2  0.1302      0.965 0.044 0.956 0.000 0.000
#> GSM1022360     2  0.1302      0.965 0.044 0.956 0.000 0.000
#> GSM1022361     2  0.1302      0.965 0.044 0.956 0.000 0.000
#> GSM1022362     2  0.1302      0.965 0.044 0.956 0.000 0.000
#> GSM1022367     3  0.1743      0.943 0.056 0.000 0.940 0.004
#> GSM1022368     3  0.1743      0.943 0.056 0.000 0.940 0.004
#> GSM1022369     3  0.1743      0.943 0.056 0.000 0.940 0.004
#> GSM1022370     3  0.1743      0.943 0.056 0.000 0.940 0.004
#> GSM1022363     2  0.1743      0.959 0.056 0.940 0.000 0.004
#> GSM1022364     2  0.1743      0.959 0.056 0.940 0.000 0.004
#> GSM1022365     2  0.1743      0.959 0.056 0.940 0.000 0.004
#> GSM1022366     2  0.1743      0.959 0.056 0.940 0.000 0.004
#> GSM1022374     1  0.0000      0.922 1.000 0.000 0.000 0.000
#> GSM1022375     1  0.0000      0.922 1.000 0.000 0.000 0.000
#> GSM1022376     1  0.0000      0.922 1.000 0.000 0.000 0.000
#> GSM1022371     2  0.1557      0.960 0.056 0.944 0.000 0.000
#> GSM1022372     2  0.1474      0.962 0.052 0.948 0.000 0.000
#> GSM1022373     2  0.1557      0.960 0.056 0.944 0.000 0.000
#> GSM1022377     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> GSM1022378     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> GSM1022379     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> GSM1022380     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> GSM1022385     3  0.0000      0.985 0.000 0.000 1.000 0.000
#> GSM1022386     3  0.0000      0.985 0.000 0.000 1.000 0.000
#> GSM1022387     3  0.0000      0.985 0.000 0.000 1.000 0.000
#> GSM1022388     3  0.0000      0.985 0.000 0.000 1.000 0.000
#> GSM1022381     2  0.0707      0.961 0.000 0.980 0.000 0.020
#> GSM1022382     2  0.0707      0.961 0.000 0.980 0.000 0.020
#> GSM1022383     2  0.0817      0.959 0.000 0.976 0.000 0.024
#> GSM1022384     2  0.1389      0.942 0.000 0.952 0.000 0.048
#> GSM1022393     1  0.1792      0.944 0.932 0.000 0.000 0.068
#> GSM1022394     1  0.1867      0.943 0.928 0.000 0.000 0.072
#> GSM1022395     1  0.1792      0.944 0.932 0.000 0.000 0.068
#> GSM1022396     1  0.1792      0.944 0.932 0.000 0.000 0.068
#> GSM1022389     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> GSM1022390     2  0.1940      0.917 0.000 0.924 0.000 0.076
#> GSM1022391     2  0.0000      0.969 0.000 1.000 0.000 0.000
#> GSM1022392     2  0.2814      0.854 0.000 0.868 0.000 0.132
#> GSM1022397     3  0.0000      0.985 0.000 0.000 1.000 0.000
#> GSM1022398     3  0.0000      0.985 0.000 0.000 1.000 0.000
#> GSM1022399     3  0.0000      0.985 0.000 0.000 1.000 0.000
#> GSM1022400     3  0.0000      0.985 0.000 0.000 1.000 0.000
#> GSM1022401     1  0.1792      0.944 0.932 0.000 0.000 0.068
#> GSM1022402     1  0.1792      0.944 0.932 0.000 0.000 0.068
#> GSM1022403     1  0.1792      0.944 0.932 0.000 0.000 0.068
#> GSM1022404     1  0.1792      0.944 0.932 0.000 0.000 0.068

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1022325     2  0.0000      0.889 0.000 1.000 0.000 0.000 0.000
#> GSM1022326     2  0.0000      0.889 0.000 1.000 0.000 0.000 0.000
#> GSM1022327     2  0.0000      0.889 0.000 1.000 0.000 0.000 0.000
#> GSM1022331     3  0.1121      0.961 0.000 0.000 0.956 0.044 0.000
#> GSM1022332     3  0.1043      0.962 0.000 0.000 0.960 0.040 0.000
#> GSM1022333     3  0.1197      0.959 0.000 0.000 0.952 0.048 0.000
#> GSM1022328     2  0.0000      0.889 0.000 1.000 0.000 0.000 0.000
#> GSM1022329     2  0.0000      0.889 0.000 1.000 0.000 0.000 0.000
#> GSM1022330     2  0.0000      0.889 0.000 1.000 0.000 0.000 0.000
#> GSM1022337     5  0.0162      0.930 0.000 0.000 0.000 0.004 0.996
#> GSM1022338     5  0.0162      0.930 0.000 0.000 0.000 0.004 0.996
#> GSM1022339     5  0.0162      0.930 0.000 0.000 0.000 0.004 0.996
#> GSM1022334     2  0.0162      0.886 0.000 0.996 0.000 0.004 0.000
#> GSM1022335     2  0.0162      0.886 0.000 0.996 0.000 0.004 0.000
#> GSM1022336     2  0.0000      0.889 0.000 1.000 0.000 0.000 0.000
#> GSM1022340     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM1022341     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM1022342     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM1022343     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM1022347     3  0.0000      0.974 0.000 0.000 1.000 0.000 0.000
#> GSM1022348     3  0.0000      0.974 0.000 0.000 1.000 0.000 0.000
#> GSM1022349     3  0.0000      0.974 0.000 0.000 1.000 0.000 0.000
#> GSM1022350     3  0.0000      0.974 0.000 0.000 1.000 0.000 0.000
#> GSM1022344     1  0.0703      0.975 0.976 0.000 0.024 0.000 0.000
#> GSM1022345     1  0.0162      0.993 0.996 0.000 0.004 0.000 0.000
#> GSM1022346     1  0.0290      0.990 0.992 0.000 0.008 0.000 0.000
#> GSM1022355     5  0.3508      0.694 0.252 0.000 0.000 0.000 0.748
#> GSM1022356     5  0.2424      0.829 0.132 0.000 0.000 0.000 0.868
#> GSM1022357     5  0.4242      0.353 0.428 0.000 0.000 0.000 0.572
#> GSM1022358     5  0.3876      0.596 0.316 0.000 0.000 0.000 0.684
#> GSM1022351     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM1022352     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM1022353     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM1022354     1  0.0000      0.996 1.000 0.000 0.000 0.000 0.000
#> GSM1022359     2  0.0162      0.887 0.000 0.996 0.000 0.004 0.000
#> GSM1022360     2  0.0162      0.887 0.000 0.996 0.000 0.004 0.000
#> GSM1022361     2  0.0162      0.887 0.000 0.996 0.000 0.004 0.000
#> GSM1022362     2  0.0162      0.887 0.000 0.996 0.000 0.004 0.000
#> GSM1022367     3  0.2708      0.918 0.000 0.044 0.884 0.072 0.000
#> GSM1022368     3  0.2473      0.928 0.000 0.032 0.896 0.072 0.000
#> GSM1022369     3  0.2208      0.936 0.000 0.020 0.908 0.072 0.000
#> GSM1022370     3  0.2708      0.918 0.000 0.044 0.884 0.072 0.000
#> GSM1022363     2  0.1478      0.820 0.000 0.936 0.000 0.064 0.000
#> GSM1022364     2  0.1410      0.825 0.000 0.940 0.000 0.060 0.000
#> GSM1022365     2  0.1478      0.820 0.000 0.936 0.000 0.064 0.000
#> GSM1022366     2  0.1410      0.825 0.000 0.940 0.000 0.060 0.000
#> GSM1022374     5  0.0324      0.927 0.000 0.004 0.000 0.004 0.992
#> GSM1022375     5  0.0324      0.927 0.000 0.004 0.000 0.004 0.992
#> GSM1022376     5  0.0162      0.930 0.000 0.000 0.000 0.004 0.996
#> GSM1022371     2  0.0000      0.889 0.000 1.000 0.000 0.000 0.000
#> GSM1022372     2  0.0000      0.889 0.000 1.000 0.000 0.000 0.000
#> GSM1022373     2  0.0000      0.889 0.000 1.000 0.000 0.000 0.000
#> GSM1022377     4  0.4302      0.863 0.000 0.480 0.000 0.520 0.000
#> GSM1022378     4  0.4446      0.869 0.004 0.476 0.000 0.520 0.000
#> GSM1022379     4  0.4446      0.869 0.004 0.476 0.000 0.520 0.000
#> GSM1022380     4  0.4555      0.872 0.008 0.472 0.000 0.520 0.000
#> GSM1022385     3  0.0000      0.974 0.000 0.000 1.000 0.000 0.000
#> GSM1022386     3  0.0000      0.974 0.000 0.000 1.000 0.000 0.000
#> GSM1022387     3  0.0000      0.974 0.000 0.000 1.000 0.000 0.000
#> GSM1022388     3  0.0000      0.974 0.000 0.000 1.000 0.000 0.000
#> GSM1022381     4  0.4630      0.902 0.016 0.396 0.000 0.588 0.000
#> GSM1022382     4  0.4707      0.901 0.020 0.392 0.000 0.588 0.000
#> GSM1022383     4  0.4748      0.897 0.016 0.384 0.004 0.596 0.000
#> GSM1022384     4  0.4714      0.885 0.016 0.372 0.004 0.608 0.000
#> GSM1022393     5  0.0000      0.930 0.000 0.000 0.000 0.000 1.000
#> GSM1022394     5  0.0000      0.930 0.000 0.000 0.000 0.000 1.000
#> GSM1022395     5  0.0000      0.930 0.000 0.000 0.000 0.000 1.000
#> GSM1022396     5  0.0000      0.930 0.000 0.000 0.000 0.000 1.000
#> GSM1022389     2  0.4655     -0.824 0.012 0.512 0.000 0.476 0.000
#> GSM1022390     4  0.5078      0.858 0.028 0.424 0.000 0.544 0.004
#> GSM1022391     2  0.4659     -0.853 0.012 0.496 0.000 0.492 0.000
#> GSM1022392     4  0.5118      0.858 0.036 0.376 0.000 0.584 0.004
#> GSM1022397     3  0.0000      0.974 0.000 0.000 1.000 0.000 0.000
#> GSM1022398     3  0.0000      0.974 0.000 0.000 1.000 0.000 0.000
#> GSM1022399     3  0.0000      0.974 0.000 0.000 1.000 0.000 0.000
#> GSM1022400     3  0.0000      0.974 0.000 0.000 1.000 0.000 0.000
#> GSM1022401     5  0.0000      0.930 0.000 0.000 0.000 0.000 1.000
#> GSM1022402     5  0.0000      0.930 0.000 0.000 0.000 0.000 1.000
#> GSM1022403     5  0.0000      0.930 0.000 0.000 0.000 0.000 1.000
#> GSM1022404     5  0.0000      0.930 0.000 0.000 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5 p6
#> GSM1022325     2  0.0547     0.7034 0.000 0.980 0.000 0.020 0.000 NA
#> GSM1022326     2  0.0458     0.7029 0.000 0.984 0.000 0.016 0.000 NA
#> GSM1022327     2  0.0632     0.7034 0.000 0.976 0.000 0.024 0.000 NA
#> GSM1022331     3  0.1501     0.8796 0.000 0.000 0.924 0.000 0.000 NA
#> GSM1022332     3  0.1327     0.8841 0.000 0.000 0.936 0.000 0.000 NA
#> GSM1022333     3  0.2048     0.8590 0.000 0.000 0.880 0.000 0.000 NA
#> GSM1022328     2  0.0508     0.7063 0.000 0.984 0.000 0.012 0.000 NA
#> GSM1022329     2  0.0622     0.7065 0.000 0.980 0.000 0.012 0.000 NA
#> GSM1022330     2  0.0806     0.7057 0.000 0.972 0.000 0.020 0.000 NA
#> GSM1022337     5  0.1204     0.8979 0.000 0.000 0.000 0.000 0.944 NA
#> GSM1022338     5  0.1204     0.8979 0.000 0.000 0.000 0.000 0.944 NA
#> GSM1022339     5  0.1204     0.8979 0.000 0.000 0.000 0.000 0.944 NA
#> GSM1022334     2  0.0405     0.7068 0.000 0.988 0.000 0.004 0.000 NA
#> GSM1022335     2  0.0520     0.7060 0.000 0.984 0.000 0.008 0.000 NA
#> GSM1022336     2  0.0520     0.7038 0.000 0.984 0.000 0.008 0.000 NA
#> GSM1022340     1  0.0260     0.9950 0.992 0.000 0.000 0.000 0.000 NA
#> GSM1022341     1  0.0260     0.9950 0.992 0.000 0.000 0.000 0.000 NA
#> GSM1022342     1  0.0260     0.9950 0.992 0.000 0.000 0.000 0.000 NA
#> GSM1022343     1  0.0260     0.9950 0.992 0.000 0.000 0.000 0.000 NA
#> GSM1022347     3  0.0291     0.8989 0.004 0.000 0.992 0.000 0.000 NA
#> GSM1022348     3  0.0000     0.8993 0.000 0.000 1.000 0.000 0.000 NA
#> GSM1022349     3  0.0291     0.8987 0.000 0.000 0.992 0.004 0.000 NA
#> GSM1022350     3  0.0291     0.8987 0.000 0.000 0.992 0.004 0.000 NA
#> GSM1022344     1  0.0000     0.9960 1.000 0.000 0.000 0.000 0.000 NA
#> GSM1022345     1  0.0000     0.9960 1.000 0.000 0.000 0.000 0.000 NA
#> GSM1022346     1  0.0000     0.9960 1.000 0.000 0.000 0.000 0.000 NA
#> GSM1022355     5  0.3636     0.5701 0.320 0.000 0.000 0.004 0.676 NA
#> GSM1022356     5  0.2320     0.8095 0.132 0.000 0.000 0.004 0.864 NA
#> GSM1022357     5  0.3923     0.3685 0.416 0.000 0.000 0.004 0.580 NA
#> GSM1022358     5  0.3769     0.5049 0.356 0.000 0.000 0.004 0.640 NA
#> GSM1022351     1  0.0146     0.9955 0.996 0.000 0.000 0.000 0.004 NA
#> GSM1022352     1  0.0146     0.9955 0.996 0.000 0.000 0.000 0.004 NA
#> GSM1022353     1  0.0146     0.9955 0.996 0.000 0.000 0.000 0.004 NA
#> GSM1022354     1  0.0146     0.9955 0.996 0.000 0.000 0.000 0.004 NA
#> GSM1022359     2  0.3394     0.5048 0.000 0.776 0.000 0.200 0.000 NA
#> GSM1022360     2  0.3460     0.4725 0.000 0.760 0.000 0.220 0.000 NA
#> GSM1022361     2  0.3190     0.4651 0.000 0.772 0.000 0.220 0.000 NA
#> GSM1022362     2  0.3541     0.4549 0.000 0.748 0.000 0.232 0.000 NA
#> GSM1022367     3  0.3950     0.6423 0.000 0.004 0.564 0.000 0.000 NA
#> GSM1022368     3  0.3782     0.6648 0.000 0.000 0.588 0.000 0.000 NA
#> GSM1022369     3  0.3765     0.6713 0.000 0.000 0.596 0.000 0.000 NA
#> GSM1022370     3  0.3797     0.6592 0.000 0.000 0.580 0.000 0.000 NA
#> GSM1022363     2  0.3930     0.4850 0.000 0.576 0.000 0.004 0.000 NA
#> GSM1022364     2  0.4018     0.4889 0.000 0.580 0.000 0.008 0.000 NA
#> GSM1022365     2  0.4018     0.4889 0.000 0.580 0.000 0.008 0.000 NA
#> GSM1022366     2  0.4018     0.4889 0.000 0.580 0.000 0.008 0.000 NA
#> GSM1022374     5  0.1327     0.8955 0.000 0.000 0.000 0.000 0.936 NA
#> GSM1022375     5  0.1327     0.8955 0.000 0.000 0.000 0.000 0.936 NA
#> GSM1022376     5  0.1327     0.8955 0.000 0.000 0.000 0.000 0.936 NA
#> GSM1022371     2  0.2070     0.6896 0.000 0.892 0.000 0.008 0.000 NA
#> GSM1022372     2  0.2070     0.6896 0.000 0.892 0.000 0.008 0.000 NA
#> GSM1022373     2  0.2070     0.6896 0.000 0.892 0.000 0.008 0.000 NA
#> GSM1022377     4  0.3615     0.9570 0.008 0.292 0.000 0.700 0.000 NA
#> GSM1022378     4  0.3615     0.9570 0.008 0.292 0.000 0.700 0.000 NA
#> GSM1022379     4  0.3595     0.9603 0.008 0.288 0.000 0.704 0.000 NA
#> GSM1022380     4  0.3575     0.9612 0.008 0.284 0.000 0.708 0.000 NA
#> GSM1022385     3  0.0260     0.8993 0.000 0.000 0.992 0.000 0.000 NA
#> GSM1022386     3  0.0260     0.8993 0.000 0.000 0.992 0.000 0.000 NA
#> GSM1022387     3  0.0260     0.8993 0.000 0.000 0.992 0.000 0.000 NA
#> GSM1022388     3  0.0260     0.8993 0.000 0.000 0.992 0.000 0.000 NA
#> GSM1022381     4  0.3398     0.9622 0.008 0.252 0.000 0.740 0.000 NA
#> GSM1022382     4  0.3398     0.9622 0.008 0.252 0.000 0.740 0.000 NA
#> GSM1022383     4  0.3373     0.9590 0.008 0.248 0.000 0.744 0.000 NA
#> GSM1022384     4  0.3298     0.9449 0.008 0.236 0.000 0.756 0.000 NA
#> GSM1022393     5  0.0146     0.9034 0.000 0.000 0.000 0.004 0.996 NA
#> GSM1022394     5  0.0146     0.9034 0.000 0.000 0.000 0.004 0.996 NA
#> GSM1022395     5  0.0000     0.9042 0.000 0.000 0.000 0.000 1.000 NA
#> GSM1022396     5  0.0146     0.9034 0.000 0.000 0.000 0.004 0.996 NA
#> GSM1022389     2  0.5056     0.0223 0.008 0.592 0.000 0.348 0.024 NA
#> GSM1022390     2  0.5423     0.0935 0.012 0.568 0.000 0.352 0.032 NA
#> GSM1022391     2  0.5051     0.0105 0.008 0.572 0.000 0.372 0.024 NA
#> GSM1022392     2  0.5480    -0.0293 0.008 0.528 0.000 0.392 0.032 NA
#> GSM1022397     3  0.0603     0.8962 0.000 0.000 0.980 0.004 0.000 NA
#> GSM1022398     3  0.0603     0.8962 0.000 0.000 0.980 0.004 0.000 NA
#> GSM1022399     3  0.0692     0.8949 0.000 0.000 0.976 0.004 0.000 NA
#> GSM1022400     3  0.0692     0.8949 0.000 0.000 0.976 0.004 0.000 NA
#> GSM1022401     5  0.0363     0.9041 0.000 0.000 0.000 0.000 0.988 NA
#> GSM1022402     5  0.0260     0.9043 0.000 0.000 0.000 0.000 0.992 NA
#> GSM1022403     5  0.0000     0.9042 0.000 0.000 0.000 0.000 1.000 NA
#> GSM1022404     5  0.0000     0.9042 0.000 0.000 0.000 0.000 1.000 NA

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-SD-NMF-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-SD-NMF-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-SD-NMF-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-SD-NMF-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-SD-NMF-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-SD-NMF-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-SD-NMF-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-SD-NMF-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-SD-NMF-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-SD-NMF-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-SD-NMF-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-SD-NMF-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-SD-NMF-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-SD-NMF-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-SD-NMF-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-SD-NMF-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-SD-NMF-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-SD-NMF-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-SD-NMF-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-SD-NMF-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk SD-NMF-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-SD-NMF-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-SD-NMF-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-SD-NMF-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-SD-NMF-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-SD-NMF-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk SD-NMF-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>         n protocol(p) cell.type(p) k
#> SD:NMF 76    6.05e-07     3.68e-06 2
#> SD:NMF 77    5.49e-11     2.79e-10 3
#> SD:NMF 80    5.59e-11     3.07e-17 4
#> SD:NMF 77    1.74e-15     7.52e-16 5
#> SD:NMF 68    7.13e-15     6.00e-14 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


CV:hclust

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["CV", "hclust"]
# you can also extract it by
# res = res_list["CV:hclust"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk CV-hclust-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk CV-hclust-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.473           0.862       0.905         0.4713 0.495   0.495
#> 3 3 0.795           0.879       0.946         0.3681 0.862   0.721
#> 4 4 0.849           0.874       0.923         0.1130 0.939   0.830
#> 5 5 0.798           0.789       0.831         0.0524 0.981   0.936
#> 6 6 0.840           0.828       0.847         0.0515 0.949   0.820

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 3

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1022325     2   0.000      0.967 0.000 1.000
#> GSM1022326     2   0.000      0.967 0.000 1.000
#> GSM1022327     2   0.000      0.967 0.000 1.000
#> GSM1022331     1   0.000      0.811 1.000 0.000
#> GSM1022332     1   0.000      0.811 1.000 0.000
#> GSM1022333     1   0.000      0.811 1.000 0.000
#> GSM1022328     2   0.000      0.967 0.000 1.000
#> GSM1022329     2   0.000      0.967 0.000 1.000
#> GSM1022330     2   0.000      0.967 0.000 1.000
#> GSM1022337     2   0.625      0.786 0.156 0.844
#> GSM1022338     2   0.625      0.786 0.156 0.844
#> GSM1022339     2   0.625      0.786 0.156 0.844
#> GSM1022334     2   0.000      0.967 0.000 1.000
#> GSM1022335     2   0.000      0.967 0.000 1.000
#> GSM1022336     2   0.000      0.967 0.000 1.000
#> GSM1022340     1   0.714      0.827 0.804 0.196
#> GSM1022341     1   0.714      0.827 0.804 0.196
#> GSM1022342     1   0.714      0.827 0.804 0.196
#> GSM1022343     1   0.714      0.827 0.804 0.196
#> GSM1022347     1   0.000      0.811 1.000 0.000
#> GSM1022348     1   0.000      0.811 1.000 0.000
#> GSM1022349     1   0.000      0.811 1.000 0.000
#> GSM1022350     1   0.000      0.811 1.000 0.000
#> GSM1022344     1   0.671      0.829 0.824 0.176
#> GSM1022345     1   0.671      0.829 0.824 0.176
#> GSM1022346     1   0.671      0.829 0.824 0.176
#> GSM1022355     1   0.839      0.802 0.732 0.268
#> GSM1022356     1   0.839      0.802 0.732 0.268
#> GSM1022357     1   0.839      0.802 0.732 0.268
#> GSM1022358     1   0.839      0.802 0.732 0.268
#> GSM1022351     1   0.839      0.802 0.732 0.268
#> GSM1022352     1   0.839      0.802 0.732 0.268
#> GSM1022353     1   0.839      0.802 0.732 0.268
#> GSM1022354     1   0.839      0.802 0.732 0.268
#> GSM1022359     2   0.000      0.967 0.000 1.000
#> GSM1022360     2   0.000      0.967 0.000 1.000
#> GSM1022361     2   0.000      0.967 0.000 1.000
#> GSM1022362     2   0.000      0.967 0.000 1.000
#> GSM1022367     1   0.814      0.626 0.748 0.252
#> GSM1022368     1   0.814      0.626 0.748 0.252
#> GSM1022369     1   0.814      0.626 0.748 0.252
#> GSM1022370     1   0.814      0.626 0.748 0.252
#> GSM1022363     2   0.000      0.967 0.000 1.000
#> GSM1022364     2   0.000      0.967 0.000 1.000
#> GSM1022365     2   0.000      0.967 0.000 1.000
#> GSM1022366     2   0.000      0.967 0.000 1.000
#> GSM1022374     2   0.625      0.786 0.156 0.844
#> GSM1022375     2   0.625      0.786 0.156 0.844
#> GSM1022376     2   0.625      0.786 0.156 0.844
#> GSM1022371     2   0.000      0.967 0.000 1.000
#> GSM1022372     2   0.000      0.967 0.000 1.000
#> GSM1022373     2   0.000      0.967 0.000 1.000
#> GSM1022377     2   0.000      0.967 0.000 1.000
#> GSM1022378     2   0.000      0.967 0.000 1.000
#> GSM1022379     2   0.000      0.967 0.000 1.000
#> GSM1022380     2   0.000      0.967 0.000 1.000
#> GSM1022385     1   0.000      0.811 1.000 0.000
#> GSM1022386     1   0.000      0.811 1.000 0.000
#> GSM1022387     1   0.000      0.811 1.000 0.000
#> GSM1022388     1   0.000      0.811 1.000 0.000
#> GSM1022381     2   0.000      0.967 0.000 1.000
#> GSM1022382     2   0.000      0.967 0.000 1.000
#> GSM1022383     2   0.000      0.967 0.000 1.000
#> GSM1022384     2   0.000      0.967 0.000 1.000
#> GSM1022393     1   0.844      0.799 0.728 0.272
#> GSM1022394     1   0.844      0.799 0.728 0.272
#> GSM1022395     1   0.844      0.799 0.728 0.272
#> GSM1022396     1   0.844      0.799 0.728 0.272
#> GSM1022389     2   0.000      0.967 0.000 1.000
#> GSM1022390     2   0.000      0.967 0.000 1.000
#> GSM1022391     2   0.000      0.967 0.000 1.000
#> GSM1022392     2   0.000      0.967 0.000 1.000
#> GSM1022397     1   0.000      0.811 1.000 0.000
#> GSM1022398     1   0.000      0.811 1.000 0.000
#> GSM1022399     1   0.000      0.811 1.000 0.000
#> GSM1022400     1   0.000      0.811 1.000 0.000
#> GSM1022401     1   0.844      0.799 0.728 0.272
#> GSM1022402     1   0.844      0.799 0.728 0.272
#> GSM1022403     1   0.844      0.799 0.728 0.272
#> GSM1022404     1   0.844      0.799 0.728 0.272

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1022325     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022326     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022327     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022331     3  0.0000      0.932 0.000 0.000 1.000
#> GSM1022332     3  0.0000      0.932 0.000 0.000 1.000
#> GSM1022333     3  0.0000      0.932 0.000 0.000 1.000
#> GSM1022328     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022329     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022330     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022337     2  0.6215      0.371 0.428 0.572 0.000
#> GSM1022338     2  0.6215      0.371 0.428 0.572 0.000
#> GSM1022339     2  0.6215      0.371 0.428 0.572 0.000
#> GSM1022334     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022335     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022336     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022340     1  0.2711      0.922 0.912 0.000 0.088
#> GSM1022341     1  0.2711      0.922 0.912 0.000 0.088
#> GSM1022342     1  0.2711      0.922 0.912 0.000 0.088
#> GSM1022343     1  0.2711      0.922 0.912 0.000 0.088
#> GSM1022347     3  0.0000      0.932 0.000 0.000 1.000
#> GSM1022348     3  0.0000      0.932 0.000 0.000 1.000
#> GSM1022349     3  0.0000      0.932 0.000 0.000 1.000
#> GSM1022350     3  0.0000      0.932 0.000 0.000 1.000
#> GSM1022344     1  0.3192      0.900 0.888 0.000 0.112
#> GSM1022345     1  0.3192      0.900 0.888 0.000 0.112
#> GSM1022346     1  0.3192      0.900 0.888 0.000 0.112
#> GSM1022355     1  0.0237      0.965 0.996 0.000 0.004
#> GSM1022356     1  0.0237      0.965 0.996 0.000 0.004
#> GSM1022357     1  0.0237      0.965 0.996 0.000 0.004
#> GSM1022358     1  0.0237      0.965 0.996 0.000 0.004
#> GSM1022351     1  0.0237      0.965 0.996 0.000 0.004
#> GSM1022352     1  0.0237      0.965 0.996 0.000 0.004
#> GSM1022353     1  0.0237      0.965 0.996 0.000 0.004
#> GSM1022354     1  0.0237      0.965 0.996 0.000 0.004
#> GSM1022359     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022360     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022361     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022362     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022367     3  0.5138      0.707 0.000 0.252 0.748
#> GSM1022368     3  0.5138      0.707 0.000 0.252 0.748
#> GSM1022369     3  0.5138      0.707 0.000 0.252 0.748
#> GSM1022370     3  0.5138      0.707 0.000 0.252 0.748
#> GSM1022363     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022364     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022365     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022366     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022374     2  0.6215      0.371 0.428 0.572 0.000
#> GSM1022375     2  0.6215      0.371 0.428 0.572 0.000
#> GSM1022376     2  0.6215      0.371 0.428 0.572 0.000
#> GSM1022371     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022372     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022373     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022377     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022378     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022379     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022380     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022385     3  0.0000      0.932 0.000 0.000 1.000
#> GSM1022386     3  0.0000      0.932 0.000 0.000 1.000
#> GSM1022387     3  0.0000      0.932 0.000 0.000 1.000
#> GSM1022388     3  0.0000      0.932 0.000 0.000 1.000
#> GSM1022381     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022382     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022383     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022384     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022393     1  0.0000      0.964 1.000 0.000 0.000
#> GSM1022394     1  0.0000      0.964 1.000 0.000 0.000
#> GSM1022395     1  0.0000      0.964 1.000 0.000 0.000
#> GSM1022396     1  0.0000      0.964 1.000 0.000 0.000
#> GSM1022389     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022390     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022391     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022392     2  0.0000      0.921 0.000 1.000 0.000
#> GSM1022397     3  0.0000      0.932 0.000 0.000 1.000
#> GSM1022398     3  0.0000      0.932 0.000 0.000 1.000
#> GSM1022399     3  0.0000      0.932 0.000 0.000 1.000
#> GSM1022400     3  0.0000      0.932 0.000 0.000 1.000
#> GSM1022401     1  0.0000      0.964 1.000 0.000 0.000
#> GSM1022402     1  0.0000      0.964 1.000 0.000 0.000
#> GSM1022403     1  0.0000      0.964 1.000 0.000 0.000
#> GSM1022404     1  0.0000      0.964 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1022325     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022326     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022327     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022331     3  0.0817      0.923 0.000 0.000 0.976 0.024
#> GSM1022332     3  0.0817      0.923 0.000 0.000 0.976 0.024
#> GSM1022333     3  0.0817      0.923 0.000 0.000 0.976 0.024
#> GSM1022328     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022329     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022330     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022337     4  0.4925      1.000 0.428 0.000 0.000 0.572
#> GSM1022338     4  0.4925      1.000 0.428 0.000 0.000 0.572
#> GSM1022339     4  0.4925      1.000 0.428 0.000 0.000 0.572
#> GSM1022334     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022335     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022336     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022340     1  0.4866      0.787 0.596 0.000 0.000 0.404
#> GSM1022341     1  0.4866      0.787 0.596 0.000 0.000 0.404
#> GSM1022342     1  0.4866      0.787 0.596 0.000 0.000 0.404
#> GSM1022343     1  0.4866      0.787 0.596 0.000 0.000 0.404
#> GSM1022347     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM1022348     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM1022349     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM1022350     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM1022344     1  0.5592      0.771 0.572 0.000 0.024 0.404
#> GSM1022345     1  0.5592      0.771 0.572 0.000 0.024 0.404
#> GSM1022346     1  0.5592      0.771 0.572 0.000 0.024 0.404
#> GSM1022355     1  0.4500      0.812 0.684 0.000 0.000 0.316
#> GSM1022356     1  0.4500      0.812 0.684 0.000 0.000 0.316
#> GSM1022357     1  0.4500      0.812 0.684 0.000 0.000 0.316
#> GSM1022358     1  0.4500      0.812 0.684 0.000 0.000 0.316
#> GSM1022351     1  0.4500      0.812 0.684 0.000 0.000 0.316
#> GSM1022352     1  0.4500      0.812 0.684 0.000 0.000 0.316
#> GSM1022353     1  0.4500      0.812 0.684 0.000 0.000 0.316
#> GSM1022354     1  0.4500      0.812 0.684 0.000 0.000 0.316
#> GSM1022359     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022360     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022361     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022362     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022367     3  0.5213      0.712 0.000 0.052 0.724 0.224
#> GSM1022368     3  0.5213      0.712 0.000 0.052 0.724 0.224
#> GSM1022369     3  0.5213      0.712 0.000 0.052 0.724 0.224
#> GSM1022370     3  0.5213      0.712 0.000 0.052 0.724 0.224
#> GSM1022363     2  0.3610      0.770 0.000 0.800 0.000 0.200
#> GSM1022364     2  0.3610      0.770 0.000 0.800 0.000 0.200
#> GSM1022365     2  0.3610      0.770 0.000 0.800 0.000 0.200
#> GSM1022366     2  0.3610      0.770 0.000 0.800 0.000 0.200
#> GSM1022374     4  0.4925      1.000 0.428 0.000 0.000 0.572
#> GSM1022375     4  0.4925      1.000 0.428 0.000 0.000 0.572
#> GSM1022376     4  0.4925      1.000 0.428 0.000 0.000 0.572
#> GSM1022371     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022372     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022373     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022377     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022378     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022379     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022380     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022385     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM1022386     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM1022387     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM1022388     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM1022381     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022382     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022383     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022384     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022393     1  0.0000      0.601 1.000 0.000 0.000 0.000
#> GSM1022394     1  0.0000      0.601 1.000 0.000 0.000 0.000
#> GSM1022395     1  0.0000      0.601 1.000 0.000 0.000 0.000
#> GSM1022396     1  0.0000      0.601 1.000 0.000 0.000 0.000
#> GSM1022389     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022390     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022391     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022392     2  0.0000      0.973 0.000 1.000 0.000 0.000
#> GSM1022397     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM1022398     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM1022399     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM1022400     3  0.0000      0.932 0.000 0.000 1.000 0.000
#> GSM1022401     1  0.0000      0.601 1.000 0.000 0.000 0.000
#> GSM1022402     1  0.0000      0.601 1.000 0.000 0.000 0.000
#> GSM1022403     1  0.0000      0.601 1.000 0.000 0.000 0.000
#> GSM1022404     1  0.0000      0.601 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1022325     2  0.2471     0.8903 0.000 0.864 0.000 0.136 0.000
#> GSM1022326     2  0.2471     0.8903 0.000 0.864 0.000 0.136 0.000
#> GSM1022327     2  0.2471     0.8903 0.000 0.864 0.000 0.136 0.000
#> GSM1022331     3  0.3837     0.0474 0.000 0.000 0.692 0.308 0.000
#> GSM1022332     3  0.3837     0.0474 0.000 0.000 0.692 0.308 0.000
#> GSM1022333     3  0.3837     0.0474 0.000 0.000 0.692 0.308 0.000
#> GSM1022328     2  0.2471     0.8903 0.000 0.864 0.000 0.136 0.000
#> GSM1022329     2  0.2471     0.8903 0.000 0.864 0.000 0.136 0.000
#> GSM1022330     2  0.2471     0.8903 0.000 0.864 0.000 0.136 0.000
#> GSM1022337     5  0.0000     1.0000 0.000 0.000 0.000 0.000 1.000
#> GSM1022338     5  0.0000     1.0000 0.000 0.000 0.000 0.000 1.000
#> GSM1022339     5  0.0000     1.0000 0.000 0.000 0.000 0.000 1.000
#> GSM1022334     2  0.2471     0.8903 0.000 0.864 0.000 0.136 0.000
#> GSM1022335     2  0.2471     0.8903 0.000 0.864 0.000 0.136 0.000
#> GSM1022336     2  0.2471     0.8903 0.000 0.864 0.000 0.136 0.000
#> GSM1022340     1  0.3707     0.6469 0.716 0.000 0.000 0.284 0.000
#> GSM1022341     1  0.3707     0.6469 0.716 0.000 0.000 0.284 0.000
#> GSM1022342     1  0.3707     0.6469 0.716 0.000 0.000 0.284 0.000
#> GSM1022343     1  0.3707     0.6469 0.716 0.000 0.000 0.284 0.000
#> GSM1022347     3  0.0000     0.8748 0.000 0.000 1.000 0.000 0.000
#> GSM1022348     3  0.0000     0.8748 0.000 0.000 1.000 0.000 0.000
#> GSM1022349     3  0.0000     0.8748 0.000 0.000 1.000 0.000 0.000
#> GSM1022350     3  0.0000     0.8748 0.000 0.000 1.000 0.000 0.000
#> GSM1022344     1  0.4360     0.6393 0.692 0.000 0.024 0.284 0.000
#> GSM1022345     1  0.4360     0.6393 0.692 0.000 0.024 0.284 0.000
#> GSM1022346     1  0.4360     0.6393 0.692 0.000 0.024 0.284 0.000
#> GSM1022355     1  0.0162     0.7403 0.996 0.000 0.000 0.000 0.004
#> GSM1022356     1  0.0162     0.7403 0.996 0.000 0.000 0.000 0.004
#> GSM1022357     1  0.0162     0.7403 0.996 0.000 0.000 0.000 0.004
#> GSM1022358     1  0.0162     0.7403 0.996 0.000 0.000 0.000 0.004
#> GSM1022351     1  0.0162     0.7403 0.996 0.000 0.000 0.000 0.004
#> GSM1022352     1  0.0162     0.7403 0.996 0.000 0.000 0.000 0.004
#> GSM1022353     1  0.0162     0.7403 0.996 0.000 0.000 0.000 0.004
#> GSM1022354     1  0.0162     0.7403 0.996 0.000 0.000 0.000 0.004
#> GSM1022359     2  0.0510     0.8980 0.000 0.984 0.000 0.016 0.000
#> GSM1022360     2  0.0510     0.8980 0.000 0.984 0.000 0.016 0.000
#> GSM1022361     2  0.0510     0.8980 0.000 0.984 0.000 0.016 0.000
#> GSM1022362     2  0.0510     0.8980 0.000 0.984 0.000 0.016 0.000
#> GSM1022367     4  0.4262     1.0000 0.000 0.000 0.440 0.560 0.000
#> GSM1022368     4  0.4262     1.0000 0.000 0.000 0.440 0.560 0.000
#> GSM1022369     4  0.4262     1.0000 0.000 0.000 0.440 0.560 0.000
#> GSM1022370     4  0.4262     1.0000 0.000 0.000 0.440 0.560 0.000
#> GSM1022363     2  0.4150     0.6598 0.000 0.612 0.000 0.388 0.000
#> GSM1022364     2  0.4150     0.6598 0.000 0.612 0.000 0.388 0.000
#> GSM1022365     2  0.4150     0.6598 0.000 0.612 0.000 0.388 0.000
#> GSM1022366     2  0.4150     0.6598 0.000 0.612 0.000 0.388 0.000
#> GSM1022374     5  0.0000     1.0000 0.000 0.000 0.000 0.000 1.000
#> GSM1022375     5  0.0000     1.0000 0.000 0.000 0.000 0.000 1.000
#> GSM1022376     5  0.0000     1.0000 0.000 0.000 0.000 0.000 1.000
#> GSM1022371     2  0.2471     0.8903 0.000 0.864 0.000 0.136 0.000
#> GSM1022372     2  0.2471     0.8903 0.000 0.864 0.000 0.136 0.000
#> GSM1022373     2  0.2471     0.8903 0.000 0.864 0.000 0.136 0.000
#> GSM1022377     2  0.0609     0.8969 0.000 0.980 0.000 0.020 0.000
#> GSM1022378     2  0.0609     0.8969 0.000 0.980 0.000 0.020 0.000
#> GSM1022379     2  0.0609     0.8969 0.000 0.980 0.000 0.020 0.000
#> GSM1022380     2  0.0609     0.8969 0.000 0.980 0.000 0.020 0.000
#> GSM1022385     3  0.0000     0.8748 0.000 0.000 1.000 0.000 0.000
#> GSM1022386     3  0.0000     0.8748 0.000 0.000 1.000 0.000 0.000
#> GSM1022387     3  0.0000     0.8748 0.000 0.000 1.000 0.000 0.000
#> GSM1022388     3  0.0000     0.8748 0.000 0.000 1.000 0.000 0.000
#> GSM1022381     2  0.0609     0.8969 0.000 0.980 0.000 0.020 0.000
#> GSM1022382     2  0.0609     0.8969 0.000 0.980 0.000 0.020 0.000
#> GSM1022383     2  0.0609     0.8969 0.000 0.980 0.000 0.020 0.000
#> GSM1022384     2  0.0609     0.8969 0.000 0.980 0.000 0.020 0.000
#> GSM1022393     1  0.3999     0.5434 0.656 0.000 0.000 0.000 0.344
#> GSM1022394     1  0.3999     0.5434 0.656 0.000 0.000 0.000 0.344
#> GSM1022395     1  0.3999     0.5434 0.656 0.000 0.000 0.000 0.344
#> GSM1022396     1  0.3999     0.5434 0.656 0.000 0.000 0.000 0.344
#> GSM1022389     2  0.0162     0.8992 0.000 0.996 0.000 0.004 0.000
#> GSM1022390     2  0.0162     0.8992 0.000 0.996 0.000 0.004 0.000
#> GSM1022391     2  0.0162     0.8992 0.000 0.996 0.000 0.004 0.000
#> GSM1022392     2  0.0162     0.8992 0.000 0.996 0.000 0.004 0.000
#> GSM1022397     3  0.0000     0.8748 0.000 0.000 1.000 0.000 0.000
#> GSM1022398     3  0.0000     0.8748 0.000 0.000 1.000 0.000 0.000
#> GSM1022399     3  0.0000     0.8748 0.000 0.000 1.000 0.000 0.000
#> GSM1022400     3  0.0000     0.8748 0.000 0.000 1.000 0.000 0.000
#> GSM1022401     1  0.3999     0.5434 0.656 0.000 0.000 0.000 0.344
#> GSM1022402     1  0.3999     0.5434 0.656 0.000 0.000 0.000 0.344
#> GSM1022403     1  0.3999     0.5434 0.656 0.000 0.000 0.000 0.344
#> GSM1022404     1  0.3999     0.5434 0.656 0.000 0.000 0.000 0.344

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1022325     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022326     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022327     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022331     6  0.3409      0.736 0.000 0.000 0.300 0.000 0.000 0.700
#> GSM1022332     6  0.3409      0.736 0.000 0.000 0.300 0.000 0.000 0.700
#> GSM1022333     6  0.3409      0.736 0.000 0.000 0.300 0.000 0.000 0.700
#> GSM1022328     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022329     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022330     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022337     5  0.4227      1.000 0.344 0.000 0.000 0.020 0.632 0.004
#> GSM1022338     5  0.4227      1.000 0.344 0.000 0.000 0.020 0.632 0.004
#> GSM1022339     5  0.4227      1.000 0.344 0.000 0.000 0.020 0.632 0.004
#> GSM1022334     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022335     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022336     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022340     4  0.0547      0.983 0.020 0.000 0.000 0.980 0.000 0.000
#> GSM1022341     4  0.0547      0.983 0.020 0.000 0.000 0.980 0.000 0.000
#> GSM1022342     4  0.0547      0.983 0.020 0.000 0.000 0.980 0.000 0.000
#> GSM1022343     4  0.0547      0.983 0.020 0.000 0.000 0.980 0.000 0.000
#> GSM1022347     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022348     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022349     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022350     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022344     4  0.1176      0.977 0.020 0.000 0.024 0.956 0.000 0.000
#> GSM1022345     4  0.1176      0.977 0.020 0.000 0.024 0.956 0.000 0.000
#> GSM1022346     4  0.1176      0.977 0.020 0.000 0.024 0.956 0.000 0.000
#> GSM1022355     1  0.4219      0.704 0.660 0.000 0.000 0.304 0.000 0.036
#> GSM1022356     1  0.4219      0.704 0.660 0.000 0.000 0.304 0.000 0.036
#> GSM1022357     1  0.4219      0.704 0.660 0.000 0.000 0.304 0.000 0.036
#> GSM1022358     1  0.4219      0.704 0.660 0.000 0.000 0.304 0.000 0.036
#> GSM1022351     1  0.4219      0.704 0.660 0.000 0.000 0.304 0.000 0.036
#> GSM1022352     1  0.4219      0.704 0.660 0.000 0.000 0.304 0.000 0.036
#> GSM1022353     1  0.4219      0.704 0.660 0.000 0.000 0.304 0.000 0.036
#> GSM1022354     1  0.4219      0.704 0.660 0.000 0.000 0.304 0.000 0.036
#> GSM1022359     2  0.2793      0.808 0.000 0.800 0.000 0.000 0.200 0.000
#> GSM1022360     2  0.2793      0.808 0.000 0.800 0.000 0.000 0.200 0.000
#> GSM1022361     2  0.2793      0.808 0.000 0.800 0.000 0.000 0.200 0.000
#> GSM1022362     2  0.2793      0.808 0.000 0.800 0.000 0.000 0.200 0.000
#> GSM1022367     6  0.1075      0.832 0.000 0.000 0.048 0.000 0.000 0.952
#> GSM1022368     6  0.1075      0.832 0.000 0.000 0.048 0.000 0.000 0.952
#> GSM1022369     6  0.1075      0.832 0.000 0.000 0.048 0.000 0.000 0.952
#> GSM1022370     6  0.1075      0.832 0.000 0.000 0.048 0.000 0.000 0.952
#> GSM1022363     2  0.3151      0.610 0.000 0.748 0.000 0.000 0.000 0.252
#> GSM1022364     2  0.3151      0.610 0.000 0.748 0.000 0.000 0.000 0.252
#> GSM1022365     2  0.3151      0.610 0.000 0.748 0.000 0.000 0.000 0.252
#> GSM1022366     2  0.3151      0.610 0.000 0.748 0.000 0.000 0.000 0.252
#> GSM1022374     5  0.4227      1.000 0.344 0.000 0.000 0.020 0.632 0.004
#> GSM1022375     5  0.4227      1.000 0.344 0.000 0.000 0.020 0.632 0.004
#> GSM1022376     5  0.4227      1.000 0.344 0.000 0.000 0.020 0.632 0.004
#> GSM1022371     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022372     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022373     2  0.0000      0.810 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022377     2  0.3672      0.768 0.000 0.632 0.000 0.000 0.368 0.000
#> GSM1022378     2  0.3672      0.768 0.000 0.632 0.000 0.000 0.368 0.000
#> GSM1022379     2  0.3672      0.768 0.000 0.632 0.000 0.000 0.368 0.000
#> GSM1022380     2  0.3672      0.768 0.000 0.632 0.000 0.000 0.368 0.000
#> GSM1022385     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022386     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022387     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022388     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022381     2  0.3672      0.768 0.000 0.632 0.000 0.000 0.368 0.000
#> GSM1022382     2  0.3672      0.768 0.000 0.632 0.000 0.000 0.368 0.000
#> GSM1022383     2  0.3672      0.768 0.000 0.632 0.000 0.000 0.368 0.000
#> GSM1022384     2  0.3672      0.768 0.000 0.632 0.000 0.000 0.368 0.000
#> GSM1022393     1  0.0000      0.693 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022394     1  0.0000      0.693 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022395     1  0.0000      0.693 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022396     1  0.0000      0.693 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022389     2  0.3653      0.781 0.000 0.692 0.000 0.000 0.300 0.008
#> GSM1022390     2  0.3653      0.781 0.000 0.692 0.000 0.000 0.300 0.008
#> GSM1022391     2  0.3653      0.781 0.000 0.692 0.000 0.000 0.300 0.008
#> GSM1022392     2  0.3653      0.781 0.000 0.692 0.000 0.000 0.300 0.008
#> GSM1022397     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022398     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022399     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022400     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022401     1  0.0000      0.693 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022402     1  0.0000      0.693 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022403     1  0.0000      0.693 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022404     1  0.0000      0.693 1.000 0.000 0.000 0.000 0.000 0.000

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-CV-hclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-CV-hclust-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-CV-hclust-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-CV-hclust-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-CV-hclust-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-CV-hclust-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-CV-hclust-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-CV-hclust-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-CV-hclust-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-CV-hclust-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-CV-hclust-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-CV-hclust-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-CV-hclust-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-CV-hclust-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-CV-hclust-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-CV-hclust-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-CV-hclust-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-CV-hclust-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-CV-hclust-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-CV-hclust-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-hclust-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-CV-hclust-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-CV-hclust-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-CV-hclust-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-CV-hclust-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-CV-hclust-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-hclust-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>            n protocol(p) cell.type(p) k
#> CV:hclust 80    3.07e-06     6.59e-07 2
#> CV:hclust 74    4.44e-09     1.12e-11 3
#> CV:hclust 80    8.66e-12     2.68e-12 4
#> CV:hclust 77    6.34e-15     6.01e-11 5
#> CV:hclust 80    8.72e-22     2.76e-13 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


CV:kmeans

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["CV", "kmeans"]
# you can also extract it by
# res = res_list["CV:kmeans"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk CV-kmeans-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk CV-kmeans-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.452           0.319       0.726         0.4755 0.539   0.539
#> 3 3 0.666           0.899       0.878         0.3616 0.718   0.511
#> 4 4 0.748           0.808       0.827         0.1168 1.000   1.000
#> 5 5 0.728           0.676       0.715         0.0656 0.886   0.658
#> 6 6 0.715           0.646       0.731         0.0468 0.952   0.785

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 3

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1022325     2   0.993     0.5767 0.452 0.548
#> GSM1022326     2   0.993     0.5767 0.452 0.548
#> GSM1022327     2   0.993     0.5767 0.452 0.548
#> GSM1022331     1   0.955     0.7411 0.624 0.376
#> GSM1022332     1   0.955     0.7411 0.624 0.376
#> GSM1022333     1   0.955     0.7411 0.624 0.376
#> GSM1022328     2   0.993     0.5767 0.452 0.548
#> GSM1022329     2   0.993     0.5767 0.452 0.548
#> GSM1022330     2   0.993     0.5767 0.452 0.548
#> GSM1022337     1   0.995     0.3310 0.540 0.460
#> GSM1022338     1   0.995     0.3310 0.540 0.460
#> GSM1022339     1   0.995     0.3310 0.540 0.460
#> GSM1022334     2   0.993     0.5767 0.452 0.548
#> GSM1022335     2   0.993     0.5767 0.452 0.548
#> GSM1022336     2   0.993     0.5767 0.452 0.548
#> GSM1022340     2   0.932    -0.4267 0.348 0.652
#> GSM1022341     2   0.932    -0.4267 0.348 0.652
#> GSM1022342     2   0.932    -0.4267 0.348 0.652
#> GSM1022343     2   0.932    -0.4267 0.348 0.652
#> GSM1022347     1   0.955     0.7411 0.624 0.376
#> GSM1022348     1   0.955     0.7411 0.624 0.376
#> GSM1022349     1   0.955     0.7411 0.624 0.376
#> GSM1022350     1   0.955     0.7411 0.624 0.376
#> GSM1022344     1   0.980     0.7047 0.584 0.416
#> GSM1022345     1   0.980     0.7047 0.584 0.416
#> GSM1022346     1   0.980     0.7047 0.584 0.416
#> GSM1022355     2   0.932    -0.4267 0.348 0.652
#> GSM1022356     2   0.932    -0.4267 0.348 0.652
#> GSM1022357     2   0.932    -0.4267 0.348 0.652
#> GSM1022358     2   0.932    -0.4267 0.348 0.652
#> GSM1022351     2   0.932    -0.4267 0.348 0.652
#> GSM1022352     2   0.932    -0.4267 0.348 0.652
#> GSM1022353     2   0.932    -0.4267 0.348 0.652
#> GSM1022354     2   0.932    -0.4267 0.348 0.652
#> GSM1022359     2   0.993     0.5767 0.452 0.548
#> GSM1022360     2   0.993     0.5767 0.452 0.548
#> GSM1022361     2   0.993     0.5767 0.452 0.548
#> GSM1022362     2   0.993     0.5767 0.452 0.548
#> GSM1022367     1   0.000     0.3023 1.000 0.000
#> GSM1022368     1   0.000     0.3023 1.000 0.000
#> GSM1022369     1   0.000     0.3023 1.000 0.000
#> GSM1022370     1   0.000     0.3023 1.000 0.000
#> GSM1022363     2   0.993     0.5767 0.452 0.548
#> GSM1022364     2   0.993     0.5767 0.452 0.548
#> GSM1022365     2   0.993     0.5767 0.452 0.548
#> GSM1022366     2   0.993     0.5767 0.452 0.548
#> GSM1022374     1   0.871     0.0481 0.708 0.292
#> GSM1022375     1   0.871     0.0481 0.708 0.292
#> GSM1022376     1   0.871     0.0481 0.708 0.292
#> GSM1022371     2   0.993     0.5767 0.452 0.548
#> GSM1022372     2   0.993     0.5767 0.452 0.548
#> GSM1022373     2   0.993     0.5767 0.452 0.548
#> GSM1022377     2   0.993     0.5767 0.452 0.548
#> GSM1022378     2   0.993     0.5767 0.452 0.548
#> GSM1022379     2   0.993     0.5767 0.452 0.548
#> GSM1022380     2   0.993     0.5767 0.452 0.548
#> GSM1022385     1   0.955     0.7411 0.624 0.376
#> GSM1022386     1   0.955     0.7411 0.624 0.376
#> GSM1022387     1   0.955     0.7411 0.624 0.376
#> GSM1022388     1   0.955     0.7411 0.624 0.376
#> GSM1022381     2   0.993     0.5767 0.452 0.548
#> GSM1022382     2   0.993     0.5767 0.452 0.548
#> GSM1022383     2   0.993     0.5767 0.452 0.548
#> GSM1022384     2   0.993     0.5767 0.452 0.548
#> GSM1022393     2   0.932    -0.4267 0.348 0.652
#> GSM1022394     2   0.932    -0.4267 0.348 0.652
#> GSM1022395     2   0.932    -0.4267 0.348 0.652
#> GSM1022396     2   0.932    -0.4267 0.348 0.652
#> GSM1022389     2   0.993     0.5767 0.452 0.548
#> GSM1022390     2   0.993     0.5767 0.452 0.548
#> GSM1022391     2   0.993     0.5767 0.452 0.548
#> GSM1022392     2   0.993     0.5767 0.452 0.548
#> GSM1022397     1   0.955     0.7411 0.624 0.376
#> GSM1022398     1   0.955     0.7411 0.624 0.376
#> GSM1022399     1   0.955     0.7411 0.624 0.376
#> GSM1022400     1   0.955     0.7411 0.624 0.376
#> GSM1022401     2   0.932    -0.4267 0.348 0.652
#> GSM1022402     2   0.932    -0.4267 0.348 0.652
#> GSM1022403     2   0.932    -0.4267 0.348 0.652
#> GSM1022404     2   0.932    -0.4267 0.348 0.652

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1022325     2  0.0424      0.935 0.008 0.992 0.000
#> GSM1022326     2  0.0424      0.935 0.008 0.992 0.000
#> GSM1022327     2  0.0424      0.935 0.008 0.992 0.000
#> GSM1022331     3  0.3459      0.849 0.096 0.012 0.892
#> GSM1022332     3  0.3459      0.849 0.096 0.012 0.892
#> GSM1022333     3  0.3459      0.849 0.096 0.012 0.892
#> GSM1022328     2  0.0424      0.935 0.008 0.992 0.000
#> GSM1022329     2  0.0424      0.935 0.008 0.992 0.000
#> GSM1022330     2  0.0424      0.935 0.008 0.992 0.000
#> GSM1022337     1  0.5650      0.823 0.808 0.084 0.108
#> GSM1022338     1  0.5650      0.823 0.808 0.084 0.108
#> GSM1022339     1  0.5650      0.823 0.808 0.084 0.108
#> GSM1022334     2  0.0592      0.935 0.012 0.988 0.000
#> GSM1022335     2  0.0592      0.935 0.012 0.988 0.000
#> GSM1022336     2  0.0592      0.935 0.012 0.988 0.000
#> GSM1022340     1  0.6301      0.938 0.712 0.028 0.260
#> GSM1022341     1  0.6301      0.938 0.712 0.028 0.260
#> GSM1022342     1  0.6301      0.938 0.712 0.028 0.260
#> GSM1022343     1  0.6301      0.938 0.712 0.028 0.260
#> GSM1022347     3  0.1182      0.904 0.012 0.012 0.976
#> GSM1022348     3  0.1182      0.904 0.012 0.012 0.976
#> GSM1022349     3  0.1182      0.904 0.012 0.012 0.976
#> GSM1022350     3  0.1182      0.904 0.012 0.012 0.976
#> GSM1022344     3  0.0592      0.893 0.012 0.000 0.988
#> GSM1022345     3  0.0592      0.893 0.012 0.000 0.988
#> GSM1022346     3  0.0592      0.893 0.012 0.000 0.988
#> GSM1022355     1  0.6301      0.938 0.712 0.028 0.260
#> GSM1022356     1  0.6301      0.938 0.712 0.028 0.260
#> GSM1022357     1  0.6301      0.938 0.712 0.028 0.260
#> GSM1022358     1  0.6301      0.938 0.712 0.028 0.260
#> GSM1022351     1  0.6301      0.938 0.712 0.028 0.260
#> GSM1022352     1  0.6301      0.938 0.712 0.028 0.260
#> GSM1022353     1  0.6301      0.938 0.712 0.028 0.260
#> GSM1022354     1  0.6301      0.938 0.712 0.028 0.260
#> GSM1022359     2  0.1163      0.933 0.028 0.972 0.000
#> GSM1022360     2  0.1163      0.933 0.028 0.972 0.000
#> GSM1022361     2  0.1163      0.933 0.028 0.972 0.000
#> GSM1022362     2  0.1163      0.933 0.028 0.972 0.000
#> GSM1022367     3  0.7617      0.707 0.160 0.152 0.688
#> GSM1022368     3  0.7617      0.707 0.160 0.152 0.688
#> GSM1022369     3  0.7617      0.707 0.160 0.152 0.688
#> GSM1022370     3  0.7617      0.707 0.160 0.152 0.688
#> GSM1022363     2  0.3771      0.882 0.112 0.876 0.012
#> GSM1022364     2  0.3771      0.882 0.112 0.876 0.012
#> GSM1022365     2  0.3771      0.882 0.112 0.876 0.012
#> GSM1022366     2  0.3771      0.882 0.112 0.876 0.012
#> GSM1022374     1  0.5538      0.785 0.812 0.116 0.072
#> GSM1022375     1  0.5538      0.785 0.812 0.116 0.072
#> GSM1022376     1  0.5538      0.785 0.812 0.116 0.072
#> GSM1022371     2  0.0592      0.935 0.012 0.988 0.000
#> GSM1022372     2  0.0592      0.935 0.012 0.988 0.000
#> GSM1022373     2  0.0592      0.935 0.012 0.988 0.000
#> GSM1022377     2  0.3752      0.914 0.144 0.856 0.000
#> GSM1022378     2  0.3752      0.914 0.144 0.856 0.000
#> GSM1022379     2  0.3752      0.914 0.144 0.856 0.000
#> GSM1022380     2  0.3752      0.914 0.144 0.856 0.000
#> GSM1022385     3  0.1182      0.904 0.012 0.012 0.976
#> GSM1022386     3  0.1182      0.904 0.012 0.012 0.976
#> GSM1022387     3  0.1182      0.904 0.012 0.012 0.976
#> GSM1022388     3  0.1182      0.904 0.012 0.012 0.976
#> GSM1022381     2  0.4002      0.911 0.160 0.840 0.000
#> GSM1022382     2  0.4002      0.911 0.160 0.840 0.000
#> GSM1022383     2  0.4002      0.911 0.160 0.840 0.000
#> GSM1022384     2  0.4002      0.911 0.160 0.840 0.000
#> GSM1022393     1  0.6066      0.935 0.728 0.024 0.248
#> GSM1022394     1  0.6105      0.936 0.724 0.024 0.252
#> GSM1022395     1  0.6105      0.936 0.724 0.024 0.252
#> GSM1022396     1  0.6105      0.936 0.724 0.024 0.252
#> GSM1022389     2  0.3918      0.910 0.140 0.856 0.004
#> GSM1022390     2  0.3918      0.910 0.140 0.856 0.004
#> GSM1022391     2  0.3918      0.910 0.140 0.856 0.004
#> GSM1022392     2  0.3918      0.910 0.140 0.856 0.004
#> GSM1022397     3  0.1182      0.904 0.012 0.012 0.976
#> GSM1022398     3  0.1182      0.904 0.012 0.012 0.976
#> GSM1022399     3  0.1182      0.904 0.012 0.012 0.976
#> GSM1022400     3  0.1182      0.904 0.012 0.012 0.976
#> GSM1022401     1  0.6105      0.936 0.724 0.024 0.252
#> GSM1022402     1  0.6105      0.936 0.724 0.024 0.252
#> GSM1022403     1  0.6105      0.936 0.724 0.024 0.252
#> GSM1022404     1  0.6105      0.936 0.724 0.024 0.252

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3 p4
#> GSM1022325     2  0.0336      0.840 0.008 0.992 0.000 NA
#> GSM1022326     2  0.0336      0.840 0.008 0.992 0.000 NA
#> GSM1022327     2  0.0336      0.840 0.008 0.992 0.000 NA
#> GSM1022331     3  0.3969      0.796 0.016 0.000 0.804 NA
#> GSM1022332     3  0.3969      0.796 0.016 0.000 0.804 NA
#> GSM1022333     3  0.3969      0.796 0.016 0.000 0.804 NA
#> GSM1022328     2  0.0336      0.840 0.008 0.992 0.000 NA
#> GSM1022329     2  0.0336      0.840 0.008 0.992 0.000 NA
#> GSM1022330     2  0.0336      0.840 0.008 0.992 0.000 NA
#> GSM1022337     1  0.5788      0.777 0.700 0.016 0.048 NA
#> GSM1022338     1  0.5788      0.777 0.700 0.016 0.048 NA
#> GSM1022339     1  0.5788      0.777 0.700 0.016 0.048 NA
#> GSM1022334     2  0.0336      0.840 0.008 0.992 0.000 NA
#> GSM1022335     2  0.0336      0.840 0.008 0.992 0.000 NA
#> GSM1022336     2  0.0336      0.840 0.008 0.992 0.000 NA
#> GSM1022340     1  0.3367      0.822 0.864 0.000 0.028 NA
#> GSM1022341     1  0.3367      0.822 0.864 0.000 0.028 NA
#> GSM1022342     1  0.3367      0.822 0.864 0.000 0.028 NA
#> GSM1022343     1  0.3367      0.822 0.864 0.000 0.028 NA
#> GSM1022347     3  0.2053      0.859 0.072 0.000 0.924 NA
#> GSM1022348     3  0.2053      0.859 0.072 0.000 0.924 NA
#> GSM1022349     3  0.2053      0.859 0.072 0.000 0.924 NA
#> GSM1022350     3  0.2053      0.859 0.072 0.000 0.924 NA
#> GSM1022344     3  0.5495      0.725 0.176 0.000 0.728 NA
#> GSM1022345     3  0.5615      0.712 0.188 0.000 0.716 NA
#> GSM1022346     3  0.5615      0.712 0.188 0.000 0.716 NA
#> GSM1022355     1  0.0336      0.870 0.992 0.000 0.000 NA
#> GSM1022356     1  0.0336      0.870 0.992 0.000 0.000 NA
#> GSM1022357     1  0.0336      0.870 0.992 0.000 0.000 NA
#> GSM1022358     1  0.0336      0.870 0.992 0.000 0.000 NA
#> GSM1022351     1  0.2401      0.844 0.904 0.000 0.004 NA
#> GSM1022352     1  0.2401      0.844 0.904 0.000 0.004 NA
#> GSM1022353     1  0.2401      0.844 0.904 0.000 0.004 NA
#> GSM1022354     1  0.2401      0.844 0.904 0.000 0.004 NA
#> GSM1022359     2  0.1452      0.838 0.008 0.956 0.000 NA
#> GSM1022360     2  0.1452      0.838 0.008 0.956 0.000 NA
#> GSM1022361     2  0.1452      0.838 0.008 0.956 0.000 NA
#> GSM1022362     2  0.1452      0.838 0.008 0.956 0.000 NA
#> GSM1022367     3  0.6496      0.653 0.004 0.072 0.568 NA
#> GSM1022368     3  0.6496      0.653 0.004 0.072 0.568 NA
#> GSM1022369     3  0.6496      0.653 0.004 0.072 0.568 NA
#> GSM1022370     3  0.6496      0.653 0.004 0.072 0.568 NA
#> GSM1022363     2  0.3870      0.738 0.000 0.788 0.004 NA
#> GSM1022364     2  0.3870      0.738 0.000 0.788 0.004 NA
#> GSM1022365     2  0.3870      0.738 0.000 0.788 0.004 NA
#> GSM1022366     2  0.3870      0.738 0.000 0.788 0.004 NA
#> GSM1022374     1  0.5954      0.768 0.688 0.020 0.048 NA
#> GSM1022375     1  0.5954      0.768 0.688 0.020 0.048 NA
#> GSM1022376     1  0.5954      0.768 0.688 0.020 0.048 NA
#> GSM1022371     2  0.1639      0.833 0.008 0.952 0.004 NA
#> GSM1022372     2  0.1639      0.833 0.008 0.952 0.004 NA
#> GSM1022373     2  0.1639      0.833 0.008 0.952 0.004 NA
#> GSM1022377     2  0.5530      0.758 0.020 0.616 0.004 NA
#> GSM1022378     2  0.5530      0.758 0.020 0.616 0.004 NA
#> GSM1022379     2  0.5530      0.758 0.020 0.616 0.004 NA
#> GSM1022380     2  0.5530      0.758 0.020 0.616 0.004 NA
#> GSM1022385     3  0.2965      0.858 0.072 0.000 0.892 NA
#> GSM1022386     3  0.2965      0.858 0.072 0.000 0.892 NA
#> GSM1022387     3  0.2965      0.858 0.072 0.000 0.892 NA
#> GSM1022388     3  0.2965      0.858 0.072 0.000 0.892 NA
#> GSM1022381     2  0.5649      0.747 0.020 0.580 0.004 NA
#> GSM1022382     2  0.5649      0.747 0.020 0.580 0.004 NA
#> GSM1022383     2  0.5649      0.747 0.020 0.580 0.004 NA
#> GSM1022384     2  0.5649      0.747 0.020 0.580 0.004 NA
#> GSM1022393     1  0.2216      0.873 0.908 0.000 0.000 NA
#> GSM1022394     1  0.2216      0.873 0.908 0.000 0.000 NA
#> GSM1022395     1  0.2216      0.873 0.908 0.000 0.000 NA
#> GSM1022396     1  0.2216      0.873 0.908 0.000 0.000 NA
#> GSM1022389     2  0.5616      0.759 0.020 0.624 0.008 NA
#> GSM1022390     2  0.5616      0.759 0.020 0.624 0.008 NA
#> GSM1022391     2  0.5616      0.759 0.020 0.624 0.008 NA
#> GSM1022392     2  0.5616      0.759 0.020 0.624 0.008 NA
#> GSM1022397     3  0.1867      0.859 0.072 0.000 0.928 NA
#> GSM1022398     3  0.1867      0.859 0.072 0.000 0.928 NA
#> GSM1022399     3  0.1867      0.859 0.072 0.000 0.928 NA
#> GSM1022400     3  0.1867      0.859 0.072 0.000 0.928 NA
#> GSM1022401     1  0.2216      0.873 0.908 0.000 0.000 NA
#> GSM1022402     1  0.2216      0.873 0.908 0.000 0.000 NA
#> GSM1022403     1  0.2216      0.873 0.908 0.000 0.000 NA
#> GSM1022404     1  0.2216      0.873 0.908 0.000 0.000 NA

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1022325     2  0.4150      0.782 0.000 0.612 0.000 0.388 0.000
#> GSM1022326     2  0.4150      0.782 0.000 0.612 0.000 0.388 0.000
#> GSM1022327     2  0.4150      0.782 0.000 0.612 0.000 0.388 0.000
#> GSM1022331     3  0.4424      0.733 0.000 0.084 0.768 0.004 0.144
#> GSM1022332     3  0.4424      0.733 0.000 0.084 0.768 0.004 0.144
#> GSM1022333     3  0.4424      0.733 0.000 0.084 0.768 0.004 0.144
#> GSM1022328     2  0.4150      0.782 0.000 0.612 0.000 0.388 0.000
#> GSM1022329     2  0.4150      0.782 0.000 0.612 0.000 0.388 0.000
#> GSM1022330     2  0.4150      0.782 0.000 0.612 0.000 0.388 0.000
#> GSM1022337     5  0.4723      0.967 0.368 0.008 0.000 0.012 0.612
#> GSM1022338     5  0.4723      0.967 0.368 0.008 0.000 0.012 0.612
#> GSM1022339     5  0.4723      0.967 0.368 0.008 0.000 0.012 0.612
#> GSM1022334     2  0.4138      0.781 0.000 0.616 0.000 0.384 0.000
#> GSM1022335     2  0.4138      0.781 0.000 0.616 0.000 0.384 0.000
#> GSM1022336     2  0.4138      0.781 0.000 0.616 0.000 0.384 0.000
#> GSM1022340     1  0.2047      0.582 0.928 0.040 0.020 0.012 0.000
#> GSM1022341     1  0.2047      0.582 0.928 0.040 0.020 0.012 0.000
#> GSM1022342     1  0.2047      0.582 0.928 0.040 0.020 0.012 0.000
#> GSM1022343     1  0.2047      0.582 0.928 0.040 0.020 0.012 0.000
#> GSM1022347     3  0.1618      0.803 0.040 0.008 0.944 0.000 0.008
#> GSM1022348     3  0.1618      0.803 0.040 0.008 0.944 0.000 0.008
#> GSM1022349     3  0.1618      0.803 0.040 0.008 0.944 0.000 0.008
#> GSM1022350     3  0.1618      0.803 0.040 0.008 0.944 0.000 0.008
#> GSM1022344     3  0.5666      0.467 0.380 0.064 0.548 0.000 0.008
#> GSM1022345     3  0.5683      0.453 0.388 0.064 0.540 0.000 0.008
#> GSM1022346     3  0.5683      0.453 0.388 0.064 0.540 0.000 0.008
#> GSM1022355     1  0.3309      0.598 0.836 0.036 0.000 0.000 0.128
#> GSM1022356     1  0.3309      0.598 0.836 0.036 0.000 0.000 0.128
#> GSM1022357     1  0.3309      0.598 0.836 0.036 0.000 0.000 0.128
#> GSM1022358     1  0.3309      0.598 0.836 0.036 0.000 0.000 0.128
#> GSM1022351     1  0.0162      0.612 0.996 0.000 0.000 0.004 0.000
#> GSM1022352     1  0.0162      0.612 0.996 0.000 0.000 0.004 0.000
#> GSM1022353     1  0.0162      0.612 0.996 0.000 0.000 0.004 0.000
#> GSM1022354     1  0.0162      0.612 0.996 0.000 0.000 0.004 0.000
#> GSM1022359     2  0.5295      0.708 0.000 0.504 0.008 0.456 0.032
#> GSM1022360     2  0.5295      0.708 0.000 0.504 0.008 0.456 0.032
#> GSM1022361     2  0.5295      0.708 0.000 0.504 0.008 0.456 0.032
#> GSM1022362     2  0.5295      0.708 0.000 0.504 0.008 0.456 0.032
#> GSM1022367     3  0.7217      0.504 0.000 0.232 0.440 0.028 0.300
#> GSM1022368     3  0.7217      0.504 0.000 0.232 0.440 0.028 0.300
#> GSM1022369     3  0.7217      0.504 0.000 0.232 0.440 0.028 0.300
#> GSM1022370     3  0.7217      0.504 0.000 0.232 0.440 0.028 0.300
#> GSM1022363     2  0.6655      0.420 0.000 0.536 0.020 0.268 0.176
#> GSM1022364     2  0.6655      0.420 0.000 0.536 0.020 0.268 0.176
#> GSM1022365     2  0.6655      0.420 0.000 0.536 0.020 0.268 0.176
#> GSM1022366     2  0.6655      0.420 0.000 0.536 0.020 0.268 0.176
#> GSM1022374     5  0.4654      0.968 0.348 0.008 0.000 0.012 0.632
#> GSM1022375     5  0.4654      0.968 0.348 0.008 0.000 0.012 0.632
#> GSM1022376     5  0.4654      0.968 0.348 0.008 0.000 0.012 0.632
#> GSM1022371     2  0.5071      0.725 0.000 0.616 0.004 0.340 0.040
#> GSM1022372     2  0.5071      0.725 0.000 0.616 0.004 0.340 0.040
#> GSM1022373     2  0.5071      0.725 0.000 0.616 0.004 0.340 0.040
#> GSM1022377     4  0.1790      0.819 0.004 0.016 0.004 0.940 0.036
#> GSM1022378     4  0.1790      0.819 0.004 0.016 0.004 0.940 0.036
#> GSM1022379     4  0.1790      0.819 0.004 0.016 0.004 0.940 0.036
#> GSM1022380     4  0.1790      0.819 0.004 0.016 0.004 0.940 0.036
#> GSM1022385     3  0.2072      0.803 0.036 0.016 0.928 0.000 0.020
#> GSM1022386     3  0.2072      0.803 0.036 0.016 0.928 0.000 0.020
#> GSM1022387     3  0.2072      0.803 0.036 0.016 0.928 0.000 0.020
#> GSM1022388     3  0.2072      0.803 0.036 0.016 0.928 0.000 0.020
#> GSM1022381     4  0.1372      0.820 0.004 0.016 0.000 0.956 0.024
#> GSM1022382     4  0.1372      0.820 0.004 0.016 0.000 0.956 0.024
#> GSM1022383     4  0.1372      0.820 0.004 0.016 0.000 0.956 0.024
#> GSM1022384     4  0.1372      0.820 0.004 0.016 0.000 0.956 0.024
#> GSM1022393     1  0.5368      0.358 0.620 0.068 0.000 0.004 0.308
#> GSM1022394     1  0.5368      0.358 0.620 0.068 0.000 0.004 0.308
#> GSM1022395     1  0.5368      0.358 0.620 0.068 0.000 0.004 0.308
#> GSM1022396     1  0.5368      0.358 0.620 0.068 0.000 0.004 0.308
#> GSM1022389     4  0.4986      0.681 0.004 0.168 0.012 0.736 0.080
#> GSM1022390     4  0.4986      0.681 0.004 0.168 0.012 0.736 0.080
#> GSM1022391     4  0.4986      0.681 0.004 0.168 0.012 0.736 0.080
#> GSM1022392     4  0.4986      0.681 0.004 0.168 0.012 0.736 0.080
#> GSM1022397     3  0.1205      0.804 0.040 0.000 0.956 0.000 0.004
#> GSM1022398     3  0.1205      0.804 0.040 0.000 0.956 0.000 0.004
#> GSM1022399     3  0.1205      0.804 0.040 0.000 0.956 0.000 0.004
#> GSM1022400     3  0.1205      0.804 0.040 0.000 0.956 0.000 0.004
#> GSM1022401     1  0.5368      0.358 0.620 0.068 0.000 0.004 0.308
#> GSM1022402     1  0.5368      0.358 0.620 0.068 0.000 0.004 0.308
#> GSM1022403     1  0.5368      0.358 0.620 0.068 0.000 0.004 0.308
#> GSM1022404     1  0.5368      0.358 0.620 0.068 0.000 0.004 0.308

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1022325     2  0.0000     0.9259 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022326     2  0.0000     0.9259 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022327     2  0.0000     0.9259 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022331     3  0.4928     0.4684 0.000 0.000 0.640 0.032 0.040 0.288
#> GSM1022332     3  0.4928     0.4684 0.000 0.000 0.640 0.032 0.040 0.288
#> GSM1022333     3  0.4928     0.4684 0.000 0.000 0.640 0.032 0.040 0.288
#> GSM1022328     2  0.0000     0.9259 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022329     2  0.0000     0.9259 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022330     2  0.0000     0.9259 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022337     5  0.3767     0.9758 0.268 0.004 0.000 0.004 0.716 0.008
#> GSM1022338     5  0.3767     0.9758 0.268 0.004 0.000 0.004 0.716 0.008
#> GSM1022339     5  0.3767     0.9758 0.268 0.004 0.000 0.004 0.716 0.008
#> GSM1022334     2  0.0291     0.9240 0.000 0.992 0.000 0.004 0.004 0.000
#> GSM1022335     2  0.0291     0.9240 0.000 0.992 0.000 0.004 0.004 0.000
#> GSM1022336     2  0.0291     0.9240 0.000 0.992 0.000 0.004 0.004 0.000
#> GSM1022340     1  0.2759     0.5295 0.880 0.000 0.008 0.040 0.008 0.064
#> GSM1022341     1  0.2759     0.5295 0.880 0.000 0.008 0.040 0.008 0.064
#> GSM1022342     1  0.2759     0.5295 0.880 0.000 0.008 0.040 0.008 0.064
#> GSM1022343     1  0.2759     0.5295 0.880 0.000 0.008 0.040 0.008 0.064
#> GSM1022347     3  0.1232     0.7779 0.004 0.000 0.956 0.024 0.016 0.000
#> GSM1022348     3  0.1232     0.7779 0.004 0.000 0.956 0.024 0.016 0.000
#> GSM1022349     3  0.1232     0.7779 0.004 0.000 0.956 0.024 0.016 0.000
#> GSM1022350     3  0.1232     0.7779 0.004 0.000 0.956 0.024 0.016 0.000
#> GSM1022344     3  0.6684     0.3388 0.388 0.000 0.440 0.068 0.020 0.084
#> GSM1022345     3  0.6691     0.3139 0.400 0.000 0.428 0.068 0.020 0.084
#> GSM1022346     3  0.6691     0.3139 0.400 0.000 0.428 0.068 0.020 0.084
#> GSM1022355     1  0.2699     0.5510 0.864 0.000 0.000 0.008 0.108 0.020
#> GSM1022356     1  0.2699     0.5510 0.864 0.000 0.000 0.008 0.108 0.020
#> GSM1022357     1  0.2699     0.5510 0.864 0.000 0.000 0.008 0.108 0.020
#> GSM1022358     1  0.2699     0.5510 0.864 0.000 0.000 0.008 0.108 0.020
#> GSM1022351     1  0.0000     0.5734 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022352     1  0.0000     0.5734 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022353     1  0.0000     0.5734 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022354     1  0.0000     0.5734 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022359     2  0.2976     0.8583 0.000 0.872 0.004 0.048 0.028 0.048
#> GSM1022360     2  0.2976     0.8583 0.000 0.872 0.004 0.048 0.028 0.048
#> GSM1022361     2  0.2976     0.8583 0.000 0.872 0.004 0.048 0.028 0.048
#> GSM1022362     2  0.2976     0.8583 0.000 0.872 0.004 0.048 0.028 0.048
#> GSM1022367     6  0.4157     0.4454 0.000 0.004 0.276 0.000 0.032 0.688
#> GSM1022368     6  0.4157     0.4454 0.000 0.004 0.276 0.000 0.032 0.688
#> GSM1022369     6  0.4157     0.4454 0.000 0.004 0.276 0.000 0.032 0.688
#> GSM1022370     6  0.4157     0.4454 0.000 0.004 0.276 0.000 0.032 0.688
#> GSM1022363     6  0.6077     0.3602 0.000 0.412 0.000 0.076 0.060 0.452
#> GSM1022364     6  0.6077     0.3602 0.000 0.412 0.000 0.076 0.060 0.452
#> GSM1022365     6  0.6077     0.3602 0.000 0.412 0.000 0.076 0.060 0.452
#> GSM1022366     6  0.6077     0.3602 0.000 0.412 0.000 0.076 0.060 0.452
#> GSM1022374     5  0.3859     0.9763 0.252 0.004 0.000 0.004 0.724 0.016
#> GSM1022375     5  0.3859     0.9763 0.252 0.004 0.000 0.004 0.724 0.016
#> GSM1022376     5  0.3859     0.9763 0.252 0.004 0.000 0.004 0.724 0.016
#> GSM1022371     2  0.3041     0.8422 0.000 0.864 0.000 0.044 0.056 0.036
#> GSM1022372     2  0.3041     0.8422 0.000 0.864 0.000 0.044 0.056 0.036
#> GSM1022373     2  0.3041     0.8422 0.000 0.864 0.000 0.044 0.056 0.036
#> GSM1022377     4  0.4664     0.8338 0.000 0.248 0.000 0.680 0.016 0.056
#> GSM1022378     4  0.4664     0.8338 0.000 0.248 0.000 0.680 0.016 0.056
#> GSM1022379     4  0.4664     0.8338 0.000 0.248 0.000 0.680 0.016 0.056
#> GSM1022380     4  0.4664     0.8338 0.000 0.248 0.000 0.680 0.016 0.056
#> GSM1022385     3  0.1623     0.7728 0.004 0.000 0.940 0.020 0.032 0.004
#> GSM1022386     3  0.1623     0.7728 0.004 0.000 0.940 0.020 0.032 0.004
#> GSM1022387     3  0.1623     0.7728 0.004 0.000 0.940 0.020 0.032 0.004
#> GSM1022388     3  0.1623     0.7728 0.004 0.000 0.940 0.020 0.032 0.004
#> GSM1022381     4  0.3854     0.8292 0.000 0.188 0.000 0.760 0.004 0.048
#> GSM1022382     4  0.3854     0.8292 0.000 0.188 0.000 0.760 0.004 0.048
#> GSM1022383     4  0.3854     0.8292 0.000 0.188 0.000 0.760 0.004 0.048
#> GSM1022384     4  0.3854     0.8292 0.000 0.188 0.000 0.760 0.004 0.048
#> GSM1022393     1  0.5844     0.0441 0.480 0.000 0.000 0.048 0.404 0.068
#> GSM1022394     1  0.5844     0.0441 0.480 0.000 0.000 0.048 0.404 0.068
#> GSM1022395     1  0.5844     0.0441 0.480 0.000 0.000 0.048 0.404 0.068
#> GSM1022396     1  0.5844     0.0441 0.480 0.000 0.000 0.048 0.404 0.068
#> GSM1022389     4  0.6097     0.7453 0.000 0.292 0.000 0.544 0.108 0.056
#> GSM1022390     4  0.6097     0.7453 0.000 0.292 0.000 0.544 0.108 0.056
#> GSM1022391     4  0.6097     0.7453 0.000 0.292 0.000 0.544 0.108 0.056
#> GSM1022392     4  0.6097     0.7453 0.000 0.292 0.000 0.544 0.108 0.056
#> GSM1022397     3  0.0146     0.7826 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM1022398     3  0.0146     0.7826 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM1022399     3  0.0146     0.7826 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM1022400     3  0.0146     0.7826 0.004 0.000 0.996 0.000 0.000 0.000
#> GSM1022401     1  0.5850     0.0416 0.480 0.000 0.000 0.052 0.404 0.064
#> GSM1022402     1  0.5850     0.0416 0.480 0.000 0.000 0.052 0.404 0.064
#> GSM1022403     1  0.5850     0.0416 0.480 0.000 0.000 0.052 0.404 0.064
#> GSM1022404     1  0.5850     0.0416 0.480 0.000 0.000 0.052 0.404 0.064

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-CV-kmeans-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-CV-kmeans-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-CV-kmeans-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-CV-kmeans-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-CV-kmeans-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-CV-kmeans-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-CV-kmeans-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-CV-kmeans-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-CV-kmeans-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-CV-kmeans-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-CV-kmeans-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-CV-kmeans-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-CV-kmeans-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-CV-kmeans-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-CV-kmeans-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-CV-kmeans-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-CV-kmeans-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-CV-kmeans-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-CV-kmeans-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-CV-kmeans-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-kmeans-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-CV-kmeans-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-CV-kmeans-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-CV-kmeans-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-CV-kmeans-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-CV-kmeans-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-kmeans-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>            n protocol(p) cell.type(p) k
#> CV:kmeans 50    1.35e-04     4.90e-09 2
#> CV:kmeans 80    2.40e-10     5.36e-11 3
#> CV:kmeans 80    2.40e-10     5.36e-11 4
#> CV:kmeans 65    3.37e-18     4.76e-11 5
#> CV:kmeans 58    3.59e-17     1.78e-09 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


CV:skmeans**

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["CV", "skmeans"]
# you can also extract it by
# res = res_list["CV:skmeans"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk CV-skmeans-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk CV-skmeans-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.957       0.983         0.5045 0.494   0.494
#> 3 3 1.000           1.000       1.000         0.3229 0.750   0.535
#> 4 4 0.861           0.862       0.854         0.0974 0.947   0.840
#> 5 5 0.813           0.861       0.894         0.0790 0.904   0.665
#> 6 6 0.843           0.828       0.887         0.0431 0.937   0.704

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 3
#> attr(,"optional")
#> [1] 2

There is also optional best \(k\) = 2 that is worth to check.

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1022325     2  0.0000      0.967 0.000 1.000
#> GSM1022326     2  0.0000      0.967 0.000 1.000
#> GSM1022327     2  0.0000      0.967 0.000 1.000
#> GSM1022331     1  0.0000      0.996 1.000 0.000
#> GSM1022332     1  0.0000      0.996 1.000 0.000
#> GSM1022333     1  0.0000      0.996 1.000 0.000
#> GSM1022328     2  0.0000      0.967 0.000 1.000
#> GSM1022329     2  0.0000      0.967 0.000 1.000
#> GSM1022330     2  0.0000      0.967 0.000 1.000
#> GSM1022337     1  0.3114      0.941 0.944 0.056
#> GSM1022338     1  0.3114      0.941 0.944 0.056
#> GSM1022339     1  0.3114      0.941 0.944 0.056
#> GSM1022334     2  0.0000      0.967 0.000 1.000
#> GSM1022335     2  0.0000      0.967 0.000 1.000
#> GSM1022336     2  0.0000      0.967 0.000 1.000
#> GSM1022340     1  0.0000      0.996 1.000 0.000
#> GSM1022341     1  0.0000      0.996 1.000 0.000
#> GSM1022342     1  0.0000      0.996 1.000 0.000
#> GSM1022343     1  0.0000      0.996 1.000 0.000
#> GSM1022347     1  0.0000      0.996 1.000 0.000
#> GSM1022348     1  0.0000      0.996 1.000 0.000
#> GSM1022349     1  0.0000      0.996 1.000 0.000
#> GSM1022350     1  0.0000      0.996 1.000 0.000
#> GSM1022344     1  0.0000      0.996 1.000 0.000
#> GSM1022345     1  0.0000      0.996 1.000 0.000
#> GSM1022346     1  0.0000      0.996 1.000 0.000
#> GSM1022355     1  0.0000      0.996 1.000 0.000
#> GSM1022356     1  0.0000      0.996 1.000 0.000
#> GSM1022357     1  0.0000      0.996 1.000 0.000
#> GSM1022358     1  0.0000      0.996 1.000 0.000
#> GSM1022351     1  0.0000      0.996 1.000 0.000
#> GSM1022352     1  0.0000      0.996 1.000 0.000
#> GSM1022353     1  0.0000      0.996 1.000 0.000
#> GSM1022354     1  0.0000      0.996 1.000 0.000
#> GSM1022359     2  0.0000      0.967 0.000 1.000
#> GSM1022360     2  0.0000      0.967 0.000 1.000
#> GSM1022361     2  0.0000      0.967 0.000 1.000
#> GSM1022362     2  0.0000      0.967 0.000 1.000
#> GSM1022367     2  0.0376      0.964 0.004 0.996
#> GSM1022368     2  0.0376      0.964 0.004 0.996
#> GSM1022369     2  0.0376      0.964 0.004 0.996
#> GSM1022370     2  0.0376      0.964 0.004 0.996
#> GSM1022363     2  0.0000      0.967 0.000 1.000
#> GSM1022364     2  0.0000      0.967 0.000 1.000
#> GSM1022365     2  0.0000      0.967 0.000 1.000
#> GSM1022366     2  0.0000      0.967 0.000 1.000
#> GSM1022374     2  0.9710      0.362 0.400 0.600
#> GSM1022375     2  0.9710      0.362 0.400 0.600
#> GSM1022376     2  0.9710      0.362 0.400 0.600
#> GSM1022371     2  0.0000      0.967 0.000 1.000
#> GSM1022372     2  0.0000      0.967 0.000 1.000
#> GSM1022373     2  0.0000      0.967 0.000 1.000
#> GSM1022377     2  0.0000      0.967 0.000 1.000
#> GSM1022378     2  0.0000      0.967 0.000 1.000
#> GSM1022379     2  0.0000      0.967 0.000 1.000
#> GSM1022380     2  0.0000      0.967 0.000 1.000
#> GSM1022385     1  0.0000      0.996 1.000 0.000
#> GSM1022386     1  0.0000      0.996 1.000 0.000
#> GSM1022387     1  0.0000      0.996 1.000 0.000
#> GSM1022388     1  0.0000      0.996 1.000 0.000
#> GSM1022381     2  0.0000      0.967 0.000 1.000
#> GSM1022382     2  0.0000      0.967 0.000 1.000
#> GSM1022383     2  0.0000      0.967 0.000 1.000
#> GSM1022384     2  0.0000      0.967 0.000 1.000
#> GSM1022393     1  0.0000      0.996 1.000 0.000
#> GSM1022394     1  0.0000      0.996 1.000 0.000
#> GSM1022395     1  0.0000      0.996 1.000 0.000
#> GSM1022396     1  0.0000      0.996 1.000 0.000
#> GSM1022389     2  0.0000      0.967 0.000 1.000
#> GSM1022390     2  0.0000      0.967 0.000 1.000
#> GSM1022391     2  0.0000      0.967 0.000 1.000
#> GSM1022392     2  0.0000      0.967 0.000 1.000
#> GSM1022397     1  0.0000      0.996 1.000 0.000
#> GSM1022398     1  0.0000      0.996 1.000 0.000
#> GSM1022399     1  0.0000      0.996 1.000 0.000
#> GSM1022400     1  0.0000      0.996 1.000 0.000
#> GSM1022401     1  0.0000      0.996 1.000 0.000
#> GSM1022402     1  0.0000      0.996 1.000 0.000
#> GSM1022403     1  0.0000      0.996 1.000 0.000
#> GSM1022404     1  0.0000      0.996 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette p1 p2 p3
#> GSM1022325     2       0          1  0  1  0
#> GSM1022326     2       0          1  0  1  0
#> GSM1022327     2       0          1  0  1  0
#> GSM1022331     3       0          1  0  0  1
#> GSM1022332     3       0          1  0  0  1
#> GSM1022333     3       0          1  0  0  1
#> GSM1022328     2       0          1  0  1  0
#> GSM1022329     2       0          1  0  1  0
#> GSM1022330     2       0          1  0  1  0
#> GSM1022337     1       0          1  1  0  0
#> GSM1022338     1       0          1  1  0  0
#> GSM1022339     1       0          1  1  0  0
#> GSM1022334     2       0          1  0  1  0
#> GSM1022335     2       0          1  0  1  0
#> GSM1022336     2       0          1  0  1  0
#> GSM1022340     1       0          1  1  0  0
#> GSM1022341     1       0          1  1  0  0
#> GSM1022342     1       0          1  1  0  0
#> GSM1022343     1       0          1  1  0  0
#> GSM1022347     3       0          1  0  0  1
#> GSM1022348     3       0          1  0  0  1
#> GSM1022349     3       0          1  0  0  1
#> GSM1022350     3       0          1  0  0  1
#> GSM1022344     3       0          1  0  0  1
#> GSM1022345     3       0          1  0  0  1
#> GSM1022346     3       0          1  0  0  1
#> GSM1022355     1       0          1  1  0  0
#> GSM1022356     1       0          1  1  0  0
#> GSM1022357     1       0          1  1  0  0
#> GSM1022358     1       0          1  1  0  0
#> GSM1022351     1       0          1  1  0  0
#> GSM1022352     1       0          1  1  0  0
#> GSM1022353     1       0          1  1  0  0
#> GSM1022354     1       0          1  1  0  0
#> GSM1022359     2       0          1  0  1  0
#> GSM1022360     2       0          1  0  1  0
#> GSM1022361     2       0          1  0  1  0
#> GSM1022362     2       0          1  0  1  0
#> GSM1022367     3       0          1  0  0  1
#> GSM1022368     3       0          1  0  0  1
#> GSM1022369     3       0          1  0  0  1
#> GSM1022370     3       0          1  0  0  1
#> GSM1022363     2       0          1  0  1  0
#> GSM1022364     2       0          1  0  1  0
#> GSM1022365     2       0          1  0  1  0
#> GSM1022366     2       0          1  0  1  0
#> GSM1022374     1       0          1  1  0  0
#> GSM1022375     1       0          1  1  0  0
#> GSM1022376     1       0          1  1  0  0
#> GSM1022371     2       0          1  0  1  0
#> GSM1022372     2       0          1  0  1  0
#> GSM1022373     2       0          1  0  1  0
#> GSM1022377     2       0          1  0  1  0
#> GSM1022378     2       0          1  0  1  0
#> GSM1022379     2       0          1  0  1  0
#> GSM1022380     2       0          1  0  1  0
#> GSM1022385     3       0          1  0  0  1
#> GSM1022386     3       0          1  0  0  1
#> GSM1022387     3       0          1  0  0  1
#> GSM1022388     3       0          1  0  0  1
#> GSM1022381     2       0          1  0  1  0
#> GSM1022382     2       0          1  0  1  0
#> GSM1022383     2       0          1  0  1  0
#> GSM1022384     2       0          1  0  1  0
#> GSM1022393     1       0          1  1  0  0
#> GSM1022394     1       0          1  1  0  0
#> GSM1022395     1       0          1  1  0  0
#> GSM1022396     1       0          1  1  0  0
#> GSM1022389     2       0          1  0  1  0
#> GSM1022390     2       0          1  0  1  0
#> GSM1022391     2       0          1  0  1  0
#> GSM1022392     2       0          1  0  1  0
#> GSM1022397     3       0          1  0  0  1
#> GSM1022398     3       0          1  0  0  1
#> GSM1022399     3       0          1  0  0  1
#> GSM1022400     3       0          1  0  0  1
#> GSM1022401     1       0          1  1  0  0
#> GSM1022402     1       0          1  1  0  0
#> GSM1022403     1       0          1  1  0  0
#> GSM1022404     1       0          1  1  0  0

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1022325     2  0.0000      0.859 0.000 1.000 0.000 0.000
#> GSM1022326     2  0.0000      0.859 0.000 1.000 0.000 0.000
#> GSM1022327     2  0.0000      0.859 0.000 1.000 0.000 0.000
#> GSM1022331     3  0.0188      0.924 0.004 0.000 0.996 0.000
#> GSM1022332     3  0.0188      0.924 0.004 0.000 0.996 0.000
#> GSM1022333     3  0.0188      0.924 0.004 0.000 0.996 0.000
#> GSM1022328     2  0.0000      0.859 0.000 1.000 0.000 0.000
#> GSM1022329     2  0.0000      0.859 0.000 1.000 0.000 0.000
#> GSM1022330     2  0.0000      0.859 0.000 1.000 0.000 0.000
#> GSM1022337     1  0.5050      0.954 0.588 0.004 0.000 0.408
#> GSM1022338     1  0.5050      0.954 0.588 0.004 0.000 0.408
#> GSM1022339     1  0.5050      0.954 0.588 0.004 0.000 0.408
#> GSM1022334     2  0.0000      0.859 0.000 1.000 0.000 0.000
#> GSM1022335     2  0.0000      0.859 0.000 1.000 0.000 0.000
#> GSM1022336     2  0.0000      0.859 0.000 1.000 0.000 0.000
#> GSM1022340     4  0.1302      0.923 0.000 0.000 0.044 0.956
#> GSM1022341     4  0.1302      0.923 0.000 0.000 0.044 0.956
#> GSM1022342     4  0.1302      0.923 0.000 0.000 0.044 0.956
#> GSM1022343     4  0.1302      0.923 0.000 0.000 0.044 0.956
#> GSM1022347     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM1022348     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM1022349     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM1022350     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM1022344     3  0.4916      0.369 0.000 0.000 0.576 0.424
#> GSM1022345     3  0.4933      0.351 0.000 0.000 0.568 0.432
#> GSM1022346     3  0.4933      0.351 0.000 0.000 0.568 0.432
#> GSM1022355     4  0.0817      0.937 0.024 0.000 0.000 0.976
#> GSM1022356     4  0.0817      0.937 0.024 0.000 0.000 0.976
#> GSM1022357     4  0.0817      0.937 0.024 0.000 0.000 0.976
#> GSM1022358     4  0.0817      0.937 0.024 0.000 0.000 0.976
#> GSM1022351     4  0.0000      0.950 0.000 0.000 0.000 1.000
#> GSM1022352     4  0.0000      0.950 0.000 0.000 0.000 1.000
#> GSM1022353     4  0.0000      0.950 0.000 0.000 0.000 1.000
#> GSM1022354     4  0.0000      0.950 0.000 0.000 0.000 1.000
#> GSM1022359     2  0.0000      0.859 0.000 1.000 0.000 0.000
#> GSM1022360     2  0.0000      0.859 0.000 1.000 0.000 0.000
#> GSM1022361     2  0.0000      0.859 0.000 1.000 0.000 0.000
#> GSM1022362     2  0.0000      0.859 0.000 1.000 0.000 0.000
#> GSM1022367     3  0.1635      0.894 0.008 0.044 0.948 0.000
#> GSM1022368     3  0.1635      0.894 0.008 0.044 0.948 0.000
#> GSM1022369     3  0.1635      0.894 0.008 0.044 0.948 0.000
#> GSM1022370     3  0.1635      0.894 0.008 0.044 0.948 0.000
#> GSM1022363     2  0.0336      0.855 0.008 0.992 0.000 0.000
#> GSM1022364     2  0.0336      0.855 0.008 0.992 0.000 0.000
#> GSM1022365     2  0.0336      0.855 0.008 0.992 0.000 0.000
#> GSM1022366     2  0.0336      0.855 0.008 0.992 0.000 0.000
#> GSM1022374     1  0.6309      0.862 0.588 0.076 0.000 0.336
#> GSM1022375     1  0.6309      0.862 0.588 0.076 0.000 0.336
#> GSM1022376     1  0.6309      0.862 0.588 0.076 0.000 0.336
#> GSM1022371     2  0.0000      0.859 0.000 1.000 0.000 0.000
#> GSM1022372     2  0.0000      0.859 0.000 1.000 0.000 0.000
#> GSM1022373     2  0.0000      0.859 0.000 1.000 0.000 0.000
#> GSM1022377     2  0.4866      0.743 0.404 0.596 0.000 0.000
#> GSM1022378     2  0.4866      0.743 0.404 0.596 0.000 0.000
#> GSM1022379     2  0.4866      0.743 0.404 0.596 0.000 0.000
#> GSM1022380     2  0.4866      0.743 0.404 0.596 0.000 0.000
#> GSM1022385     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM1022386     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM1022387     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM1022388     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM1022381     2  0.4866      0.743 0.404 0.596 0.000 0.000
#> GSM1022382     2  0.4866      0.743 0.404 0.596 0.000 0.000
#> GSM1022383     2  0.4866      0.743 0.404 0.596 0.000 0.000
#> GSM1022384     2  0.4866      0.743 0.404 0.596 0.000 0.000
#> GSM1022393     1  0.4898      0.957 0.584 0.000 0.000 0.416
#> GSM1022394     1  0.4898      0.957 0.584 0.000 0.000 0.416
#> GSM1022395     1  0.4898      0.957 0.584 0.000 0.000 0.416
#> GSM1022396     1  0.4898      0.957 0.584 0.000 0.000 0.416
#> GSM1022389     2  0.4804      0.751 0.384 0.616 0.000 0.000
#> GSM1022390     2  0.4804      0.751 0.384 0.616 0.000 0.000
#> GSM1022391     2  0.4804      0.751 0.384 0.616 0.000 0.000
#> GSM1022392     2  0.4804      0.751 0.384 0.616 0.000 0.000
#> GSM1022397     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM1022398     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM1022399     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM1022400     3  0.0000      0.925 0.000 0.000 1.000 0.000
#> GSM1022401     1  0.4898      0.957 0.584 0.000 0.000 0.416
#> GSM1022402     1  0.4898      0.957 0.584 0.000 0.000 0.416
#> GSM1022403     1  0.4898      0.957 0.584 0.000 0.000 0.416
#> GSM1022404     1  0.4898      0.957 0.584 0.000 0.000 0.416

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1022325     2  0.2891      0.936 0.000 0.824 0.000 0.176 0.000
#> GSM1022326     2  0.2891      0.936 0.000 0.824 0.000 0.176 0.000
#> GSM1022327     2  0.2891      0.936 0.000 0.824 0.000 0.176 0.000
#> GSM1022331     3  0.1205      0.899 0.040 0.000 0.956 0.004 0.000
#> GSM1022332     3  0.1205      0.899 0.040 0.000 0.956 0.004 0.000
#> GSM1022333     3  0.1205      0.899 0.040 0.000 0.956 0.004 0.000
#> GSM1022328     2  0.2891      0.936 0.000 0.824 0.000 0.176 0.000
#> GSM1022329     2  0.2891      0.936 0.000 0.824 0.000 0.176 0.000
#> GSM1022330     2  0.2891      0.936 0.000 0.824 0.000 0.176 0.000
#> GSM1022337     5  0.0162      0.874 0.004 0.000 0.000 0.000 0.996
#> GSM1022338     5  0.0162      0.874 0.004 0.000 0.000 0.000 0.996
#> GSM1022339     5  0.0162      0.874 0.004 0.000 0.000 0.000 0.996
#> GSM1022334     2  0.2891      0.936 0.000 0.824 0.000 0.176 0.000
#> GSM1022335     2  0.2891      0.936 0.000 0.824 0.000 0.176 0.000
#> GSM1022336     2  0.2891      0.936 0.000 0.824 0.000 0.176 0.000
#> GSM1022340     1  0.1630      0.864 0.944 0.000 0.036 0.004 0.016
#> GSM1022341     1  0.1630      0.864 0.944 0.000 0.036 0.004 0.016
#> GSM1022342     1  0.1630      0.864 0.944 0.000 0.036 0.004 0.016
#> GSM1022343     1  0.1630      0.864 0.944 0.000 0.036 0.004 0.016
#> GSM1022347     3  0.0000      0.914 0.000 0.000 1.000 0.000 0.000
#> GSM1022348     3  0.0000      0.914 0.000 0.000 1.000 0.000 0.000
#> GSM1022349     3  0.0000      0.914 0.000 0.000 1.000 0.000 0.000
#> GSM1022350     3  0.0000      0.914 0.000 0.000 1.000 0.000 0.000
#> GSM1022344     3  0.4452     -0.159 0.496 0.000 0.500 0.004 0.000
#> GSM1022345     1  0.4415      0.237 0.552 0.000 0.444 0.004 0.000
#> GSM1022346     1  0.4420      0.225 0.548 0.000 0.448 0.004 0.000
#> GSM1022355     1  0.2020      0.845 0.900 0.000 0.000 0.000 0.100
#> GSM1022356     1  0.2127      0.836 0.892 0.000 0.000 0.000 0.108
#> GSM1022357     1  0.2020      0.845 0.900 0.000 0.000 0.000 0.100
#> GSM1022358     1  0.2020      0.845 0.900 0.000 0.000 0.000 0.100
#> GSM1022351     1  0.1270      0.869 0.948 0.000 0.000 0.000 0.052
#> GSM1022352     1  0.1270      0.869 0.948 0.000 0.000 0.000 0.052
#> GSM1022353     1  0.1270      0.869 0.948 0.000 0.000 0.000 0.052
#> GSM1022354     1  0.1270      0.869 0.948 0.000 0.000 0.000 0.052
#> GSM1022359     2  0.3003      0.930 0.000 0.812 0.000 0.188 0.000
#> GSM1022360     2  0.3003      0.930 0.000 0.812 0.000 0.188 0.000
#> GSM1022361     2  0.3003      0.930 0.000 0.812 0.000 0.188 0.000
#> GSM1022362     2  0.3003      0.930 0.000 0.812 0.000 0.188 0.000
#> GSM1022367     3  0.4735      0.778 0.052 0.176 0.752 0.004 0.016
#> GSM1022368     3  0.4735      0.778 0.052 0.176 0.752 0.004 0.016
#> GSM1022369     3  0.4735      0.778 0.052 0.176 0.752 0.004 0.016
#> GSM1022370     3  0.4735      0.778 0.052 0.176 0.752 0.004 0.016
#> GSM1022363     2  0.1087      0.769 0.016 0.968 0.000 0.008 0.008
#> GSM1022364     2  0.1087      0.769 0.016 0.968 0.000 0.008 0.008
#> GSM1022365     2  0.1087      0.769 0.016 0.968 0.000 0.008 0.008
#> GSM1022366     2  0.1087      0.769 0.016 0.968 0.000 0.008 0.008
#> GSM1022374     5  0.0162      0.872 0.000 0.004 0.000 0.000 0.996
#> GSM1022375     5  0.0162      0.872 0.000 0.004 0.000 0.000 0.996
#> GSM1022376     5  0.0162      0.872 0.000 0.004 0.000 0.000 0.996
#> GSM1022371     2  0.2966      0.932 0.000 0.816 0.000 0.184 0.000
#> GSM1022372     2  0.2966      0.932 0.000 0.816 0.000 0.184 0.000
#> GSM1022373     2  0.2966      0.932 0.000 0.816 0.000 0.184 0.000
#> GSM1022377     4  0.0609      0.945 0.000 0.020 0.000 0.980 0.000
#> GSM1022378     4  0.0609      0.945 0.000 0.020 0.000 0.980 0.000
#> GSM1022379     4  0.0609      0.945 0.000 0.020 0.000 0.980 0.000
#> GSM1022380     4  0.0609      0.945 0.000 0.020 0.000 0.980 0.000
#> GSM1022385     3  0.0000      0.914 0.000 0.000 1.000 0.000 0.000
#> GSM1022386     3  0.0000      0.914 0.000 0.000 1.000 0.000 0.000
#> GSM1022387     3  0.0000      0.914 0.000 0.000 1.000 0.000 0.000
#> GSM1022388     3  0.0000      0.914 0.000 0.000 1.000 0.000 0.000
#> GSM1022381     4  0.0510      0.945 0.000 0.016 0.000 0.984 0.000
#> GSM1022382     4  0.0510      0.945 0.000 0.016 0.000 0.984 0.000
#> GSM1022383     4  0.0510      0.945 0.000 0.016 0.000 0.984 0.000
#> GSM1022384     4  0.0510      0.945 0.000 0.016 0.000 0.984 0.000
#> GSM1022393     5  0.2891      0.898 0.176 0.000 0.000 0.000 0.824
#> GSM1022394     5  0.2891      0.898 0.176 0.000 0.000 0.000 0.824
#> GSM1022395     5  0.2891      0.898 0.176 0.000 0.000 0.000 0.824
#> GSM1022396     5  0.2891      0.898 0.176 0.000 0.000 0.000 0.824
#> GSM1022389     4  0.2377      0.881 0.000 0.128 0.000 0.872 0.000
#> GSM1022390     4  0.2377      0.881 0.000 0.128 0.000 0.872 0.000
#> GSM1022391     4  0.2377      0.881 0.000 0.128 0.000 0.872 0.000
#> GSM1022392     4  0.2377      0.881 0.000 0.128 0.000 0.872 0.000
#> GSM1022397     3  0.0000      0.914 0.000 0.000 1.000 0.000 0.000
#> GSM1022398     3  0.0000      0.914 0.000 0.000 1.000 0.000 0.000
#> GSM1022399     3  0.0000      0.914 0.000 0.000 1.000 0.000 0.000
#> GSM1022400     3  0.0000      0.914 0.000 0.000 1.000 0.000 0.000
#> GSM1022401     5  0.2891      0.898 0.176 0.000 0.000 0.000 0.824
#> GSM1022402     5  0.2891      0.898 0.176 0.000 0.000 0.000 0.824
#> GSM1022403     5  0.2891      0.898 0.176 0.000 0.000 0.000 0.824
#> GSM1022404     5  0.2891      0.898 0.176 0.000 0.000 0.000 0.824

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1022325     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022326     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022327     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022331     3  0.2597      0.736 0.000 0.000 0.824 0.000 0.000 0.176
#> GSM1022332     3  0.2597      0.736 0.000 0.000 0.824 0.000 0.000 0.176
#> GSM1022333     3  0.2597      0.736 0.000 0.000 0.824 0.000 0.000 0.176
#> GSM1022328     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022329     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022330     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022337     5  0.0000      0.816 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022338     5  0.0000      0.816 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022339     5  0.0000      0.816 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022334     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022335     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022336     2  0.0000      0.989 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022340     1  0.1500      0.896 0.936 0.000 0.012 0.000 0.000 0.052
#> GSM1022341     1  0.1500      0.896 0.936 0.000 0.012 0.000 0.000 0.052
#> GSM1022342     1  0.1500      0.896 0.936 0.000 0.012 0.000 0.000 0.052
#> GSM1022343     1  0.1500      0.896 0.936 0.000 0.012 0.000 0.000 0.052
#> GSM1022347     3  0.0000      0.879 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022348     3  0.0000      0.879 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022349     3  0.0000      0.879 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022350     3  0.0000      0.879 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022344     3  0.4181      0.601 0.248 0.000 0.700 0.000 0.000 0.052
#> GSM1022345     3  0.4684      0.379 0.372 0.000 0.576 0.000 0.000 0.052
#> GSM1022346     3  0.4653      0.406 0.360 0.000 0.588 0.000 0.000 0.052
#> GSM1022355     1  0.3095      0.833 0.840 0.000 0.000 0.008 0.036 0.116
#> GSM1022356     1  0.3165      0.828 0.836 0.000 0.000 0.008 0.040 0.116
#> GSM1022357     1  0.3095      0.833 0.840 0.000 0.000 0.008 0.036 0.116
#> GSM1022358     1  0.3095      0.833 0.840 0.000 0.000 0.008 0.036 0.116
#> GSM1022351     1  0.0000      0.909 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022352     1  0.0000      0.909 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022353     1  0.0000      0.909 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022354     1  0.0000      0.909 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022359     2  0.0458      0.978 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM1022360     2  0.0458      0.978 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM1022361     2  0.0458      0.978 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM1022362     2  0.0458      0.978 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM1022367     6  0.3309      0.540 0.000 0.000 0.280 0.000 0.000 0.720
#> GSM1022368     6  0.3309      0.540 0.000 0.000 0.280 0.000 0.000 0.720
#> GSM1022369     6  0.3309      0.540 0.000 0.000 0.280 0.000 0.000 0.720
#> GSM1022370     6  0.3309      0.540 0.000 0.000 0.280 0.000 0.000 0.720
#> GSM1022363     6  0.3847      0.449 0.000 0.456 0.000 0.000 0.000 0.544
#> GSM1022364     6  0.3847      0.449 0.000 0.456 0.000 0.000 0.000 0.544
#> GSM1022365     6  0.3847      0.449 0.000 0.456 0.000 0.000 0.000 0.544
#> GSM1022366     6  0.3847      0.449 0.000 0.456 0.000 0.000 0.000 0.544
#> GSM1022374     5  0.0000      0.816 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022375     5  0.0000      0.816 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022376     5  0.0000      0.816 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022371     2  0.0458      0.976 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM1022372     2  0.0458      0.976 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM1022373     2  0.0458      0.976 0.000 0.984 0.000 0.016 0.000 0.000
#> GSM1022377     4  0.0713      0.894 0.000 0.028 0.000 0.972 0.000 0.000
#> GSM1022378     4  0.0713      0.894 0.000 0.028 0.000 0.972 0.000 0.000
#> GSM1022379     4  0.0713      0.894 0.000 0.028 0.000 0.972 0.000 0.000
#> GSM1022380     4  0.0713      0.894 0.000 0.028 0.000 0.972 0.000 0.000
#> GSM1022385     3  0.0000      0.879 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022386     3  0.0000      0.879 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022387     3  0.0000      0.879 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022388     3  0.0000      0.879 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022381     4  0.0713      0.894 0.000 0.028 0.000 0.972 0.000 0.000
#> GSM1022382     4  0.0713      0.894 0.000 0.028 0.000 0.972 0.000 0.000
#> GSM1022383     4  0.0713      0.894 0.000 0.028 0.000 0.972 0.000 0.000
#> GSM1022384     4  0.0713      0.894 0.000 0.028 0.000 0.972 0.000 0.000
#> GSM1022393     5  0.4548      0.847 0.156 0.000 0.000 0.008 0.720 0.116
#> GSM1022394     5  0.4548      0.847 0.156 0.000 0.000 0.008 0.720 0.116
#> GSM1022395     5  0.4548      0.847 0.156 0.000 0.000 0.008 0.720 0.116
#> GSM1022396     5  0.4548      0.847 0.156 0.000 0.000 0.008 0.720 0.116
#> GSM1022389     4  0.4456      0.767 0.000 0.180 0.000 0.708 0.000 0.112
#> GSM1022390     4  0.4456      0.767 0.000 0.180 0.000 0.708 0.000 0.112
#> GSM1022391     4  0.4456      0.767 0.000 0.180 0.000 0.708 0.000 0.112
#> GSM1022392     4  0.4456      0.767 0.000 0.180 0.000 0.708 0.000 0.112
#> GSM1022397     3  0.0000      0.879 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022398     3  0.0000      0.879 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022399     3  0.0000      0.879 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022400     3  0.0000      0.879 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022401     5  0.4548      0.847 0.156 0.000 0.000 0.008 0.720 0.116
#> GSM1022402     5  0.4548      0.847 0.156 0.000 0.000 0.008 0.720 0.116
#> GSM1022403     5  0.4548      0.847 0.156 0.000 0.000 0.008 0.720 0.116
#> GSM1022404     5  0.4548      0.847 0.156 0.000 0.000 0.008 0.720 0.116

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-CV-skmeans-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-CV-skmeans-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-CV-skmeans-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-CV-skmeans-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-CV-skmeans-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-CV-skmeans-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-CV-skmeans-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-CV-skmeans-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-CV-skmeans-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-CV-skmeans-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-CV-skmeans-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-CV-skmeans-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-CV-skmeans-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-CV-skmeans-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-CV-skmeans-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-CV-skmeans-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-CV-skmeans-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-CV-skmeans-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-CV-skmeans-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-CV-skmeans-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-skmeans-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-CV-skmeans-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-CV-skmeans-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-CV-skmeans-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-CV-skmeans-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-CV-skmeans-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-skmeans-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>             n protocol(p) cell.type(p) k
#> CV:skmeans 77    4.63e-06     1.59e-07 2
#> CV:skmeans 80    2.40e-10     5.36e-11 3
#> CV:skmeans 77    6.46e-16     2.62e-14 4
#> CV:skmeans 77    1.84e-20     1.36e-13 5
#> CV:skmeans 74    8.39e-29     1.48e-11 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


CV:pam**

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["CV", "pam"]
# you can also extract it by
# res = res_list["CV:pam"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'pam' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 3.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk CV-pam-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk CV-pam-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.810           0.896       0.954         0.5040 0.495   0.495
#> 3 3 0.962           0.957       0.982         0.3238 0.689   0.452
#> 4 4 0.865           0.928       0.912         0.1070 0.914   0.744
#> 5 5 0.840           0.782       0.864         0.0640 0.962   0.852
#> 6 6 0.893           0.901       0.946         0.0512 0.938   0.726

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 3

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1022325     2   0.000      0.905 0.000 1.000
#> GSM1022326     2   0.000      0.905 0.000 1.000
#> GSM1022327     2   0.000      0.905 0.000 1.000
#> GSM1022331     1   0.000      1.000 1.000 0.000
#> GSM1022332     1   0.000      1.000 1.000 0.000
#> GSM1022333     1   0.000      1.000 1.000 0.000
#> GSM1022328     2   0.000      0.905 0.000 1.000
#> GSM1022329     2   0.000      0.905 0.000 1.000
#> GSM1022330     2   0.000      0.905 0.000 1.000
#> GSM1022337     2   0.971      0.429 0.400 0.600
#> GSM1022338     2   0.971      0.429 0.400 0.600
#> GSM1022339     2   0.971      0.429 0.400 0.600
#> GSM1022334     2   0.000      0.905 0.000 1.000
#> GSM1022335     2   0.000      0.905 0.000 1.000
#> GSM1022336     2   0.000      0.905 0.000 1.000
#> GSM1022340     1   0.000      1.000 1.000 0.000
#> GSM1022341     1   0.000      1.000 1.000 0.000
#> GSM1022342     1   0.000      1.000 1.000 0.000
#> GSM1022343     1   0.000      1.000 1.000 0.000
#> GSM1022347     1   0.000      1.000 1.000 0.000
#> GSM1022348     1   0.000      1.000 1.000 0.000
#> GSM1022349     1   0.000      1.000 1.000 0.000
#> GSM1022350     1   0.000      1.000 1.000 0.000
#> GSM1022344     1   0.000      1.000 1.000 0.000
#> GSM1022345     1   0.000      1.000 1.000 0.000
#> GSM1022346     1   0.000      1.000 1.000 0.000
#> GSM1022355     1   0.000      1.000 1.000 0.000
#> GSM1022356     1   0.000      1.000 1.000 0.000
#> GSM1022357     1   0.000      1.000 1.000 0.000
#> GSM1022358     1   0.000      1.000 1.000 0.000
#> GSM1022351     1   0.000      1.000 1.000 0.000
#> GSM1022352     1   0.000      1.000 1.000 0.000
#> GSM1022353     1   0.000      1.000 1.000 0.000
#> GSM1022354     1   0.000      1.000 1.000 0.000
#> GSM1022359     2   0.000      0.905 0.000 1.000
#> GSM1022360     2   0.000      0.905 0.000 1.000
#> GSM1022361     2   0.000      0.905 0.000 1.000
#> GSM1022362     2   0.000      0.905 0.000 1.000
#> GSM1022367     2   0.722      0.729 0.200 0.800
#> GSM1022368     2   0.971      0.386 0.400 0.600
#> GSM1022369     2   0.971      0.386 0.400 0.600
#> GSM1022370     2   0.722      0.729 0.200 0.800
#> GSM1022363     2   0.000      0.905 0.000 1.000
#> GSM1022364     2   0.000      0.905 0.000 1.000
#> GSM1022365     2   0.000      0.905 0.000 1.000
#> GSM1022366     2   0.000      0.905 0.000 1.000
#> GSM1022374     2   0.971      0.429 0.400 0.600
#> GSM1022375     2   0.971      0.429 0.400 0.600
#> GSM1022376     2   0.971      0.429 0.400 0.600
#> GSM1022371     2   0.000      0.905 0.000 1.000
#> GSM1022372     2   0.000      0.905 0.000 1.000
#> GSM1022373     2   0.000      0.905 0.000 1.000
#> GSM1022377     2   0.000      0.905 0.000 1.000
#> GSM1022378     2   0.000      0.905 0.000 1.000
#> GSM1022379     2   0.000      0.905 0.000 1.000
#> GSM1022380     2   0.000      0.905 0.000 1.000
#> GSM1022385     1   0.000      1.000 1.000 0.000
#> GSM1022386     1   0.000      1.000 1.000 0.000
#> GSM1022387     1   0.000      1.000 1.000 0.000
#> GSM1022388     1   0.000      1.000 1.000 0.000
#> GSM1022381     2   0.000      0.905 0.000 1.000
#> GSM1022382     2   0.000      0.905 0.000 1.000
#> GSM1022383     2   0.000      0.905 0.000 1.000
#> GSM1022384     2   0.000      0.905 0.000 1.000
#> GSM1022393     1   0.000      1.000 1.000 0.000
#> GSM1022394     1   0.000      1.000 1.000 0.000
#> GSM1022395     1   0.000      1.000 1.000 0.000
#> GSM1022396     1   0.000      1.000 1.000 0.000
#> GSM1022389     2   0.000      0.905 0.000 1.000
#> GSM1022390     2   0.000      0.905 0.000 1.000
#> GSM1022391     2   0.000      0.905 0.000 1.000
#> GSM1022392     2   0.443      0.839 0.092 0.908
#> GSM1022397     1   0.000      1.000 1.000 0.000
#> GSM1022398     1   0.000      1.000 1.000 0.000
#> GSM1022399     1   0.000      1.000 1.000 0.000
#> GSM1022400     1   0.000      1.000 1.000 0.000
#> GSM1022401     1   0.000      1.000 1.000 0.000
#> GSM1022402     1   0.000      1.000 1.000 0.000
#> GSM1022403     1   0.000      1.000 1.000 0.000
#> GSM1022404     1   0.000      1.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1022325     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022326     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022327     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022331     3   0.000      0.981 0.000 0.000 1.000
#> GSM1022332     3   0.000      0.981 0.000 0.000 1.000
#> GSM1022333     3   0.000      0.981 0.000 0.000 1.000
#> GSM1022328     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022329     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022330     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022337     1   0.000      0.956 1.000 0.000 0.000
#> GSM1022338     1   0.000      0.956 1.000 0.000 0.000
#> GSM1022339     1   0.000      0.956 1.000 0.000 0.000
#> GSM1022334     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022335     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022336     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022340     1   0.000      0.956 1.000 0.000 0.000
#> GSM1022341     1   0.000      0.956 1.000 0.000 0.000
#> GSM1022342     1   0.000      0.956 1.000 0.000 0.000
#> GSM1022343     1   0.000      0.956 1.000 0.000 0.000
#> GSM1022347     3   0.000      0.981 0.000 0.000 1.000
#> GSM1022348     3   0.000      0.981 0.000 0.000 1.000
#> GSM1022349     3   0.000      0.981 0.000 0.000 1.000
#> GSM1022350     3   0.000      0.981 0.000 0.000 1.000
#> GSM1022344     3   0.000      0.981 0.000 0.000 1.000
#> GSM1022345     3   0.000      0.981 0.000 0.000 1.000
#> GSM1022346     3   0.000      0.981 0.000 0.000 1.000
#> GSM1022355     1   0.000      0.956 1.000 0.000 0.000
#> GSM1022356     1   0.000      0.956 1.000 0.000 0.000
#> GSM1022357     1   0.000      0.956 1.000 0.000 0.000
#> GSM1022358     1   0.000      0.956 1.000 0.000 0.000
#> GSM1022351     1   0.000      0.956 1.000 0.000 0.000
#> GSM1022352     1   0.000      0.956 1.000 0.000 0.000
#> GSM1022353     1   0.000      0.956 1.000 0.000 0.000
#> GSM1022354     1   0.000      0.956 1.000 0.000 0.000
#> GSM1022359     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022360     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022361     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022362     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022367     3   0.435      0.782 0.000 0.184 0.816
#> GSM1022368     3   0.000      0.981 0.000 0.000 1.000
#> GSM1022369     3   0.000      0.981 0.000 0.000 1.000
#> GSM1022370     3   0.450      0.765 0.000 0.196 0.804
#> GSM1022363     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022364     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022365     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022366     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022374     1   0.418      0.788 0.828 0.172 0.000
#> GSM1022375     1   0.424      0.783 0.824 0.176 0.000
#> GSM1022376     1   0.000      0.956 1.000 0.000 0.000
#> GSM1022371     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022372     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022373     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022377     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022378     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022379     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022380     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022385     3   0.000      0.981 0.000 0.000 1.000
#> GSM1022386     3   0.000      0.981 0.000 0.000 1.000
#> GSM1022387     3   0.000      0.981 0.000 0.000 1.000
#> GSM1022388     3   0.000      0.981 0.000 0.000 1.000
#> GSM1022381     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022382     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022383     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022384     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022393     1   0.000      0.956 1.000 0.000 0.000
#> GSM1022394     1   0.000      0.956 1.000 0.000 0.000
#> GSM1022395     1   0.000      0.956 1.000 0.000 0.000
#> GSM1022396     1   0.000      0.956 1.000 0.000 0.000
#> GSM1022389     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022390     1   0.615      0.343 0.592 0.408 0.000
#> GSM1022391     2   0.000      1.000 0.000 1.000 0.000
#> GSM1022392     1   0.562      0.573 0.692 0.308 0.000
#> GSM1022397     3   0.000      0.981 0.000 0.000 1.000
#> GSM1022398     3   0.000      0.981 0.000 0.000 1.000
#> GSM1022399     3   0.000      0.981 0.000 0.000 1.000
#> GSM1022400     3   0.000      0.981 0.000 0.000 1.000
#> GSM1022401     1   0.000      0.956 1.000 0.000 0.000
#> GSM1022402     1   0.000      0.956 1.000 0.000 0.000
#> GSM1022403     1   0.000      0.956 1.000 0.000 0.000
#> GSM1022404     1   0.000      0.956 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1022325     2   0.380      0.981 0.000 0.780 0.000 0.220
#> GSM1022326     2   0.380      0.981 0.000 0.780 0.000 0.220
#> GSM1022327     2   0.380      0.981 0.000 0.780 0.000 0.220
#> GSM1022331     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM1022332     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM1022333     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM1022328     2   0.380      0.981 0.000 0.780 0.000 0.220
#> GSM1022329     2   0.380      0.981 0.000 0.780 0.000 0.220
#> GSM1022330     2   0.380      0.981 0.000 0.780 0.000 0.220
#> GSM1022337     1   0.000      0.888 1.000 0.000 0.000 0.000
#> GSM1022338     1   0.000      0.888 1.000 0.000 0.000 0.000
#> GSM1022339     1   0.000      0.888 1.000 0.000 0.000 0.000
#> GSM1022334     2   0.380      0.981 0.000 0.780 0.000 0.220
#> GSM1022335     2   0.380      0.981 0.000 0.780 0.000 0.220
#> GSM1022336     2   0.380      0.981 0.000 0.780 0.000 0.220
#> GSM1022340     1   0.380      0.881 0.780 0.220 0.000 0.000
#> GSM1022341     1   0.380      0.881 0.780 0.220 0.000 0.000
#> GSM1022342     1   0.380      0.881 0.780 0.220 0.000 0.000
#> GSM1022343     1   0.380      0.881 0.780 0.220 0.000 0.000
#> GSM1022347     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM1022348     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM1022349     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM1022350     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM1022344     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM1022345     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM1022346     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM1022355     1   0.380      0.881 0.780 0.220 0.000 0.000
#> GSM1022356     1   0.380      0.881 0.780 0.220 0.000 0.000
#> GSM1022357     1   0.380      0.881 0.780 0.220 0.000 0.000
#> GSM1022358     1   0.380      0.881 0.780 0.220 0.000 0.000
#> GSM1022351     1   0.380      0.881 0.780 0.220 0.000 0.000
#> GSM1022352     1   0.380      0.881 0.780 0.220 0.000 0.000
#> GSM1022353     1   0.380      0.881 0.780 0.220 0.000 0.000
#> GSM1022354     1   0.380      0.881 0.780 0.220 0.000 0.000
#> GSM1022359     2   0.380      0.981 0.000 0.780 0.000 0.220
#> GSM1022360     2   0.380      0.981 0.000 0.780 0.000 0.220
#> GSM1022361     2   0.380      0.981 0.000 0.780 0.000 0.220
#> GSM1022362     2   0.380      0.981 0.000 0.780 0.000 0.220
#> GSM1022367     3   0.471      0.766 0.000 0.152 0.784 0.064
#> GSM1022368     3   0.172      0.927 0.000 0.000 0.936 0.064
#> GSM1022369     3   0.172      0.927 0.000 0.000 0.936 0.064
#> GSM1022370     3   0.485      0.750 0.000 0.164 0.772 0.064
#> GSM1022363     2   0.430      0.920 0.000 0.716 0.000 0.284
#> GSM1022364     2   0.430      0.920 0.000 0.716 0.000 0.284
#> GSM1022365     2   0.430      0.920 0.000 0.716 0.000 0.284
#> GSM1022366     2   0.430      0.920 0.000 0.716 0.000 0.284
#> GSM1022374     1   0.401      0.730 0.820 0.148 0.000 0.032
#> GSM1022375     1   0.406      0.725 0.816 0.152 0.000 0.032
#> GSM1022376     1   0.102      0.870 0.968 0.000 0.000 0.032
#> GSM1022371     2   0.380      0.981 0.000 0.780 0.000 0.220
#> GSM1022372     2   0.380      0.981 0.000 0.780 0.000 0.220
#> GSM1022373     2   0.380      0.981 0.000 0.780 0.000 0.220
#> GSM1022377     4   0.172      0.954 0.000 0.064 0.000 0.936
#> GSM1022378     4   0.172      0.954 0.000 0.064 0.000 0.936
#> GSM1022379     4   0.172      0.954 0.000 0.064 0.000 0.936
#> GSM1022380     4   0.172      0.954 0.000 0.064 0.000 0.936
#> GSM1022385     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM1022386     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM1022387     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM1022388     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM1022381     4   0.000      0.935 0.000 0.000 0.000 1.000
#> GSM1022382     4   0.000      0.935 0.000 0.000 0.000 1.000
#> GSM1022383     4   0.000      0.935 0.000 0.000 0.000 1.000
#> GSM1022384     4   0.000      0.935 0.000 0.000 0.000 1.000
#> GSM1022393     1   0.000      0.888 1.000 0.000 0.000 0.000
#> GSM1022394     1   0.000      0.888 1.000 0.000 0.000 0.000
#> GSM1022395     1   0.000      0.888 1.000 0.000 0.000 0.000
#> GSM1022396     1   0.000      0.888 1.000 0.000 0.000 0.000
#> GSM1022389     4   0.194      0.943 0.000 0.076 0.000 0.924
#> GSM1022390     4   0.204      0.941 0.032 0.032 0.000 0.936
#> GSM1022391     4   0.172      0.954 0.000 0.064 0.000 0.936
#> GSM1022392     4   0.203      0.937 0.036 0.028 0.000 0.936
#> GSM1022397     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM1022398     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM1022399     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM1022400     3   0.000      0.973 0.000 0.000 1.000 0.000
#> GSM1022401     1   0.000      0.888 1.000 0.000 0.000 0.000
#> GSM1022402     1   0.000      0.888 1.000 0.000 0.000 0.000
#> GSM1022403     1   0.000      0.888 1.000 0.000 0.000 0.000
#> GSM1022404     1   0.000      0.888 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1022325     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000
#> GSM1022326     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000
#> GSM1022327     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000
#> GSM1022331     3  0.4249      0.647 0.000 0.000 0.568 0.000 0.432
#> GSM1022332     3  0.4249      0.647 0.000 0.000 0.568 0.000 0.432
#> GSM1022333     3  0.4249      0.647 0.000 0.000 0.568 0.000 0.432
#> GSM1022328     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000
#> GSM1022329     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000
#> GSM1022330     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000
#> GSM1022337     5  0.4256      0.811 0.436 0.000 0.000 0.000 0.564
#> GSM1022338     5  0.4256      0.811 0.436 0.000 0.000 0.000 0.564
#> GSM1022339     5  0.4256      0.811 0.436 0.000 0.000 0.000 0.564
#> GSM1022334     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000
#> GSM1022335     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000
#> GSM1022336     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000
#> GSM1022340     1  0.0000      0.807 1.000 0.000 0.000 0.000 0.000
#> GSM1022341     1  0.0000      0.807 1.000 0.000 0.000 0.000 0.000
#> GSM1022342     1  0.0000      0.807 1.000 0.000 0.000 0.000 0.000
#> GSM1022343     1  0.0000      0.807 1.000 0.000 0.000 0.000 0.000
#> GSM1022347     3  0.0000      0.846 0.000 0.000 1.000 0.000 0.000
#> GSM1022348     3  0.0000      0.846 0.000 0.000 1.000 0.000 0.000
#> GSM1022349     3  0.0000      0.846 0.000 0.000 1.000 0.000 0.000
#> GSM1022350     3  0.0000      0.846 0.000 0.000 1.000 0.000 0.000
#> GSM1022344     3  0.0404      0.841 0.012 0.000 0.988 0.000 0.000
#> GSM1022345     3  0.0510      0.839 0.016 0.000 0.984 0.000 0.000
#> GSM1022346     3  0.0510      0.839 0.016 0.000 0.984 0.000 0.000
#> GSM1022355     1  0.0000      0.807 1.000 0.000 0.000 0.000 0.000
#> GSM1022356     1  0.0404      0.801 0.988 0.000 0.000 0.000 0.012
#> GSM1022357     1  0.0000      0.807 1.000 0.000 0.000 0.000 0.000
#> GSM1022358     1  0.0000      0.807 1.000 0.000 0.000 0.000 0.000
#> GSM1022351     1  0.0000      0.807 1.000 0.000 0.000 0.000 0.000
#> GSM1022352     1  0.0000      0.807 1.000 0.000 0.000 0.000 0.000
#> GSM1022353     1  0.0000      0.807 1.000 0.000 0.000 0.000 0.000
#> GSM1022354     1  0.0000      0.807 1.000 0.000 0.000 0.000 0.000
#> GSM1022359     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000
#> GSM1022360     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000
#> GSM1022361     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000
#> GSM1022362     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000
#> GSM1022367     3  0.5293      0.595 0.000 0.000 0.492 0.048 0.460
#> GSM1022368     3  0.5291      0.598 0.000 0.000 0.496 0.048 0.456
#> GSM1022369     3  0.5291      0.598 0.000 0.000 0.496 0.048 0.456
#> GSM1022370     3  0.5293      0.595 0.000 0.000 0.492 0.048 0.460
#> GSM1022363     2  0.5276      0.473 0.000 0.516 0.000 0.048 0.436
#> GSM1022364     2  0.5276      0.473 0.000 0.516 0.000 0.048 0.436
#> GSM1022365     2  0.5276      0.473 0.000 0.516 0.000 0.048 0.436
#> GSM1022366     2  0.5271      0.476 0.000 0.520 0.000 0.048 0.432
#> GSM1022374     5  0.5974      0.711 0.284 0.148 0.000 0.000 0.568
#> GSM1022375     5  0.5939      0.705 0.276 0.148 0.000 0.000 0.576
#> GSM1022376     5  0.4249      0.811 0.432 0.000 0.000 0.000 0.568
#> GSM1022371     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000
#> GSM1022372     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000
#> GSM1022373     2  0.0000      0.888 0.000 1.000 0.000 0.000 0.000
#> GSM1022377     4  0.1197      0.890 0.000 0.048 0.000 0.952 0.000
#> GSM1022378     4  0.1197      0.890 0.000 0.048 0.000 0.952 0.000
#> GSM1022379     4  0.1197      0.890 0.000 0.048 0.000 0.952 0.000
#> GSM1022380     4  0.1197      0.890 0.000 0.048 0.000 0.952 0.000
#> GSM1022385     3  0.0000      0.846 0.000 0.000 1.000 0.000 0.000
#> GSM1022386     3  0.0000      0.846 0.000 0.000 1.000 0.000 0.000
#> GSM1022387     3  0.0000      0.846 0.000 0.000 1.000 0.000 0.000
#> GSM1022388     3  0.0000      0.846 0.000 0.000 1.000 0.000 0.000
#> GSM1022381     4  0.0000      0.877 0.000 0.000 0.000 1.000 0.000
#> GSM1022382     4  0.0000      0.877 0.000 0.000 0.000 1.000 0.000
#> GSM1022383     4  0.0000      0.877 0.000 0.000 0.000 1.000 0.000
#> GSM1022384     4  0.0000      0.877 0.000 0.000 0.000 1.000 0.000
#> GSM1022393     1  0.3366      0.615 0.768 0.000 0.000 0.000 0.232
#> GSM1022394     1  0.3366      0.615 0.768 0.000 0.000 0.000 0.232
#> GSM1022395     1  0.3366      0.615 0.768 0.000 0.000 0.000 0.232
#> GSM1022396     1  0.3366      0.615 0.768 0.000 0.000 0.000 0.232
#> GSM1022389     4  0.3480      0.773 0.000 0.248 0.000 0.752 0.000
#> GSM1022390     4  0.3395      0.789 0.000 0.236 0.000 0.764 0.000
#> GSM1022391     4  0.3395      0.789 0.000 0.236 0.000 0.764 0.000
#> GSM1022392     4  0.3521      0.791 0.004 0.232 0.000 0.764 0.000
#> GSM1022397     3  0.0000      0.846 0.000 0.000 1.000 0.000 0.000
#> GSM1022398     3  0.0000      0.846 0.000 0.000 1.000 0.000 0.000
#> GSM1022399     3  0.0000      0.846 0.000 0.000 1.000 0.000 0.000
#> GSM1022400     3  0.0000      0.846 0.000 0.000 1.000 0.000 0.000
#> GSM1022401     1  0.3366      0.615 0.768 0.000 0.000 0.000 0.232
#> GSM1022402     1  0.3366      0.615 0.768 0.000 0.000 0.000 0.232
#> GSM1022403     1  0.3366      0.615 0.768 0.000 0.000 0.000 0.232
#> GSM1022404     1  0.3366      0.615 0.768 0.000 0.000 0.000 0.232

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1022325     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022326     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022327     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022331     6  0.3371      0.684 0.000 0.000 0.292 0.000 0.000 0.708
#> GSM1022332     6  0.3371      0.684 0.000 0.000 0.292 0.000 0.000 0.708
#> GSM1022333     6  0.3371      0.684 0.000 0.000 0.292 0.000 0.000 0.708
#> GSM1022328     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022329     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022330     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022337     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022338     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022339     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022334     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022335     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022336     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022340     1  0.0000      0.878 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022341     1  0.0000      0.878 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022342     1  0.0000      0.878 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022343     1  0.0000      0.878 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022347     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022348     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022349     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022350     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022344     3  0.2416      0.815 0.156 0.000 0.844 0.000 0.000 0.000
#> GSM1022345     3  0.2996      0.742 0.228 0.000 0.772 0.000 0.000 0.000
#> GSM1022346     3  0.2996      0.742 0.228 0.000 0.772 0.000 0.000 0.000
#> GSM1022355     1  0.0000      0.878 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022356     1  0.0632      0.872 0.976 0.000 0.000 0.000 0.024 0.000
#> GSM1022357     1  0.0000      0.878 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022358     1  0.0000      0.878 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022351     1  0.0000      0.878 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022352     1  0.0000      0.878 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022353     1  0.0000      0.878 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022354     1  0.0000      0.878 1.000 0.000 0.000 0.000 0.000 0.000
#> GSM1022359     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022360     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022361     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022362     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022367     6  0.0000      0.890 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1022368     6  0.0000      0.890 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1022369     6  0.0000      0.890 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1022370     6  0.0000      0.890 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1022363     6  0.0000      0.890 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1022364     6  0.0000      0.890 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1022365     6  0.0000      0.890 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1022366     6  0.0713      0.867 0.000 0.028 0.000 0.000 0.000 0.972
#> GSM1022374     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022375     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022376     5  0.0000      1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> GSM1022371     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022372     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022373     2  0.0000      1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022377     4  0.0000      0.905 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022378     4  0.0000      0.905 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022379     4  0.0000      0.905 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022380     4  0.0000      0.905 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022385     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022386     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022387     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022388     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022381     4  0.0000      0.905 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022382     4  0.0000      0.905 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022383     4  0.0000      0.905 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022384     4  0.0000      0.905 0.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022393     1  0.3101      0.791 0.756 0.000 0.000 0.000 0.244 0.000
#> GSM1022394     1  0.3101      0.791 0.756 0.000 0.000 0.000 0.244 0.000
#> GSM1022395     1  0.3101      0.791 0.756 0.000 0.000 0.000 0.244 0.000
#> GSM1022396     1  0.3101      0.791 0.756 0.000 0.000 0.000 0.244 0.000
#> GSM1022389     4  0.2912      0.790 0.000 0.216 0.000 0.784 0.000 0.000
#> GSM1022390     4  0.2793      0.807 0.000 0.200 0.000 0.800 0.000 0.000
#> GSM1022391     4  0.2793      0.807 0.000 0.200 0.000 0.800 0.000 0.000
#> GSM1022392     4  0.2793      0.807 0.000 0.200 0.000 0.800 0.000 0.000
#> GSM1022397     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022398     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022399     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022400     3  0.0000      0.947 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022401     1  0.3101      0.791 0.756 0.000 0.000 0.000 0.244 0.000
#> GSM1022402     1  0.3101      0.791 0.756 0.000 0.000 0.000 0.244 0.000
#> GSM1022403     1  0.3101      0.791 0.756 0.000 0.000 0.000 0.244 0.000
#> GSM1022404     1  0.3101      0.791 0.756 0.000 0.000 0.000 0.244 0.000

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-CV-pam-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-CV-pam-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-CV-pam-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-CV-pam-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-CV-pam-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-CV-pam-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-CV-pam-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-CV-pam-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-CV-pam-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-CV-pam-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-CV-pam-get-signatures-1

get_signatures(res, k = 3)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

plot of chunk tab-CV-pam-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-CV-pam-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-CV-pam-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-CV-pam-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-CV-pam-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-CV-pam-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-CV-pam-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-CV-pam-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-CV-pam-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-pam-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-CV-pam-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-CV-pam-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-CV-pam-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-CV-pam-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-CV-pam-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-pam-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>         n protocol(p) cell.type(p) k
#> CV:pam 72    3.06e-06     7.12e-08 2
#> CV:pam 79    1.78e-10     2.17e-10 3
#> CV:pam 80    2.97e-15     3.00e-10 4
#> CV:pam 76    3.70e-19     2.02e-09 5
#> CV:pam 80    1.08e-28     1.03e-07 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


CV:mclust

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["CV", "mclust"]
# you can also extract it by
# res = res_list["CV:mclust"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 5.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk CV-mclust-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk CV-mclust-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.379           0.891       0.893         0.4414 0.556   0.556
#> 3 3 0.522           0.738       0.873         0.4516 0.714   0.512
#> 4 4 0.791           0.799       0.875         0.1451 0.797   0.485
#> 5 5 0.803           0.863       0.902         0.0680 0.973   0.895
#> 6 6 0.876           0.874       0.923         0.0506 0.920   0.666

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 5

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1022325     2  0.4690      0.815 0.100 0.900
#> GSM1022326     2  0.4562      0.817 0.096 0.904
#> GSM1022327     2  0.5178      0.804 0.116 0.884
#> GSM1022331     1  0.0000      0.998 1.000 0.000
#> GSM1022332     1  0.0000      0.998 1.000 0.000
#> GSM1022333     1  0.0000      0.998 1.000 0.000
#> GSM1022328     2  0.3431      0.826 0.064 0.936
#> GSM1022329     2  0.4690      0.811 0.100 0.900
#> GSM1022330     2  0.5519      0.792 0.128 0.872
#> GSM1022337     2  0.5408      0.903 0.124 0.876
#> GSM1022338     2  0.5408      0.903 0.124 0.876
#> GSM1022339     2  0.5408      0.903 0.124 0.876
#> GSM1022334     2  0.4815      0.807 0.104 0.896
#> GSM1022335     2  0.4815      0.807 0.104 0.896
#> GSM1022336     2  0.4939      0.805 0.108 0.892
#> GSM1022340     2  0.5408      0.903 0.124 0.876
#> GSM1022341     2  0.5408      0.903 0.124 0.876
#> GSM1022342     2  0.5408      0.903 0.124 0.876
#> GSM1022343     2  0.5408      0.903 0.124 0.876
#> GSM1022347     1  0.0000      0.998 1.000 0.000
#> GSM1022348     1  0.0000      0.998 1.000 0.000
#> GSM1022349     1  0.0000      0.998 1.000 0.000
#> GSM1022350     1  0.0000      0.998 1.000 0.000
#> GSM1022344     1  0.0000      0.998 1.000 0.000
#> GSM1022345     1  0.0376      0.994 0.996 0.004
#> GSM1022346     1  0.0376      0.994 0.996 0.004
#> GSM1022355     2  0.5408      0.903 0.124 0.876
#> GSM1022356     2  0.5408      0.903 0.124 0.876
#> GSM1022357     2  0.5408      0.903 0.124 0.876
#> GSM1022358     2  0.5408      0.903 0.124 0.876
#> GSM1022351     2  0.5408      0.903 0.124 0.876
#> GSM1022352     2  0.5408      0.903 0.124 0.876
#> GSM1022353     2  0.5408      0.903 0.124 0.876
#> GSM1022354     2  0.5408      0.903 0.124 0.876
#> GSM1022359     2  0.8267      0.642 0.260 0.740
#> GSM1022360     2  0.8144      0.654 0.252 0.748
#> GSM1022361     2  0.8207      0.648 0.256 0.744
#> GSM1022362     2  0.8207      0.648 0.256 0.744
#> GSM1022367     1  0.0000      0.998 1.000 0.000
#> GSM1022368     1  0.0000      0.998 1.000 0.000
#> GSM1022369     1  0.0000      0.998 1.000 0.000
#> GSM1022370     1  0.0000      0.998 1.000 0.000
#> GSM1022363     1  0.0672      0.990 0.992 0.008
#> GSM1022364     1  0.0672      0.990 0.992 0.008
#> GSM1022365     1  0.0672      0.990 0.992 0.008
#> GSM1022366     1  0.0672      0.990 0.992 0.008
#> GSM1022374     2  0.5408      0.903 0.124 0.876
#> GSM1022375     2  0.5408      0.903 0.124 0.876
#> GSM1022376     2  0.5408      0.903 0.124 0.876
#> GSM1022371     2  0.6148      0.893 0.152 0.848
#> GSM1022372     2  0.6148      0.893 0.152 0.848
#> GSM1022373     2  0.6148      0.893 0.152 0.848
#> GSM1022377     2  0.6343      0.892 0.160 0.840
#> GSM1022378     2  0.6343      0.892 0.160 0.840
#> GSM1022379     2  0.6343      0.892 0.160 0.840
#> GSM1022380     2  0.6343      0.892 0.160 0.840
#> GSM1022385     1  0.0000      0.998 1.000 0.000
#> GSM1022386     1  0.0000      0.998 1.000 0.000
#> GSM1022387     1  0.0000      0.998 1.000 0.000
#> GSM1022388     1  0.0000      0.998 1.000 0.000
#> GSM1022381     2  0.9850      0.547 0.428 0.572
#> GSM1022382     2  0.9850      0.547 0.428 0.572
#> GSM1022383     2  0.9850      0.547 0.428 0.572
#> GSM1022384     2  0.9850      0.547 0.428 0.572
#> GSM1022393     2  0.5408      0.903 0.124 0.876
#> GSM1022394     2  0.5408      0.903 0.124 0.876
#> GSM1022395     2  0.5408      0.903 0.124 0.876
#> GSM1022396     2  0.5408      0.903 0.124 0.876
#> GSM1022389     2  0.6247      0.893 0.156 0.844
#> GSM1022390     2  0.6247      0.893 0.156 0.844
#> GSM1022391     2  0.6247      0.893 0.156 0.844
#> GSM1022392     2  0.6247      0.893 0.156 0.844
#> GSM1022397     1  0.0000      0.998 1.000 0.000
#> GSM1022398     1  0.0000      0.998 1.000 0.000
#> GSM1022399     1  0.0000      0.998 1.000 0.000
#> GSM1022400     1  0.0000      0.998 1.000 0.000
#> GSM1022401     2  0.5408      0.903 0.124 0.876
#> GSM1022402     2  0.5408      0.903 0.124 0.876
#> GSM1022403     2  0.5408      0.903 0.124 0.876
#> GSM1022404     2  0.5408      0.903 0.124 0.876

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1022325     2   0.000      0.791 0.000 1.000 0.000
#> GSM1022326     2   0.000      0.791 0.000 1.000 0.000
#> GSM1022327     2   0.000      0.791 0.000 1.000 0.000
#> GSM1022331     3   0.576      0.809 0.124 0.076 0.800
#> GSM1022332     3   0.576      0.809 0.124 0.076 0.800
#> GSM1022333     3   0.576      0.809 0.124 0.076 0.800
#> GSM1022328     2   0.000      0.791 0.000 1.000 0.000
#> GSM1022329     2   0.000      0.791 0.000 1.000 0.000
#> GSM1022330     2   0.000      0.791 0.000 1.000 0.000
#> GSM1022337     1   0.000      0.876 1.000 0.000 0.000
#> GSM1022338     1   0.000      0.876 1.000 0.000 0.000
#> GSM1022339     1   0.000      0.876 1.000 0.000 0.000
#> GSM1022334     2   0.000      0.791 0.000 1.000 0.000
#> GSM1022335     2   0.000      0.791 0.000 1.000 0.000
#> GSM1022336     2   0.000      0.791 0.000 1.000 0.000
#> GSM1022340     1   0.529      0.587 0.732 0.000 0.268
#> GSM1022341     1   0.529      0.587 0.732 0.000 0.268
#> GSM1022342     1   0.529      0.587 0.732 0.000 0.268
#> GSM1022343     1   0.529      0.587 0.732 0.000 0.268
#> GSM1022347     3   0.000      0.864 0.000 0.000 1.000
#> GSM1022348     3   0.000      0.864 0.000 0.000 1.000
#> GSM1022349     3   0.000      0.864 0.000 0.000 1.000
#> GSM1022350     3   0.000      0.864 0.000 0.000 1.000
#> GSM1022344     3   0.576      0.517 0.328 0.000 0.672
#> GSM1022345     3   0.576      0.517 0.328 0.000 0.672
#> GSM1022346     3   0.576      0.517 0.328 0.000 0.672
#> GSM1022355     1   0.116      0.872 0.972 0.000 0.028
#> GSM1022356     1   0.116      0.872 0.972 0.000 0.028
#> GSM1022357     1   0.116      0.872 0.972 0.000 0.028
#> GSM1022358     1   0.116      0.872 0.972 0.000 0.028
#> GSM1022351     1   0.116      0.872 0.972 0.000 0.028
#> GSM1022352     1   0.116      0.872 0.972 0.000 0.028
#> GSM1022353     1   0.116      0.872 0.972 0.000 0.028
#> GSM1022354     1   0.116      0.872 0.972 0.000 0.028
#> GSM1022359     2   0.000      0.791 0.000 1.000 0.000
#> GSM1022360     2   0.000      0.791 0.000 1.000 0.000
#> GSM1022361     2   0.000      0.791 0.000 1.000 0.000
#> GSM1022362     2   0.000      0.791 0.000 1.000 0.000
#> GSM1022367     3   0.660      0.784 0.124 0.120 0.756
#> GSM1022368     3   0.660      0.784 0.124 0.120 0.756
#> GSM1022369     3   0.660      0.784 0.124 0.120 0.756
#> GSM1022370     3   0.660      0.784 0.124 0.120 0.756
#> GSM1022363     2   0.369      0.767 0.052 0.896 0.052
#> GSM1022364     2   0.369      0.767 0.052 0.896 0.052
#> GSM1022365     2   0.369      0.767 0.052 0.896 0.052
#> GSM1022366     2   0.369      0.767 0.052 0.896 0.052
#> GSM1022374     1   0.000      0.876 1.000 0.000 0.000
#> GSM1022375     1   0.000      0.876 1.000 0.000 0.000
#> GSM1022376     1   0.000      0.876 1.000 0.000 0.000
#> GSM1022371     2   0.606      0.578 0.276 0.708 0.016
#> GSM1022372     2   0.606      0.578 0.276 0.708 0.016
#> GSM1022373     2   0.606      0.578 0.276 0.708 0.016
#> GSM1022377     2   0.846      0.478 0.328 0.564 0.108
#> GSM1022378     2   0.846      0.478 0.328 0.564 0.108
#> GSM1022379     2   0.846      0.478 0.328 0.564 0.108
#> GSM1022380     2   0.846      0.478 0.328 0.564 0.108
#> GSM1022385     3   0.000      0.864 0.000 0.000 1.000
#> GSM1022386     3   0.000      0.864 0.000 0.000 1.000
#> GSM1022387     3   0.000      0.864 0.000 0.000 1.000
#> GSM1022388     3   0.000      0.864 0.000 0.000 1.000
#> GSM1022381     2   0.846      0.478 0.328 0.564 0.108
#> GSM1022382     2   0.846      0.478 0.328 0.564 0.108
#> GSM1022383     2   0.846      0.478 0.328 0.564 0.108
#> GSM1022384     2   0.849      0.461 0.336 0.556 0.108
#> GSM1022393     1   0.000      0.876 1.000 0.000 0.000
#> GSM1022394     1   0.000      0.876 1.000 0.000 0.000
#> GSM1022395     1   0.000      0.876 1.000 0.000 0.000
#> GSM1022396     1   0.000      0.876 1.000 0.000 0.000
#> GSM1022389     1   0.733      0.278 0.612 0.344 0.044
#> GSM1022390     1   0.733      0.278 0.612 0.344 0.044
#> GSM1022391     1   0.733      0.278 0.612 0.344 0.044
#> GSM1022392     1   0.733      0.278 0.612 0.344 0.044
#> GSM1022397     3   0.000      0.864 0.000 0.000 1.000
#> GSM1022398     3   0.000      0.864 0.000 0.000 1.000
#> GSM1022399     3   0.000      0.864 0.000 0.000 1.000
#> GSM1022400     3   0.000      0.864 0.000 0.000 1.000
#> GSM1022401     1   0.000      0.876 1.000 0.000 0.000
#> GSM1022402     1   0.000      0.876 1.000 0.000 0.000
#> GSM1022403     1   0.000      0.876 1.000 0.000 0.000
#> GSM1022404     1   0.000      0.876 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1022325     2  0.0000      0.978 0.000 1.000 0.000 0.000
#> GSM1022326     2  0.0000      0.978 0.000 1.000 0.000 0.000
#> GSM1022327     2  0.0000      0.978 0.000 1.000 0.000 0.000
#> GSM1022331     3  0.8195      0.313 0.244 0.032 0.500 0.224
#> GSM1022332     3  0.8195      0.313 0.244 0.032 0.500 0.224
#> GSM1022333     3  0.8195      0.313 0.244 0.032 0.500 0.224
#> GSM1022328     2  0.0000      0.978 0.000 1.000 0.000 0.000
#> GSM1022329     2  0.0000      0.978 0.000 1.000 0.000 0.000
#> GSM1022330     2  0.0000      0.978 0.000 1.000 0.000 0.000
#> GSM1022337     1  0.5090      0.941 0.660 0.016 0.000 0.324
#> GSM1022338     1  0.5090      0.941 0.660 0.016 0.000 0.324
#> GSM1022339     1  0.5090      0.941 0.660 0.016 0.000 0.324
#> GSM1022334     2  0.0000      0.978 0.000 1.000 0.000 0.000
#> GSM1022335     2  0.0000      0.978 0.000 1.000 0.000 0.000
#> GSM1022336     2  0.0000      0.978 0.000 1.000 0.000 0.000
#> GSM1022340     4  0.0336      0.747 0.000 0.000 0.008 0.992
#> GSM1022341     4  0.0336      0.747 0.000 0.000 0.008 0.992
#> GSM1022342     4  0.0336      0.747 0.000 0.000 0.008 0.992
#> GSM1022343     4  0.0336      0.747 0.000 0.000 0.008 0.992
#> GSM1022347     3  0.0000      0.771 0.000 0.000 1.000 0.000
#> GSM1022348     3  0.0000      0.771 0.000 0.000 1.000 0.000
#> GSM1022349     3  0.0000      0.771 0.000 0.000 1.000 0.000
#> GSM1022350     3  0.0000      0.771 0.000 0.000 1.000 0.000
#> GSM1022344     4  0.3166      0.734 0.000 0.016 0.116 0.868
#> GSM1022345     4  0.3166      0.734 0.000 0.016 0.116 0.868
#> GSM1022346     4  0.3166      0.734 0.000 0.016 0.116 0.868
#> GSM1022355     4  0.1940      0.721 0.076 0.000 0.000 0.924
#> GSM1022356     4  0.1940      0.721 0.076 0.000 0.000 0.924
#> GSM1022357     4  0.1940      0.721 0.076 0.000 0.000 0.924
#> GSM1022358     4  0.1940      0.721 0.076 0.000 0.000 0.924
#> GSM1022351     4  0.1474      0.735 0.052 0.000 0.000 0.948
#> GSM1022352     4  0.1867      0.723 0.072 0.000 0.000 0.928
#> GSM1022353     4  0.1867      0.723 0.072 0.000 0.000 0.928
#> GSM1022354     4  0.1867      0.723 0.072 0.000 0.000 0.928
#> GSM1022359     2  0.0000      0.978 0.000 1.000 0.000 0.000
#> GSM1022360     2  0.0000      0.978 0.000 1.000 0.000 0.000
#> GSM1022361     2  0.0000      0.978 0.000 1.000 0.000 0.000
#> GSM1022362     2  0.0000      0.978 0.000 1.000 0.000 0.000
#> GSM1022367     3  0.9472      0.231 0.244 0.132 0.400 0.224
#> GSM1022368     3  0.9472      0.231 0.244 0.132 0.400 0.224
#> GSM1022369     3  0.9472      0.231 0.244 0.132 0.400 0.224
#> GSM1022370     3  0.9472      0.231 0.244 0.132 0.400 0.224
#> GSM1022363     2  0.2635      0.905 0.000 0.904 0.076 0.020
#> GSM1022364     2  0.2635      0.905 0.000 0.904 0.076 0.020
#> GSM1022365     2  0.2635      0.905 0.000 0.904 0.076 0.020
#> GSM1022366     2  0.2635      0.905 0.000 0.904 0.076 0.020
#> GSM1022374     1  0.5090      0.941 0.660 0.016 0.000 0.324
#> GSM1022375     1  0.5090      0.941 0.660 0.016 0.000 0.324
#> GSM1022376     1  0.5090      0.941 0.660 0.016 0.000 0.324
#> GSM1022371     2  0.0000      0.978 0.000 1.000 0.000 0.000
#> GSM1022372     2  0.0000      0.978 0.000 1.000 0.000 0.000
#> GSM1022373     2  0.0000      0.978 0.000 1.000 0.000 0.000
#> GSM1022377     4  0.5188      0.775 0.276 0.024 0.004 0.696
#> GSM1022378     4  0.5188      0.775 0.276 0.024 0.004 0.696
#> GSM1022379     4  0.5226      0.775 0.276 0.020 0.008 0.696
#> GSM1022380     4  0.5325      0.774 0.276 0.024 0.008 0.692
#> GSM1022385     3  0.0000      0.771 0.000 0.000 1.000 0.000
#> GSM1022386     3  0.0000      0.771 0.000 0.000 1.000 0.000
#> GSM1022387     3  0.0000      0.771 0.000 0.000 1.000 0.000
#> GSM1022388     3  0.0000      0.771 0.000 0.000 1.000 0.000
#> GSM1022381     4  0.5764      0.770 0.276 0.024 0.024 0.676
#> GSM1022382     4  0.5764      0.770 0.276 0.024 0.024 0.676
#> GSM1022383     4  0.5764      0.770 0.276 0.024 0.024 0.676
#> GSM1022384     4  0.5764      0.770 0.276 0.024 0.024 0.676
#> GSM1022393     1  0.4250      0.956 0.724 0.000 0.000 0.276
#> GSM1022394     1  0.4250      0.956 0.724 0.000 0.000 0.276
#> GSM1022395     1  0.4250      0.956 0.724 0.000 0.000 0.276
#> GSM1022396     1  0.4250      0.956 0.724 0.000 0.000 0.276
#> GSM1022389     4  0.4927      0.780 0.264 0.024 0.000 0.712
#> GSM1022390     4  0.4927      0.780 0.264 0.024 0.000 0.712
#> GSM1022391     4  0.4927      0.780 0.264 0.024 0.000 0.712
#> GSM1022392     4  0.4927      0.780 0.264 0.024 0.000 0.712
#> GSM1022397     3  0.0000      0.771 0.000 0.000 1.000 0.000
#> GSM1022398     3  0.0000      0.771 0.000 0.000 1.000 0.000
#> GSM1022399     3  0.0000      0.771 0.000 0.000 1.000 0.000
#> GSM1022400     3  0.0000      0.771 0.000 0.000 1.000 0.000
#> GSM1022401     1  0.4250      0.956 0.724 0.000 0.000 0.276
#> GSM1022402     1  0.4250      0.956 0.724 0.000 0.000 0.276
#> GSM1022403     1  0.4250      0.956 0.724 0.000 0.000 0.276
#> GSM1022404     1  0.4250      0.956 0.724 0.000 0.000 0.276

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1022325     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000
#> GSM1022326     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000
#> GSM1022327     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000
#> GSM1022331     5  0.0162      1.000 0.000 0.000 0.004 0.000 0.996
#> GSM1022332     5  0.0162      1.000 0.000 0.000 0.004 0.000 0.996
#> GSM1022333     5  0.0162      1.000 0.000 0.000 0.004 0.000 0.996
#> GSM1022328     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000
#> GSM1022329     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000
#> GSM1022330     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000
#> GSM1022337     1  0.3857      0.670 0.688 0.000 0.000 0.000 0.312
#> GSM1022338     1  0.3857      0.670 0.688 0.000 0.000 0.000 0.312
#> GSM1022339     1  0.3857      0.670 0.688 0.000 0.000 0.000 0.312
#> GSM1022334     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000
#> GSM1022335     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000
#> GSM1022336     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000
#> GSM1022340     4  0.3039      0.805 0.192 0.000 0.000 0.808 0.000
#> GSM1022341     4  0.3039      0.805 0.192 0.000 0.000 0.808 0.000
#> GSM1022342     4  0.3039      0.805 0.192 0.000 0.000 0.808 0.000
#> GSM1022343     4  0.3039      0.805 0.192 0.000 0.000 0.808 0.000
#> GSM1022347     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022348     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022349     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022350     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022344     4  0.5159      0.766 0.188 0.000 0.124 0.688 0.000
#> GSM1022345     4  0.5159      0.766 0.188 0.000 0.124 0.688 0.000
#> GSM1022346     4  0.5159      0.766 0.188 0.000 0.124 0.688 0.000
#> GSM1022355     4  0.4045      0.715 0.356 0.000 0.000 0.644 0.000
#> GSM1022356     4  0.4045      0.715 0.356 0.000 0.000 0.644 0.000
#> GSM1022357     4  0.4045      0.715 0.356 0.000 0.000 0.644 0.000
#> GSM1022358     4  0.4045      0.715 0.356 0.000 0.000 0.644 0.000
#> GSM1022351     4  0.3039      0.805 0.192 0.000 0.000 0.808 0.000
#> GSM1022352     4  0.4045      0.715 0.356 0.000 0.000 0.644 0.000
#> GSM1022353     4  0.4045      0.715 0.356 0.000 0.000 0.644 0.000
#> GSM1022354     4  0.4045      0.715 0.356 0.000 0.000 0.644 0.000
#> GSM1022359     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000
#> GSM1022360     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000
#> GSM1022361     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000
#> GSM1022362     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000
#> GSM1022367     5  0.0162      1.000 0.000 0.000 0.004 0.000 0.996
#> GSM1022368     5  0.0162      1.000 0.000 0.000 0.004 0.000 0.996
#> GSM1022369     5  0.0162      1.000 0.000 0.000 0.004 0.000 0.996
#> GSM1022370     5  0.0162      1.000 0.000 0.000 0.004 0.000 0.996
#> GSM1022363     2  0.2852      0.827 0.000 0.828 0.000 0.000 0.172
#> GSM1022364     2  0.2852      0.827 0.000 0.828 0.000 0.000 0.172
#> GSM1022365     2  0.2852      0.827 0.000 0.828 0.000 0.000 0.172
#> GSM1022366     2  0.2852      0.827 0.000 0.828 0.000 0.000 0.172
#> GSM1022374     1  0.3857      0.670 0.688 0.000 0.000 0.000 0.312
#> GSM1022375     1  0.3857      0.670 0.688 0.000 0.000 0.000 0.312
#> GSM1022376     1  0.3857      0.670 0.688 0.000 0.000 0.000 0.312
#> GSM1022371     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000
#> GSM1022372     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000
#> GSM1022373     2  0.0000      0.962 0.000 1.000 0.000 0.000 0.000
#> GSM1022377     4  0.1444      0.795 0.000 0.040 0.000 0.948 0.012
#> GSM1022378     4  0.1444      0.795 0.000 0.040 0.000 0.948 0.012
#> GSM1022379     4  0.1444      0.795 0.000 0.040 0.000 0.948 0.012
#> GSM1022380     4  0.1444      0.795 0.000 0.040 0.000 0.948 0.012
#> GSM1022385     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022386     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022387     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022388     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022381     4  0.2278      0.772 0.000 0.060 0.000 0.908 0.032
#> GSM1022382     4  0.2278      0.772 0.000 0.060 0.000 0.908 0.032
#> GSM1022383     4  0.2278      0.772 0.000 0.060 0.000 0.908 0.032
#> GSM1022384     4  0.2278      0.772 0.000 0.060 0.000 0.908 0.032
#> GSM1022393     1  0.0000      0.810 1.000 0.000 0.000 0.000 0.000
#> GSM1022394     1  0.0000      0.810 1.000 0.000 0.000 0.000 0.000
#> GSM1022395     1  0.0000      0.810 1.000 0.000 0.000 0.000 0.000
#> GSM1022396     1  0.0000      0.810 1.000 0.000 0.000 0.000 0.000
#> GSM1022389     4  0.1800      0.804 0.020 0.048 0.000 0.932 0.000
#> GSM1022390     4  0.1800      0.804 0.020 0.048 0.000 0.932 0.000
#> GSM1022391     4  0.1800      0.804 0.020 0.048 0.000 0.932 0.000
#> GSM1022392     4  0.1800      0.804 0.020 0.048 0.000 0.932 0.000
#> GSM1022397     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022398     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022399     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022400     3  0.0000      1.000 0.000 0.000 1.000 0.000 0.000
#> GSM1022401     1  0.0000      0.810 1.000 0.000 0.000 0.000 0.000
#> GSM1022402     1  0.0000      0.810 1.000 0.000 0.000 0.000 0.000
#> GSM1022403     1  0.0000      0.810 1.000 0.000 0.000 0.000 0.000
#> GSM1022404     1  0.0000      0.810 1.000 0.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4   p5    p6
#> GSM1022325     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.00 0.000
#> GSM1022326     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.00 0.000
#> GSM1022327     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.00 0.000
#> GSM1022331     6  0.0000      1.000 0.000 0.000 0.000 0.000 0.00 1.000
#> GSM1022332     6  0.0000      1.000 0.000 0.000 0.000 0.000 0.00 1.000
#> GSM1022333     6  0.0000      1.000 0.000 0.000 0.000 0.000 0.00 1.000
#> GSM1022328     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.00 0.000
#> GSM1022329     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.00 0.000
#> GSM1022330     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.00 0.000
#> GSM1022337     5  0.0000      0.736 0.000 0.000 0.000 0.000 1.00 0.000
#> GSM1022338     5  0.0000      0.736 0.000 0.000 0.000 0.000 1.00 0.000
#> GSM1022339     5  0.0000      0.736 0.000 0.000 0.000 0.000 1.00 0.000
#> GSM1022334     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.00 0.000
#> GSM1022335     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.00 0.000
#> GSM1022336     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.00 0.000
#> GSM1022340     1  0.2527      0.838 0.832 0.000 0.000 0.168 0.00 0.000
#> GSM1022341     1  0.2527      0.838 0.832 0.000 0.000 0.168 0.00 0.000
#> GSM1022342     1  0.2527      0.838 0.832 0.000 0.000 0.168 0.00 0.000
#> GSM1022343     1  0.2527      0.838 0.832 0.000 0.000 0.168 0.00 0.000
#> GSM1022347     3  0.0000      0.895 0.000 0.000 1.000 0.000 0.00 0.000
#> GSM1022348     3  0.0000      0.895 0.000 0.000 1.000 0.000 0.00 0.000
#> GSM1022349     3  0.0000      0.895 0.000 0.000 1.000 0.000 0.00 0.000
#> GSM1022350     3  0.0000      0.895 0.000 0.000 1.000 0.000 0.00 0.000
#> GSM1022344     3  0.5591      0.416 0.248 0.000 0.576 0.168 0.00 0.008
#> GSM1022345     3  0.5765      0.408 0.248 0.000 0.568 0.168 0.00 0.016
#> GSM1022346     3  0.5765      0.408 0.248 0.000 0.568 0.168 0.00 0.016
#> GSM1022355     1  0.0146      0.887 0.996 0.000 0.000 0.004 0.00 0.000
#> GSM1022356     1  0.0146      0.887 0.996 0.000 0.000 0.004 0.00 0.000
#> GSM1022357     1  0.0146      0.887 0.996 0.000 0.000 0.004 0.00 0.000
#> GSM1022358     1  0.0146      0.887 0.996 0.000 0.000 0.004 0.00 0.000
#> GSM1022351     1  0.2135      0.856 0.872 0.000 0.000 0.128 0.00 0.000
#> GSM1022352     1  0.0146      0.887 0.996 0.000 0.000 0.004 0.00 0.000
#> GSM1022353     1  0.0146      0.887 0.996 0.000 0.000 0.004 0.00 0.000
#> GSM1022354     1  0.0146      0.887 0.996 0.000 0.000 0.004 0.00 0.000
#> GSM1022359     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.00 0.000
#> GSM1022360     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.00 0.000
#> GSM1022361     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.00 0.000
#> GSM1022362     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.00 0.000
#> GSM1022367     6  0.0000      1.000 0.000 0.000 0.000 0.000 0.00 1.000
#> GSM1022368     6  0.0000      1.000 0.000 0.000 0.000 0.000 0.00 1.000
#> GSM1022369     6  0.0000      1.000 0.000 0.000 0.000 0.000 0.00 1.000
#> GSM1022370     6  0.0000      1.000 0.000 0.000 0.000 0.000 0.00 1.000
#> GSM1022363     2  0.2527      0.829 0.000 0.832 0.000 0.000 0.00 0.168
#> GSM1022364     2  0.2527      0.829 0.000 0.832 0.000 0.000 0.00 0.168
#> GSM1022365     2  0.2527      0.829 0.000 0.832 0.000 0.000 0.00 0.168
#> GSM1022366     2  0.2527      0.829 0.000 0.832 0.000 0.000 0.00 0.168
#> GSM1022374     5  0.0000      0.736 0.000 0.000 0.000 0.000 1.00 0.000
#> GSM1022375     5  0.0000      0.736 0.000 0.000 0.000 0.000 1.00 0.000
#> GSM1022376     5  0.0000      0.736 0.000 0.000 0.000 0.000 1.00 0.000
#> GSM1022371     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.00 0.000
#> GSM1022372     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.00 0.000
#> GSM1022373     2  0.0000      0.963 0.000 1.000 0.000 0.000 0.00 0.000
#> GSM1022377     4  0.0000      0.954 0.000 0.000 0.000 1.000 0.00 0.000
#> GSM1022378     4  0.0000      0.954 0.000 0.000 0.000 1.000 0.00 0.000
#> GSM1022379     4  0.0000      0.954 0.000 0.000 0.000 1.000 0.00 0.000
#> GSM1022380     4  0.0000      0.954 0.000 0.000 0.000 1.000 0.00 0.000
#> GSM1022385     3  0.0000      0.895 0.000 0.000 1.000 0.000 0.00 0.000
#> GSM1022386     3  0.0000      0.895 0.000 0.000 1.000 0.000 0.00 0.000
#> GSM1022387     3  0.0000      0.895 0.000 0.000 1.000 0.000 0.00 0.000
#> GSM1022388     3  0.0000      0.895 0.000 0.000 1.000 0.000 0.00 0.000
#> GSM1022381     4  0.0000      0.954 0.000 0.000 0.000 1.000 0.00 0.000
#> GSM1022382     4  0.0000      0.954 0.000 0.000 0.000 1.000 0.00 0.000
#> GSM1022383     4  0.0000      0.954 0.000 0.000 0.000 1.000 0.00 0.000
#> GSM1022384     4  0.0000      0.954 0.000 0.000 0.000 1.000 0.00 0.000
#> GSM1022393     5  0.3647      0.765 0.360 0.000 0.000 0.000 0.64 0.000
#> GSM1022394     5  0.3647      0.765 0.360 0.000 0.000 0.000 0.64 0.000
#> GSM1022395     5  0.3647      0.765 0.360 0.000 0.000 0.000 0.64 0.000
#> GSM1022396     5  0.3647      0.765 0.360 0.000 0.000 0.000 0.64 0.000
#> GSM1022389     4  0.2499      0.903 0.072 0.048 0.000 0.880 0.00 0.000
#> GSM1022390     4  0.2499      0.903 0.072 0.048 0.000 0.880 0.00 0.000
#> GSM1022391     4  0.2499      0.903 0.072 0.048 0.000 0.880 0.00 0.000
#> GSM1022392     4  0.2499      0.903 0.072 0.048 0.000 0.880 0.00 0.000
#> GSM1022397     3  0.0000      0.895 0.000 0.000 1.000 0.000 0.00 0.000
#> GSM1022398     3  0.0000      0.895 0.000 0.000 1.000 0.000 0.00 0.000
#> GSM1022399     3  0.0000      0.895 0.000 0.000 1.000 0.000 0.00 0.000
#> GSM1022400     3  0.0000      0.895 0.000 0.000 1.000 0.000 0.00 0.000
#> GSM1022401     5  0.3647      0.765 0.360 0.000 0.000 0.000 0.64 0.000
#> GSM1022402     5  0.3647      0.765 0.360 0.000 0.000 0.000 0.64 0.000
#> GSM1022403     5  0.3647      0.765 0.360 0.000 0.000 0.000 0.64 0.000
#> GSM1022404     5  0.3647      0.765 0.360 0.000 0.000 0.000 0.64 0.000

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-CV-mclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-CV-mclust-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-CV-mclust-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-CV-mclust-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-CV-mclust-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-CV-mclust-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-CV-mclust-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-CV-mclust-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-CV-mclust-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-CV-mclust-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-CV-mclust-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-CV-mclust-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-CV-mclust-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-CV-mclust-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-CV-mclust-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-CV-mclust-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-CV-mclust-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-CV-mclust-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-CV-mclust-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-CV-mclust-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-mclust-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-CV-mclust-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-CV-mclust-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-CV-mclust-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-CV-mclust-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-CV-mclust-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-mclust-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>            n protocol(p) cell.type(p) k
#> CV:mclust 80    9.82e-09     1.94e-03 2
#> CV:mclust 68    1.93e-10     2.24e-08 3
#> CV:mclust 73    6.10e-14     9.98e-13 4
#> CV:mclust 80    1.34e-16     1.37e-13 5
#> CV:mclust 77    2.13e-24     5.97e-13 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


CV:NMF*

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["CV", "NMF"]
# you can also extract it by
# res = res_list["CV:NMF"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 5.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk CV-NMF-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk CV-NMF-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.866           0.928       0.961         0.4960 0.499   0.499
#> 3 3 1.000           0.966       0.986         0.3479 0.748   0.534
#> 4 4 1.000           0.985       0.991         0.0835 0.893   0.701
#> 5 5 0.916           0.867       0.916         0.0586 0.934   0.763
#> 6 6 0.836           0.770       0.870         0.0493 0.981   0.916

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 5
#> attr(,"optional")
#> [1] 3 4

There is also optional best \(k\) = 3 4 that is worth to check.

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1022325     2   0.000      0.976 0.000 1.000
#> GSM1022326     2   0.000      0.976 0.000 1.000
#> GSM1022327     2   0.000      0.976 0.000 1.000
#> GSM1022331     1   0.000      0.942 1.000 0.000
#> GSM1022332     1   0.000      0.942 1.000 0.000
#> GSM1022333     1   0.000      0.942 1.000 0.000
#> GSM1022328     2   0.000      0.976 0.000 1.000
#> GSM1022329     2   0.000      0.976 0.000 1.000
#> GSM1022330     2   0.000      0.976 0.000 1.000
#> GSM1022337     1   0.909      0.594 0.676 0.324
#> GSM1022338     1   0.895      0.619 0.688 0.312
#> GSM1022339     2   0.958      0.322 0.380 0.620
#> GSM1022334     2   0.000      0.976 0.000 1.000
#> GSM1022335     2   0.000      0.976 0.000 1.000
#> GSM1022336     2   0.000      0.976 0.000 1.000
#> GSM1022340     1   0.327      0.940 0.940 0.060
#> GSM1022341     1   0.295      0.944 0.948 0.052
#> GSM1022342     1   0.295      0.944 0.948 0.052
#> GSM1022343     1   0.295      0.944 0.948 0.052
#> GSM1022347     1   0.000      0.942 1.000 0.000
#> GSM1022348     1   0.000      0.942 1.000 0.000
#> GSM1022349     1   0.000      0.942 1.000 0.000
#> GSM1022350     1   0.000      0.942 1.000 0.000
#> GSM1022344     1   0.000      0.942 1.000 0.000
#> GSM1022345     1   0.000      0.942 1.000 0.000
#> GSM1022346     1   0.000      0.942 1.000 0.000
#> GSM1022355     1   0.311      0.942 0.944 0.056
#> GSM1022356     1   0.327      0.940 0.940 0.060
#> GSM1022357     1   0.260      0.945 0.956 0.044
#> GSM1022358     1   0.327      0.940 0.940 0.060
#> GSM1022351     1   0.327      0.940 0.940 0.060
#> GSM1022352     1   0.278      0.944 0.952 0.048
#> GSM1022353     1   0.278      0.944 0.952 0.048
#> GSM1022354     1   0.295      0.944 0.948 0.052
#> GSM1022359     2   0.000      0.976 0.000 1.000
#> GSM1022360     2   0.000      0.976 0.000 1.000
#> GSM1022361     2   0.000      0.976 0.000 1.000
#> GSM1022362     2   0.000      0.976 0.000 1.000
#> GSM1022367     1   0.795      0.698 0.760 0.240
#> GSM1022368     1   0.518      0.863 0.884 0.116
#> GSM1022369     1   0.358      0.909 0.932 0.068
#> GSM1022370     1   0.827      0.664 0.740 0.260
#> GSM1022363     2   0.000      0.976 0.000 1.000
#> GSM1022364     2   0.000      0.976 0.000 1.000
#> GSM1022365     2   0.000      0.976 0.000 1.000
#> GSM1022366     2   0.000      0.976 0.000 1.000
#> GSM1022374     2   0.552      0.840 0.128 0.872
#> GSM1022375     2   0.541      0.845 0.124 0.876
#> GSM1022376     2   0.574      0.829 0.136 0.864
#> GSM1022371     2   0.000      0.976 0.000 1.000
#> GSM1022372     2   0.000      0.976 0.000 1.000
#> GSM1022373     2   0.000      0.976 0.000 1.000
#> GSM1022377     2   0.000      0.976 0.000 1.000
#> GSM1022378     2   0.000      0.976 0.000 1.000
#> GSM1022379     2   0.000      0.976 0.000 1.000
#> GSM1022380     2   0.000      0.976 0.000 1.000
#> GSM1022385     1   0.000      0.942 1.000 0.000
#> GSM1022386     1   0.000      0.942 1.000 0.000
#> GSM1022387     1   0.000      0.942 1.000 0.000
#> GSM1022388     1   0.000      0.942 1.000 0.000
#> GSM1022381     2   0.000      0.976 0.000 1.000
#> GSM1022382     2   0.000      0.976 0.000 1.000
#> GSM1022383     2   0.000      0.976 0.000 1.000
#> GSM1022384     2   0.000      0.976 0.000 1.000
#> GSM1022393     1   0.343      0.937 0.936 0.064
#> GSM1022394     1   0.242      0.945 0.960 0.040
#> GSM1022395     1   0.327      0.940 0.940 0.060
#> GSM1022396     1   0.295      0.944 0.948 0.052
#> GSM1022389     2   0.000      0.976 0.000 1.000
#> GSM1022390     2   0.000      0.976 0.000 1.000
#> GSM1022391     2   0.000      0.976 0.000 1.000
#> GSM1022392     2   0.000      0.976 0.000 1.000
#> GSM1022397     1   0.000      0.942 1.000 0.000
#> GSM1022398     1   0.000      0.942 1.000 0.000
#> GSM1022399     1   0.000      0.942 1.000 0.000
#> GSM1022400     1   0.000      0.942 1.000 0.000
#> GSM1022401     1   0.260      0.945 0.956 0.044
#> GSM1022402     1   0.311      0.942 0.944 0.056
#> GSM1022403     1   0.311      0.942 0.944 0.056
#> GSM1022404     1   0.278      0.944 0.952 0.048

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1022325     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022326     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022327     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022331     3  0.0000      0.990 0.000 0.000 1.000
#> GSM1022332     3  0.0000      0.990 0.000 0.000 1.000
#> GSM1022333     3  0.0000      0.990 0.000 0.000 1.000
#> GSM1022328     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022329     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022330     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022337     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022338     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022339     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022334     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022335     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022336     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022340     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022341     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022342     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022343     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022347     3  0.0000      0.990 0.000 0.000 1.000
#> GSM1022348     3  0.0000      0.990 0.000 0.000 1.000
#> GSM1022349     3  0.0000      0.990 0.000 0.000 1.000
#> GSM1022350     3  0.0000      0.990 0.000 0.000 1.000
#> GSM1022344     3  0.0000      0.990 0.000 0.000 1.000
#> GSM1022345     3  0.4504      0.752 0.196 0.000 0.804
#> GSM1022346     3  0.0592      0.979 0.012 0.000 0.988
#> GSM1022355     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022356     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022357     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022358     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022351     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022352     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022353     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022354     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022359     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022360     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022361     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022362     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022367     3  0.0000      0.990 0.000 0.000 1.000
#> GSM1022368     3  0.0000      0.990 0.000 0.000 1.000
#> GSM1022369     3  0.0000      0.990 0.000 0.000 1.000
#> GSM1022370     3  0.0000      0.990 0.000 0.000 1.000
#> GSM1022363     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022364     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022365     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022366     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022374     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022375     1  0.0424      0.964 0.992 0.008 0.000
#> GSM1022376     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022371     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022372     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022373     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022377     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022378     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022379     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022380     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022385     3  0.0000      0.990 0.000 0.000 1.000
#> GSM1022386     3  0.0000      0.990 0.000 0.000 1.000
#> GSM1022387     3  0.0000      0.990 0.000 0.000 1.000
#> GSM1022388     3  0.0000      0.990 0.000 0.000 1.000
#> GSM1022381     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022382     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022383     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022384     2  0.0000      0.993 0.000 1.000 0.000
#> GSM1022393     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022394     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022395     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022396     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022389     2  0.3267      0.867 0.116 0.884 0.000
#> GSM1022390     1  0.6079      0.376 0.612 0.388 0.000
#> GSM1022391     2  0.2711      0.901 0.088 0.912 0.000
#> GSM1022392     1  0.5591      0.566 0.696 0.304 0.000
#> GSM1022397     3  0.0000      0.990 0.000 0.000 1.000
#> GSM1022398     3  0.0000      0.990 0.000 0.000 1.000
#> GSM1022399     3  0.0000      0.990 0.000 0.000 1.000
#> GSM1022400     3  0.0000      0.990 0.000 0.000 1.000
#> GSM1022401     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022402     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022403     1  0.0000      0.971 1.000 0.000 0.000
#> GSM1022404     1  0.0000      0.971 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1022325     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022326     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022327     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022331     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022332     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022333     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022328     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022329     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022330     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022337     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM1022338     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM1022339     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM1022334     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022335     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022336     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022340     4  0.0000      0.999 0.000 0.000 0.000 1.000
#> GSM1022341     4  0.0000      0.999 0.000 0.000 0.000 1.000
#> GSM1022342     4  0.0000      0.999 0.000 0.000 0.000 1.000
#> GSM1022343     4  0.0000      0.999 0.000 0.000 0.000 1.000
#> GSM1022347     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022348     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022349     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022350     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022344     4  0.0188      0.995 0.000 0.000 0.004 0.996
#> GSM1022345     4  0.0000      0.999 0.000 0.000 0.000 1.000
#> GSM1022346     4  0.0000      0.999 0.000 0.000 0.000 1.000
#> GSM1022355     1  0.3123      0.850 0.844 0.000 0.000 0.156
#> GSM1022356     1  0.2345      0.904 0.900 0.000 0.000 0.100
#> GSM1022357     1  0.3219      0.841 0.836 0.000 0.000 0.164
#> GSM1022358     1  0.2469      0.898 0.892 0.000 0.000 0.108
#> GSM1022351     4  0.0000      0.999 0.000 0.000 0.000 1.000
#> GSM1022352     4  0.0000      0.999 0.000 0.000 0.000 1.000
#> GSM1022353     4  0.0000      0.999 0.000 0.000 0.000 1.000
#> GSM1022354     4  0.0188      0.995 0.004 0.000 0.000 0.996
#> GSM1022359     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022360     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022361     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022362     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022367     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022368     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022369     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022370     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022363     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022364     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022365     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022366     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022374     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM1022375     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM1022376     1  0.0000      0.966 1.000 0.000 0.000 0.000
#> GSM1022371     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022372     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022373     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022377     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022378     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022379     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022380     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022385     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022386     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022387     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022388     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022381     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022382     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022383     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022384     2  0.0188      0.993 0.000 0.996 0.000 0.004
#> GSM1022393     1  0.0188      0.967 0.996 0.000 0.000 0.004
#> GSM1022394     1  0.0336      0.967 0.992 0.000 0.000 0.008
#> GSM1022395     1  0.0188      0.967 0.996 0.000 0.000 0.004
#> GSM1022396     1  0.0336      0.967 0.992 0.000 0.000 0.008
#> GSM1022389     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022390     2  0.0921      0.971 0.000 0.972 0.000 0.028
#> GSM1022391     2  0.0000      0.996 0.000 1.000 0.000 0.000
#> GSM1022392     2  0.2011      0.915 0.000 0.920 0.000 0.080
#> GSM1022397     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022398     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022399     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022400     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022401     1  0.0336      0.967 0.992 0.000 0.000 0.008
#> GSM1022402     1  0.0188      0.967 0.996 0.000 0.000 0.004
#> GSM1022403     1  0.0336      0.967 0.992 0.000 0.000 0.008
#> GSM1022404     1  0.0336      0.967 0.992 0.000 0.000 0.008

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1022325     2  0.0000      0.878 0.000 1.000 0.000 0.000 0.000
#> GSM1022326     2  0.0000      0.878 0.000 1.000 0.000 0.000 0.000
#> GSM1022327     2  0.0000      0.878 0.000 1.000 0.000 0.000 0.000
#> GSM1022331     3  0.0510      0.985 0.000 0.000 0.984 0.016 0.000
#> GSM1022332     3  0.0510      0.985 0.000 0.000 0.984 0.016 0.000
#> GSM1022333     3  0.0510      0.985 0.000 0.000 0.984 0.016 0.000
#> GSM1022328     2  0.0000      0.878 0.000 1.000 0.000 0.000 0.000
#> GSM1022329     2  0.0000      0.878 0.000 1.000 0.000 0.000 0.000
#> GSM1022330     2  0.0000      0.878 0.000 1.000 0.000 0.000 0.000
#> GSM1022337     5  0.0000      0.952 0.000 0.000 0.000 0.000 1.000
#> GSM1022338     5  0.0000      0.952 0.000 0.000 0.000 0.000 1.000
#> GSM1022339     5  0.0000      0.952 0.000 0.000 0.000 0.000 1.000
#> GSM1022334     2  0.0000      0.878 0.000 1.000 0.000 0.000 0.000
#> GSM1022335     2  0.0000      0.878 0.000 1.000 0.000 0.000 0.000
#> GSM1022336     2  0.0000      0.878 0.000 1.000 0.000 0.000 0.000
#> GSM1022340     1  0.0000      0.998 1.000 0.000 0.000 0.000 0.000
#> GSM1022341     1  0.0000      0.998 1.000 0.000 0.000 0.000 0.000
#> GSM1022342     1  0.0000      0.998 1.000 0.000 0.000 0.000 0.000
#> GSM1022343     1  0.0000      0.998 1.000 0.000 0.000 0.000 0.000
#> GSM1022347     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000
#> GSM1022348     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000
#> GSM1022349     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000
#> GSM1022350     3  0.0000      0.988 0.000 0.000 1.000 0.000 0.000
#> GSM1022344     1  0.0290      0.992 0.992 0.000 0.008 0.000 0.000
#> GSM1022345     1  0.0162      0.996 0.996 0.000 0.004 0.000 0.000
#> GSM1022346     1  0.0162      0.996 0.996 0.000 0.004 0.000 0.000
#> GSM1022355     5  0.2773      0.812 0.164 0.000 0.000 0.000 0.836
#> GSM1022356     5  0.1270      0.916 0.052 0.000 0.000 0.000 0.948
#> GSM1022357     5  0.3999      0.536 0.344 0.000 0.000 0.000 0.656
#> GSM1022358     5  0.3452      0.711 0.244 0.000 0.000 0.000 0.756
#> GSM1022351     1  0.0000      0.998 1.000 0.000 0.000 0.000 0.000
#> GSM1022352     1  0.0000      0.998 1.000 0.000 0.000 0.000 0.000
#> GSM1022353     1  0.0000      0.998 1.000 0.000 0.000 0.000 0.000
#> GSM1022354     1  0.0000      0.998 1.000 0.000 0.000 0.000 0.000
#> GSM1022359     2  0.0000      0.878 0.000 1.000 0.000 0.000 0.000
#> GSM1022360     2  0.0000      0.878 0.000 1.000 0.000 0.000 0.000
#> GSM1022361     2  0.0000      0.878 0.000 1.000 0.000 0.000 0.000
#> GSM1022362     2  0.0000      0.878 0.000 1.000 0.000 0.000 0.000
#> GSM1022367     3  0.1124      0.973 0.000 0.004 0.960 0.036 0.000
#> GSM1022368     3  0.1124      0.973 0.000 0.004 0.960 0.036 0.000
#> GSM1022369     3  0.1124      0.973 0.000 0.004 0.960 0.036 0.000
#> GSM1022370     3  0.1469      0.963 0.000 0.016 0.948 0.036 0.000
#> GSM1022363     2  0.0880      0.841 0.000 0.968 0.000 0.032 0.000
#> GSM1022364     2  0.0880      0.841 0.000 0.968 0.000 0.032 0.000
#> GSM1022365     2  0.0880      0.841 0.000 0.968 0.000 0.032 0.000
#> GSM1022366     2  0.0880      0.841 0.000 0.968 0.000 0.032 0.000
#> GSM1022374     5  0.0000      0.952 0.000 0.000 0.000 0.000 1.000
#> GSM1022375     5  0.0000      0.952 0.000 0.000 0.000 0.000 1.000
#> GSM1022376     5  0.0000      0.952 0.000 0.000 0.000 0.000 1.000
#> GSM1022371     2  0.0000      0.878 0.000 1.000 0.000 0.000 0.000
#> GSM1022372     2  0.0000      0.878 0.000 1.000 0.000 0.000 0.000
#> GSM1022373     2  0.0000      0.878 0.000 1.000 0.000 0.000 0.000
#> GSM1022377     4  0.4304      0.905 0.000 0.484 0.000 0.516 0.000
#> GSM1022378     4  0.4304      0.905 0.000 0.484 0.000 0.516 0.000
#> GSM1022379     4  0.4304      0.905 0.000 0.484 0.000 0.516 0.000
#> GSM1022380     4  0.4304      0.905 0.000 0.484 0.000 0.516 0.000
#> GSM1022385     3  0.0162      0.989 0.000 0.000 0.996 0.004 0.000
#> GSM1022386     3  0.0162      0.989 0.000 0.000 0.996 0.004 0.000
#> GSM1022387     3  0.0162      0.989 0.000 0.000 0.996 0.004 0.000
#> GSM1022388     3  0.0162      0.989 0.000 0.000 0.996 0.004 0.000
#> GSM1022381     4  0.4590      0.894 0.012 0.420 0.000 0.568 0.000
#> GSM1022382     4  0.4627      0.909 0.012 0.444 0.000 0.544 0.000
#> GSM1022383     4  0.4610      0.904 0.012 0.432 0.000 0.556 0.000
#> GSM1022384     4  0.4547      0.869 0.012 0.400 0.000 0.588 0.000
#> GSM1022393     5  0.0000      0.952 0.000 0.000 0.000 0.000 1.000
#> GSM1022394     5  0.0000      0.952 0.000 0.000 0.000 0.000 1.000
#> GSM1022395     5  0.0000      0.952 0.000 0.000 0.000 0.000 1.000
#> GSM1022396     5  0.0000      0.952 0.000 0.000 0.000 0.000 1.000
#> GSM1022389     2  0.4310     -0.619 0.004 0.604 0.000 0.392 0.000
#> GSM1022390     2  0.4641     -0.745 0.012 0.532 0.000 0.456 0.000
#> GSM1022391     2  0.4310     -0.619 0.004 0.604 0.000 0.392 0.000
#> GSM1022392     4  0.4747      0.732 0.016 0.488 0.000 0.496 0.000
#> GSM1022397     3  0.0162      0.989 0.000 0.000 0.996 0.004 0.000
#> GSM1022398     3  0.0162      0.989 0.000 0.000 0.996 0.004 0.000
#> GSM1022399     3  0.0162      0.989 0.000 0.000 0.996 0.004 0.000
#> GSM1022400     3  0.0162      0.989 0.000 0.000 0.996 0.004 0.000
#> GSM1022401     5  0.0000      0.952 0.000 0.000 0.000 0.000 1.000
#> GSM1022402     5  0.0000      0.952 0.000 0.000 0.000 0.000 1.000
#> GSM1022403     5  0.0000      0.952 0.000 0.000 0.000 0.000 1.000
#> GSM1022404     5  0.0000      0.952 0.000 0.000 0.000 0.000 1.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5 p6
#> GSM1022325     2  0.1219      0.693 0.000 0.948 0.000 0.048 0.000 NA
#> GSM1022326     2  0.0692      0.709 0.000 0.976 0.000 0.020 0.000 NA
#> GSM1022327     2  0.0692      0.707 0.000 0.976 0.000 0.020 0.000 NA
#> GSM1022331     3  0.2003      0.860 0.000 0.000 0.884 0.000 0.000 NA
#> GSM1022332     3  0.1714      0.870 0.000 0.000 0.908 0.000 0.000 NA
#> GSM1022333     3  0.2260      0.849 0.000 0.000 0.860 0.000 0.000 NA
#> GSM1022328     2  0.0260      0.714 0.000 0.992 0.000 0.008 0.000 NA
#> GSM1022329     2  0.0146      0.714 0.000 0.996 0.000 0.004 0.000 NA
#> GSM1022330     2  0.0260      0.714 0.000 0.992 0.000 0.008 0.000 NA
#> GSM1022337     5  0.0508      0.931 0.000 0.000 0.000 0.004 0.984 NA
#> GSM1022338     5  0.0508      0.931 0.000 0.000 0.000 0.004 0.984 NA
#> GSM1022339     5  0.0508      0.931 0.000 0.000 0.000 0.004 0.984 NA
#> GSM1022334     2  0.0260      0.715 0.000 0.992 0.000 0.000 0.000 NA
#> GSM1022335     2  0.0260      0.715 0.000 0.992 0.000 0.000 0.000 NA
#> GSM1022336     2  0.0260      0.715 0.000 0.992 0.000 0.000 0.000 NA
#> GSM1022340     1  0.0146      0.946 0.996 0.000 0.000 0.000 0.000 NA
#> GSM1022341     1  0.0146      0.946 0.996 0.000 0.000 0.000 0.000 NA
#> GSM1022342     1  0.0146      0.946 0.996 0.000 0.000 0.000 0.000 NA
#> GSM1022343     1  0.0146      0.946 0.996 0.000 0.000 0.000 0.000 NA
#> GSM1022347     3  0.0000      0.892 0.000 0.000 1.000 0.000 0.000 NA
#> GSM1022348     3  0.0000      0.892 0.000 0.000 1.000 0.000 0.000 NA
#> GSM1022349     3  0.0000      0.892 0.000 0.000 1.000 0.000 0.000 NA
#> GSM1022350     3  0.0000      0.892 0.000 0.000 1.000 0.000 0.000 NA
#> GSM1022344     1  0.0146      0.946 0.996 0.000 0.000 0.000 0.000 NA
#> GSM1022345     1  0.0000      0.946 1.000 0.000 0.000 0.000 0.000 NA
#> GSM1022346     1  0.0000      0.946 1.000 0.000 0.000 0.000 0.000 NA
#> GSM1022355     5  0.4058      0.512 0.320 0.000 0.000 0.016 0.660 NA
#> GSM1022356     5  0.2636      0.818 0.120 0.000 0.000 0.016 0.860 NA
#> GSM1022357     1  0.4394     -0.121 0.496 0.000 0.000 0.016 0.484 NA
#> GSM1022358     5  0.4332      0.273 0.416 0.000 0.000 0.016 0.564 NA
#> GSM1022351     1  0.0146      0.946 0.996 0.000 0.000 0.000 0.000 NA
#> GSM1022352     1  0.0000      0.946 1.000 0.000 0.000 0.000 0.000 NA
#> GSM1022353     1  0.0000      0.946 1.000 0.000 0.000 0.000 0.000 NA
#> GSM1022354     1  0.0000      0.946 1.000 0.000 0.000 0.000 0.000 NA
#> GSM1022359     2  0.3109      0.481 0.000 0.772 0.000 0.224 0.000 NA
#> GSM1022360     2  0.3189      0.460 0.000 0.760 0.000 0.236 0.000 NA
#> GSM1022361     2  0.3189      0.460 0.000 0.760 0.000 0.236 0.000 NA
#> GSM1022362     2  0.3265      0.441 0.000 0.748 0.000 0.248 0.000 NA
#> GSM1022367     3  0.3838      0.641 0.000 0.000 0.552 0.000 0.000 NA
#> GSM1022368     3  0.3833      0.645 0.000 0.000 0.556 0.000 0.000 NA
#> GSM1022369     3  0.3833      0.645 0.000 0.000 0.556 0.000 0.000 NA
#> GSM1022370     3  0.3828      0.648 0.000 0.000 0.560 0.000 0.000 NA
#> GSM1022363     2  0.4293      0.457 0.000 0.536 0.004 0.012 0.000 NA
#> GSM1022364     2  0.4314      0.460 0.000 0.536 0.000 0.020 0.000 NA
#> GSM1022365     2  0.4314      0.460 0.000 0.536 0.000 0.020 0.000 NA
#> GSM1022366     2  0.4314      0.460 0.000 0.536 0.000 0.020 0.000 NA
#> GSM1022374     5  0.0405      0.932 0.000 0.000 0.000 0.004 0.988 NA
#> GSM1022375     5  0.0405      0.932 0.000 0.000 0.000 0.004 0.988 NA
#> GSM1022376     5  0.0405      0.932 0.000 0.000 0.000 0.004 0.988 NA
#> GSM1022371     2  0.2094      0.698 0.000 0.900 0.000 0.020 0.000 NA
#> GSM1022372     2  0.2199      0.695 0.000 0.892 0.000 0.020 0.000 NA
#> GSM1022373     2  0.2094      0.698 0.000 0.900 0.000 0.020 0.000 NA
#> GSM1022377     4  0.3076      0.953 0.000 0.240 0.000 0.760 0.000 NA
#> GSM1022378     4  0.3076      0.953 0.000 0.240 0.000 0.760 0.000 NA
#> GSM1022379     4  0.3076      0.953 0.000 0.240 0.000 0.760 0.000 NA
#> GSM1022380     4  0.3076      0.953 0.000 0.240 0.000 0.760 0.000 NA
#> GSM1022385     3  0.0547      0.891 0.000 0.000 0.980 0.000 0.000 NA
#> GSM1022386     3  0.0547      0.891 0.000 0.000 0.980 0.000 0.000 NA
#> GSM1022387     3  0.0547      0.891 0.000 0.000 0.980 0.000 0.000 NA
#> GSM1022388     3  0.0547      0.891 0.000 0.000 0.980 0.000 0.000 NA
#> GSM1022381     4  0.2697      0.955 0.000 0.188 0.000 0.812 0.000 NA
#> GSM1022382     4  0.2697      0.955 0.000 0.188 0.000 0.812 0.000 NA
#> GSM1022383     4  0.2664      0.952 0.000 0.184 0.000 0.816 0.000 NA
#> GSM1022384     4  0.2664      0.952 0.000 0.184 0.000 0.816 0.000 NA
#> GSM1022393     5  0.0291      0.930 0.000 0.000 0.000 0.004 0.992 NA
#> GSM1022394     5  0.0508      0.927 0.000 0.000 0.000 0.012 0.984 NA
#> GSM1022395     5  0.0000      0.932 0.000 0.000 0.000 0.000 1.000 NA
#> GSM1022396     5  0.0508      0.927 0.000 0.000 0.000 0.012 0.984 NA
#> GSM1022389     2  0.4416      0.188 0.000 0.600 0.000 0.372 0.008 NA
#> GSM1022390     2  0.4499      0.305 0.000 0.620 0.000 0.344 0.012 NA
#> GSM1022391     2  0.4432      0.256 0.000 0.616 0.000 0.352 0.008 NA
#> GSM1022392     2  0.4770      0.246 0.000 0.584 0.000 0.368 0.012 NA
#> GSM1022397     3  0.0146      0.891 0.000 0.000 0.996 0.000 0.000 NA
#> GSM1022398     3  0.0146      0.891 0.000 0.000 0.996 0.000 0.000 NA
#> GSM1022399     3  0.0146      0.891 0.000 0.000 0.996 0.000 0.000 NA
#> GSM1022400     3  0.0260      0.889 0.000 0.000 0.992 0.000 0.000 NA
#> GSM1022401     5  0.0146      0.933 0.000 0.000 0.000 0.000 0.996 NA
#> GSM1022402     5  0.0146      0.933 0.000 0.000 0.000 0.000 0.996 NA
#> GSM1022403     5  0.0000      0.932 0.000 0.000 0.000 0.000 1.000 NA
#> GSM1022404     5  0.0146      0.932 0.000 0.000 0.000 0.004 0.996 NA

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-CV-NMF-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-CV-NMF-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-CV-NMF-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-CV-NMF-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-CV-NMF-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-CV-NMF-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-CV-NMF-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-CV-NMF-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-CV-NMF-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-CV-NMF-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

plot of chunk tab-CV-NMF-get-signatures-1

get_signatures(res, k = 3)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

plot of chunk tab-CV-NMF-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-CV-NMF-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-CV-NMF-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-CV-NMF-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-CV-NMF-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-CV-NMF-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-CV-NMF-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-CV-NMF-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-CV-NMF-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk CV-NMF-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-CV-NMF-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-CV-NMF-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-CV-NMF-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-CV-NMF-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-CV-NMF-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk CV-NMF-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>         n protocol(p) cell.type(p) k
#> CV:NMF 79    3.39e-05     1.50e-08 2
#> CV:NMF 79    1.78e-10     2.17e-10 3
#> CV:NMF 80    5.59e-11     3.07e-17 4
#> CV:NMF 77    7.58e-16     7.52e-16 5
#> CV:NMF 66    2.67e-15     1.58e-13 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


MAD:hclust**

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["MAD", "hclust"]
# you can also extract it by
# res = res_list["MAD:hclust"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk MAD-hclust-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk MAD-hclust-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.838           0.914       0.959         0.4997 0.502   0.502
#> 3 3 0.926           0.927       0.968         0.2051 0.916   0.832
#> 4 4 0.785           0.825       0.849         0.1558 0.901   0.763
#> 5 5 0.886           0.925       0.910         0.0831 0.913   0.726
#> 6 6 1.000           0.999       1.000         0.0704 0.962   0.836

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 6
#> attr(,"optional")
#> [1] 3

There is also optional best \(k\) = 3 that is worth to check.

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1022325     2   0.000      0.923 0.000 1.000
#> GSM1022326     2   0.000      0.923 0.000 1.000
#> GSM1022327     2   0.000      0.923 0.000 1.000
#> GSM1022331     2   0.963      0.487 0.388 0.612
#> GSM1022332     2   0.963      0.487 0.388 0.612
#> GSM1022333     2   0.963      0.487 0.388 0.612
#> GSM1022328     2   0.000      0.923 0.000 1.000
#> GSM1022329     2   0.000      0.923 0.000 1.000
#> GSM1022330     2   0.000      0.923 0.000 1.000
#> GSM1022337     2   0.456      0.866 0.096 0.904
#> GSM1022338     2   0.456      0.866 0.096 0.904
#> GSM1022339     2   0.456      0.866 0.096 0.904
#> GSM1022334     2   0.000      0.923 0.000 1.000
#> GSM1022335     2   0.000      0.923 0.000 1.000
#> GSM1022336     2   0.000      0.923 0.000 1.000
#> GSM1022340     1   0.000      1.000 1.000 0.000
#> GSM1022341     1   0.000      1.000 1.000 0.000
#> GSM1022342     1   0.000      1.000 1.000 0.000
#> GSM1022343     1   0.000      1.000 1.000 0.000
#> GSM1022347     1   0.000      1.000 1.000 0.000
#> GSM1022348     1   0.000      1.000 1.000 0.000
#> GSM1022349     1   0.000      1.000 1.000 0.000
#> GSM1022350     1   0.000      1.000 1.000 0.000
#> GSM1022344     1   0.000      1.000 1.000 0.000
#> GSM1022345     1   0.000      1.000 1.000 0.000
#> GSM1022346     1   0.000      1.000 1.000 0.000
#> GSM1022355     1   0.000      1.000 1.000 0.000
#> GSM1022356     1   0.000      1.000 1.000 0.000
#> GSM1022357     1   0.000      1.000 1.000 0.000
#> GSM1022358     1   0.000      1.000 1.000 0.000
#> GSM1022351     1   0.000      1.000 1.000 0.000
#> GSM1022352     1   0.000      1.000 1.000 0.000
#> GSM1022353     1   0.000      1.000 1.000 0.000
#> GSM1022354     1   0.000      1.000 1.000 0.000
#> GSM1022359     2   0.000      0.923 0.000 1.000
#> GSM1022360     2   0.000      0.923 0.000 1.000
#> GSM1022361     2   0.000      0.923 0.000 1.000
#> GSM1022362     2   0.000      0.923 0.000 1.000
#> GSM1022367     2   0.963      0.487 0.388 0.612
#> GSM1022368     2   0.963      0.487 0.388 0.612
#> GSM1022369     2   0.963      0.487 0.388 0.612
#> GSM1022370     2   0.963      0.487 0.388 0.612
#> GSM1022363     2   0.000      0.923 0.000 1.000
#> GSM1022364     2   0.000      0.923 0.000 1.000
#> GSM1022365     2   0.000      0.923 0.000 1.000
#> GSM1022366     2   0.000      0.923 0.000 1.000
#> GSM1022374     2   0.456      0.866 0.096 0.904
#> GSM1022375     2   0.456      0.866 0.096 0.904
#> GSM1022376     2   0.456      0.866 0.096 0.904
#> GSM1022371     2   0.000      0.923 0.000 1.000
#> GSM1022372     2   0.000      0.923 0.000 1.000
#> GSM1022373     2   0.000      0.923 0.000 1.000
#> GSM1022377     2   0.000      0.923 0.000 1.000
#> GSM1022378     2   0.000      0.923 0.000 1.000
#> GSM1022379     2   0.000      0.923 0.000 1.000
#> GSM1022380     2   0.000      0.923 0.000 1.000
#> GSM1022385     1   0.000      1.000 1.000 0.000
#> GSM1022386     1   0.000      1.000 1.000 0.000
#> GSM1022387     1   0.000      1.000 1.000 0.000
#> GSM1022388     1   0.000      1.000 1.000 0.000
#> GSM1022381     2   0.000      0.923 0.000 1.000
#> GSM1022382     2   0.000      0.923 0.000 1.000
#> GSM1022383     2   0.000      0.923 0.000 1.000
#> GSM1022384     2   0.000      0.923 0.000 1.000
#> GSM1022393     1   0.000      1.000 1.000 0.000
#> GSM1022394     1   0.000      1.000 1.000 0.000
#> GSM1022395     1   0.000      1.000 1.000 0.000
#> GSM1022396     1   0.000      1.000 1.000 0.000
#> GSM1022389     2   0.000      0.923 0.000 1.000
#> GSM1022390     2   0.000      0.923 0.000 1.000
#> GSM1022391     2   0.000      0.923 0.000 1.000
#> GSM1022392     2   0.000      0.923 0.000 1.000
#> GSM1022397     1   0.000      1.000 1.000 0.000
#> GSM1022398     1   0.000      1.000 1.000 0.000
#> GSM1022399     1   0.000      1.000 1.000 0.000
#> GSM1022400     1   0.000      1.000 1.000 0.000
#> GSM1022401     1   0.000      1.000 1.000 0.000
#> GSM1022402     1   0.000      1.000 1.000 0.000
#> GSM1022403     1   0.000      1.000 1.000 0.000
#> GSM1022404     1   0.000      1.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1022325     2  0.0000      0.929 0.000 1.000 0.000
#> GSM1022326     2  0.0000      0.929 0.000 1.000 0.000
#> GSM1022327     2  0.0000      0.929 0.000 1.000 0.000
#> GSM1022331     3  0.0475      1.000 0.004 0.004 0.992
#> GSM1022332     3  0.0475      1.000 0.004 0.004 0.992
#> GSM1022333     3  0.0475      1.000 0.004 0.004 0.992
#> GSM1022328     2  0.0000      0.929 0.000 1.000 0.000
#> GSM1022329     2  0.0000      0.929 0.000 1.000 0.000
#> GSM1022330     2  0.0000      0.929 0.000 1.000 0.000
#> GSM1022337     2  0.6126      0.421 0.000 0.600 0.400
#> GSM1022338     2  0.6126      0.421 0.000 0.600 0.400
#> GSM1022339     2  0.6126      0.421 0.000 0.600 0.400
#> GSM1022334     2  0.0000      0.929 0.000 1.000 0.000
#> GSM1022335     2  0.0000      0.929 0.000 1.000 0.000
#> GSM1022336     2  0.0000      0.929 0.000 1.000 0.000
#> GSM1022340     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022341     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022342     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022343     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022347     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022348     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022349     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022350     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022344     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022345     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022346     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022355     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022356     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022357     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022358     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022351     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022352     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022353     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022354     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022359     2  0.0000      0.929 0.000 1.000 0.000
#> GSM1022360     2  0.0000      0.929 0.000 1.000 0.000
#> GSM1022361     2  0.0000      0.929 0.000 1.000 0.000
#> GSM1022362     2  0.0000      0.929 0.000 1.000 0.000
#> GSM1022367     3  0.0475      1.000 0.004 0.004 0.992
#> GSM1022368     3  0.0475      1.000 0.004 0.004 0.992
#> GSM1022369     3  0.0475      1.000 0.004 0.004 0.992
#> GSM1022370     3  0.0475      1.000 0.004 0.004 0.992
#> GSM1022363     2  0.0000      0.929 0.000 1.000 0.000
#> GSM1022364     2  0.0000      0.929 0.000 1.000 0.000
#> GSM1022365     2  0.0000      0.929 0.000 1.000 0.000
#> GSM1022366     2  0.0000      0.929 0.000 1.000 0.000
#> GSM1022374     2  0.6126      0.421 0.000 0.600 0.400
#> GSM1022375     2  0.6126      0.421 0.000 0.600 0.400
#> GSM1022376     2  0.6126      0.421 0.000 0.600 0.400
#> GSM1022371     2  0.0000      0.929 0.000 1.000 0.000
#> GSM1022372     2  0.0000      0.929 0.000 1.000 0.000
#> GSM1022373     2  0.0000      0.929 0.000 1.000 0.000
#> GSM1022377     2  0.0237      0.928 0.000 0.996 0.004
#> GSM1022378     2  0.0237      0.928 0.000 0.996 0.004
#> GSM1022379     2  0.0237      0.928 0.000 0.996 0.004
#> GSM1022380     2  0.0237      0.928 0.000 0.996 0.004
#> GSM1022385     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022386     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022387     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022388     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022381     2  0.0237      0.928 0.000 0.996 0.004
#> GSM1022382     2  0.0237      0.928 0.000 0.996 0.004
#> GSM1022383     2  0.0237      0.928 0.000 0.996 0.004
#> GSM1022384     2  0.0237      0.928 0.000 0.996 0.004
#> GSM1022393     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022394     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022395     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022396     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022389     2  0.0237      0.928 0.000 0.996 0.004
#> GSM1022390     2  0.0237      0.928 0.000 0.996 0.004
#> GSM1022391     2  0.0237      0.928 0.000 0.996 0.004
#> GSM1022392     2  0.0237      0.928 0.000 0.996 0.004
#> GSM1022397     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022398     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022399     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022400     1  0.0000      0.999 1.000 0.000 0.000
#> GSM1022401     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022402     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022403     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022404     1  0.0237      0.997 0.996 0.000 0.004

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1  p2    p3    p4
#> GSM1022325     2   0.000      0.826 0.000 1.0 0.000 0.000
#> GSM1022326     2   0.000      0.826 0.000 1.0 0.000 0.000
#> GSM1022327     2   0.000      0.826 0.000 1.0 0.000 0.000
#> GSM1022331     3   0.484      1.000 0.000 0.0 0.604 0.396
#> GSM1022332     3   0.484      1.000 0.000 0.0 0.604 0.396
#> GSM1022333     3   0.484      1.000 0.000 0.0 0.604 0.396
#> GSM1022328     2   0.000      0.826 0.000 1.0 0.000 0.000
#> GSM1022329     2   0.000      0.826 0.000 1.0 0.000 0.000
#> GSM1022330     2   0.000      0.826 0.000 1.0 0.000 0.000
#> GSM1022337     2   0.485      0.380 0.000 0.6 0.000 0.400
#> GSM1022338     2   0.485      0.380 0.000 0.6 0.000 0.400
#> GSM1022339     2   0.485      0.380 0.000 0.6 0.000 0.400
#> GSM1022334     2   0.000      0.826 0.000 1.0 0.000 0.000
#> GSM1022335     2   0.000      0.826 0.000 1.0 0.000 0.000
#> GSM1022336     2   0.000      0.826 0.000 1.0 0.000 0.000
#> GSM1022340     1   0.484      0.860 0.604 0.0 0.396 0.000
#> GSM1022341     1   0.484      0.860 0.604 0.0 0.396 0.000
#> GSM1022342     1   0.484      0.860 0.604 0.0 0.396 0.000
#> GSM1022343     1   0.484      0.860 0.604 0.0 0.396 0.000
#> GSM1022347     1   0.000      0.702 1.000 0.0 0.000 0.000
#> GSM1022348     1   0.000      0.702 1.000 0.0 0.000 0.000
#> GSM1022349     1   0.000      0.702 1.000 0.0 0.000 0.000
#> GSM1022350     1   0.000      0.702 1.000 0.0 0.000 0.000
#> GSM1022344     1   0.484      0.860 0.604 0.0 0.396 0.000
#> GSM1022345     1   0.484      0.860 0.604 0.0 0.396 0.000
#> GSM1022346     1   0.484      0.860 0.604 0.0 0.396 0.000
#> GSM1022355     1   0.484      0.860 0.604 0.0 0.396 0.000
#> GSM1022356     1   0.484      0.860 0.604 0.0 0.396 0.000
#> GSM1022357     1   0.484      0.860 0.604 0.0 0.396 0.000
#> GSM1022358     1   0.484      0.860 0.604 0.0 0.396 0.000
#> GSM1022351     1   0.484      0.860 0.604 0.0 0.396 0.000
#> GSM1022352     1   0.484      0.860 0.604 0.0 0.396 0.000
#> GSM1022353     1   0.484      0.860 0.604 0.0 0.396 0.000
#> GSM1022354     1   0.484      0.860 0.604 0.0 0.396 0.000
#> GSM1022359     2   0.000      0.826 0.000 1.0 0.000 0.000
#> GSM1022360     2   0.000      0.826 0.000 1.0 0.000 0.000
#> GSM1022361     2   0.000      0.826 0.000 1.0 0.000 0.000
#> GSM1022362     2   0.000      0.826 0.000 1.0 0.000 0.000
#> GSM1022367     3   0.484      1.000 0.000 0.0 0.604 0.396
#> GSM1022368     3   0.484      1.000 0.000 0.0 0.604 0.396
#> GSM1022369     3   0.484      1.000 0.000 0.0 0.604 0.396
#> GSM1022370     3   0.484      1.000 0.000 0.0 0.604 0.396
#> GSM1022363     2   0.000      0.826 0.000 1.0 0.000 0.000
#> GSM1022364     2   0.000      0.826 0.000 1.0 0.000 0.000
#> GSM1022365     2   0.000      0.826 0.000 1.0 0.000 0.000
#> GSM1022366     2   0.000      0.826 0.000 1.0 0.000 0.000
#> GSM1022374     2   0.485      0.380 0.000 0.6 0.000 0.400
#> GSM1022375     2   0.485      0.380 0.000 0.6 0.000 0.400
#> GSM1022376     2   0.485      0.380 0.000 0.6 0.000 0.400
#> GSM1022371     2   0.000      0.826 0.000 1.0 0.000 0.000
#> GSM1022372     2   0.000      0.826 0.000 1.0 0.000 0.000
#> GSM1022373     2   0.000      0.826 0.000 1.0 0.000 0.000
#> GSM1022377     4   0.485      1.000 0.000 0.4 0.000 0.600
#> GSM1022378     4   0.485      1.000 0.000 0.4 0.000 0.600
#> GSM1022379     4   0.485      1.000 0.000 0.4 0.000 0.600
#> GSM1022380     4   0.485      1.000 0.000 0.4 0.000 0.600
#> GSM1022385     1   0.000      0.702 1.000 0.0 0.000 0.000
#> GSM1022386     1   0.000      0.702 1.000 0.0 0.000 0.000
#> GSM1022387     1   0.000      0.702 1.000 0.0 0.000 0.000
#> GSM1022388     1   0.000      0.702 1.000 0.0 0.000 0.000
#> GSM1022381     4   0.485      1.000 0.000 0.4 0.000 0.600
#> GSM1022382     4   0.485      1.000 0.000 0.4 0.000 0.600
#> GSM1022383     4   0.485      1.000 0.000 0.4 0.000 0.600
#> GSM1022384     4   0.485      1.000 0.000 0.4 0.000 0.600
#> GSM1022393     1   0.502      0.858 0.600 0.0 0.396 0.004
#> GSM1022394     1   0.502      0.858 0.600 0.0 0.396 0.004
#> GSM1022395     1   0.502      0.858 0.600 0.0 0.396 0.004
#> GSM1022396     1   0.502      0.858 0.600 0.0 0.396 0.004
#> GSM1022389     4   0.485      1.000 0.000 0.4 0.000 0.600
#> GSM1022390     4   0.485      1.000 0.000 0.4 0.000 0.600
#> GSM1022391     4   0.485      1.000 0.000 0.4 0.000 0.600
#> GSM1022392     4   0.485      1.000 0.000 0.4 0.000 0.600
#> GSM1022397     1   0.000      0.702 1.000 0.0 0.000 0.000
#> GSM1022398     1   0.000      0.702 1.000 0.0 0.000 0.000
#> GSM1022399     1   0.000      0.702 1.000 0.0 0.000 0.000
#> GSM1022400     1   0.000      0.702 1.000 0.0 0.000 0.000
#> GSM1022401     1   0.502      0.858 0.600 0.0 0.396 0.004
#> GSM1022402     1   0.502      0.858 0.600 0.0 0.396 0.004
#> GSM1022403     1   0.502      0.858 0.600 0.0 0.396 0.004
#> GSM1022404     1   0.502      0.858 0.600 0.0 0.396 0.004

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2 p3  p4 p5
#> GSM1022325     2  0.4182      0.840 0.000 0.600  0 0.4  0
#> GSM1022326     2  0.4182      0.840 0.000 0.600  0 0.4  0
#> GSM1022327     2  0.4182      0.840 0.000 0.600  0 0.4  0
#> GSM1022331     5  0.0000      1.000 0.000 0.000  0 0.0  1
#> GSM1022332     5  0.0000      1.000 0.000 0.000  0 0.0  1
#> GSM1022333     5  0.0000      1.000 0.000 0.000  0 0.0  1
#> GSM1022328     2  0.4182      0.840 0.000 0.600  0 0.4  0
#> GSM1022329     2  0.4182      0.840 0.000 0.600  0 0.4  0
#> GSM1022330     2  0.4182      0.840 0.000 0.600  0 0.4  0
#> GSM1022337     2  0.0000      0.545 0.000 1.000  0 0.0  0
#> GSM1022338     2  0.0000      0.545 0.000 1.000  0 0.0  0
#> GSM1022339     2  0.0000      0.545 0.000 1.000  0 0.0  0
#> GSM1022334     2  0.4182      0.840 0.000 0.600  0 0.4  0
#> GSM1022335     2  0.4182      0.840 0.000 0.600  0 0.4  0
#> GSM1022336     2  0.4182      0.840 0.000 0.600  0 0.4  0
#> GSM1022340     1  0.0000      0.999 1.000 0.000  0 0.0  0
#> GSM1022341     1  0.0000      0.999 1.000 0.000  0 0.0  0
#> GSM1022342     1  0.0000      0.999 1.000 0.000  0 0.0  0
#> GSM1022343     1  0.0000      0.999 1.000 0.000  0 0.0  0
#> GSM1022347     3  0.0000      1.000 0.000 0.000  1 0.0  0
#> GSM1022348     3  0.0000      1.000 0.000 0.000  1 0.0  0
#> GSM1022349     3  0.0000      1.000 0.000 0.000  1 0.0  0
#> GSM1022350     3  0.0000      1.000 0.000 0.000  1 0.0  0
#> GSM1022344     1  0.0000      0.999 1.000 0.000  0 0.0  0
#> GSM1022345     1  0.0000      0.999 1.000 0.000  0 0.0  0
#> GSM1022346     1  0.0000      0.999 1.000 0.000  0 0.0  0
#> GSM1022355     1  0.0000      0.999 1.000 0.000  0 0.0  0
#> GSM1022356     1  0.0000      0.999 1.000 0.000  0 0.0  0
#> GSM1022357     1  0.0000      0.999 1.000 0.000  0 0.0  0
#> GSM1022358     1  0.0000      0.999 1.000 0.000  0 0.0  0
#> GSM1022351     1  0.0000      0.999 1.000 0.000  0 0.0  0
#> GSM1022352     1  0.0000      0.999 1.000 0.000  0 0.0  0
#> GSM1022353     1  0.0000      0.999 1.000 0.000  0 0.0  0
#> GSM1022354     1  0.0000      0.999 1.000 0.000  0 0.0  0
#> GSM1022359     2  0.4182      0.840 0.000 0.600  0 0.4  0
#> GSM1022360     2  0.4182      0.840 0.000 0.600  0 0.4  0
#> GSM1022361     2  0.4182      0.840 0.000 0.600  0 0.4  0
#> GSM1022362     2  0.4182      0.840 0.000 0.600  0 0.4  0
#> GSM1022367     5  0.0000      1.000 0.000 0.000  0 0.0  1
#> GSM1022368     5  0.0000      1.000 0.000 0.000  0 0.0  1
#> GSM1022369     5  0.0000      1.000 0.000 0.000  0 0.0  1
#> GSM1022370     5  0.0000      1.000 0.000 0.000  0 0.0  1
#> GSM1022363     2  0.4182      0.840 0.000 0.600  0 0.4  0
#> GSM1022364     2  0.4182      0.840 0.000 0.600  0 0.4  0
#> GSM1022365     2  0.4182      0.840 0.000 0.600  0 0.4  0
#> GSM1022366     2  0.4182      0.840 0.000 0.600  0 0.4  0
#> GSM1022374     2  0.0000      0.545 0.000 1.000  0 0.0  0
#> GSM1022375     2  0.0000      0.545 0.000 1.000  0 0.0  0
#> GSM1022376     2  0.0000      0.545 0.000 1.000  0 0.0  0
#> GSM1022371     2  0.4182      0.840 0.000 0.600  0 0.4  0
#> GSM1022372     2  0.4182      0.840 0.000 0.600  0 0.4  0
#> GSM1022373     2  0.4182      0.840 0.000 0.600  0 0.4  0
#> GSM1022377     4  0.0000      1.000 0.000 0.000  0 1.0  0
#> GSM1022378     4  0.0000      1.000 0.000 0.000  0 1.0  0
#> GSM1022379     4  0.0000      1.000 0.000 0.000  0 1.0  0
#> GSM1022380     4  0.0000      1.000 0.000 0.000  0 1.0  0
#> GSM1022385     3  0.0000      1.000 0.000 0.000  1 0.0  0
#> GSM1022386     3  0.0000      1.000 0.000 0.000  1 0.0  0
#> GSM1022387     3  0.0000      1.000 0.000 0.000  1 0.0  0
#> GSM1022388     3  0.0000      1.000 0.000 0.000  1 0.0  0
#> GSM1022381     4  0.0000      1.000 0.000 0.000  0 1.0  0
#> GSM1022382     4  0.0000      1.000 0.000 0.000  0 1.0  0
#> GSM1022383     4  0.0000      1.000 0.000 0.000  0 1.0  0
#> GSM1022384     4  0.0000      1.000 0.000 0.000  0 1.0  0
#> GSM1022393     1  0.0162      0.997 0.996 0.004  0 0.0  0
#> GSM1022394     1  0.0162      0.997 0.996 0.004  0 0.0  0
#> GSM1022395     1  0.0162      0.997 0.996 0.004  0 0.0  0
#> GSM1022396     1  0.0162      0.997 0.996 0.004  0 0.0  0
#> GSM1022389     4  0.0000      1.000 0.000 0.000  0 1.0  0
#> GSM1022390     4  0.0000      1.000 0.000 0.000  0 1.0  0
#> GSM1022391     4  0.0000      1.000 0.000 0.000  0 1.0  0
#> GSM1022392     4  0.0000      1.000 0.000 0.000  0 1.0  0
#> GSM1022397     3  0.0000      1.000 0.000 0.000  1 0.0  0
#> GSM1022398     3  0.0000      1.000 0.000 0.000  1 0.0  0
#> GSM1022399     3  0.0000      1.000 0.000 0.000  1 0.0  0
#> GSM1022400     3  0.0000      1.000 0.000 0.000  1 0.0  0
#> GSM1022401     1  0.0162      0.997 0.996 0.004  0 0.0  0
#> GSM1022402     1  0.0162      0.997 0.996 0.004  0 0.0  0
#> GSM1022403     1  0.0162      0.997 0.996 0.004  0 0.0  0
#> GSM1022404     1  0.0162      0.997 0.996 0.004  0 0.0  0

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1 p2 p3 p4    p5 p6
#> GSM1022325     2  0.0000      1.000 0.000  1  0  0 0.000  0
#> GSM1022326     2  0.0000      1.000 0.000  1  0  0 0.000  0
#> GSM1022327     2  0.0000      1.000 0.000  1  0  0 0.000  0
#> GSM1022331     6  0.0000      1.000 0.000  0  0  0 0.000  1
#> GSM1022332     6  0.0000      1.000 0.000  0  0  0 0.000  1
#> GSM1022333     6  0.0000      1.000 0.000  0  0  0 0.000  1
#> GSM1022328     2  0.0000      1.000 0.000  1  0  0 0.000  0
#> GSM1022329     2  0.0000      1.000 0.000  1  0  0 0.000  0
#> GSM1022330     2  0.0000      1.000 0.000  1  0  0 0.000  0
#> GSM1022337     5  0.0000      1.000 0.000  0  0  0 1.000  0
#> GSM1022338     5  0.0000      1.000 0.000  0  0  0 1.000  0
#> GSM1022339     5  0.0000      1.000 0.000  0  0  0 1.000  0
#> GSM1022334     2  0.0000      1.000 0.000  1  0  0 0.000  0
#> GSM1022335     2  0.0000      1.000 0.000  1  0  0 0.000  0
#> GSM1022336     2  0.0000      1.000 0.000  1  0  0 0.000  0
#> GSM1022340     1  0.0000      0.999 1.000  0  0  0 0.000  0
#> GSM1022341     1  0.0000      0.999 1.000  0  0  0 0.000  0
#> GSM1022342     1  0.0000      0.999 1.000  0  0  0 0.000  0
#> GSM1022343     1  0.0000      0.999 1.000  0  0  0 0.000  0
#> GSM1022347     3  0.0000      1.000 0.000  0  1  0 0.000  0
#> GSM1022348     3  0.0000      1.000 0.000  0  1  0 0.000  0
#> GSM1022349     3  0.0000      1.000 0.000  0  1  0 0.000  0
#> GSM1022350     3  0.0000      1.000 0.000  0  1  0 0.000  0
#> GSM1022344     1  0.0000      0.999 1.000  0  0  0 0.000  0
#> GSM1022345     1  0.0000      0.999 1.000  0  0  0 0.000  0
#> GSM1022346     1  0.0000      0.999 1.000  0  0  0 0.000  0
#> GSM1022355     1  0.0000      0.999 1.000  0  0  0 0.000  0
#> GSM1022356     1  0.0000      0.999 1.000  0  0  0 0.000  0
#> GSM1022357     1  0.0000      0.999 1.000  0  0  0 0.000  0
#> GSM1022358     1  0.0000      0.999 1.000  0  0  0 0.000  0
#> GSM1022351     1  0.0000      0.999 1.000  0  0  0 0.000  0
#> GSM1022352     1  0.0000      0.999 1.000  0  0  0 0.000  0
#> GSM1022353     1  0.0000      0.999 1.000  0  0  0 0.000  0
#> GSM1022354     1  0.0000      0.999 1.000  0  0  0 0.000  0
#> GSM1022359     2  0.0000      1.000 0.000  1  0  0 0.000  0
#> GSM1022360     2  0.0000      1.000 0.000  1  0  0 0.000  0
#> GSM1022361     2  0.0000      1.000 0.000  1  0  0 0.000  0
#> GSM1022362     2  0.0000      1.000 0.000  1  0  0 0.000  0
#> GSM1022367     6  0.0000      1.000 0.000  0  0  0 0.000  1
#> GSM1022368     6  0.0000      1.000 0.000  0  0  0 0.000  1
#> GSM1022369     6  0.0000      1.000 0.000  0  0  0 0.000  1
#> GSM1022370     6  0.0000      1.000 0.000  0  0  0 0.000  1
#> GSM1022363     2  0.0000      1.000 0.000  1  0  0 0.000  0
#> GSM1022364     2  0.0000      1.000 0.000  1  0  0 0.000  0
#> GSM1022365     2  0.0000      1.000 0.000  1  0  0 0.000  0
#> GSM1022366     2  0.0000      1.000 0.000  1  0  0 0.000  0
#> GSM1022374     5  0.0000      1.000 0.000  0  0  0 1.000  0
#> GSM1022375     5  0.0000      1.000 0.000  0  0  0 1.000  0
#> GSM1022376     5  0.0000      1.000 0.000  0  0  0 1.000  0
#> GSM1022371     2  0.0000      1.000 0.000  1  0  0 0.000  0
#> GSM1022372     2  0.0000      1.000 0.000  1  0  0 0.000  0
#> GSM1022373     2  0.0000      1.000 0.000  1  0  0 0.000  0
#> GSM1022377     4  0.0000      1.000 0.000  0  0  1 0.000  0
#> GSM1022378     4  0.0000      1.000 0.000  0  0  1 0.000  0
#> GSM1022379     4  0.0000      1.000 0.000  0  0  1 0.000  0
#> GSM1022380     4  0.0000      1.000 0.000  0  0  1 0.000  0
#> GSM1022385     3  0.0000      1.000 0.000  0  1  0 0.000  0
#> GSM1022386     3  0.0000      1.000 0.000  0  1  0 0.000  0
#> GSM1022387     3  0.0000      1.000 0.000  0  1  0 0.000  0
#> GSM1022388     3  0.0000      1.000 0.000  0  1  0 0.000  0
#> GSM1022381     4  0.0000      1.000 0.000  0  0  1 0.000  0
#> GSM1022382     4  0.0000      1.000 0.000  0  0  1 0.000  0
#> GSM1022383     4  0.0000      1.000 0.000  0  0  1 0.000  0
#> GSM1022384     4  0.0000      1.000 0.000  0  0  1 0.000  0
#> GSM1022393     1  0.0146      0.997 0.996  0  0  0 0.004  0
#> GSM1022394     1  0.0146      0.997 0.996  0  0  0 0.004  0
#> GSM1022395     1  0.0146      0.997 0.996  0  0  0 0.004  0
#> GSM1022396     1  0.0146      0.997 0.996  0  0  0 0.004  0
#> GSM1022389     4  0.0000      1.000 0.000  0  0  1 0.000  0
#> GSM1022390     4  0.0000      1.000 0.000  0  0  1 0.000  0
#> GSM1022391     4  0.0000      1.000 0.000  0  0  1 0.000  0
#> GSM1022392     4  0.0000      1.000 0.000  0  0  1 0.000  0
#> GSM1022397     3  0.0000      1.000 0.000  0  1  0 0.000  0
#> GSM1022398     3  0.0000      1.000 0.000  0  1  0 0.000  0
#> GSM1022399     3  0.0000      1.000 0.000  0  1  0 0.000  0
#> GSM1022400     3  0.0000      1.000 0.000  0  1  0 0.000  0
#> GSM1022401     1  0.0146      0.997 0.996  0  0  0 0.004  0
#> GSM1022402     1  0.0146      0.997 0.996  0  0  0 0.004  0
#> GSM1022403     1  0.0146      0.997 0.996  0  0  0 0.004  0
#> GSM1022404     1  0.0146      0.997 0.996  0  0  0 0.004  0

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-hclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-MAD-hclust-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-MAD-hclust-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-MAD-hclust-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-MAD-hclust-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-MAD-hclust-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-MAD-hclust-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-MAD-hclust-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-MAD-hclust-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-MAD-hclust-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-MAD-hclust-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-MAD-hclust-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-MAD-hclust-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-MAD-hclust-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-MAD-hclust-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-MAD-hclust-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-MAD-hclust-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-MAD-hclust-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-MAD-hclust-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-MAD-hclust-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-hclust-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-MAD-hclust-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-MAD-hclust-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-MAD-hclust-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-MAD-hclust-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-MAD-hclust-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-hclust-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>             n protocol(p) cell.type(p) k
#> MAD:hclust 73    1.81e-07     1.42e-05 2
#> MAD:hclust 74    3.24e-08     4.57e-10 3
#> MAD:hclust 74    3.92e-13     2.44e-09 4
#> MAD:hclust 80    5.03e-20     9.50e-08 5
#> MAD:hclust 80    3.12e-20     5.27e-11 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


MAD:kmeans*

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["MAD", "kmeans"]
# you can also extract it by
# res = res_list["MAD:kmeans"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk MAD-kmeans-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk MAD-kmeans-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.902           0.947       0.966         0.5001 0.495   0.495
#> 3 3 0.566           0.657       0.739         0.2742 0.836   0.679
#> 4 4 0.617           0.695       0.723         0.1256 0.851   0.613
#> 5 5 0.693           0.782       0.787         0.0723 0.930   0.738
#> 6 6 0.701           0.749       0.758         0.0466 0.992   0.963

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 2

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1022325     2   0.000      0.948 0.000 1.000
#> GSM1022326     2   0.000      0.948 0.000 1.000
#> GSM1022327     2   0.000      0.948 0.000 1.000
#> GSM1022331     1   0.224      0.954 0.964 0.036
#> GSM1022332     1   0.224      0.954 0.964 0.036
#> GSM1022333     1   0.224      0.954 0.964 0.036
#> GSM1022328     2   0.000      0.948 0.000 1.000
#> GSM1022329     2   0.000      0.948 0.000 1.000
#> GSM1022330     2   0.000      0.948 0.000 1.000
#> GSM1022337     2   0.795      0.694 0.240 0.760
#> GSM1022338     2   0.795      0.694 0.240 0.760
#> GSM1022339     2   0.795      0.694 0.240 0.760
#> GSM1022334     2   0.000      0.948 0.000 1.000
#> GSM1022335     2   0.000      0.948 0.000 1.000
#> GSM1022336     2   0.000      0.948 0.000 1.000
#> GSM1022340     1   0.204      0.981 0.968 0.032
#> GSM1022341     1   0.204      0.981 0.968 0.032
#> GSM1022342     1   0.204      0.981 0.968 0.032
#> GSM1022343     1   0.204      0.981 0.968 0.032
#> GSM1022347     1   0.000      0.978 1.000 0.000
#> GSM1022348     1   0.000      0.978 1.000 0.000
#> GSM1022349     1   0.000      0.978 1.000 0.000
#> GSM1022350     1   0.000      0.978 1.000 0.000
#> GSM1022344     1   0.000      0.978 1.000 0.000
#> GSM1022345     1   0.000      0.978 1.000 0.000
#> GSM1022346     1   0.000      0.978 1.000 0.000
#> GSM1022355     1   0.204      0.981 0.968 0.032
#> GSM1022356     1   0.204      0.981 0.968 0.032
#> GSM1022357     1   0.204      0.981 0.968 0.032
#> GSM1022358     1   0.204      0.981 0.968 0.032
#> GSM1022351     1   0.204      0.981 0.968 0.032
#> GSM1022352     1   0.204      0.981 0.968 0.032
#> GSM1022353     1   0.204      0.981 0.968 0.032
#> GSM1022354     1   0.204      0.981 0.968 0.032
#> GSM1022359     2   0.000      0.948 0.000 1.000
#> GSM1022360     2   0.000      0.948 0.000 1.000
#> GSM1022361     2   0.000      0.948 0.000 1.000
#> GSM1022362     2   0.000      0.948 0.000 1.000
#> GSM1022367     2   0.184      0.934 0.028 0.972
#> GSM1022368     2   0.184      0.934 0.028 0.972
#> GSM1022369     2   0.184      0.934 0.028 0.972
#> GSM1022370     2   0.184      0.934 0.028 0.972
#> GSM1022363     2   0.000      0.948 0.000 1.000
#> GSM1022364     2   0.000      0.948 0.000 1.000
#> GSM1022365     2   0.000      0.948 0.000 1.000
#> GSM1022366     2   0.000      0.948 0.000 1.000
#> GSM1022374     2   0.000      0.948 0.000 1.000
#> GSM1022375     2   0.000      0.948 0.000 1.000
#> GSM1022376     2   0.000      0.948 0.000 1.000
#> GSM1022371     2   0.000      0.948 0.000 1.000
#> GSM1022372     2   0.000      0.948 0.000 1.000
#> GSM1022373     2   0.000      0.948 0.000 1.000
#> GSM1022377     2   0.456      0.911 0.096 0.904
#> GSM1022378     2   0.456      0.911 0.096 0.904
#> GSM1022379     2   0.456      0.911 0.096 0.904
#> GSM1022380     2   0.456      0.911 0.096 0.904
#> GSM1022385     1   0.000      0.978 1.000 0.000
#> GSM1022386     1   0.000      0.978 1.000 0.000
#> GSM1022387     1   0.000      0.978 1.000 0.000
#> GSM1022388     1   0.000      0.978 1.000 0.000
#> GSM1022381     2   0.456      0.911 0.096 0.904
#> GSM1022382     2   0.456      0.911 0.096 0.904
#> GSM1022383     2   0.456      0.911 0.096 0.904
#> GSM1022384     2   0.456      0.911 0.096 0.904
#> GSM1022393     1   0.204      0.981 0.968 0.032
#> GSM1022394     1   0.204      0.981 0.968 0.032
#> GSM1022395     1   0.204      0.981 0.968 0.032
#> GSM1022396     1   0.204      0.981 0.968 0.032
#> GSM1022389     2   0.456      0.911 0.096 0.904
#> GSM1022390     2   0.456      0.911 0.096 0.904
#> GSM1022391     2   0.456      0.911 0.096 0.904
#> GSM1022392     2   0.456      0.911 0.096 0.904
#> GSM1022397     1   0.000      0.978 1.000 0.000
#> GSM1022398     1   0.000      0.978 1.000 0.000
#> GSM1022399     1   0.000      0.978 1.000 0.000
#> GSM1022400     1   0.000      0.978 1.000 0.000
#> GSM1022401     1   0.204      0.981 0.968 0.032
#> GSM1022402     1   0.204      0.981 0.968 0.032
#> GSM1022403     1   0.204      0.981 0.968 0.032
#> GSM1022404     1   0.204      0.981 0.968 0.032

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1022325     2  0.0000      0.826 0.000 1.000 0.000
#> GSM1022326     2  0.0000      0.826 0.000 1.000 0.000
#> GSM1022327     2  0.0000      0.826 0.000 1.000 0.000
#> GSM1022331     3  0.5138      0.508 0.252 0.000 0.748
#> GSM1022332     3  0.5138      0.508 0.252 0.000 0.748
#> GSM1022333     3  0.5138      0.508 0.252 0.000 0.748
#> GSM1022328     2  0.0000      0.826 0.000 1.000 0.000
#> GSM1022329     2  0.0000      0.826 0.000 1.000 0.000
#> GSM1022330     2  0.0000      0.826 0.000 1.000 0.000
#> GSM1022337     1  0.6967      0.205 0.668 0.288 0.044
#> GSM1022338     1  0.6967      0.205 0.668 0.288 0.044
#> GSM1022339     1  0.6967      0.205 0.668 0.288 0.044
#> GSM1022334     2  0.0000      0.826 0.000 1.000 0.000
#> GSM1022335     2  0.0000      0.826 0.000 1.000 0.000
#> GSM1022336     2  0.0000      0.826 0.000 1.000 0.000
#> GSM1022340     3  0.6267     -0.527 0.452 0.000 0.548
#> GSM1022341     3  0.6267     -0.527 0.452 0.000 0.548
#> GSM1022342     3  0.6267     -0.527 0.452 0.000 0.548
#> GSM1022343     3  0.6267     -0.527 0.452 0.000 0.548
#> GSM1022347     3  0.0000      0.767 0.000 0.000 1.000
#> GSM1022348     3  0.0000      0.767 0.000 0.000 1.000
#> GSM1022349     3  0.0000      0.767 0.000 0.000 1.000
#> GSM1022350     3  0.0000      0.767 0.000 0.000 1.000
#> GSM1022344     3  0.1964      0.714 0.056 0.000 0.944
#> GSM1022345     3  0.1964      0.714 0.056 0.000 0.944
#> GSM1022346     3  0.1964      0.714 0.056 0.000 0.944
#> GSM1022355     1  0.6260      0.767 0.552 0.000 0.448
#> GSM1022356     1  0.6260      0.767 0.552 0.000 0.448
#> GSM1022357     1  0.6260      0.767 0.552 0.000 0.448
#> GSM1022358     1  0.6260      0.767 0.552 0.000 0.448
#> GSM1022351     1  0.6260      0.767 0.552 0.000 0.448
#> GSM1022352     1  0.6260      0.767 0.552 0.000 0.448
#> GSM1022353     1  0.6260      0.767 0.552 0.000 0.448
#> GSM1022354     1  0.6260      0.767 0.552 0.000 0.448
#> GSM1022359     2  0.1031      0.824 0.024 0.976 0.000
#> GSM1022360     2  0.1031      0.824 0.024 0.976 0.000
#> GSM1022361     2  0.1031      0.824 0.024 0.976 0.000
#> GSM1022362     2  0.1031      0.824 0.024 0.976 0.000
#> GSM1022367     2  0.7159      0.659 0.288 0.660 0.052
#> GSM1022368     2  0.7159      0.659 0.288 0.660 0.052
#> GSM1022369     2  0.7159      0.659 0.288 0.660 0.052
#> GSM1022370     2  0.7159      0.659 0.288 0.660 0.052
#> GSM1022363     2  0.2625      0.807 0.084 0.916 0.000
#> GSM1022364     2  0.2625      0.807 0.084 0.916 0.000
#> GSM1022365     2  0.2625      0.807 0.084 0.916 0.000
#> GSM1022366     2  0.2625      0.807 0.084 0.916 0.000
#> GSM1022374     2  0.6468      0.471 0.444 0.552 0.004
#> GSM1022375     2  0.6468      0.471 0.444 0.552 0.004
#> GSM1022376     2  0.6468      0.471 0.444 0.552 0.004
#> GSM1022371     2  0.0237      0.826 0.004 0.996 0.000
#> GSM1022372     2  0.0237      0.826 0.004 0.996 0.000
#> GSM1022373     2  0.0237      0.826 0.004 0.996 0.000
#> GSM1022377     2  0.6872      0.717 0.276 0.680 0.044
#> GSM1022378     2  0.6872      0.717 0.276 0.680 0.044
#> GSM1022379     2  0.6872      0.717 0.276 0.680 0.044
#> GSM1022380     2  0.6872      0.717 0.276 0.680 0.044
#> GSM1022385     3  0.0000      0.767 0.000 0.000 1.000
#> GSM1022386     3  0.0000      0.767 0.000 0.000 1.000
#> GSM1022387     3  0.0000      0.767 0.000 0.000 1.000
#> GSM1022388     3  0.0000      0.767 0.000 0.000 1.000
#> GSM1022381     2  0.6905      0.716 0.280 0.676 0.044
#> GSM1022382     2  0.6905      0.716 0.280 0.676 0.044
#> GSM1022383     2  0.6905      0.716 0.280 0.676 0.044
#> GSM1022384     2  0.6905      0.716 0.280 0.676 0.044
#> GSM1022393     1  0.6235      0.773 0.564 0.000 0.436
#> GSM1022394     1  0.6235      0.773 0.564 0.000 0.436
#> GSM1022395     1  0.6235      0.773 0.564 0.000 0.436
#> GSM1022396     1  0.6235      0.773 0.564 0.000 0.436
#> GSM1022389     2  0.6665      0.709 0.276 0.688 0.036
#> GSM1022390     2  0.7150      0.628 0.348 0.616 0.036
#> GSM1022391     2  0.6665      0.709 0.276 0.688 0.036
#> GSM1022392     2  0.7150      0.628 0.348 0.616 0.036
#> GSM1022397     3  0.0000      0.767 0.000 0.000 1.000
#> GSM1022398     3  0.0000      0.767 0.000 0.000 1.000
#> GSM1022399     3  0.0000      0.767 0.000 0.000 1.000
#> GSM1022400     3  0.0000      0.767 0.000 0.000 1.000
#> GSM1022401     1  0.6235      0.773 0.564 0.000 0.436
#> GSM1022402     1  0.6235      0.773 0.564 0.000 0.436
#> GSM1022403     1  0.6235      0.773 0.564 0.000 0.436
#> GSM1022404     1  0.6235      0.773 0.564 0.000 0.436

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1022325     2  0.0336      0.677 0.000 0.992 0.000 0.008
#> GSM1022326     2  0.0336      0.677 0.000 0.992 0.000 0.008
#> GSM1022327     2  0.0336      0.677 0.000 0.992 0.000 0.008
#> GSM1022331     3  0.4562      0.556 0.028 0.000 0.764 0.208
#> GSM1022332     3  0.4562      0.556 0.028 0.000 0.764 0.208
#> GSM1022333     3  0.4562      0.556 0.028 0.000 0.764 0.208
#> GSM1022328     2  0.0336      0.677 0.000 0.992 0.000 0.008
#> GSM1022329     2  0.0336      0.677 0.000 0.992 0.000 0.008
#> GSM1022330     2  0.0336      0.677 0.000 0.992 0.000 0.008
#> GSM1022337     1  0.9380      0.159 0.428 0.168 0.160 0.244
#> GSM1022338     1  0.9380      0.159 0.428 0.168 0.160 0.244
#> GSM1022339     1  0.9380      0.159 0.428 0.168 0.160 0.244
#> GSM1022334     2  0.0336      0.677 0.000 0.992 0.000 0.008
#> GSM1022335     2  0.0336      0.677 0.000 0.992 0.000 0.008
#> GSM1022336     2  0.0336      0.677 0.000 0.992 0.000 0.008
#> GSM1022340     1  0.6078      0.604 0.684 0.000 0.152 0.164
#> GSM1022341     1  0.6078      0.604 0.684 0.000 0.152 0.164
#> GSM1022342     1  0.6078      0.604 0.684 0.000 0.152 0.164
#> GSM1022343     1  0.6078      0.604 0.684 0.000 0.152 0.164
#> GSM1022347     3  0.4059      0.859 0.200 0.000 0.788 0.012
#> GSM1022348     3  0.4059      0.859 0.200 0.000 0.788 0.012
#> GSM1022349     3  0.4059      0.859 0.200 0.000 0.788 0.012
#> GSM1022350     3  0.4059      0.859 0.200 0.000 0.788 0.012
#> GSM1022344     3  0.6855      0.639 0.276 0.000 0.580 0.144
#> GSM1022345     3  0.6855      0.639 0.276 0.000 0.580 0.144
#> GSM1022346     3  0.6855      0.639 0.276 0.000 0.580 0.144
#> GSM1022355     1  0.2999      0.776 0.864 0.000 0.004 0.132
#> GSM1022356     1  0.2999      0.776 0.864 0.000 0.004 0.132
#> GSM1022357     1  0.2999      0.776 0.864 0.000 0.004 0.132
#> GSM1022358     1  0.2999      0.776 0.864 0.000 0.004 0.132
#> GSM1022351     1  0.3105      0.774 0.856 0.000 0.004 0.140
#> GSM1022352     1  0.3105      0.774 0.856 0.000 0.004 0.140
#> GSM1022353     1  0.3105      0.774 0.856 0.000 0.004 0.140
#> GSM1022354     1  0.3105      0.774 0.856 0.000 0.004 0.140
#> GSM1022359     2  0.0707      0.676 0.000 0.980 0.000 0.020
#> GSM1022360     2  0.0707      0.676 0.000 0.980 0.000 0.020
#> GSM1022361     2  0.0707      0.676 0.000 0.980 0.000 0.020
#> GSM1022362     2  0.0707      0.676 0.000 0.980 0.000 0.020
#> GSM1022367     2  0.7815      0.318 0.004 0.444 0.224 0.328
#> GSM1022368     2  0.7815      0.318 0.004 0.444 0.224 0.328
#> GSM1022369     2  0.7815      0.318 0.004 0.444 0.224 0.328
#> GSM1022370     2  0.7815      0.318 0.004 0.444 0.224 0.328
#> GSM1022363     2  0.2466      0.652 0.000 0.900 0.004 0.096
#> GSM1022364     2  0.2466      0.652 0.000 0.900 0.004 0.096
#> GSM1022365     2  0.2466      0.652 0.000 0.900 0.004 0.096
#> GSM1022366     2  0.2466      0.652 0.000 0.900 0.004 0.096
#> GSM1022374     2  0.9820      0.156 0.288 0.292 0.160 0.260
#> GSM1022375     2  0.9820      0.156 0.288 0.292 0.160 0.260
#> GSM1022376     2  0.9820      0.156 0.288 0.292 0.160 0.260
#> GSM1022371     2  0.0592      0.679 0.000 0.984 0.000 0.016
#> GSM1022372     2  0.0592      0.679 0.000 0.984 0.000 0.016
#> GSM1022373     2  0.0592      0.679 0.000 0.984 0.000 0.016
#> GSM1022377     4  0.6951      0.952 0.068 0.440 0.016 0.476
#> GSM1022378     4  0.6951      0.952 0.068 0.440 0.016 0.476
#> GSM1022379     4  0.6951      0.952 0.068 0.440 0.016 0.476
#> GSM1022380     4  0.6951      0.952 0.068 0.440 0.016 0.476
#> GSM1022385     3  0.3933      0.860 0.200 0.000 0.792 0.008
#> GSM1022386     3  0.3933      0.860 0.200 0.000 0.792 0.008
#> GSM1022387     3  0.3933      0.860 0.200 0.000 0.792 0.008
#> GSM1022388     3  0.3933      0.860 0.200 0.000 0.792 0.008
#> GSM1022381     4  0.6834      0.951 0.068 0.424 0.012 0.496
#> GSM1022382     4  0.6834      0.951 0.068 0.424 0.012 0.496
#> GSM1022383     4  0.6834      0.951 0.068 0.424 0.012 0.496
#> GSM1022384     4  0.6834      0.951 0.068 0.424 0.012 0.496
#> GSM1022393     1  0.0000      0.772 1.000 0.000 0.000 0.000
#> GSM1022394     1  0.0000      0.772 1.000 0.000 0.000 0.000
#> GSM1022395     1  0.0000      0.772 1.000 0.000 0.000 0.000
#> GSM1022396     1  0.0000      0.772 1.000 0.000 0.000 0.000
#> GSM1022389     4  0.6959      0.932 0.076 0.444 0.012 0.468
#> GSM1022390     4  0.7353      0.896 0.112 0.408 0.012 0.468
#> GSM1022391     4  0.6959      0.932 0.076 0.444 0.012 0.468
#> GSM1022392     4  0.7353      0.896 0.112 0.408 0.012 0.468
#> GSM1022397     3  0.3610      0.861 0.200 0.000 0.800 0.000
#> GSM1022398     3  0.3610      0.861 0.200 0.000 0.800 0.000
#> GSM1022399     3  0.3610      0.861 0.200 0.000 0.800 0.000
#> GSM1022400     3  0.3610      0.861 0.200 0.000 0.800 0.000
#> GSM1022401     1  0.0000      0.772 1.000 0.000 0.000 0.000
#> GSM1022402     1  0.0000      0.772 1.000 0.000 0.000 0.000
#> GSM1022403     1  0.0000      0.772 1.000 0.000 0.000 0.000
#> GSM1022404     1  0.0000      0.772 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1022325     2  0.0162      0.934 0.000 0.996 0.000 0.004 0.000
#> GSM1022326     2  0.0162      0.934 0.000 0.996 0.000 0.004 0.000
#> GSM1022327     2  0.0162      0.934 0.000 0.996 0.000 0.004 0.000
#> GSM1022331     3  0.5708      0.332 0.000 0.000 0.588 0.112 0.300
#> GSM1022332     3  0.5708      0.332 0.000 0.000 0.588 0.112 0.300
#> GSM1022333     3  0.5708      0.332 0.000 0.000 0.588 0.112 0.300
#> GSM1022328     2  0.0162      0.934 0.000 0.996 0.000 0.004 0.000
#> GSM1022329     2  0.0162      0.934 0.000 0.996 0.000 0.004 0.000
#> GSM1022330     2  0.0162      0.934 0.000 0.996 0.000 0.004 0.000
#> GSM1022337     5  0.4428      0.650 0.160 0.084 0.000 0.000 0.756
#> GSM1022338     5  0.4428      0.650 0.160 0.084 0.000 0.000 0.756
#> GSM1022339     5  0.4428      0.650 0.160 0.084 0.000 0.000 0.756
#> GSM1022334     2  0.0290      0.932 0.000 0.992 0.000 0.008 0.000
#> GSM1022335     2  0.0290      0.932 0.000 0.992 0.000 0.008 0.000
#> GSM1022336     2  0.0290      0.932 0.000 0.992 0.000 0.008 0.000
#> GSM1022340     1  0.5661      0.572 0.696 0.000 0.164 0.096 0.044
#> GSM1022341     1  0.5661      0.572 0.696 0.000 0.164 0.096 0.044
#> GSM1022342     1  0.5661      0.572 0.696 0.000 0.164 0.096 0.044
#> GSM1022343     1  0.5661      0.572 0.696 0.000 0.164 0.096 0.044
#> GSM1022347     3  0.2956      0.813 0.096 0.000 0.872 0.020 0.012
#> GSM1022348     3  0.2956      0.813 0.096 0.000 0.872 0.020 0.012
#> GSM1022349     3  0.2956      0.813 0.096 0.000 0.872 0.020 0.012
#> GSM1022350     3  0.2956      0.813 0.096 0.000 0.872 0.020 0.012
#> GSM1022344     3  0.7076      0.346 0.356 0.000 0.468 0.120 0.056
#> GSM1022345     3  0.7076      0.346 0.356 0.000 0.468 0.120 0.056
#> GSM1022346     3  0.7076      0.346 0.356 0.000 0.468 0.120 0.056
#> GSM1022355     1  0.0162      0.812 0.996 0.000 0.000 0.000 0.004
#> GSM1022356     1  0.0162      0.812 0.996 0.000 0.000 0.000 0.004
#> GSM1022357     1  0.0162      0.812 0.996 0.000 0.000 0.000 0.004
#> GSM1022358     1  0.0162      0.812 0.996 0.000 0.000 0.000 0.004
#> GSM1022351     1  0.1124      0.805 0.960 0.000 0.004 0.036 0.000
#> GSM1022352     1  0.1124      0.805 0.960 0.000 0.004 0.036 0.000
#> GSM1022353     1  0.1124      0.805 0.960 0.000 0.004 0.036 0.000
#> GSM1022354     1  0.1124      0.805 0.960 0.000 0.004 0.036 0.000
#> GSM1022359     2  0.1041      0.923 0.000 0.964 0.004 0.032 0.000
#> GSM1022360     2  0.1041      0.923 0.000 0.964 0.004 0.032 0.000
#> GSM1022361     2  0.1041      0.923 0.000 0.964 0.004 0.032 0.000
#> GSM1022362     2  0.1041      0.923 0.000 0.964 0.004 0.032 0.000
#> GSM1022367     5  0.7635      0.594 0.000 0.248 0.096 0.176 0.480
#> GSM1022368     5  0.7635      0.594 0.000 0.248 0.096 0.176 0.480
#> GSM1022369     5  0.7635      0.594 0.000 0.248 0.096 0.176 0.480
#> GSM1022370     5  0.7635      0.594 0.000 0.248 0.096 0.176 0.480
#> GSM1022363     2  0.3804      0.829 0.000 0.832 0.020 0.092 0.056
#> GSM1022364     2  0.3804      0.829 0.000 0.832 0.020 0.092 0.056
#> GSM1022365     2  0.3804      0.829 0.000 0.832 0.020 0.092 0.056
#> GSM1022366     2  0.3804      0.829 0.000 0.832 0.020 0.092 0.056
#> GSM1022374     5  0.4836      0.725 0.072 0.164 0.004 0.012 0.748
#> GSM1022375     5  0.4836      0.725 0.072 0.164 0.004 0.012 0.748
#> GSM1022376     5  0.4836      0.725 0.072 0.164 0.004 0.012 0.748
#> GSM1022371     2  0.1243      0.921 0.000 0.960 0.008 0.028 0.004
#> GSM1022372     2  0.1243      0.921 0.000 0.960 0.008 0.028 0.004
#> GSM1022373     2  0.1243      0.921 0.000 0.960 0.008 0.028 0.004
#> GSM1022377     4  0.5277      0.943 0.016 0.316 0.012 0.636 0.020
#> GSM1022378     4  0.5277      0.943 0.016 0.316 0.012 0.636 0.020
#> GSM1022379     4  0.5277      0.943 0.016 0.316 0.012 0.636 0.020
#> GSM1022380     4  0.5277      0.943 0.016 0.316 0.012 0.636 0.020
#> GSM1022385     3  0.2859      0.812 0.096 0.000 0.876 0.016 0.012
#> GSM1022386     3  0.2859      0.812 0.096 0.000 0.876 0.016 0.012
#> GSM1022387     3  0.2859      0.812 0.096 0.000 0.876 0.016 0.012
#> GSM1022388     3  0.2859      0.812 0.096 0.000 0.876 0.016 0.012
#> GSM1022381     4  0.4769      0.946 0.016 0.316 0.004 0.656 0.008
#> GSM1022382     4  0.4769      0.946 0.016 0.316 0.004 0.656 0.008
#> GSM1022383     4  0.4769      0.946 0.016 0.316 0.004 0.656 0.008
#> GSM1022384     4  0.4769      0.946 0.016 0.316 0.004 0.656 0.008
#> GSM1022393     1  0.3639      0.769 0.792 0.000 0.000 0.024 0.184
#> GSM1022394     1  0.3639      0.769 0.792 0.000 0.000 0.024 0.184
#> GSM1022395     1  0.3639      0.769 0.792 0.000 0.000 0.024 0.184
#> GSM1022396     1  0.3639      0.769 0.792 0.000 0.000 0.024 0.184
#> GSM1022389     4  0.5592      0.913 0.024 0.308 0.016 0.628 0.024
#> GSM1022390     4  0.5952      0.892 0.052 0.280 0.016 0.628 0.024
#> GSM1022391     4  0.5592      0.913 0.024 0.308 0.016 0.628 0.024
#> GSM1022392     4  0.5952      0.892 0.052 0.280 0.016 0.628 0.024
#> GSM1022397     3  0.1965      0.817 0.096 0.000 0.904 0.000 0.000
#> GSM1022398     3  0.1965      0.817 0.096 0.000 0.904 0.000 0.000
#> GSM1022399     3  0.1965      0.817 0.096 0.000 0.904 0.000 0.000
#> GSM1022400     3  0.1965      0.817 0.096 0.000 0.904 0.000 0.000
#> GSM1022401     1  0.3639      0.769 0.792 0.000 0.000 0.024 0.184
#> GSM1022402     1  0.3639      0.769 0.792 0.000 0.000 0.024 0.184
#> GSM1022403     1  0.3639      0.769 0.792 0.000 0.000 0.024 0.184
#> GSM1022404     1  0.3639      0.769 0.792 0.000 0.000 0.024 0.184

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1022325     2  0.0146     0.8691 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM1022326     2  0.0146     0.8691 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM1022327     2  0.0146     0.8691 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM1022331     3  0.6299     0.0907 0.000 0.000 0.460 0.024 0.192 0.324
#> GSM1022332     3  0.6299     0.0907 0.000 0.000 0.460 0.024 0.192 0.324
#> GSM1022333     3  0.6299     0.0907 0.000 0.000 0.460 0.024 0.192 0.324
#> GSM1022328     2  0.0146     0.8691 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM1022329     2  0.0146     0.8691 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM1022330     2  0.0146     0.8691 0.000 0.996 0.000 0.004 0.000 0.000
#> GSM1022337     5  0.2579     0.9006 0.088 0.040 0.000 0.000 0.872 0.000
#> GSM1022338     5  0.2579     0.9006 0.088 0.040 0.000 0.000 0.872 0.000
#> GSM1022339     5  0.2579     0.9006 0.088 0.040 0.000 0.000 0.872 0.000
#> GSM1022334     2  0.0291     0.8687 0.000 0.992 0.000 0.004 0.004 0.000
#> GSM1022335     2  0.0291     0.8687 0.000 0.992 0.000 0.004 0.004 0.000
#> GSM1022336     2  0.0291     0.8687 0.000 0.992 0.000 0.004 0.004 0.000
#> GSM1022340     1  0.5582     0.5371 0.660 0.000 0.140 0.048 0.004 0.148
#> GSM1022341     1  0.5582     0.5371 0.660 0.000 0.140 0.048 0.004 0.148
#> GSM1022342     1  0.5582     0.5371 0.660 0.000 0.140 0.048 0.004 0.148
#> GSM1022343     1  0.5582     0.5371 0.660 0.000 0.140 0.048 0.004 0.148
#> GSM1022347     3  0.1914     0.7722 0.056 0.000 0.920 0.008 0.000 0.016
#> GSM1022348     3  0.1914     0.7722 0.056 0.000 0.920 0.008 0.000 0.016
#> GSM1022349     3  0.1914     0.7722 0.056 0.000 0.920 0.008 0.000 0.016
#> GSM1022350     3  0.1914     0.7722 0.056 0.000 0.920 0.008 0.000 0.016
#> GSM1022344     3  0.7031     0.2807 0.316 0.000 0.444 0.076 0.012 0.152
#> GSM1022345     3  0.7031     0.2807 0.316 0.000 0.444 0.076 0.012 0.152
#> GSM1022346     3  0.7031     0.2807 0.316 0.000 0.444 0.076 0.012 0.152
#> GSM1022355     1  0.0622     0.7281 0.980 0.000 0.000 0.008 0.012 0.000
#> GSM1022356     1  0.0622     0.7281 0.980 0.000 0.000 0.008 0.012 0.000
#> GSM1022357     1  0.0622     0.7281 0.980 0.000 0.000 0.008 0.012 0.000
#> GSM1022358     1  0.0622     0.7281 0.980 0.000 0.000 0.008 0.012 0.000
#> GSM1022351     1  0.1700     0.7154 0.928 0.000 0.000 0.024 0.000 0.048
#> GSM1022352     1  0.1700     0.7154 0.928 0.000 0.000 0.024 0.000 0.048
#> GSM1022353     1  0.1700     0.7154 0.928 0.000 0.000 0.024 0.000 0.048
#> GSM1022354     1  0.1700     0.7154 0.928 0.000 0.000 0.024 0.000 0.048
#> GSM1022359     2  0.2556     0.8405 0.000 0.864 0.008 0.008 0.000 0.120
#> GSM1022360     2  0.2556     0.8405 0.000 0.864 0.008 0.008 0.000 0.120
#> GSM1022361     2  0.2556     0.8405 0.000 0.864 0.008 0.008 0.000 0.120
#> GSM1022362     2  0.2556     0.8405 0.000 0.864 0.008 0.008 0.000 0.120
#> GSM1022367     6  0.6688     1.0000 0.000 0.172 0.028 0.016 0.348 0.436
#> GSM1022368     6  0.6688     1.0000 0.000 0.172 0.028 0.016 0.348 0.436
#> GSM1022369     6  0.6688     1.0000 0.000 0.172 0.028 0.016 0.348 0.436
#> GSM1022370     6  0.6688     1.0000 0.000 0.172 0.028 0.016 0.348 0.436
#> GSM1022363     2  0.4639     0.6319 0.000 0.644 0.000 0.016 0.036 0.304
#> GSM1022364     2  0.4639     0.6319 0.000 0.644 0.000 0.016 0.036 0.304
#> GSM1022365     2  0.4639     0.6319 0.000 0.644 0.000 0.016 0.036 0.304
#> GSM1022366     2  0.4639     0.6319 0.000 0.644 0.000 0.016 0.036 0.304
#> GSM1022374     5  0.3525     0.8908 0.052 0.076 0.000 0.004 0.836 0.032
#> GSM1022375     5  0.3525     0.8908 0.052 0.076 0.000 0.004 0.836 0.032
#> GSM1022376     5  0.3525     0.8908 0.052 0.076 0.000 0.004 0.836 0.032
#> GSM1022371     2  0.2149     0.8502 0.000 0.900 0.000 0.004 0.016 0.080
#> GSM1022372     2  0.2149     0.8502 0.000 0.900 0.000 0.004 0.016 0.080
#> GSM1022373     2  0.2149     0.8502 0.000 0.900 0.000 0.004 0.016 0.080
#> GSM1022377     4  0.4319     0.9209 0.000 0.188 0.016 0.748 0.016 0.032
#> GSM1022378     4  0.4319     0.9209 0.000 0.188 0.016 0.748 0.016 0.032
#> GSM1022379     4  0.4299     0.9209 0.000 0.188 0.012 0.748 0.016 0.036
#> GSM1022380     4  0.4299     0.9209 0.000 0.188 0.012 0.748 0.016 0.036
#> GSM1022385     3  0.3510     0.7527 0.052 0.000 0.848 0.028 0.024 0.048
#> GSM1022386     3  0.3510     0.7527 0.052 0.000 0.848 0.028 0.024 0.048
#> GSM1022387     3  0.3510     0.7527 0.052 0.000 0.848 0.028 0.024 0.048
#> GSM1022388     3  0.3510     0.7527 0.052 0.000 0.848 0.028 0.024 0.048
#> GSM1022381     4  0.3262     0.9255 0.000 0.180 0.004 0.800 0.004 0.012
#> GSM1022382     4  0.3262     0.9255 0.000 0.180 0.004 0.800 0.004 0.012
#> GSM1022383     4  0.3262     0.9255 0.000 0.180 0.004 0.800 0.004 0.012
#> GSM1022384     4  0.3262     0.9255 0.000 0.180 0.004 0.800 0.004 0.012
#> GSM1022393     1  0.4973     0.6327 0.664 0.000 0.000 0.052 0.248 0.036
#> GSM1022394     1  0.4973     0.6327 0.664 0.000 0.000 0.052 0.248 0.036
#> GSM1022395     1  0.4973     0.6327 0.664 0.000 0.000 0.052 0.248 0.036
#> GSM1022396     1  0.4973     0.6327 0.664 0.000 0.000 0.052 0.248 0.036
#> GSM1022389     4  0.4929     0.8942 0.000 0.188 0.012 0.696 0.008 0.096
#> GSM1022390     4  0.5007     0.8901 0.004 0.180 0.012 0.700 0.008 0.096
#> GSM1022391     4  0.4929     0.8942 0.000 0.188 0.012 0.696 0.008 0.096
#> GSM1022392     4  0.5007     0.8901 0.004 0.180 0.012 0.700 0.008 0.096
#> GSM1022397     3  0.1204     0.7742 0.056 0.000 0.944 0.000 0.000 0.000
#> GSM1022398     3  0.1204     0.7742 0.056 0.000 0.944 0.000 0.000 0.000
#> GSM1022399     3  0.1204     0.7742 0.056 0.000 0.944 0.000 0.000 0.000
#> GSM1022400     3  0.1204     0.7742 0.056 0.000 0.944 0.000 0.000 0.000
#> GSM1022401     1  0.4973     0.6327 0.664 0.000 0.000 0.052 0.248 0.036
#> GSM1022402     1  0.4973     0.6327 0.664 0.000 0.000 0.052 0.248 0.036
#> GSM1022403     1  0.4973     0.6327 0.664 0.000 0.000 0.052 0.248 0.036
#> GSM1022404     1  0.4973     0.6327 0.664 0.000 0.000 0.052 0.248 0.036

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-kmeans-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-MAD-kmeans-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-MAD-kmeans-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-MAD-kmeans-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-MAD-kmeans-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-MAD-kmeans-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-MAD-kmeans-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-MAD-kmeans-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-MAD-kmeans-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-MAD-kmeans-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-MAD-kmeans-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-MAD-kmeans-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-MAD-kmeans-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-MAD-kmeans-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-MAD-kmeans-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-MAD-kmeans-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-MAD-kmeans-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-MAD-kmeans-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-MAD-kmeans-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-MAD-kmeans-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-kmeans-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-MAD-kmeans-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-MAD-kmeans-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-MAD-kmeans-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-MAD-kmeans-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-MAD-kmeans-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-kmeans-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>             n protocol(p) cell.type(p) k
#> MAD:kmeans 80    1.22e-07     6.13e-05 2
#> MAD:kmeans 70    1.92e-12     5.88e-08 3
#> MAD:kmeans 70    9.95e-17     1.58e-08 4
#> MAD:kmeans 74    1.38e-18     3.80e-11 5
#> MAD:kmeans 74    8.86e-21     1.52e-10 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


MAD:skmeans**

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["MAD", "skmeans"]
# you can also extract it by
# res = res_list["MAD:skmeans"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk MAD-skmeans-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk MAD-skmeans-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.962       0.985         0.5059 0.495   0.495
#> 3 3 0.641           0.734       0.792         0.2831 0.830   0.669
#> 4 4 0.777           0.877       0.892         0.1293 0.853   0.621
#> 5 5 0.874           0.866       0.911         0.0805 0.937   0.763
#> 6 6 0.881           0.858       0.907         0.0358 0.974   0.877

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 2

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette  p1  p2
#> GSM1022325     2   0.000      0.970 0.0 1.0
#> GSM1022326     2   0.000      0.970 0.0 1.0
#> GSM1022327     2   0.000      0.970 0.0 1.0
#> GSM1022331     1   0.000      1.000 1.0 0.0
#> GSM1022332     1   0.000      1.000 1.0 0.0
#> GSM1022333     1   0.000      1.000 1.0 0.0
#> GSM1022328     2   0.000      0.970 0.0 1.0
#> GSM1022329     2   0.000      0.970 0.0 1.0
#> GSM1022330     2   0.000      0.970 0.0 1.0
#> GSM1022337     2   0.971      0.366 0.4 0.6
#> GSM1022338     2   0.971      0.366 0.4 0.6
#> GSM1022339     2   0.971      0.366 0.4 0.6
#> GSM1022334     2   0.000      0.970 0.0 1.0
#> GSM1022335     2   0.000      0.970 0.0 1.0
#> GSM1022336     2   0.000      0.970 0.0 1.0
#> GSM1022340     1   0.000      1.000 1.0 0.0
#> GSM1022341     1   0.000      1.000 1.0 0.0
#> GSM1022342     1   0.000      1.000 1.0 0.0
#> GSM1022343     1   0.000      1.000 1.0 0.0
#> GSM1022347     1   0.000      1.000 1.0 0.0
#> GSM1022348     1   0.000      1.000 1.0 0.0
#> GSM1022349     1   0.000      1.000 1.0 0.0
#> GSM1022350     1   0.000      1.000 1.0 0.0
#> GSM1022344     1   0.000      1.000 1.0 0.0
#> GSM1022345     1   0.000      1.000 1.0 0.0
#> GSM1022346     1   0.000      1.000 1.0 0.0
#> GSM1022355     1   0.000      1.000 1.0 0.0
#> GSM1022356     1   0.000      1.000 1.0 0.0
#> GSM1022357     1   0.000      1.000 1.0 0.0
#> GSM1022358     1   0.000      1.000 1.0 0.0
#> GSM1022351     1   0.000      1.000 1.0 0.0
#> GSM1022352     1   0.000      1.000 1.0 0.0
#> GSM1022353     1   0.000      1.000 1.0 0.0
#> GSM1022354     1   0.000      1.000 1.0 0.0
#> GSM1022359     2   0.000      0.970 0.0 1.0
#> GSM1022360     2   0.000      0.970 0.0 1.0
#> GSM1022361     2   0.000      0.970 0.0 1.0
#> GSM1022362     2   0.000      0.970 0.0 1.0
#> GSM1022367     2   0.000      0.970 0.0 1.0
#> GSM1022368     2   0.000      0.970 0.0 1.0
#> GSM1022369     2   0.000      0.970 0.0 1.0
#> GSM1022370     2   0.000      0.970 0.0 1.0
#> GSM1022363     2   0.000      0.970 0.0 1.0
#> GSM1022364     2   0.000      0.970 0.0 1.0
#> GSM1022365     2   0.000      0.970 0.0 1.0
#> GSM1022366     2   0.000      0.970 0.0 1.0
#> GSM1022374     2   0.000      0.970 0.0 1.0
#> GSM1022375     2   0.000      0.970 0.0 1.0
#> GSM1022376     2   0.000      0.970 0.0 1.0
#> GSM1022371     2   0.000      0.970 0.0 1.0
#> GSM1022372     2   0.000      0.970 0.0 1.0
#> GSM1022373     2   0.000      0.970 0.0 1.0
#> GSM1022377     2   0.000      0.970 0.0 1.0
#> GSM1022378     2   0.000      0.970 0.0 1.0
#> GSM1022379     2   0.000      0.970 0.0 1.0
#> GSM1022380     2   0.000      0.970 0.0 1.0
#> GSM1022385     1   0.000      1.000 1.0 0.0
#> GSM1022386     1   0.000      1.000 1.0 0.0
#> GSM1022387     1   0.000      1.000 1.0 0.0
#> GSM1022388     1   0.000      1.000 1.0 0.0
#> GSM1022381     2   0.000      0.970 0.0 1.0
#> GSM1022382     2   0.000      0.970 0.0 1.0
#> GSM1022383     2   0.000      0.970 0.0 1.0
#> GSM1022384     2   0.000      0.970 0.0 1.0
#> GSM1022393     1   0.000      1.000 1.0 0.0
#> GSM1022394     1   0.000      1.000 1.0 0.0
#> GSM1022395     1   0.000      1.000 1.0 0.0
#> GSM1022396     1   0.000      1.000 1.0 0.0
#> GSM1022389     2   0.000      0.970 0.0 1.0
#> GSM1022390     2   0.000      0.970 0.0 1.0
#> GSM1022391     2   0.000      0.970 0.0 1.0
#> GSM1022392     2   0.000      0.970 0.0 1.0
#> GSM1022397     1   0.000      1.000 1.0 0.0
#> GSM1022398     1   0.000      1.000 1.0 0.0
#> GSM1022399     1   0.000      1.000 1.0 0.0
#> GSM1022400     1   0.000      1.000 1.0 0.0
#> GSM1022401     1   0.000      1.000 1.0 0.0
#> GSM1022402     1   0.000      1.000 1.0 0.0
#> GSM1022403     1   0.000      1.000 1.0 0.0
#> GSM1022404     1   0.000      1.000 1.0 0.0

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1022325     2  0.0000     0.7917 0.000 1.000 0.000
#> GSM1022326     2  0.0000     0.7917 0.000 1.000 0.000
#> GSM1022327     2  0.0000     0.7917 0.000 1.000 0.000
#> GSM1022331     3  0.5881     0.5894 0.016 0.256 0.728
#> GSM1022332     3  0.5881     0.5894 0.016 0.256 0.728
#> GSM1022333     3  0.5881     0.5894 0.016 0.256 0.728
#> GSM1022328     2  0.0000     0.7917 0.000 1.000 0.000
#> GSM1022329     2  0.0000     0.7917 0.000 1.000 0.000
#> GSM1022330     2  0.0000     0.7917 0.000 1.000 0.000
#> GSM1022337     1  0.5859     0.4307 0.656 0.344 0.000
#> GSM1022338     1  0.5859     0.4307 0.656 0.344 0.000
#> GSM1022339     1  0.5859     0.4307 0.656 0.344 0.000
#> GSM1022334     2  0.0000     0.7917 0.000 1.000 0.000
#> GSM1022335     2  0.0000     0.7917 0.000 1.000 0.000
#> GSM1022336     2  0.0000     0.7917 0.000 1.000 0.000
#> GSM1022340     1  0.6244     0.7418 0.560 0.000 0.440
#> GSM1022341     1  0.6244     0.7418 0.560 0.000 0.440
#> GSM1022342     1  0.6244     0.7418 0.560 0.000 0.440
#> GSM1022343     1  0.6244     0.7418 0.560 0.000 0.440
#> GSM1022347     3  0.0000     0.9106 0.000 0.000 1.000
#> GSM1022348     3  0.0000     0.9106 0.000 0.000 1.000
#> GSM1022349     3  0.0000     0.9106 0.000 0.000 1.000
#> GSM1022350     3  0.0000     0.9106 0.000 0.000 1.000
#> GSM1022344     3  0.0000     0.9106 0.000 0.000 1.000
#> GSM1022345     3  0.0000     0.9106 0.000 0.000 1.000
#> GSM1022346     3  0.0000     0.9106 0.000 0.000 1.000
#> GSM1022355     1  0.5650     0.8825 0.688 0.000 0.312
#> GSM1022356     1  0.5650     0.8825 0.688 0.000 0.312
#> GSM1022357     1  0.5650     0.8825 0.688 0.000 0.312
#> GSM1022358     1  0.5650     0.8825 0.688 0.000 0.312
#> GSM1022351     1  0.5650     0.8825 0.688 0.000 0.312
#> GSM1022352     1  0.5650     0.8825 0.688 0.000 0.312
#> GSM1022353     1  0.5650     0.8825 0.688 0.000 0.312
#> GSM1022354     1  0.5650     0.8825 0.688 0.000 0.312
#> GSM1022359     2  0.0000     0.7917 0.000 1.000 0.000
#> GSM1022360     2  0.0000     0.7917 0.000 1.000 0.000
#> GSM1022361     2  0.0000     0.7917 0.000 1.000 0.000
#> GSM1022362     2  0.0000     0.7917 0.000 1.000 0.000
#> GSM1022367     2  0.6931     0.0672 0.016 0.528 0.456
#> GSM1022368     2  0.6931     0.0672 0.016 0.528 0.456
#> GSM1022369     2  0.6931     0.0672 0.016 0.528 0.456
#> GSM1022370     2  0.6931     0.0672 0.016 0.528 0.456
#> GSM1022363     2  0.0424     0.7885 0.008 0.992 0.000
#> GSM1022364     2  0.0424     0.7885 0.008 0.992 0.000
#> GSM1022365     2  0.0424     0.7885 0.008 0.992 0.000
#> GSM1022366     2  0.0424     0.7885 0.008 0.992 0.000
#> GSM1022374     2  0.6154     0.2316 0.408 0.592 0.000
#> GSM1022375     2  0.6154     0.2316 0.408 0.592 0.000
#> GSM1022376     2  0.6154     0.2316 0.408 0.592 0.000
#> GSM1022371     2  0.0000     0.7917 0.000 1.000 0.000
#> GSM1022372     2  0.0000     0.7917 0.000 1.000 0.000
#> GSM1022373     2  0.0000     0.7917 0.000 1.000 0.000
#> GSM1022377     2  0.5859     0.6832 0.344 0.656 0.000
#> GSM1022378     2  0.5859     0.6832 0.344 0.656 0.000
#> GSM1022379     2  0.5859     0.6832 0.344 0.656 0.000
#> GSM1022380     2  0.5859     0.6832 0.344 0.656 0.000
#> GSM1022385     3  0.0000     0.9106 0.000 0.000 1.000
#> GSM1022386     3  0.0000     0.9106 0.000 0.000 1.000
#> GSM1022387     3  0.0000     0.9106 0.000 0.000 1.000
#> GSM1022388     3  0.0000     0.9106 0.000 0.000 1.000
#> GSM1022381     2  0.5859     0.6832 0.344 0.656 0.000
#> GSM1022382     2  0.5859     0.6832 0.344 0.656 0.000
#> GSM1022383     2  0.5859     0.6832 0.344 0.656 0.000
#> GSM1022384     2  0.5859     0.6832 0.344 0.656 0.000
#> GSM1022393     1  0.5650     0.8825 0.688 0.000 0.312
#> GSM1022394     1  0.5650     0.8825 0.688 0.000 0.312
#> GSM1022395     1  0.5650     0.8825 0.688 0.000 0.312
#> GSM1022396     1  0.5650     0.8825 0.688 0.000 0.312
#> GSM1022389     2  0.5859     0.6832 0.344 0.656 0.000
#> GSM1022390     2  0.6095     0.6428 0.392 0.608 0.000
#> GSM1022391     2  0.5859     0.6832 0.344 0.656 0.000
#> GSM1022392     2  0.6095     0.6428 0.392 0.608 0.000
#> GSM1022397     3  0.0000     0.9106 0.000 0.000 1.000
#> GSM1022398     3  0.0000     0.9106 0.000 0.000 1.000
#> GSM1022399     3  0.0000     0.9106 0.000 0.000 1.000
#> GSM1022400     3  0.0000     0.9106 0.000 0.000 1.000
#> GSM1022401     1  0.5650     0.8825 0.688 0.000 0.312
#> GSM1022402     1  0.5650     0.8825 0.688 0.000 0.312
#> GSM1022403     1  0.5650     0.8825 0.688 0.000 0.312
#> GSM1022404     1  0.5650     0.8825 0.688 0.000 0.312

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1022325     2  0.4222      0.839 0.000 0.728 0.000 0.272
#> GSM1022326     2  0.4222      0.839 0.000 0.728 0.000 0.272
#> GSM1022327     2  0.4222      0.839 0.000 0.728 0.000 0.272
#> GSM1022331     3  0.0592      0.955 0.000 0.016 0.984 0.000
#> GSM1022332     3  0.0592      0.955 0.000 0.016 0.984 0.000
#> GSM1022333     3  0.0592      0.955 0.000 0.016 0.984 0.000
#> GSM1022328     2  0.4222      0.839 0.000 0.728 0.000 0.272
#> GSM1022329     2  0.4222      0.839 0.000 0.728 0.000 0.272
#> GSM1022330     2  0.4222      0.839 0.000 0.728 0.000 0.272
#> GSM1022337     2  0.3945      0.462 0.216 0.780 0.004 0.000
#> GSM1022338     2  0.3945      0.462 0.216 0.780 0.004 0.000
#> GSM1022339     2  0.3945      0.462 0.216 0.780 0.004 0.000
#> GSM1022334     2  0.4222      0.839 0.000 0.728 0.000 0.272
#> GSM1022335     2  0.4222      0.839 0.000 0.728 0.000 0.272
#> GSM1022336     2  0.4222      0.839 0.000 0.728 0.000 0.272
#> GSM1022340     1  0.1557      0.895 0.944 0.000 0.056 0.000
#> GSM1022341     1  0.1557      0.895 0.944 0.000 0.056 0.000
#> GSM1022342     1  0.1557      0.895 0.944 0.000 0.056 0.000
#> GSM1022343     1  0.1557      0.895 0.944 0.000 0.056 0.000
#> GSM1022347     3  0.0188      0.967 0.004 0.000 0.996 0.000
#> GSM1022348     3  0.0188      0.967 0.004 0.000 0.996 0.000
#> GSM1022349     3  0.0188      0.967 0.004 0.000 0.996 0.000
#> GSM1022350     3  0.0188      0.967 0.004 0.000 0.996 0.000
#> GSM1022344     3  0.3219      0.837 0.164 0.000 0.836 0.000
#> GSM1022345     3  0.3219      0.837 0.164 0.000 0.836 0.000
#> GSM1022346     3  0.3219      0.837 0.164 0.000 0.836 0.000
#> GSM1022355     1  0.0000      0.923 1.000 0.000 0.000 0.000
#> GSM1022356     1  0.0000      0.923 1.000 0.000 0.000 0.000
#> GSM1022357     1  0.0000      0.923 1.000 0.000 0.000 0.000
#> GSM1022358     1  0.0000      0.923 1.000 0.000 0.000 0.000
#> GSM1022351     1  0.0000      0.923 1.000 0.000 0.000 0.000
#> GSM1022352     1  0.0000      0.923 1.000 0.000 0.000 0.000
#> GSM1022353     1  0.0000      0.923 1.000 0.000 0.000 0.000
#> GSM1022354     1  0.0000      0.923 1.000 0.000 0.000 0.000
#> GSM1022359     2  0.4222      0.839 0.000 0.728 0.000 0.272
#> GSM1022360     2  0.4222      0.839 0.000 0.728 0.000 0.272
#> GSM1022361     2  0.4222      0.839 0.000 0.728 0.000 0.272
#> GSM1022362     2  0.4222      0.839 0.000 0.728 0.000 0.272
#> GSM1022367     2  0.3219      0.698 0.000 0.836 0.164 0.000
#> GSM1022368     2  0.3219      0.698 0.000 0.836 0.164 0.000
#> GSM1022369     2  0.3219      0.698 0.000 0.836 0.164 0.000
#> GSM1022370     2  0.3219      0.698 0.000 0.836 0.164 0.000
#> GSM1022363     2  0.3907      0.832 0.000 0.768 0.000 0.232
#> GSM1022364     2  0.3907      0.832 0.000 0.768 0.000 0.232
#> GSM1022365     2  0.3907      0.832 0.000 0.768 0.000 0.232
#> GSM1022366     2  0.3907      0.832 0.000 0.768 0.000 0.232
#> GSM1022374     2  0.0524      0.704 0.008 0.988 0.004 0.000
#> GSM1022375     2  0.0524      0.704 0.008 0.988 0.004 0.000
#> GSM1022376     2  0.0524      0.704 0.008 0.988 0.004 0.000
#> GSM1022371     2  0.4222      0.839 0.000 0.728 0.000 0.272
#> GSM1022372     2  0.4222      0.839 0.000 0.728 0.000 0.272
#> GSM1022373     2  0.4222      0.839 0.000 0.728 0.000 0.272
#> GSM1022377     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022378     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022379     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022380     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022385     3  0.0188      0.967 0.004 0.000 0.996 0.000
#> GSM1022386     3  0.0188      0.967 0.004 0.000 0.996 0.000
#> GSM1022387     3  0.0188      0.967 0.004 0.000 0.996 0.000
#> GSM1022388     3  0.0188      0.967 0.004 0.000 0.996 0.000
#> GSM1022381     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022382     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022383     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022384     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022393     1  0.3123      0.897 0.844 0.156 0.000 0.000
#> GSM1022394     1  0.3123      0.897 0.844 0.156 0.000 0.000
#> GSM1022395     1  0.3123      0.897 0.844 0.156 0.000 0.000
#> GSM1022396     1  0.3123      0.897 0.844 0.156 0.000 0.000
#> GSM1022389     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022390     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022391     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022392     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022397     3  0.0188      0.967 0.004 0.000 0.996 0.000
#> GSM1022398     3  0.0188      0.967 0.004 0.000 0.996 0.000
#> GSM1022399     3  0.0188      0.967 0.004 0.000 0.996 0.000
#> GSM1022400     3  0.0188      0.967 0.004 0.000 0.996 0.000
#> GSM1022401     1  0.3123      0.897 0.844 0.156 0.000 0.000
#> GSM1022402     1  0.3123      0.897 0.844 0.156 0.000 0.000
#> GSM1022403     1  0.3123      0.897 0.844 0.156 0.000 0.000
#> GSM1022404     1  0.3123      0.897 0.844 0.156 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1022325     2  0.1197      0.986 0.000 0.952 0.000 0.048 0.000
#> GSM1022326     2  0.1197      0.986 0.000 0.952 0.000 0.048 0.000
#> GSM1022327     2  0.1197      0.986 0.000 0.952 0.000 0.048 0.000
#> GSM1022331     3  0.3934      0.642 0.000 0.000 0.740 0.016 0.244
#> GSM1022332     3  0.3934      0.642 0.000 0.000 0.740 0.016 0.244
#> GSM1022333     3  0.3934      0.642 0.000 0.000 0.740 0.016 0.244
#> GSM1022328     2  0.1197      0.986 0.000 0.952 0.000 0.048 0.000
#> GSM1022329     2  0.1197      0.986 0.000 0.952 0.000 0.048 0.000
#> GSM1022330     2  0.1197      0.986 0.000 0.952 0.000 0.048 0.000
#> GSM1022337     5  0.0566      0.757 0.004 0.012 0.000 0.000 0.984
#> GSM1022338     5  0.0566      0.757 0.004 0.012 0.000 0.000 0.984
#> GSM1022339     5  0.0566      0.757 0.004 0.012 0.000 0.000 0.984
#> GSM1022334     2  0.1197      0.986 0.000 0.952 0.000 0.048 0.000
#> GSM1022335     2  0.1197      0.986 0.000 0.952 0.000 0.048 0.000
#> GSM1022336     2  0.1197      0.986 0.000 0.952 0.000 0.048 0.000
#> GSM1022340     1  0.2763      0.752 0.848 0.000 0.148 0.004 0.000
#> GSM1022341     1  0.2763      0.752 0.848 0.000 0.148 0.004 0.000
#> GSM1022342     1  0.2763      0.752 0.848 0.000 0.148 0.004 0.000
#> GSM1022343     1  0.2763      0.752 0.848 0.000 0.148 0.004 0.000
#> GSM1022347     3  0.0000      0.898 0.000 0.000 1.000 0.000 0.000
#> GSM1022348     3  0.0000      0.898 0.000 0.000 1.000 0.000 0.000
#> GSM1022349     3  0.0000      0.898 0.000 0.000 1.000 0.000 0.000
#> GSM1022350     3  0.0000      0.898 0.000 0.000 1.000 0.000 0.000
#> GSM1022344     3  0.3550      0.711 0.236 0.000 0.760 0.004 0.000
#> GSM1022345     3  0.3550      0.711 0.236 0.000 0.760 0.004 0.000
#> GSM1022346     3  0.3550      0.711 0.236 0.000 0.760 0.004 0.000
#> GSM1022355     1  0.0290      0.842 0.992 0.000 0.000 0.000 0.008
#> GSM1022356     1  0.0290      0.842 0.992 0.000 0.000 0.000 0.008
#> GSM1022357     1  0.0290      0.842 0.992 0.000 0.000 0.000 0.008
#> GSM1022358     1  0.0290      0.842 0.992 0.000 0.000 0.000 0.008
#> GSM1022351     1  0.0162      0.840 0.996 0.000 0.000 0.004 0.000
#> GSM1022352     1  0.0162      0.840 0.996 0.000 0.000 0.004 0.000
#> GSM1022353     1  0.0162      0.840 0.996 0.000 0.000 0.004 0.000
#> GSM1022354     1  0.0162      0.840 0.996 0.000 0.000 0.004 0.000
#> GSM1022359     2  0.1197      0.986 0.000 0.952 0.000 0.048 0.000
#> GSM1022360     2  0.1197      0.986 0.000 0.952 0.000 0.048 0.000
#> GSM1022361     2  0.1197      0.986 0.000 0.952 0.000 0.048 0.000
#> GSM1022362     2  0.1197      0.986 0.000 0.952 0.000 0.048 0.000
#> GSM1022367     5  0.5764      0.575 0.000 0.388 0.056 0.016 0.540
#> GSM1022368     5  0.5764      0.575 0.000 0.388 0.056 0.016 0.540
#> GSM1022369     5  0.5764      0.575 0.000 0.388 0.056 0.016 0.540
#> GSM1022370     5  0.5764      0.575 0.000 0.388 0.056 0.016 0.540
#> GSM1022363     2  0.0000      0.943 0.000 1.000 0.000 0.000 0.000
#> GSM1022364     2  0.0000      0.943 0.000 1.000 0.000 0.000 0.000
#> GSM1022365     2  0.0000      0.943 0.000 1.000 0.000 0.000 0.000
#> GSM1022366     2  0.0000      0.943 0.000 1.000 0.000 0.000 0.000
#> GSM1022374     5  0.0794      0.767 0.000 0.028 0.000 0.000 0.972
#> GSM1022375     5  0.0794      0.767 0.000 0.028 0.000 0.000 0.972
#> GSM1022376     5  0.0794      0.767 0.000 0.028 0.000 0.000 0.972
#> GSM1022371     2  0.1197      0.986 0.000 0.952 0.000 0.048 0.000
#> GSM1022372     2  0.1197      0.986 0.000 0.952 0.000 0.048 0.000
#> GSM1022373     2  0.1197      0.986 0.000 0.952 0.000 0.048 0.000
#> GSM1022377     4  0.0609      0.999 0.000 0.020 0.000 0.980 0.000
#> GSM1022378     4  0.0609      0.999 0.000 0.020 0.000 0.980 0.000
#> GSM1022379     4  0.0609      0.999 0.000 0.020 0.000 0.980 0.000
#> GSM1022380     4  0.0609      0.999 0.000 0.020 0.000 0.980 0.000
#> GSM1022385     3  0.0000      0.898 0.000 0.000 1.000 0.000 0.000
#> GSM1022386     3  0.0000      0.898 0.000 0.000 1.000 0.000 0.000
#> GSM1022387     3  0.0000      0.898 0.000 0.000 1.000 0.000 0.000
#> GSM1022388     3  0.0000      0.898 0.000 0.000 1.000 0.000 0.000
#> GSM1022381     4  0.0609      0.999 0.000 0.020 0.000 0.980 0.000
#> GSM1022382     4  0.0609      0.999 0.000 0.020 0.000 0.980 0.000
#> GSM1022383     4  0.0609      0.999 0.000 0.020 0.000 0.980 0.000
#> GSM1022384     4  0.0609      0.999 0.000 0.020 0.000 0.980 0.000
#> GSM1022393     1  0.3452      0.785 0.756 0.000 0.000 0.000 0.244
#> GSM1022394     1  0.3452      0.785 0.756 0.000 0.000 0.000 0.244
#> GSM1022395     1  0.3452      0.785 0.756 0.000 0.000 0.000 0.244
#> GSM1022396     1  0.3452      0.785 0.756 0.000 0.000 0.000 0.244
#> GSM1022389     4  0.0771      0.998 0.000 0.020 0.000 0.976 0.004
#> GSM1022390     4  0.0771      0.998 0.000 0.020 0.000 0.976 0.004
#> GSM1022391     4  0.0771      0.998 0.000 0.020 0.000 0.976 0.004
#> GSM1022392     4  0.0771      0.998 0.000 0.020 0.000 0.976 0.004
#> GSM1022397     3  0.0000      0.898 0.000 0.000 1.000 0.000 0.000
#> GSM1022398     3  0.0000      0.898 0.000 0.000 1.000 0.000 0.000
#> GSM1022399     3  0.0000      0.898 0.000 0.000 1.000 0.000 0.000
#> GSM1022400     3  0.0000      0.898 0.000 0.000 1.000 0.000 0.000
#> GSM1022401     1  0.3452      0.785 0.756 0.000 0.000 0.000 0.244
#> GSM1022402     1  0.3452      0.785 0.756 0.000 0.000 0.000 0.244
#> GSM1022403     1  0.3452      0.785 0.756 0.000 0.000 0.000 0.244
#> GSM1022404     1  0.3452      0.785 0.756 0.000 0.000 0.000 0.244

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1022325     2  0.0000      0.973 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022326     2  0.0000      0.973 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022327     2  0.0000      0.973 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022331     6  0.3446      0.712 0.000 0.000 0.308 0.000 0.000 0.692
#> GSM1022332     6  0.3446      0.712 0.000 0.000 0.308 0.000 0.000 0.692
#> GSM1022333     6  0.3446      0.712 0.000 0.000 0.308 0.000 0.000 0.692
#> GSM1022328     2  0.0000      0.973 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022329     2  0.0000      0.973 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022330     2  0.0000      0.973 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022337     5  0.0260      0.989 0.000 0.000 0.000 0.000 0.992 0.008
#> GSM1022338     5  0.0260      0.989 0.000 0.000 0.000 0.000 0.992 0.008
#> GSM1022339     5  0.0260      0.989 0.000 0.000 0.000 0.000 0.992 0.008
#> GSM1022334     2  0.0000      0.973 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022335     2  0.0000      0.973 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022336     2  0.0000      0.973 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022340     1  0.5100      0.554 0.644 0.000 0.200 0.004 0.000 0.152
#> GSM1022341     1  0.5100      0.554 0.644 0.000 0.200 0.004 0.000 0.152
#> GSM1022342     1  0.5100      0.554 0.644 0.000 0.200 0.004 0.000 0.152
#> GSM1022343     1  0.5100      0.554 0.644 0.000 0.200 0.004 0.000 0.152
#> GSM1022347     3  0.0000      0.921 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022348     3  0.0000      0.921 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022349     3  0.0000      0.921 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022350     3  0.0000      0.921 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022344     3  0.4446      0.674 0.120 0.000 0.724 0.004 0.000 0.152
#> GSM1022345     3  0.4486      0.670 0.124 0.000 0.720 0.004 0.000 0.152
#> GSM1022346     3  0.4486      0.670 0.124 0.000 0.720 0.004 0.000 0.152
#> GSM1022355     1  0.0363      0.745 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM1022356     1  0.0363      0.745 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM1022357     1  0.0363      0.745 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM1022358     1  0.0363      0.745 0.988 0.000 0.000 0.000 0.012 0.000
#> GSM1022351     1  0.2278      0.720 0.868 0.000 0.000 0.004 0.000 0.128
#> GSM1022352     1  0.2278      0.720 0.868 0.000 0.000 0.004 0.000 0.128
#> GSM1022353     1  0.2278      0.720 0.868 0.000 0.000 0.004 0.000 0.128
#> GSM1022354     1  0.2278      0.720 0.868 0.000 0.000 0.004 0.000 0.128
#> GSM1022359     2  0.0000      0.973 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022360     2  0.0000      0.973 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022361     2  0.0000      0.973 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022362     2  0.0000      0.973 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022367     6  0.3556      0.777 0.000 0.068 0.012 0.000 0.104 0.816
#> GSM1022368     6  0.3556      0.777 0.000 0.068 0.012 0.000 0.104 0.816
#> GSM1022369     6  0.3556      0.777 0.000 0.068 0.012 0.000 0.104 0.816
#> GSM1022370     6  0.3556      0.777 0.000 0.068 0.012 0.000 0.104 0.816
#> GSM1022363     2  0.2092      0.882 0.000 0.876 0.000 0.000 0.000 0.124
#> GSM1022364     2  0.2092      0.882 0.000 0.876 0.000 0.000 0.000 0.124
#> GSM1022365     2  0.2092      0.882 0.000 0.876 0.000 0.000 0.000 0.124
#> GSM1022366     2  0.2092      0.882 0.000 0.876 0.000 0.000 0.000 0.124
#> GSM1022374     5  0.0603      0.989 0.000 0.004 0.000 0.000 0.980 0.016
#> GSM1022375     5  0.0603      0.989 0.000 0.004 0.000 0.000 0.980 0.016
#> GSM1022376     5  0.0603      0.989 0.000 0.004 0.000 0.000 0.980 0.016
#> GSM1022371     2  0.0000      0.973 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022372     2  0.0000      0.973 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022373     2  0.0000      0.973 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022377     4  0.0260      0.989 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM1022378     4  0.0260      0.989 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM1022379     4  0.0260      0.989 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM1022380     4  0.0260      0.989 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM1022385     3  0.0000      0.921 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022386     3  0.0000      0.921 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022387     3  0.0000      0.921 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022388     3  0.0000      0.921 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022381     4  0.0260      0.989 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM1022382     4  0.0260      0.989 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM1022383     4  0.0260      0.989 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM1022384     4  0.0260      0.989 0.000 0.008 0.000 0.992 0.000 0.000
#> GSM1022393     1  0.3290      0.675 0.744 0.000 0.000 0.000 0.252 0.004
#> GSM1022394     1  0.3290      0.675 0.744 0.000 0.000 0.000 0.252 0.004
#> GSM1022395     1  0.3290      0.675 0.744 0.000 0.000 0.000 0.252 0.004
#> GSM1022396     1  0.3290      0.675 0.744 0.000 0.000 0.000 0.252 0.004
#> GSM1022389     4  0.0972      0.978 0.000 0.008 0.000 0.964 0.000 0.028
#> GSM1022390     4  0.0972      0.978 0.000 0.008 0.000 0.964 0.000 0.028
#> GSM1022391     4  0.0972      0.978 0.000 0.008 0.000 0.964 0.000 0.028
#> GSM1022392     4  0.0972      0.978 0.000 0.008 0.000 0.964 0.000 0.028
#> GSM1022397     3  0.0000      0.921 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022398     3  0.0000      0.921 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022399     3  0.0000      0.921 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022400     3  0.0000      0.921 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022401     1  0.3290      0.675 0.744 0.000 0.000 0.000 0.252 0.004
#> GSM1022402     1  0.3290      0.675 0.744 0.000 0.000 0.000 0.252 0.004
#> GSM1022403     1  0.3290      0.675 0.744 0.000 0.000 0.000 0.252 0.004
#> GSM1022404     1  0.3290      0.675 0.744 0.000 0.000 0.000 0.252 0.004

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-skmeans-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-MAD-skmeans-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-MAD-skmeans-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-MAD-skmeans-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-MAD-skmeans-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-MAD-skmeans-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-MAD-skmeans-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-MAD-skmeans-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-MAD-skmeans-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-MAD-skmeans-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-MAD-skmeans-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-MAD-skmeans-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-MAD-skmeans-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-MAD-skmeans-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-MAD-skmeans-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-MAD-skmeans-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-MAD-skmeans-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-MAD-skmeans-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-MAD-skmeans-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-MAD-skmeans-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-skmeans-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-MAD-skmeans-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-MAD-skmeans-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-MAD-skmeans-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-MAD-skmeans-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-MAD-skmeans-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-skmeans-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>              n protocol(p) cell.type(p) k
#> MAD:skmeans 77    4.05e-07     8.12e-06 2
#> MAD:skmeans 70    7.45e-12     3.09e-09 3
#> MAD:skmeans 77    1.00e-19     7.99e-06 4
#> MAD:skmeans 80    7.64e-20     2.66e-10 5
#> MAD:skmeans 80    2.76e-23     8.50e-10 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


MAD:pam**

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["MAD", "pam"]
# you can also extract it by
# res = res_list["MAD:pam"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'pam' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk MAD-pam-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk MAD-pam-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.898           0.964       0.981         0.5044 0.495   0.495
#> 3 3 0.906           0.941       0.975         0.2784 0.796   0.612
#> 4 4 0.955           0.945       0.977         0.1449 0.894   0.705
#> 5 5 1.000           1.000       1.000         0.0786 0.930   0.738
#> 6 6 1.000           0.961       0.980         0.0347 0.952   0.774

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 6
#> attr(,"optional")
#> [1] 3 4 5

There is also optional best \(k\) = 3 4 5 that is worth to check.

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1022325     2   0.000      0.962 0.000 1.000
#> GSM1022326     2   0.000      0.962 0.000 1.000
#> GSM1022327     2   0.000      0.962 0.000 1.000
#> GSM1022331     1   0.000      1.000 1.000 0.000
#> GSM1022332     1   0.000      1.000 1.000 0.000
#> GSM1022333     1   0.000      1.000 1.000 0.000
#> GSM1022328     2   0.000      0.962 0.000 1.000
#> GSM1022329     2   0.000      0.962 0.000 1.000
#> GSM1022330     2   0.000      0.962 0.000 1.000
#> GSM1022337     2   0.730      0.784 0.204 0.796
#> GSM1022338     2   0.730      0.784 0.204 0.796
#> GSM1022339     2   0.730      0.784 0.204 0.796
#> GSM1022334     2   0.000      0.962 0.000 1.000
#> GSM1022335     2   0.000      0.962 0.000 1.000
#> GSM1022336     2   0.000      0.962 0.000 1.000
#> GSM1022340     1   0.000      1.000 1.000 0.000
#> GSM1022341     1   0.000      1.000 1.000 0.000
#> GSM1022342     1   0.000      1.000 1.000 0.000
#> GSM1022343     1   0.000      1.000 1.000 0.000
#> GSM1022347     1   0.000      1.000 1.000 0.000
#> GSM1022348     1   0.000      1.000 1.000 0.000
#> GSM1022349     1   0.000      1.000 1.000 0.000
#> GSM1022350     1   0.000      1.000 1.000 0.000
#> GSM1022344     1   0.000      1.000 1.000 0.000
#> GSM1022345     1   0.000      1.000 1.000 0.000
#> GSM1022346     1   0.000      1.000 1.000 0.000
#> GSM1022355     1   0.000      1.000 1.000 0.000
#> GSM1022356     1   0.000      1.000 1.000 0.000
#> GSM1022357     1   0.000      1.000 1.000 0.000
#> GSM1022358     1   0.000      1.000 1.000 0.000
#> GSM1022351     1   0.000      1.000 1.000 0.000
#> GSM1022352     1   0.000      1.000 1.000 0.000
#> GSM1022353     1   0.000      1.000 1.000 0.000
#> GSM1022354     1   0.000      1.000 1.000 0.000
#> GSM1022359     2   0.000      0.962 0.000 1.000
#> GSM1022360     2   0.000      0.962 0.000 1.000
#> GSM1022361     2   0.000      0.962 0.000 1.000
#> GSM1022362     2   0.000      0.962 0.000 1.000
#> GSM1022367     2   0.000      0.962 0.000 1.000
#> GSM1022368     2   0.000      0.962 0.000 1.000
#> GSM1022369     2   0.000      0.962 0.000 1.000
#> GSM1022370     2   0.000      0.962 0.000 1.000
#> GSM1022363     2   0.000      0.962 0.000 1.000
#> GSM1022364     2   0.000      0.962 0.000 1.000
#> GSM1022365     2   0.000      0.962 0.000 1.000
#> GSM1022366     2   0.000      0.962 0.000 1.000
#> GSM1022374     2   0.714      0.793 0.196 0.804
#> GSM1022375     2   0.706      0.798 0.192 0.808
#> GSM1022376     2   0.722      0.788 0.200 0.800
#> GSM1022371     2   0.000      0.962 0.000 1.000
#> GSM1022372     2   0.000      0.962 0.000 1.000
#> GSM1022373     2   0.000      0.962 0.000 1.000
#> GSM1022377     2   0.000      0.962 0.000 1.000
#> GSM1022378     2   0.000      0.962 0.000 1.000
#> GSM1022379     2   0.000      0.962 0.000 1.000
#> GSM1022380     2   0.000      0.962 0.000 1.000
#> GSM1022385     1   0.000      1.000 1.000 0.000
#> GSM1022386     1   0.000      1.000 1.000 0.000
#> GSM1022387     1   0.000      1.000 1.000 0.000
#> GSM1022388     1   0.000      1.000 1.000 0.000
#> GSM1022381     2   0.000      0.962 0.000 1.000
#> GSM1022382     2   0.000      0.962 0.000 1.000
#> GSM1022383     2   0.000      0.962 0.000 1.000
#> GSM1022384     2   0.584      0.837 0.140 0.860
#> GSM1022393     1   0.000      1.000 1.000 0.000
#> GSM1022394     1   0.000      1.000 1.000 0.000
#> GSM1022395     1   0.000      1.000 1.000 0.000
#> GSM1022396     1   0.000      1.000 1.000 0.000
#> GSM1022389     2   0.000      0.962 0.000 1.000
#> GSM1022390     2   0.141      0.949 0.020 0.980
#> GSM1022391     2   0.000      0.962 0.000 1.000
#> GSM1022392     2   0.644      0.828 0.164 0.836
#> GSM1022397     1   0.000      1.000 1.000 0.000
#> GSM1022398     1   0.000      1.000 1.000 0.000
#> GSM1022399     1   0.000      1.000 1.000 0.000
#> GSM1022400     1   0.000      1.000 1.000 0.000
#> GSM1022401     1   0.000      1.000 1.000 0.000
#> GSM1022402     1   0.000      1.000 1.000 0.000
#> GSM1022403     1   0.000      1.000 1.000 0.000
#> GSM1022404     1   0.000      1.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1022325     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022326     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022327     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022331     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1022332     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1022333     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1022328     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022329     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022330     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022337     1  0.4974      0.694 0.764 0.236 0.000
#> GSM1022338     1  0.4974      0.694 0.764 0.236 0.000
#> GSM1022339     1  0.6126      0.346 0.600 0.400 0.000
#> GSM1022334     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022335     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022336     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022340     1  0.0000      0.945 1.000 0.000 0.000
#> GSM1022341     1  0.0000      0.945 1.000 0.000 0.000
#> GSM1022342     1  0.0000      0.945 1.000 0.000 0.000
#> GSM1022343     1  0.0000      0.945 1.000 0.000 0.000
#> GSM1022347     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1022348     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1022349     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1022350     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1022344     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1022345     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1022346     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1022355     1  0.0000      0.945 1.000 0.000 0.000
#> GSM1022356     1  0.0000      0.945 1.000 0.000 0.000
#> GSM1022357     1  0.0000      0.945 1.000 0.000 0.000
#> GSM1022358     1  0.0000      0.945 1.000 0.000 0.000
#> GSM1022351     1  0.0000      0.945 1.000 0.000 0.000
#> GSM1022352     1  0.0000      0.945 1.000 0.000 0.000
#> GSM1022353     1  0.0000      0.945 1.000 0.000 0.000
#> GSM1022354     1  0.0000      0.945 1.000 0.000 0.000
#> GSM1022359     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022360     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022361     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022362     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022367     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022368     2  0.0237      0.970 0.000 0.996 0.004
#> GSM1022369     2  0.4452      0.770 0.000 0.808 0.192
#> GSM1022370     2  0.0237      0.970 0.000 0.996 0.004
#> GSM1022363     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022364     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022365     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022366     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022374     2  0.4504      0.759 0.196 0.804 0.000
#> GSM1022375     2  0.4452      0.764 0.192 0.808 0.000
#> GSM1022376     2  0.4555      0.753 0.200 0.800 0.000
#> GSM1022371     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022372     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022373     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022377     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022378     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022379     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022380     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022385     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1022386     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1022387     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1022388     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1022381     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022382     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022383     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022384     2  0.0000      0.973 0.000 1.000 0.000
#> GSM1022393     1  0.0000      0.945 1.000 0.000 0.000
#> GSM1022394     1  0.0000      0.945 1.000 0.000 0.000
#> GSM1022395     1  0.0000      0.945 1.000 0.000 0.000
#> GSM1022396     1  0.0000      0.945 1.000 0.000 0.000
#> GSM1022389     2  0.0237      0.970 0.004 0.996 0.000
#> GSM1022390     1  0.4346      0.760 0.816 0.184 0.000
#> GSM1022391     2  0.3482      0.839 0.128 0.872 0.000
#> GSM1022392     1  0.1529      0.911 0.960 0.040 0.000
#> GSM1022397     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1022398     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1022399     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1022400     3  0.0000      1.000 0.000 0.000 1.000
#> GSM1022401     1  0.0000      0.945 1.000 0.000 0.000
#> GSM1022402     1  0.0000      0.945 1.000 0.000 0.000
#> GSM1022403     1  0.0000      0.945 1.000 0.000 0.000
#> GSM1022404     1  0.0000      0.945 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1022325     2  0.0000      0.965 0.000 1.000 0.000 0.000
#> GSM1022326     2  0.0000      0.965 0.000 1.000 0.000 0.000
#> GSM1022327     2  0.0000      0.965 0.000 1.000 0.000 0.000
#> GSM1022331     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022332     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022333     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022328     2  0.0000      0.965 0.000 1.000 0.000 0.000
#> GSM1022329     2  0.0000      0.965 0.000 1.000 0.000 0.000
#> GSM1022330     2  0.0000      0.965 0.000 1.000 0.000 0.000
#> GSM1022337     1  0.4624      0.489 0.660 0.340 0.000 0.000
#> GSM1022338     1  0.4134      0.642 0.740 0.260 0.000 0.000
#> GSM1022339     1  0.4866      0.329 0.596 0.404 0.000 0.000
#> GSM1022334     2  0.0000      0.965 0.000 1.000 0.000 0.000
#> GSM1022335     2  0.0000      0.965 0.000 1.000 0.000 0.000
#> GSM1022336     2  0.0000      0.965 0.000 1.000 0.000 0.000
#> GSM1022340     1  0.0000      0.945 1.000 0.000 0.000 0.000
#> GSM1022341     1  0.0000      0.945 1.000 0.000 0.000 0.000
#> GSM1022342     1  0.0000      0.945 1.000 0.000 0.000 0.000
#> GSM1022343     1  0.0000      0.945 1.000 0.000 0.000 0.000
#> GSM1022347     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022348     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022349     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022350     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022344     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022345     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022346     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022355     1  0.0000      0.945 1.000 0.000 0.000 0.000
#> GSM1022356     1  0.0000      0.945 1.000 0.000 0.000 0.000
#> GSM1022357     1  0.0000      0.945 1.000 0.000 0.000 0.000
#> GSM1022358     1  0.0000      0.945 1.000 0.000 0.000 0.000
#> GSM1022351     1  0.0000      0.945 1.000 0.000 0.000 0.000
#> GSM1022352     1  0.0000      0.945 1.000 0.000 0.000 0.000
#> GSM1022353     1  0.0000      0.945 1.000 0.000 0.000 0.000
#> GSM1022354     1  0.0000      0.945 1.000 0.000 0.000 0.000
#> GSM1022359     2  0.0000      0.965 0.000 1.000 0.000 0.000
#> GSM1022360     2  0.0000      0.965 0.000 1.000 0.000 0.000
#> GSM1022361     2  0.0000      0.965 0.000 1.000 0.000 0.000
#> GSM1022362     2  0.0000      0.965 0.000 1.000 0.000 0.000
#> GSM1022367     2  0.0336      0.960 0.000 0.992 0.000 0.008
#> GSM1022368     2  0.1209      0.940 0.000 0.964 0.004 0.032
#> GSM1022369     2  0.4152      0.789 0.000 0.808 0.160 0.032
#> GSM1022370     2  0.0188      0.963 0.000 0.996 0.004 0.000
#> GSM1022363     2  0.0000      0.965 0.000 1.000 0.000 0.000
#> GSM1022364     2  0.0000      0.965 0.000 1.000 0.000 0.000
#> GSM1022365     2  0.0000      0.965 0.000 1.000 0.000 0.000
#> GSM1022366     2  0.0000      0.965 0.000 1.000 0.000 0.000
#> GSM1022374     2  0.3569      0.761 0.196 0.804 0.000 0.000
#> GSM1022375     2  0.3528      0.766 0.192 0.808 0.000 0.000
#> GSM1022376     2  0.3610      0.755 0.200 0.800 0.000 0.000
#> GSM1022371     2  0.0000      0.965 0.000 1.000 0.000 0.000
#> GSM1022372     2  0.0000      0.965 0.000 1.000 0.000 0.000
#> GSM1022373     2  0.0000      0.965 0.000 1.000 0.000 0.000
#> GSM1022377     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022378     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022379     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022380     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022385     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022386     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022387     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022388     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022381     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022382     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022383     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022384     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022393     1  0.0000      0.945 1.000 0.000 0.000 0.000
#> GSM1022394     1  0.0000      0.945 1.000 0.000 0.000 0.000
#> GSM1022395     1  0.0000      0.945 1.000 0.000 0.000 0.000
#> GSM1022396     1  0.0000      0.945 1.000 0.000 0.000 0.000
#> GSM1022389     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022390     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022391     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022392     4  0.0000      1.000 0.000 0.000 0.000 1.000
#> GSM1022397     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022398     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022399     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022400     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022401     1  0.0000      0.945 1.000 0.000 0.000 0.000
#> GSM1022402     1  0.0000      0.945 1.000 0.000 0.000 0.000
#> GSM1022403     1  0.0000      0.945 1.000 0.000 0.000 0.000
#> GSM1022404     1  0.0000      0.945 1.000 0.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette p1 p2 p3 p4 p5
#> GSM1022325     2       0          1  0  1  0  0  0
#> GSM1022326     2       0          1  0  1  0  0  0
#> GSM1022327     2       0          1  0  1  0  0  0
#> GSM1022331     3       0          1  0  0  1  0  0
#> GSM1022332     3       0          1  0  0  1  0  0
#> GSM1022333     3       0          1  0  0  1  0  0
#> GSM1022328     2       0          1  0  1  0  0  0
#> GSM1022329     2       0          1  0  1  0  0  0
#> GSM1022330     2       0          1  0  1  0  0  0
#> GSM1022337     5       0          1  0  0  0  0  1
#> GSM1022338     5       0          1  0  0  0  0  1
#> GSM1022339     5       0          1  0  0  0  0  1
#> GSM1022334     2       0          1  0  1  0  0  0
#> GSM1022335     2       0          1  0  1  0  0  0
#> GSM1022336     2       0          1  0  1  0  0  0
#> GSM1022340     1       0          1  1  0  0  0  0
#> GSM1022341     1       0          1  1  0  0  0  0
#> GSM1022342     1       0          1  1  0  0  0  0
#> GSM1022343     1       0          1  1  0  0  0  0
#> GSM1022347     3       0          1  0  0  1  0  0
#> GSM1022348     3       0          1  0  0  1  0  0
#> GSM1022349     3       0          1  0  0  1  0  0
#> GSM1022350     3       0          1  0  0  1  0  0
#> GSM1022344     3       0          1  0  0  1  0  0
#> GSM1022345     3       0          1  0  0  1  0  0
#> GSM1022346     3       0          1  0  0  1  0  0
#> GSM1022355     1       0          1  1  0  0  0  0
#> GSM1022356     1       0          1  1  0  0  0  0
#> GSM1022357     1       0          1  1  0  0  0  0
#> GSM1022358     1       0          1  1  0  0  0  0
#> GSM1022351     1       0          1  1  0  0  0  0
#> GSM1022352     1       0          1  1  0  0  0  0
#> GSM1022353     1       0          1  1  0  0  0  0
#> GSM1022354     1       0          1  1  0  0  0  0
#> GSM1022359     2       0          1  0  1  0  0  0
#> GSM1022360     2       0          1  0  1  0  0  0
#> GSM1022361     2       0          1  0  1  0  0  0
#> GSM1022362     2       0          1  0  1  0  0  0
#> GSM1022367     5       0          1  0  0  0  0  1
#> GSM1022368     5       0          1  0  0  0  0  1
#> GSM1022369     5       0          1  0  0  0  0  1
#> GSM1022370     5       0          1  0  0  0  0  1
#> GSM1022363     2       0          1  0  1  0  0  0
#> GSM1022364     2       0          1  0  1  0  0  0
#> GSM1022365     2       0          1  0  1  0  0  0
#> GSM1022366     2       0          1  0  1  0  0  0
#> GSM1022374     5       0          1  0  0  0  0  1
#> GSM1022375     5       0          1  0  0  0  0  1
#> GSM1022376     5       0          1  0  0  0  0  1
#> GSM1022371     2       0          1  0  1  0  0  0
#> GSM1022372     2       0          1  0  1  0  0  0
#> GSM1022373     2       0          1  0  1  0  0  0
#> GSM1022377     4       0          1  0  0  0  1  0
#> GSM1022378     4       0          1  0  0  0  1  0
#> GSM1022379     4       0          1  0  0  0  1  0
#> GSM1022380     4       0          1  0  0  0  1  0
#> GSM1022385     3       0          1  0  0  1  0  0
#> GSM1022386     3       0          1  0  0  1  0  0
#> GSM1022387     3       0          1  0  0  1  0  0
#> GSM1022388     3       0          1  0  0  1  0  0
#> GSM1022381     4       0          1  0  0  0  1  0
#> GSM1022382     4       0          1  0  0  0  1  0
#> GSM1022383     4       0          1  0  0  0  1  0
#> GSM1022384     4       0          1  0  0  0  1  0
#> GSM1022393     1       0          1  1  0  0  0  0
#> GSM1022394     1       0          1  1  0  0  0  0
#> GSM1022395     1       0          1  1  0  0  0  0
#> GSM1022396     1       0          1  1  0  0  0  0
#> GSM1022389     4       0          1  0  0  0  1  0
#> GSM1022390     4       0          1  0  0  0  1  0
#> GSM1022391     4       0          1  0  0  0  1  0
#> GSM1022392     4       0          1  0  0  0  1  0
#> GSM1022397     3       0          1  0  0  1  0  0
#> GSM1022398     3       0          1  0  0  1  0  0
#> GSM1022399     3       0          1  0  0  1  0  0
#> GSM1022400     3       0          1  0  0  1  0  0
#> GSM1022401     1       0          1  1  0  0  0  0
#> GSM1022402     1       0          1  1  0  0  0  0
#> GSM1022403     1       0          1  1  0  0  0  0
#> GSM1022404     1       0          1  1  0  0  0  0

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3 p4    p5    p6
#> GSM1022325     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022326     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022327     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022331     6   0.000      0.920 0.000 0.000 0.000  0 0.000 1.000
#> GSM1022332     6   0.000      0.920 0.000 0.000 0.000  0 0.000 1.000
#> GSM1022333     6   0.000      0.920 0.000 0.000 0.000  0 0.000 1.000
#> GSM1022328     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022329     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022330     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022337     5   0.000      0.932 0.000 0.000 0.000  0 1.000 0.000
#> GSM1022338     5   0.000      0.932 0.000 0.000 0.000  0 1.000 0.000
#> GSM1022339     5   0.000      0.932 0.000 0.000 0.000  0 1.000 0.000
#> GSM1022334     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022335     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022336     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022340     1   0.000      0.963 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022341     1   0.000      0.963 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022342     1   0.000      0.963 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022343     1   0.000      0.963 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022347     3   0.000      0.993 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022348     3   0.000      0.993 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022349     3   0.000      0.993 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022350     3   0.000      0.993 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022344     3   0.000      0.993 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022345     3   0.156      0.905 0.080 0.000 0.920  0 0.000 0.000
#> GSM1022346     3   0.026      0.985 0.008 0.000 0.992  0 0.000 0.000
#> GSM1022355     1   0.000      0.963 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022356     1   0.000      0.963 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022357     1   0.000      0.963 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022358     1   0.000      0.963 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022351     1   0.000      0.963 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022352     1   0.000      0.963 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022353     1   0.000      0.963 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022354     1   0.000      0.963 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022359     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022360     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022361     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022362     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022367     6   0.000      0.920 0.000 0.000 0.000  0 0.000 1.000
#> GSM1022368     6   0.000      0.920 0.000 0.000 0.000  0 0.000 1.000
#> GSM1022369     6   0.000      0.920 0.000 0.000 0.000  0 0.000 1.000
#> GSM1022370     6   0.000      0.920 0.000 0.000 0.000  0 0.000 1.000
#> GSM1022363     6   0.150      0.843 0.000 0.076 0.000  0 0.000 0.924
#> GSM1022364     6   0.382      0.250 0.000 0.436 0.000  0 0.000 0.564
#> GSM1022365     6   0.000      0.920 0.000 0.000 0.000  0 0.000 1.000
#> GSM1022366     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022374     5   0.181      0.925 0.000 0.008 0.000  0 0.912 0.080
#> GSM1022375     5   0.166      0.924 0.000 0.000 0.000  0 0.912 0.088
#> GSM1022376     5   0.166      0.924 0.000 0.000 0.000  0 0.912 0.088
#> GSM1022371     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022372     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022373     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022377     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022378     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022379     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022380     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022385     3   0.000      0.993 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022386     3   0.000      0.993 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022387     3   0.000      0.993 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022388     3   0.000      0.993 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022381     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022382     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022383     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022384     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022393     1   0.166      0.943 0.912 0.000 0.000  0 0.088 0.000
#> GSM1022394     1   0.166      0.943 0.912 0.000 0.000  0 0.088 0.000
#> GSM1022395     1   0.166      0.943 0.912 0.000 0.000  0 0.088 0.000
#> GSM1022396     1   0.166      0.943 0.912 0.000 0.000  0 0.088 0.000
#> GSM1022389     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022390     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022391     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022392     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022397     3   0.000      0.993 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022398     3   0.000      0.993 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022399     3   0.000      0.993 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022400     3   0.000      0.993 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022401     1   0.166      0.943 0.912 0.000 0.000  0 0.088 0.000
#> GSM1022402     1   0.166      0.943 0.912 0.000 0.000  0 0.088 0.000
#> GSM1022403     1   0.166      0.943 0.912 0.000 0.000  0 0.088 0.000
#> GSM1022404     1   0.166      0.943 0.912 0.000 0.000  0 0.088 0.000

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-pam-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-MAD-pam-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-MAD-pam-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-MAD-pam-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-MAD-pam-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-MAD-pam-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-MAD-pam-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-MAD-pam-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-MAD-pam-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-MAD-pam-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-MAD-pam-get-signatures-1

get_signatures(res, k = 3)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

plot of chunk tab-MAD-pam-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-MAD-pam-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-MAD-pam-get-signatures-4

get_signatures(res, k = 6)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

plot of chunk tab-MAD-pam-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-MAD-pam-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-MAD-pam-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-MAD-pam-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-MAD-pam-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-MAD-pam-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-pam-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-MAD-pam-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-MAD-pam-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-MAD-pam-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-MAD-pam-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-MAD-pam-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-pam-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>          n protocol(p) cell.type(p) k
#> MAD:pam 80    1.22e-07     6.13e-05 2
#> MAD:pam 79    4.03e-14     1.29e-05 3
#> MAD:pam 78    2.47e-19     6.14e-06 4
#> MAD:pam 80    7.64e-20     2.66e-10 5
#> MAD:pam 79    5.39e-26     2.50e-08 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


MAD:mclust

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["MAD", "mclust"]
# you can also extract it by
# res = res_list["MAD:mclust"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 5.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk MAD-mclust-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk MAD-mclust-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.357           0.817       0.871         0.4562 0.509   0.509
#> 3 3 0.574           0.754       0.858         0.3991 0.740   0.525
#> 4 4 0.656           0.694       0.832         0.1443 0.733   0.373
#> 5 5 0.876           0.908       0.942         0.0846 0.891   0.616
#> 6 6 0.885           0.905       0.919         0.0274 0.987   0.933

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 5

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1022325     2  0.5946      0.790 0.144 0.856
#> GSM1022326     2  0.6048      0.789 0.148 0.852
#> GSM1022327     2  0.5842      0.791 0.140 0.860
#> GSM1022331     2  0.8861      0.613 0.304 0.696
#> GSM1022332     2  0.8861      0.613 0.304 0.696
#> GSM1022333     2  0.8861      0.613 0.304 0.696
#> GSM1022328     2  0.6048      0.789 0.148 0.852
#> GSM1022329     2  0.5946      0.790 0.144 0.856
#> GSM1022330     2  0.5946      0.790 0.144 0.856
#> GSM1022337     2  0.9933      0.607 0.452 0.548
#> GSM1022338     2  0.9933      0.607 0.452 0.548
#> GSM1022339     2  0.9933      0.607 0.452 0.548
#> GSM1022334     2  0.6048      0.789 0.148 0.852
#> GSM1022335     2  0.6048      0.789 0.148 0.852
#> GSM1022336     2  0.5946      0.790 0.144 0.856
#> GSM1022340     1  0.0000      0.898 1.000 0.000
#> GSM1022341     1  0.0000      0.898 1.000 0.000
#> GSM1022342     1  0.0000      0.898 1.000 0.000
#> GSM1022343     1  0.0000      0.898 1.000 0.000
#> GSM1022347     1  0.6343      0.877 0.840 0.160
#> GSM1022348     1  0.6343      0.877 0.840 0.160
#> GSM1022349     1  0.6343      0.877 0.840 0.160
#> GSM1022350     1  0.6343      0.877 0.840 0.160
#> GSM1022344     1  0.6148      0.878 0.848 0.152
#> GSM1022345     1  0.6148      0.878 0.848 0.152
#> GSM1022346     1  0.6148      0.878 0.848 0.152
#> GSM1022355     1  0.0376      0.897 0.996 0.004
#> GSM1022356     1  0.0376      0.897 0.996 0.004
#> GSM1022357     1  0.0376      0.897 0.996 0.004
#> GSM1022358     1  0.0376      0.897 0.996 0.004
#> GSM1022351     1  0.0376      0.897 0.996 0.004
#> GSM1022352     1  0.0376      0.897 0.996 0.004
#> GSM1022353     1  0.0376      0.897 0.996 0.004
#> GSM1022354     1  0.0376      0.897 0.996 0.004
#> GSM1022359     2  0.0672      0.769 0.008 0.992
#> GSM1022360     2  0.0938      0.771 0.012 0.988
#> GSM1022361     2  0.0938      0.771 0.012 0.988
#> GSM1022362     2  0.0938      0.771 0.012 0.988
#> GSM1022367     2  0.8861      0.613 0.304 0.696
#> GSM1022368     2  0.8861      0.613 0.304 0.696
#> GSM1022369     2  0.8861      0.613 0.304 0.696
#> GSM1022370     2  0.8861      0.613 0.304 0.696
#> GSM1022363     2  0.2778      0.773 0.048 0.952
#> GSM1022364     2  0.2778      0.773 0.048 0.952
#> GSM1022365     2  0.2778      0.773 0.048 0.952
#> GSM1022366     2  0.2778      0.773 0.048 0.952
#> GSM1022374     2  0.9933      0.607 0.452 0.548
#> GSM1022375     2  0.9933      0.607 0.452 0.548
#> GSM1022376     2  0.9933      0.607 0.452 0.548
#> GSM1022371     2  0.6712      0.786 0.176 0.824
#> GSM1022372     2  0.6712      0.786 0.176 0.824
#> GSM1022373     2  0.6712      0.786 0.176 0.824
#> GSM1022377     1  0.5294      0.891 0.880 0.120
#> GSM1022378     1  0.5059      0.893 0.888 0.112
#> GSM1022379     1  0.5178      0.892 0.884 0.116
#> GSM1022380     1  0.5059      0.893 0.888 0.112
#> GSM1022385     1  0.6343      0.877 0.840 0.160
#> GSM1022386     1  0.6343      0.877 0.840 0.160
#> GSM1022387     1  0.6343      0.877 0.840 0.160
#> GSM1022388     1  0.6343      0.877 0.840 0.160
#> GSM1022381     1  0.5842      0.885 0.860 0.140
#> GSM1022382     1  0.5842      0.885 0.860 0.140
#> GSM1022383     1  0.5842      0.885 0.860 0.140
#> GSM1022384     1  0.5842      0.885 0.860 0.140
#> GSM1022393     1  0.0376      0.897 0.996 0.004
#> GSM1022394     1  0.0376      0.897 0.996 0.004
#> GSM1022395     1  0.0376      0.897 0.996 0.004
#> GSM1022396     1  0.0376      0.897 0.996 0.004
#> GSM1022389     1  0.0000      0.898 1.000 0.000
#> GSM1022390     1  0.0000      0.898 1.000 0.000
#> GSM1022391     1  0.0000      0.898 1.000 0.000
#> GSM1022392     1  0.0000      0.898 1.000 0.000
#> GSM1022397     1  0.6343      0.877 0.840 0.160
#> GSM1022398     1  0.6343      0.877 0.840 0.160
#> GSM1022399     1  0.6343      0.877 0.840 0.160
#> GSM1022400     1  0.6343      0.877 0.840 0.160
#> GSM1022401     1  0.0376      0.897 0.996 0.004
#> GSM1022402     1  0.0376      0.897 0.996 0.004
#> GSM1022403     1  0.0376      0.897 0.996 0.004
#> GSM1022404     1  0.0376      0.897 0.996 0.004

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1022325     2  0.0000      0.850 0.000 1.000 0.000
#> GSM1022326     2  0.0000      0.850 0.000 1.000 0.000
#> GSM1022327     2  0.0000      0.850 0.000 1.000 0.000
#> GSM1022331     2  0.9730      0.248 0.256 0.448 0.296
#> GSM1022332     2  0.9730      0.248 0.256 0.448 0.296
#> GSM1022333     2  0.9730      0.248 0.256 0.448 0.296
#> GSM1022328     2  0.0000      0.850 0.000 1.000 0.000
#> GSM1022329     2  0.0000      0.850 0.000 1.000 0.000
#> GSM1022330     2  0.0000      0.850 0.000 1.000 0.000
#> GSM1022337     1  0.0592      0.961 0.988 0.012 0.000
#> GSM1022338     1  0.0592      0.961 0.988 0.012 0.000
#> GSM1022339     1  0.0592      0.961 0.988 0.012 0.000
#> GSM1022334     2  0.0000      0.850 0.000 1.000 0.000
#> GSM1022335     2  0.0000      0.850 0.000 1.000 0.000
#> GSM1022336     2  0.0000      0.850 0.000 1.000 0.000
#> GSM1022340     3  0.6647      0.572 0.396 0.012 0.592
#> GSM1022341     3  0.6647      0.572 0.396 0.012 0.592
#> GSM1022342     3  0.6647      0.572 0.396 0.012 0.592
#> GSM1022343     3  0.6647      0.572 0.396 0.012 0.592
#> GSM1022347     3  0.0000      0.675 0.000 0.000 1.000
#> GSM1022348     3  0.0000      0.675 0.000 0.000 1.000
#> GSM1022349     3  0.0000      0.675 0.000 0.000 1.000
#> GSM1022350     3  0.0000      0.675 0.000 0.000 1.000
#> GSM1022344     3  0.6470      0.605 0.356 0.012 0.632
#> GSM1022345     3  0.6470      0.605 0.356 0.012 0.632
#> GSM1022346     3  0.6470      0.605 0.356 0.012 0.632
#> GSM1022355     1  0.0000      0.967 1.000 0.000 0.000
#> GSM1022356     1  0.0000      0.967 1.000 0.000 0.000
#> GSM1022357     1  0.0000      0.967 1.000 0.000 0.000
#> GSM1022358     1  0.0000      0.967 1.000 0.000 0.000
#> GSM1022351     1  0.0000      0.967 1.000 0.000 0.000
#> GSM1022352     1  0.0000      0.967 1.000 0.000 0.000
#> GSM1022353     1  0.0000      0.967 1.000 0.000 0.000
#> GSM1022354     1  0.0000      0.967 1.000 0.000 0.000
#> GSM1022359     2  0.0000      0.850 0.000 1.000 0.000
#> GSM1022360     2  0.0000      0.850 0.000 1.000 0.000
#> GSM1022361     2  0.0000      0.850 0.000 1.000 0.000
#> GSM1022362     2  0.0000      0.850 0.000 1.000 0.000
#> GSM1022367     2  0.9120      0.407 0.256 0.544 0.200
#> GSM1022368     2  0.9120      0.407 0.256 0.544 0.200
#> GSM1022369     2  0.9120      0.407 0.256 0.544 0.200
#> GSM1022370     2  0.9120      0.407 0.256 0.544 0.200
#> GSM1022363     2  0.0000      0.850 0.000 1.000 0.000
#> GSM1022364     2  0.0000      0.850 0.000 1.000 0.000
#> GSM1022365     2  0.0000      0.850 0.000 1.000 0.000
#> GSM1022366     2  0.0000      0.850 0.000 1.000 0.000
#> GSM1022374     1  0.0592      0.961 0.988 0.012 0.000
#> GSM1022375     1  0.0592      0.961 0.988 0.012 0.000
#> GSM1022376     1  0.0592      0.961 0.988 0.012 0.000
#> GSM1022371     2  0.1163      0.833 0.028 0.972 0.000
#> GSM1022372     2  0.1163      0.833 0.028 0.972 0.000
#> GSM1022373     2  0.1163      0.833 0.028 0.972 0.000
#> GSM1022377     3  0.9594      0.528 0.360 0.204 0.436
#> GSM1022378     3  0.9594      0.528 0.360 0.204 0.436
#> GSM1022379     3  0.9594      0.528 0.360 0.204 0.436
#> GSM1022380     3  0.9594      0.528 0.360 0.204 0.436
#> GSM1022385     3  0.0000      0.675 0.000 0.000 1.000
#> GSM1022386     3  0.0000      0.675 0.000 0.000 1.000
#> GSM1022387     3  0.0000      0.675 0.000 0.000 1.000
#> GSM1022388     3  0.0000      0.675 0.000 0.000 1.000
#> GSM1022381     3  0.9594      0.528 0.360 0.204 0.436
#> GSM1022382     3  0.9594      0.528 0.360 0.204 0.436
#> GSM1022383     3  0.9594      0.528 0.360 0.204 0.436
#> GSM1022384     3  0.9594      0.528 0.360 0.204 0.436
#> GSM1022393     1  0.0000      0.967 1.000 0.000 0.000
#> GSM1022394     1  0.0000      0.967 1.000 0.000 0.000
#> GSM1022395     1  0.0000      0.967 1.000 0.000 0.000
#> GSM1022396     1  0.0000      0.967 1.000 0.000 0.000
#> GSM1022389     1  0.3412      0.837 0.876 0.124 0.000
#> GSM1022390     1  0.3412      0.837 0.876 0.124 0.000
#> GSM1022391     1  0.3412      0.837 0.876 0.124 0.000
#> GSM1022392     1  0.3412      0.837 0.876 0.124 0.000
#> GSM1022397     3  0.0000      0.675 0.000 0.000 1.000
#> GSM1022398     3  0.0000      0.675 0.000 0.000 1.000
#> GSM1022399     3  0.0000      0.675 0.000 0.000 1.000
#> GSM1022400     3  0.0000      0.675 0.000 0.000 1.000
#> GSM1022401     1  0.0000      0.967 1.000 0.000 0.000
#> GSM1022402     1  0.0000      0.967 1.000 0.000 0.000
#> GSM1022403     1  0.0000      0.967 1.000 0.000 0.000
#> GSM1022404     1  0.0000      0.967 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1022325     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022326     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022327     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022331     4  0.7735      0.511 0.104 0.136 0.136 0.624
#> GSM1022332     4  0.7735      0.511 0.104 0.136 0.136 0.624
#> GSM1022333     4  0.7735      0.511 0.104 0.136 0.136 0.624
#> GSM1022328     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022329     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022330     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022337     4  0.2647      0.518 0.120 0.000 0.000 0.880
#> GSM1022338     4  0.2647      0.518 0.120 0.000 0.000 0.880
#> GSM1022339     4  0.2647      0.518 0.120 0.000 0.000 0.880
#> GSM1022334     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022335     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022336     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022340     1  0.6447     -0.471 0.484 0.000 0.068 0.448
#> GSM1022341     1  0.6447     -0.471 0.484 0.000 0.068 0.448
#> GSM1022342     1  0.6447     -0.471 0.484 0.000 0.068 0.448
#> GSM1022343     1  0.6447     -0.471 0.484 0.000 0.068 0.448
#> GSM1022347     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022348     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022349     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022350     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022344     4  0.7184      0.520 0.416 0.000 0.136 0.448
#> GSM1022345     4  0.7184      0.520 0.416 0.000 0.136 0.448
#> GSM1022346     4  0.7184      0.520 0.416 0.000 0.136 0.448
#> GSM1022355     1  0.0000      0.620 1.000 0.000 0.000 0.000
#> GSM1022356     1  0.0000      0.620 1.000 0.000 0.000 0.000
#> GSM1022357     1  0.0000      0.620 1.000 0.000 0.000 0.000
#> GSM1022358     1  0.0000      0.620 1.000 0.000 0.000 0.000
#> GSM1022351     1  0.0469      0.613 0.988 0.000 0.000 0.012
#> GSM1022352     1  0.0469      0.613 0.988 0.000 0.000 0.012
#> GSM1022353     1  0.0469      0.613 0.988 0.000 0.000 0.012
#> GSM1022354     1  0.0469      0.613 0.988 0.000 0.000 0.012
#> GSM1022359     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022360     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022361     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022362     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022367     4  0.7680      0.508 0.104 0.168 0.104 0.624
#> GSM1022368     4  0.7680      0.508 0.104 0.168 0.104 0.624
#> GSM1022369     4  0.7680      0.508 0.104 0.168 0.104 0.624
#> GSM1022370     4  0.7680      0.508 0.104 0.168 0.104 0.624
#> GSM1022363     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022364     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022365     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022366     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022374     4  0.2647      0.518 0.120 0.000 0.000 0.880
#> GSM1022375     4  0.2647      0.518 0.120 0.000 0.000 0.880
#> GSM1022376     4  0.2647      0.518 0.120 0.000 0.000 0.880
#> GSM1022371     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022372     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022373     2  0.0000      1.000 0.000 1.000 0.000 0.000
#> GSM1022377     4  0.5901      0.621 0.280 0.000 0.068 0.652
#> GSM1022378     4  0.5901      0.621 0.280 0.000 0.068 0.652
#> GSM1022379     4  0.5901      0.621 0.280 0.000 0.068 0.652
#> GSM1022380     4  0.5901      0.621 0.280 0.000 0.068 0.652
#> GSM1022385     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022386     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022387     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022388     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022381     4  0.5901      0.621 0.280 0.000 0.068 0.652
#> GSM1022382     4  0.5901      0.621 0.280 0.000 0.068 0.652
#> GSM1022383     4  0.5901      0.621 0.280 0.000 0.068 0.652
#> GSM1022384     4  0.5901      0.621 0.280 0.000 0.068 0.652
#> GSM1022393     1  0.4277      0.610 0.720 0.000 0.000 0.280
#> GSM1022394     1  0.4277      0.610 0.720 0.000 0.000 0.280
#> GSM1022395     1  0.4277      0.610 0.720 0.000 0.000 0.280
#> GSM1022396     1  0.4277      0.610 0.720 0.000 0.000 0.280
#> GSM1022389     4  0.5835      0.606 0.280 0.000 0.064 0.656
#> GSM1022390     4  0.5835      0.606 0.280 0.000 0.064 0.656
#> GSM1022391     4  0.5835      0.606 0.280 0.000 0.064 0.656
#> GSM1022392     4  0.5835      0.606 0.280 0.000 0.064 0.656
#> GSM1022397     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022398     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022399     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022400     3  0.0000      1.000 0.000 0.000 1.000 0.000
#> GSM1022401     1  0.4277      0.610 0.720 0.000 0.000 0.280
#> GSM1022402     1  0.4277      0.610 0.720 0.000 0.000 0.280
#> GSM1022403     1  0.4277      0.610 0.720 0.000 0.000 0.280
#> GSM1022404     1  0.4277      0.610 0.720 0.000 0.000 0.280

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1 p2 p3    p4    p5
#> GSM1022325     2  0.0000      1.000 0.000  1  0 0.000 0.000
#> GSM1022326     2  0.0000      1.000 0.000  1  0 0.000 0.000
#> GSM1022327     2  0.0000      1.000 0.000  1  0 0.000 0.000
#> GSM1022331     5  0.0000      0.855 0.000  0  0 0.000 1.000
#> GSM1022332     5  0.0000      0.855 0.000  0  0 0.000 1.000
#> GSM1022333     5  0.0000      0.855 0.000  0  0 0.000 1.000
#> GSM1022328     2  0.0000      1.000 0.000  1  0 0.000 0.000
#> GSM1022329     2  0.0000      1.000 0.000  1  0 0.000 0.000
#> GSM1022330     2  0.0000      1.000 0.000  1  0 0.000 0.000
#> GSM1022337     5  0.3752      0.809 0.292  0  0 0.000 0.708
#> GSM1022338     5  0.3752      0.809 0.292  0  0 0.000 0.708
#> GSM1022339     5  0.3752      0.809 0.292  0  0 0.000 0.708
#> GSM1022334     2  0.0000      1.000 0.000  1  0 0.000 0.000
#> GSM1022335     2  0.0000      1.000 0.000  1  0 0.000 0.000
#> GSM1022336     2  0.0000      1.000 0.000  1  0 0.000 0.000
#> GSM1022340     4  0.2127      0.906 0.108  0  0 0.892 0.000
#> GSM1022341     4  0.2127      0.906 0.108  0  0 0.892 0.000
#> GSM1022342     4  0.2127      0.906 0.108  0  0 0.892 0.000
#> GSM1022343     4  0.2127      0.906 0.108  0  0 0.892 0.000
#> GSM1022347     3  0.0000      1.000 0.000  0  1 0.000 0.000
#> GSM1022348     3  0.0000      1.000 0.000  0  1 0.000 0.000
#> GSM1022349     3  0.0000      1.000 0.000  0  1 0.000 0.000
#> GSM1022350     3  0.0000      1.000 0.000  0  1 0.000 0.000
#> GSM1022344     4  0.2127      0.906 0.108  0  0 0.892 0.000
#> GSM1022345     4  0.2127      0.906 0.108  0  0 0.892 0.000
#> GSM1022346     4  0.2127      0.906 0.108  0  0 0.892 0.000
#> GSM1022355     1  0.3684      0.728 0.720  0  0 0.280 0.000
#> GSM1022356     1  0.3684      0.728 0.720  0  0 0.280 0.000
#> GSM1022357     1  0.3684      0.728 0.720  0  0 0.280 0.000
#> GSM1022358     1  0.3684      0.728 0.720  0  0 0.280 0.000
#> GSM1022351     4  0.2230      0.897 0.116  0  0 0.884 0.000
#> GSM1022352     1  0.3752      0.713 0.708  0  0 0.292 0.000
#> GSM1022353     1  0.3752      0.713 0.708  0  0 0.292 0.000
#> GSM1022354     1  0.3752      0.713 0.708  0  0 0.292 0.000
#> GSM1022359     2  0.0000      1.000 0.000  1  0 0.000 0.000
#> GSM1022360     2  0.0000      1.000 0.000  1  0 0.000 0.000
#> GSM1022361     2  0.0000      1.000 0.000  1  0 0.000 0.000
#> GSM1022362     2  0.0000      1.000 0.000  1  0 0.000 0.000
#> GSM1022367     5  0.0000      0.855 0.000  0  0 0.000 1.000
#> GSM1022368     5  0.0000      0.855 0.000  0  0 0.000 1.000
#> GSM1022369     5  0.0000      0.855 0.000  0  0 0.000 1.000
#> GSM1022370     5  0.0000      0.855 0.000  0  0 0.000 1.000
#> GSM1022363     2  0.0000      1.000 0.000  1  0 0.000 0.000
#> GSM1022364     2  0.0000      1.000 0.000  1  0 0.000 0.000
#> GSM1022365     2  0.0000      1.000 0.000  1  0 0.000 0.000
#> GSM1022366     2  0.0000      1.000 0.000  1  0 0.000 0.000
#> GSM1022374     5  0.3752      0.809 0.292  0  0 0.000 0.708
#> GSM1022375     5  0.3752      0.809 0.292  0  0 0.000 0.708
#> GSM1022376     5  0.3752      0.809 0.292  0  0 0.000 0.708
#> GSM1022371     2  0.0000      1.000 0.000  1  0 0.000 0.000
#> GSM1022372     2  0.0000      1.000 0.000  1  0 0.000 0.000
#> GSM1022373     2  0.0000      1.000 0.000  1  0 0.000 0.000
#> GSM1022377     4  0.0000      0.941 0.000  0  0 1.000 0.000
#> GSM1022378     4  0.0000      0.941 0.000  0  0 1.000 0.000
#> GSM1022379     4  0.0000      0.941 0.000  0  0 1.000 0.000
#> GSM1022380     4  0.0000      0.941 0.000  0  0 1.000 0.000
#> GSM1022385     3  0.0000      1.000 0.000  0  1 0.000 0.000
#> GSM1022386     3  0.0000      1.000 0.000  0  1 0.000 0.000
#> GSM1022387     3  0.0000      1.000 0.000  0  1 0.000 0.000
#> GSM1022388     3  0.0000      1.000 0.000  0  1 0.000 0.000
#> GSM1022381     4  0.0000      0.941 0.000  0  0 1.000 0.000
#> GSM1022382     4  0.0000      0.941 0.000  0  0 1.000 0.000
#> GSM1022383     4  0.0000      0.941 0.000  0  0 1.000 0.000
#> GSM1022384     4  0.0000      0.941 0.000  0  0 1.000 0.000
#> GSM1022393     1  0.0000      0.779 1.000  0  0 0.000 0.000
#> GSM1022394     1  0.0000      0.779 1.000  0  0 0.000 0.000
#> GSM1022395     1  0.0000      0.779 1.000  0  0 0.000 0.000
#> GSM1022396     1  0.0000      0.779 1.000  0  0 0.000 0.000
#> GSM1022389     4  0.0162      0.941 0.004  0  0 0.996 0.000
#> GSM1022390     4  0.0162      0.941 0.004  0  0 0.996 0.000
#> GSM1022391     4  0.0162      0.941 0.004  0  0 0.996 0.000
#> GSM1022392     4  0.0162      0.941 0.004  0  0 0.996 0.000
#> GSM1022397     3  0.0000      1.000 0.000  0  1 0.000 0.000
#> GSM1022398     3  0.0000      1.000 0.000  0  1 0.000 0.000
#> GSM1022399     3  0.0000      1.000 0.000  0  1 0.000 0.000
#> GSM1022400     3  0.0000      1.000 0.000  0  1 0.000 0.000
#> GSM1022401     1  0.0000      0.779 1.000  0  0 0.000 0.000
#> GSM1022402     1  0.0000      0.779 1.000  0  0 0.000 0.000
#> GSM1022403     1  0.0000      0.779 1.000  0  0 0.000 0.000
#> GSM1022404     1  0.0000      0.779 1.000  0  0 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1 p2    p3    p4    p5 p6
#> GSM1022325     2   0.000      1.000 0.000  1 0.000 0.000 0.000  0
#> GSM1022326     2   0.000      1.000 0.000  1 0.000 0.000 0.000  0
#> GSM1022327     2   0.000      1.000 0.000  1 0.000 0.000 0.000  0
#> GSM1022331     6   0.000      1.000 0.000  0 0.000 0.000 0.000  1
#> GSM1022332     6   0.000      1.000 0.000  0 0.000 0.000 0.000  1
#> GSM1022333     6   0.000      1.000 0.000  0 0.000 0.000 0.000  1
#> GSM1022328     2   0.000      1.000 0.000  1 0.000 0.000 0.000  0
#> GSM1022329     2   0.000      1.000 0.000  1 0.000 0.000 0.000  0
#> GSM1022330     2   0.000      1.000 0.000  1 0.000 0.000 0.000  0
#> GSM1022337     5   0.000      1.000 0.000  0 0.000 0.000 1.000  0
#> GSM1022338     5   0.000      1.000 0.000  0 0.000 0.000 1.000  0
#> GSM1022339     5   0.000      1.000 0.000  0 0.000 0.000 1.000  0
#> GSM1022334     2   0.000      1.000 0.000  1 0.000 0.000 0.000  0
#> GSM1022335     2   0.000      1.000 0.000  1 0.000 0.000 0.000  0
#> GSM1022336     2   0.000      1.000 0.000  1 0.000 0.000 0.000  0
#> GSM1022340     4   0.355      0.759 0.332  0 0.000 0.668 0.000  0
#> GSM1022341     4   0.355      0.759 0.332  0 0.000 0.668 0.000  0
#> GSM1022342     4   0.355      0.759 0.332  0 0.000 0.668 0.000  0
#> GSM1022343     4   0.355      0.759 0.332  0 0.000 0.668 0.000  0
#> GSM1022347     3   0.000      1.000 0.000  0 1.000 0.000 0.000  0
#> GSM1022348     3   0.000      1.000 0.000  0 1.000 0.000 0.000  0
#> GSM1022349     3   0.000      1.000 0.000  0 1.000 0.000 0.000  0
#> GSM1022350     3   0.000      1.000 0.000  0 1.000 0.000 0.000  0
#> GSM1022344     4   0.435      0.769 0.280  0 0.052 0.668 0.000  0
#> GSM1022345     4   0.435      0.769 0.280  0 0.052 0.668 0.000  0
#> GSM1022346     4   0.435      0.769 0.280  0 0.052 0.668 0.000  0
#> GSM1022355     1   0.139      0.782 0.932  0 0.000 0.068 0.000  0
#> GSM1022356     1   0.139      0.782 0.932  0 0.000 0.068 0.000  0
#> GSM1022357     1   0.139      0.782 0.932  0 0.000 0.068 0.000  0
#> GSM1022358     1   0.139      0.782 0.932  0 0.000 0.068 0.000  0
#> GSM1022351     4   0.387      0.492 0.484  0 0.000 0.516 0.000  0
#> GSM1022352     1   0.139      0.782 0.932  0 0.000 0.068 0.000  0
#> GSM1022353     1   0.139      0.782 0.932  0 0.000 0.068 0.000  0
#> GSM1022354     1   0.139      0.782 0.932  0 0.000 0.068 0.000  0
#> GSM1022359     2   0.000      1.000 0.000  1 0.000 0.000 0.000  0
#> GSM1022360     2   0.000      1.000 0.000  1 0.000 0.000 0.000  0
#> GSM1022361     2   0.000      1.000 0.000  1 0.000 0.000 0.000  0
#> GSM1022362     2   0.000      1.000 0.000  1 0.000 0.000 0.000  0
#> GSM1022367     6   0.000      1.000 0.000  0 0.000 0.000 0.000  1
#> GSM1022368     6   0.000      1.000 0.000  0 0.000 0.000 0.000  1
#> GSM1022369     6   0.000      1.000 0.000  0 0.000 0.000 0.000  1
#> GSM1022370     6   0.000      1.000 0.000  0 0.000 0.000 0.000  1
#> GSM1022363     2   0.000      1.000 0.000  1 0.000 0.000 0.000  0
#> GSM1022364     2   0.000      1.000 0.000  1 0.000 0.000 0.000  0
#> GSM1022365     2   0.000      1.000 0.000  1 0.000 0.000 0.000  0
#> GSM1022366     2   0.000      1.000 0.000  1 0.000 0.000 0.000  0
#> GSM1022374     5   0.000      1.000 0.000  0 0.000 0.000 1.000  0
#> GSM1022375     5   0.000      1.000 0.000  0 0.000 0.000 1.000  0
#> GSM1022376     5   0.000      1.000 0.000  0 0.000 0.000 1.000  0
#> GSM1022371     2   0.000      1.000 0.000  1 0.000 0.000 0.000  0
#> GSM1022372     2   0.000      1.000 0.000  1 0.000 0.000 0.000  0
#> GSM1022373     2   0.000      1.000 0.000  1 0.000 0.000 0.000  0
#> GSM1022377     4   0.000      0.809 0.000  0 0.000 1.000 0.000  0
#> GSM1022378     4   0.000      0.809 0.000  0 0.000 1.000 0.000  0
#> GSM1022379     4   0.000      0.809 0.000  0 0.000 1.000 0.000  0
#> GSM1022380     4   0.000      0.809 0.000  0 0.000 1.000 0.000  0
#> GSM1022385     3   0.000      1.000 0.000  0 1.000 0.000 0.000  0
#> GSM1022386     3   0.000      1.000 0.000  0 1.000 0.000 0.000  0
#> GSM1022387     3   0.000      1.000 0.000  0 1.000 0.000 0.000  0
#> GSM1022388     3   0.000      1.000 0.000  0 1.000 0.000 0.000  0
#> GSM1022381     4   0.000      0.809 0.000  0 0.000 1.000 0.000  0
#> GSM1022382     4   0.000      0.809 0.000  0 0.000 1.000 0.000  0
#> GSM1022383     4   0.000      0.809 0.000  0 0.000 1.000 0.000  0
#> GSM1022384     4   0.000      0.809 0.000  0 0.000 1.000 0.000  0
#> GSM1022393     1   0.288      0.788 0.788  0 0.000 0.000 0.212  0
#> GSM1022394     1   0.288      0.788 0.788  0 0.000 0.000 0.212  0
#> GSM1022395     1   0.288      0.788 0.788  0 0.000 0.000 0.212  0
#> GSM1022396     1   0.288      0.788 0.788  0 0.000 0.000 0.212  0
#> GSM1022389     4   0.249      0.828 0.164  0 0.000 0.836 0.000  0
#> GSM1022390     4   0.249      0.828 0.164  0 0.000 0.836 0.000  0
#> GSM1022391     4   0.249      0.828 0.164  0 0.000 0.836 0.000  0
#> GSM1022392     4   0.249      0.828 0.164  0 0.000 0.836 0.000  0
#> GSM1022397     3   0.000      1.000 0.000  0 1.000 0.000 0.000  0
#> GSM1022398     3   0.000      1.000 0.000  0 1.000 0.000 0.000  0
#> GSM1022399     3   0.000      1.000 0.000  0 1.000 0.000 0.000  0
#> GSM1022400     3   0.000      1.000 0.000  0 1.000 0.000 0.000  0
#> GSM1022401     1   0.288      0.788 0.788  0 0.000 0.000 0.212  0
#> GSM1022402     1   0.288      0.788 0.788  0 0.000 0.000 0.212  0
#> GSM1022403     1   0.288      0.788 0.788  0 0.000 0.000 0.212  0
#> GSM1022404     1   0.288      0.788 0.788  0 0.000 0.000 0.212  0

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-mclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-MAD-mclust-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-MAD-mclust-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-MAD-mclust-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-MAD-mclust-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-MAD-mclust-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-MAD-mclust-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-MAD-mclust-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-MAD-mclust-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-MAD-mclust-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-MAD-mclust-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-MAD-mclust-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-MAD-mclust-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-MAD-mclust-get-signatures-4

get_signatures(res, k = 6)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

plot of chunk tab-MAD-mclust-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-MAD-mclust-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-MAD-mclust-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-MAD-mclust-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-MAD-mclust-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-MAD-mclust-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-mclust-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-MAD-mclust-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-MAD-mclust-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-MAD-mclust-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-MAD-mclust-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-MAD-mclust-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-mclust-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>             n protocol(p) cell.type(p) k
#> MAD:mclust 80    1.10e-11     4.22e-01 2
#> MAD:mclust 73    3.39e-15     1.25e-05 3
#> MAD:mclust 76    1.02e-13     7.08e-08 4
#> MAD:mclust 80    3.30e-17     1.92e-14 5
#> MAD:mclust 79    1.54e-20     1.39e-13 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


MAD:NMF**

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["MAD", "NMF"]
# you can also extract it by
# res = res_list["MAD:NMF"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk MAD-NMF-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk MAD-NMF-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.974           0.975       0.988         0.5059 0.495   0.495
#> 3 3 0.747           0.822       0.923         0.3088 0.717   0.491
#> 4 4 0.744           0.829       0.895         0.1158 0.836   0.570
#> 5 5 0.801           0.732       0.858         0.0450 0.935   0.760
#> 6 6 0.789           0.740       0.822         0.0417 0.929   0.704

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 2

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1022325     2  0.0000      0.976 0.000 1.000
#> GSM1022326     2  0.0000      0.976 0.000 1.000
#> GSM1022327     2  0.0000      0.976 0.000 1.000
#> GSM1022331     1  0.0000      1.000 1.000 0.000
#> GSM1022332     1  0.0000      1.000 1.000 0.000
#> GSM1022333     1  0.0000      1.000 1.000 0.000
#> GSM1022328     2  0.0000      0.976 0.000 1.000
#> GSM1022329     2  0.0000      0.976 0.000 1.000
#> GSM1022330     2  0.0000      0.976 0.000 1.000
#> GSM1022337     2  0.7745      0.724 0.228 0.772
#> GSM1022338     2  0.7883      0.711 0.236 0.764
#> GSM1022339     2  0.6623      0.803 0.172 0.828
#> GSM1022334     2  0.0000      0.976 0.000 1.000
#> GSM1022335     2  0.0000      0.976 0.000 1.000
#> GSM1022336     2  0.0000      0.976 0.000 1.000
#> GSM1022340     1  0.0000      1.000 1.000 0.000
#> GSM1022341     1  0.0000      1.000 1.000 0.000
#> GSM1022342     1  0.0000      1.000 1.000 0.000
#> GSM1022343     1  0.0000      1.000 1.000 0.000
#> GSM1022347     1  0.0000      1.000 1.000 0.000
#> GSM1022348     1  0.0000      1.000 1.000 0.000
#> GSM1022349     1  0.0000      1.000 1.000 0.000
#> GSM1022350     1  0.0000      1.000 1.000 0.000
#> GSM1022344     1  0.0000      1.000 1.000 0.000
#> GSM1022345     1  0.0000      1.000 1.000 0.000
#> GSM1022346     1  0.0000      1.000 1.000 0.000
#> GSM1022355     1  0.0000      1.000 1.000 0.000
#> GSM1022356     1  0.0000      1.000 1.000 0.000
#> GSM1022357     1  0.0000      1.000 1.000 0.000
#> GSM1022358     1  0.0000      1.000 1.000 0.000
#> GSM1022351     1  0.0000      1.000 1.000 0.000
#> GSM1022352     1  0.0000      1.000 1.000 0.000
#> GSM1022353     1  0.0000      1.000 1.000 0.000
#> GSM1022354     1  0.0000      1.000 1.000 0.000
#> GSM1022359     2  0.0000      0.976 0.000 1.000
#> GSM1022360     2  0.0000      0.976 0.000 1.000
#> GSM1022361     2  0.0000      0.976 0.000 1.000
#> GSM1022362     2  0.0000      0.976 0.000 1.000
#> GSM1022367     2  0.0000      0.976 0.000 1.000
#> GSM1022368     2  0.0000      0.976 0.000 1.000
#> GSM1022369     2  0.0000      0.976 0.000 1.000
#> GSM1022370     2  0.0000      0.976 0.000 1.000
#> GSM1022363     2  0.0000      0.976 0.000 1.000
#> GSM1022364     2  0.0000      0.976 0.000 1.000
#> GSM1022365     2  0.0000      0.976 0.000 1.000
#> GSM1022366     2  0.0000      0.976 0.000 1.000
#> GSM1022374     2  0.0000      0.976 0.000 1.000
#> GSM1022375     2  0.0000      0.976 0.000 1.000
#> GSM1022376     2  0.0000      0.976 0.000 1.000
#> GSM1022371     2  0.0000      0.976 0.000 1.000
#> GSM1022372     2  0.0000      0.976 0.000 1.000
#> GSM1022373     2  0.0000      0.976 0.000 1.000
#> GSM1022377     2  0.0000      0.976 0.000 1.000
#> GSM1022378     2  0.0000      0.976 0.000 1.000
#> GSM1022379     2  0.0000      0.976 0.000 1.000
#> GSM1022380     2  0.0000      0.976 0.000 1.000
#> GSM1022385     1  0.0000      1.000 1.000 0.000
#> GSM1022386     1  0.0000      1.000 1.000 0.000
#> GSM1022387     1  0.0000      1.000 1.000 0.000
#> GSM1022388     1  0.0000      1.000 1.000 0.000
#> GSM1022381     2  0.0672      0.970 0.008 0.992
#> GSM1022382     2  0.0376      0.973 0.004 0.996
#> GSM1022383     2  0.1843      0.955 0.028 0.972
#> GSM1022384     2  0.5294      0.868 0.120 0.880
#> GSM1022393     1  0.0000      1.000 1.000 0.000
#> GSM1022394     1  0.0000      1.000 1.000 0.000
#> GSM1022395     1  0.0000      1.000 1.000 0.000
#> GSM1022396     1  0.0000      1.000 1.000 0.000
#> GSM1022389     2  0.0000      0.976 0.000 1.000
#> GSM1022390     2  0.2423      0.945 0.040 0.960
#> GSM1022391     2  0.0000      0.976 0.000 1.000
#> GSM1022392     2  0.6048      0.835 0.148 0.852
#> GSM1022397     1  0.0000      1.000 1.000 0.000
#> GSM1022398     1  0.0000      1.000 1.000 0.000
#> GSM1022399     1  0.0000      1.000 1.000 0.000
#> GSM1022400     1  0.0000      1.000 1.000 0.000
#> GSM1022401     1  0.0000      1.000 1.000 0.000
#> GSM1022402     1  0.0000      1.000 1.000 0.000
#> GSM1022403     1  0.0000      1.000 1.000 0.000
#> GSM1022404     1  0.0000      1.000 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1022325     2  0.0000     0.8491 0.000 1.000 0.000
#> GSM1022326     2  0.0000     0.8491 0.000 1.000 0.000
#> GSM1022327     2  0.0000     0.8491 0.000 1.000 0.000
#> GSM1022331     3  0.0000     0.9200 0.000 0.000 1.000
#> GSM1022332     3  0.0000     0.9200 0.000 0.000 1.000
#> GSM1022333     3  0.0000     0.9200 0.000 0.000 1.000
#> GSM1022328     2  0.0000     0.8491 0.000 1.000 0.000
#> GSM1022329     2  0.0000     0.8491 0.000 1.000 0.000
#> GSM1022330     2  0.0000     0.8491 0.000 1.000 0.000
#> GSM1022337     1  0.2878     0.8758 0.904 0.096 0.000
#> GSM1022338     1  0.2878     0.8758 0.904 0.096 0.000
#> GSM1022339     1  0.4842     0.6773 0.776 0.224 0.000
#> GSM1022334     2  0.0000     0.8491 0.000 1.000 0.000
#> GSM1022335     2  0.0000     0.8491 0.000 1.000 0.000
#> GSM1022336     2  0.0000     0.8491 0.000 1.000 0.000
#> GSM1022340     1  0.0000     0.9680 1.000 0.000 0.000
#> GSM1022341     1  0.0000     0.9680 1.000 0.000 0.000
#> GSM1022342     1  0.0000     0.9680 1.000 0.000 0.000
#> GSM1022343     1  0.0000     0.9680 1.000 0.000 0.000
#> GSM1022347     3  0.0000     0.9200 0.000 0.000 1.000
#> GSM1022348     3  0.0000     0.9200 0.000 0.000 1.000
#> GSM1022349     3  0.0000     0.9200 0.000 0.000 1.000
#> GSM1022350     3  0.0000     0.9200 0.000 0.000 1.000
#> GSM1022344     3  0.1289     0.8982 0.032 0.000 0.968
#> GSM1022345     3  0.6280     0.1564 0.460 0.000 0.540
#> GSM1022346     3  0.3879     0.7855 0.152 0.000 0.848
#> GSM1022355     1  0.0000     0.9680 1.000 0.000 0.000
#> GSM1022356     1  0.0000     0.9680 1.000 0.000 0.000
#> GSM1022357     1  0.0000     0.9680 1.000 0.000 0.000
#> GSM1022358     1  0.0000     0.9680 1.000 0.000 0.000
#> GSM1022351     1  0.0000     0.9680 1.000 0.000 0.000
#> GSM1022352     1  0.0000     0.9680 1.000 0.000 0.000
#> GSM1022353     1  0.0000     0.9680 1.000 0.000 0.000
#> GSM1022354     1  0.0000     0.9680 1.000 0.000 0.000
#> GSM1022359     2  0.0000     0.8491 0.000 1.000 0.000
#> GSM1022360     2  0.0000     0.8491 0.000 1.000 0.000
#> GSM1022361     2  0.0000     0.8491 0.000 1.000 0.000
#> GSM1022362     2  0.0000     0.8491 0.000 1.000 0.000
#> GSM1022367     2  0.6244     0.0926 0.000 0.560 0.440
#> GSM1022368     3  0.5327     0.6155 0.000 0.272 0.728
#> GSM1022369     3  0.2959     0.8376 0.000 0.100 0.900
#> GSM1022370     3  0.6305     0.1105 0.000 0.484 0.516
#> GSM1022363     2  0.0000     0.8491 0.000 1.000 0.000
#> GSM1022364     2  0.0000     0.8491 0.000 1.000 0.000
#> GSM1022365     2  0.0000     0.8491 0.000 1.000 0.000
#> GSM1022366     2  0.0000     0.8491 0.000 1.000 0.000
#> GSM1022374     2  0.5363     0.5996 0.276 0.724 0.000
#> GSM1022375     2  0.4931     0.6614 0.232 0.768 0.000
#> GSM1022376     2  0.5948     0.4432 0.360 0.640 0.000
#> GSM1022371     2  0.0000     0.8491 0.000 1.000 0.000
#> GSM1022372     2  0.0000     0.8491 0.000 1.000 0.000
#> GSM1022373     2  0.0000     0.8491 0.000 1.000 0.000
#> GSM1022377     2  0.5058     0.6849 0.244 0.756 0.000
#> GSM1022378     2  0.5138     0.6766 0.252 0.748 0.000
#> GSM1022379     2  0.6154     0.4240 0.408 0.592 0.000
#> GSM1022380     2  0.6244     0.3441 0.440 0.560 0.000
#> GSM1022385     3  0.0000     0.9200 0.000 0.000 1.000
#> GSM1022386     3  0.0000     0.9200 0.000 0.000 1.000
#> GSM1022387     3  0.0000     0.9200 0.000 0.000 1.000
#> GSM1022388     3  0.0000     0.9200 0.000 0.000 1.000
#> GSM1022381     2  0.5785     0.5712 0.332 0.668 0.000
#> GSM1022382     2  0.5785     0.5712 0.332 0.668 0.000
#> GSM1022383     2  0.5327     0.6549 0.272 0.728 0.000
#> GSM1022384     2  0.6079     0.4706 0.388 0.612 0.000
#> GSM1022393     1  0.0000     0.9680 1.000 0.000 0.000
#> GSM1022394     1  0.0000     0.9680 1.000 0.000 0.000
#> GSM1022395     1  0.0000     0.9680 1.000 0.000 0.000
#> GSM1022396     1  0.0000     0.9680 1.000 0.000 0.000
#> GSM1022389     1  0.2796     0.8750 0.908 0.092 0.000
#> GSM1022390     1  0.0747     0.9550 0.984 0.016 0.000
#> GSM1022391     1  0.4062     0.7695 0.836 0.164 0.000
#> GSM1022392     1  0.0237     0.9651 0.996 0.004 0.000
#> GSM1022397     3  0.0000     0.9200 0.000 0.000 1.000
#> GSM1022398     3  0.0000     0.9200 0.000 0.000 1.000
#> GSM1022399     3  0.0000     0.9200 0.000 0.000 1.000
#> GSM1022400     3  0.0000     0.9200 0.000 0.000 1.000
#> GSM1022401     1  0.0000     0.9680 1.000 0.000 0.000
#> GSM1022402     1  0.0000     0.9680 1.000 0.000 0.000
#> GSM1022403     1  0.0000     0.9680 1.000 0.000 0.000
#> GSM1022404     1  0.0000     0.9680 1.000 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1022325     2  0.2530     0.8736 0.000 0.888 0.000 0.112
#> GSM1022326     2  0.2530     0.8736 0.000 0.888 0.000 0.112
#> GSM1022327     2  0.2011     0.8784 0.000 0.920 0.000 0.080
#> GSM1022331     3  0.0000     0.9515 0.000 0.000 1.000 0.000
#> GSM1022332     3  0.0000     0.9515 0.000 0.000 1.000 0.000
#> GSM1022333     3  0.0000     0.9515 0.000 0.000 1.000 0.000
#> GSM1022328     2  0.0188     0.8785 0.000 0.996 0.000 0.004
#> GSM1022329     2  0.0469     0.8796 0.000 0.988 0.000 0.012
#> GSM1022330     2  0.0707     0.8802 0.000 0.980 0.000 0.020
#> GSM1022337     1  0.1022     0.8606 0.968 0.032 0.000 0.000
#> GSM1022338     1  0.1022     0.8606 0.968 0.032 0.000 0.000
#> GSM1022339     1  0.2011     0.8287 0.920 0.080 0.000 0.000
#> GSM1022334     2  0.2530     0.8736 0.000 0.888 0.000 0.112
#> GSM1022335     2  0.2469     0.8745 0.000 0.892 0.000 0.108
#> GSM1022336     2  0.2408     0.8753 0.000 0.896 0.000 0.104
#> GSM1022340     4  0.3123     0.8114 0.156 0.000 0.000 0.844
#> GSM1022341     4  0.3123     0.8114 0.156 0.000 0.000 0.844
#> GSM1022342     4  0.3123     0.8114 0.156 0.000 0.000 0.844
#> GSM1022343     4  0.3123     0.8114 0.156 0.000 0.000 0.844
#> GSM1022347     3  0.0000     0.9515 0.000 0.000 1.000 0.000
#> GSM1022348     3  0.0000     0.9515 0.000 0.000 1.000 0.000
#> GSM1022349     3  0.0000     0.9515 0.000 0.000 1.000 0.000
#> GSM1022350     3  0.0000     0.9515 0.000 0.000 1.000 0.000
#> GSM1022344     4  0.3444     0.7232 0.000 0.000 0.184 0.816
#> GSM1022345     4  0.3400     0.7266 0.000 0.000 0.180 0.820
#> GSM1022346     4  0.3400     0.7266 0.000 0.000 0.180 0.820
#> GSM1022355     1  0.3726     0.7336 0.788 0.000 0.000 0.212
#> GSM1022356     1  0.3172     0.7925 0.840 0.000 0.000 0.160
#> GSM1022357     1  0.4356     0.6020 0.708 0.000 0.000 0.292
#> GSM1022358     1  0.3528     0.7589 0.808 0.000 0.000 0.192
#> GSM1022351     4  0.3172     0.8096 0.160 0.000 0.000 0.840
#> GSM1022352     4  0.3172     0.8096 0.160 0.000 0.000 0.840
#> GSM1022353     4  0.3172     0.8096 0.160 0.000 0.000 0.840
#> GSM1022354     4  0.3219     0.8050 0.164 0.000 0.000 0.836
#> GSM1022359     2  0.0188     0.8770 0.004 0.996 0.000 0.000
#> GSM1022360     2  0.0188     0.8770 0.004 0.996 0.000 0.000
#> GSM1022361     2  0.0188     0.8770 0.004 0.996 0.000 0.000
#> GSM1022362     2  0.0188     0.8770 0.004 0.996 0.000 0.000
#> GSM1022367     3  0.4010     0.8092 0.028 0.156 0.816 0.000
#> GSM1022368     3  0.4010     0.8092 0.028 0.156 0.816 0.000
#> GSM1022369     3  0.4010     0.8092 0.028 0.156 0.816 0.000
#> GSM1022370     3  0.4010     0.8092 0.028 0.156 0.816 0.000
#> GSM1022363     2  0.0921     0.8662 0.028 0.972 0.000 0.000
#> GSM1022364     2  0.0921     0.8662 0.028 0.972 0.000 0.000
#> GSM1022365     2  0.0921     0.8662 0.028 0.972 0.000 0.000
#> GSM1022366     2  0.0817     0.8684 0.024 0.976 0.000 0.000
#> GSM1022374     1  0.3123     0.7614 0.844 0.156 0.000 0.000
#> GSM1022375     1  0.3123     0.7614 0.844 0.156 0.000 0.000
#> GSM1022376     1  0.3123     0.7614 0.844 0.156 0.000 0.000
#> GSM1022371     2  0.0592     0.8725 0.016 0.984 0.000 0.000
#> GSM1022372     2  0.0469     0.8741 0.012 0.988 0.000 0.000
#> GSM1022373     2  0.0707     0.8705 0.020 0.980 0.000 0.000
#> GSM1022377     2  0.3356     0.8488 0.000 0.824 0.000 0.176
#> GSM1022378     2  0.3400     0.8472 0.000 0.820 0.000 0.180
#> GSM1022379     2  0.4040     0.8069 0.000 0.752 0.000 0.248
#> GSM1022380     2  0.4406     0.7596 0.000 0.700 0.000 0.300
#> GSM1022385     3  0.0000     0.9515 0.000 0.000 1.000 0.000
#> GSM1022386     3  0.0000     0.9515 0.000 0.000 1.000 0.000
#> GSM1022387     3  0.0000     0.9515 0.000 0.000 1.000 0.000
#> GSM1022388     3  0.0000     0.9515 0.000 0.000 1.000 0.000
#> GSM1022381     2  0.4431     0.7523 0.000 0.696 0.000 0.304
#> GSM1022382     2  0.4406     0.7567 0.000 0.700 0.000 0.300
#> GSM1022383     2  0.4500     0.7375 0.000 0.684 0.000 0.316
#> GSM1022384     2  0.4933     0.5385 0.000 0.568 0.000 0.432
#> GSM1022393     1  0.1118     0.8817 0.964 0.000 0.000 0.036
#> GSM1022394     1  0.1211     0.8801 0.960 0.000 0.000 0.040
#> GSM1022395     1  0.1118     0.8817 0.964 0.000 0.000 0.036
#> GSM1022396     1  0.1118     0.8817 0.964 0.000 0.000 0.036
#> GSM1022389     2  0.3688     0.8338 0.000 0.792 0.000 0.208
#> GSM1022390     4  0.4790    -0.0454 0.000 0.380 0.000 0.620
#> GSM1022391     2  0.3942     0.8147 0.000 0.764 0.000 0.236
#> GSM1022392     4  0.4304     0.2835 0.000 0.284 0.000 0.716
#> GSM1022397     3  0.0000     0.9515 0.000 0.000 1.000 0.000
#> GSM1022398     3  0.0000     0.9515 0.000 0.000 1.000 0.000
#> GSM1022399     3  0.0000     0.9515 0.000 0.000 1.000 0.000
#> GSM1022400     3  0.0000     0.9515 0.000 0.000 1.000 0.000
#> GSM1022401     1  0.1118     0.8817 0.964 0.000 0.000 0.036
#> GSM1022402     1  0.1022     0.8808 0.968 0.000 0.000 0.032
#> GSM1022403     1  0.1118     0.8817 0.964 0.000 0.000 0.036
#> GSM1022404     1  0.1118     0.8817 0.964 0.000 0.000 0.036

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1022325     2  0.0880     0.7570 0.000 0.968 0.000 0.032 0.000
#> GSM1022326     2  0.0794     0.7605 0.000 0.972 0.000 0.028 0.000
#> GSM1022327     2  0.0703     0.7630 0.000 0.976 0.000 0.024 0.000
#> GSM1022331     3  0.1731     0.9027 0.012 0.000 0.940 0.040 0.008
#> GSM1022332     3  0.1569     0.9057 0.012 0.000 0.948 0.032 0.008
#> GSM1022333     3  0.1913     0.8991 0.016 0.000 0.932 0.044 0.008
#> GSM1022328     2  0.0510     0.7683 0.000 0.984 0.000 0.016 0.000
#> GSM1022329     2  0.0609     0.7669 0.000 0.980 0.000 0.020 0.000
#> GSM1022330     2  0.0609     0.7650 0.000 0.980 0.000 0.020 0.000
#> GSM1022337     5  0.0290     0.8755 0.000 0.000 0.000 0.008 0.992
#> GSM1022338     5  0.0290     0.8755 0.000 0.000 0.000 0.008 0.992
#> GSM1022339     5  0.0290     0.8755 0.000 0.000 0.000 0.008 0.992
#> GSM1022334     2  0.0963     0.7539 0.000 0.964 0.000 0.036 0.000
#> GSM1022335     2  0.1043     0.7558 0.000 0.960 0.000 0.040 0.000
#> GSM1022336     2  0.0963     0.7539 0.000 0.964 0.000 0.036 0.000
#> GSM1022340     1  0.1278     0.9163 0.960 0.000 0.004 0.016 0.020
#> GSM1022341     1  0.1278     0.9163 0.960 0.000 0.004 0.016 0.020
#> GSM1022342     1  0.1179     0.9155 0.964 0.000 0.004 0.016 0.016
#> GSM1022343     1  0.1179     0.9155 0.964 0.000 0.004 0.016 0.016
#> GSM1022347     3  0.1043     0.9007 0.040 0.000 0.960 0.000 0.000
#> GSM1022348     3  0.0404     0.9167 0.012 0.000 0.988 0.000 0.000
#> GSM1022349     3  0.0703     0.9117 0.024 0.000 0.976 0.000 0.000
#> GSM1022350     3  0.0510     0.9155 0.016 0.000 0.984 0.000 0.000
#> GSM1022344     1  0.2124     0.8606 0.900 0.000 0.096 0.004 0.000
#> GSM1022345     1  0.1502     0.8865 0.940 0.000 0.056 0.004 0.000
#> GSM1022346     1  0.1830     0.8797 0.924 0.000 0.068 0.008 0.000
#> GSM1022355     5  0.4171     0.3900 0.396 0.000 0.000 0.000 0.604
#> GSM1022356     5  0.3336     0.7136 0.228 0.000 0.000 0.000 0.772
#> GSM1022357     1  0.4283     0.0238 0.544 0.000 0.000 0.000 0.456
#> GSM1022358     5  0.4015     0.5068 0.348 0.000 0.000 0.000 0.652
#> GSM1022351     1  0.1364     0.9128 0.952 0.000 0.000 0.012 0.036
#> GSM1022352     1  0.1124     0.9132 0.960 0.000 0.000 0.004 0.036
#> GSM1022353     1  0.1205     0.9113 0.956 0.000 0.000 0.004 0.040
#> GSM1022354     1  0.1205     0.9113 0.956 0.000 0.000 0.004 0.040
#> GSM1022359     2  0.0404     0.7684 0.000 0.988 0.000 0.012 0.000
#> GSM1022360     2  0.0510     0.7677 0.000 0.984 0.000 0.016 0.000
#> GSM1022361     2  0.0510     0.7677 0.000 0.984 0.000 0.016 0.000
#> GSM1022362     2  0.0404     0.7682 0.000 0.988 0.000 0.012 0.000
#> GSM1022367     3  0.5947     0.7215 0.016 0.164 0.684 0.112 0.024
#> GSM1022368     3  0.5633     0.7537 0.016 0.136 0.716 0.108 0.024
#> GSM1022369     3  0.5543     0.7601 0.016 0.132 0.724 0.104 0.024
#> GSM1022370     3  0.5782     0.7376 0.016 0.156 0.700 0.104 0.024
#> GSM1022363     2  0.3409     0.6502 0.016 0.844 0.000 0.116 0.024
#> GSM1022364     2  0.3319     0.6546 0.016 0.848 0.000 0.116 0.020
#> GSM1022365     2  0.3319     0.6546 0.016 0.848 0.000 0.116 0.020
#> GSM1022366     2  0.3070     0.6671 0.016 0.860 0.000 0.112 0.012
#> GSM1022374     5  0.3241     0.7769 0.012 0.104 0.000 0.028 0.856
#> GSM1022375     5  0.3405     0.7704 0.012 0.104 0.000 0.036 0.848
#> GSM1022376     5  0.2452     0.8243 0.012 0.052 0.000 0.028 0.908
#> GSM1022371     2  0.0771     0.7612 0.000 0.976 0.000 0.020 0.004
#> GSM1022372     2  0.1041     0.7631 0.000 0.964 0.000 0.032 0.004
#> GSM1022373     2  0.0865     0.7590 0.000 0.972 0.000 0.024 0.004
#> GSM1022377     2  0.4905    -0.7976 0.024 0.500 0.000 0.476 0.000
#> GSM1022378     2  0.4978    -0.8047 0.028 0.496 0.000 0.476 0.000
#> GSM1022379     2  0.4978    -0.8047 0.028 0.496 0.000 0.476 0.000
#> GSM1022380     4  0.4980     0.7991 0.028 0.484 0.000 0.488 0.000
#> GSM1022385     3  0.0000     0.9181 0.000 0.000 1.000 0.000 0.000
#> GSM1022386     3  0.0000     0.9181 0.000 0.000 1.000 0.000 0.000
#> GSM1022387     3  0.0000     0.9181 0.000 0.000 1.000 0.000 0.000
#> GSM1022388     3  0.0000     0.9181 0.000 0.000 1.000 0.000 0.000
#> GSM1022381     4  0.5170     0.8695 0.032 0.440 0.000 0.524 0.004
#> GSM1022382     4  0.5170     0.8695 0.032 0.440 0.000 0.524 0.004
#> GSM1022383     4  0.5166     0.8704 0.032 0.436 0.000 0.528 0.004
#> GSM1022384     4  0.5106     0.8553 0.032 0.400 0.000 0.564 0.004
#> GSM1022393     5  0.1282     0.8889 0.044 0.000 0.000 0.004 0.952
#> GSM1022394     5  0.1357     0.8874 0.048 0.000 0.000 0.004 0.948
#> GSM1022395     5  0.1282     0.8889 0.044 0.000 0.000 0.004 0.952
#> GSM1022396     5  0.1282     0.8889 0.044 0.000 0.000 0.004 0.952
#> GSM1022389     2  0.4972    -0.8155 0.020 0.500 0.000 0.476 0.004
#> GSM1022390     4  0.5933     0.7775 0.084 0.348 0.000 0.556 0.012
#> GSM1022391     4  0.5382     0.8195 0.044 0.476 0.000 0.476 0.004
#> GSM1022392     4  0.5919     0.7398 0.092 0.316 0.000 0.580 0.012
#> GSM1022397     3  0.0579     0.9170 0.008 0.000 0.984 0.008 0.000
#> GSM1022398     3  0.0579     0.9170 0.008 0.000 0.984 0.008 0.000
#> GSM1022399     3  0.0693     0.9160 0.012 0.000 0.980 0.008 0.000
#> GSM1022400     3  0.0798     0.9148 0.016 0.000 0.976 0.008 0.000
#> GSM1022401     5  0.1282     0.8889 0.044 0.000 0.000 0.004 0.952
#> GSM1022402     5  0.1043     0.8878 0.040 0.000 0.000 0.000 0.960
#> GSM1022403     5  0.1357     0.8874 0.048 0.000 0.000 0.004 0.948
#> GSM1022404     5  0.1282     0.8889 0.044 0.000 0.000 0.004 0.952

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1022325     2  0.0777      0.671 0.000 0.972 0.000 0.024 0.000 0.004
#> GSM1022326     2  0.0603      0.672 0.000 0.980 0.000 0.016 0.000 0.004
#> GSM1022327     2  0.0692      0.672 0.000 0.976 0.000 0.020 0.000 0.004
#> GSM1022331     3  0.2527      0.648 0.000 0.000 0.832 0.000 0.000 0.168
#> GSM1022332     3  0.2135      0.747 0.000 0.000 0.872 0.000 0.000 0.128
#> GSM1022333     3  0.2854      0.509 0.000 0.000 0.792 0.000 0.000 0.208
#> GSM1022328     2  0.0717      0.674 0.000 0.976 0.000 0.016 0.000 0.008
#> GSM1022329     2  0.0622      0.675 0.000 0.980 0.000 0.012 0.000 0.008
#> GSM1022330     2  0.0622      0.675 0.000 0.980 0.000 0.012 0.000 0.008
#> GSM1022337     5  0.2425      0.839 0.000 0.004 0.000 0.024 0.884 0.088
#> GSM1022338     5  0.2373      0.840 0.000 0.004 0.000 0.024 0.888 0.084
#> GSM1022339     5  0.2526      0.837 0.000 0.004 0.000 0.024 0.876 0.096
#> GSM1022334     2  0.0260      0.673 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM1022335     2  0.0260      0.673 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM1022336     2  0.0260      0.673 0.000 0.992 0.000 0.008 0.000 0.000
#> GSM1022340     1  0.0748      0.982 0.976 0.000 0.000 0.016 0.004 0.004
#> GSM1022341     1  0.0748      0.982 0.976 0.000 0.000 0.016 0.004 0.004
#> GSM1022342     1  0.0748      0.982 0.976 0.000 0.000 0.016 0.004 0.004
#> GSM1022343     1  0.0748      0.982 0.976 0.000 0.000 0.016 0.004 0.004
#> GSM1022347     3  0.0748      0.899 0.016 0.000 0.976 0.004 0.000 0.004
#> GSM1022348     3  0.0653      0.900 0.012 0.000 0.980 0.004 0.000 0.004
#> GSM1022349     3  0.0603      0.899 0.016 0.000 0.980 0.004 0.000 0.000
#> GSM1022350     3  0.0692      0.898 0.020 0.000 0.976 0.004 0.000 0.000
#> GSM1022344     1  0.0777      0.968 0.972 0.000 0.004 0.000 0.000 0.024
#> GSM1022345     1  0.1082      0.963 0.956 0.000 0.000 0.004 0.000 0.040
#> GSM1022346     1  0.1152      0.960 0.952 0.000 0.004 0.000 0.000 0.044
#> GSM1022355     5  0.3835      0.552 0.320 0.000 0.000 0.012 0.668 0.000
#> GSM1022356     5  0.3201      0.709 0.208 0.000 0.000 0.012 0.780 0.000
#> GSM1022357     5  0.4478      0.246 0.444 0.000 0.000 0.012 0.532 0.012
#> GSM1022358     5  0.3629      0.622 0.276 0.000 0.000 0.012 0.712 0.000
#> GSM1022351     1  0.0622      0.983 0.980 0.000 0.000 0.012 0.008 0.000
#> GSM1022352     1  0.0622      0.983 0.980 0.000 0.000 0.012 0.008 0.000
#> GSM1022353     1  0.0881      0.982 0.972 0.000 0.000 0.012 0.008 0.008
#> GSM1022354     1  0.0622      0.983 0.980 0.000 0.000 0.012 0.008 0.000
#> GSM1022359     2  0.3241      0.618 0.000 0.824 0.000 0.112 0.000 0.064
#> GSM1022360     2  0.3426      0.610 0.000 0.808 0.000 0.124 0.000 0.068
#> GSM1022361     2  0.3066      0.602 0.000 0.832 0.000 0.124 0.000 0.044
#> GSM1022362     2  0.3313      0.607 0.000 0.816 0.000 0.124 0.000 0.060
#> GSM1022367     6  0.3847      0.979 0.000 0.000 0.456 0.000 0.000 0.544
#> GSM1022368     6  0.3851      0.979 0.000 0.000 0.460 0.000 0.000 0.540
#> GSM1022369     6  0.3857      0.969 0.000 0.000 0.468 0.000 0.000 0.532
#> GSM1022370     6  0.3966      0.963 0.000 0.000 0.444 0.004 0.000 0.552
#> GSM1022363     2  0.4184      0.362 0.000 0.504 0.000 0.012 0.000 0.484
#> GSM1022364     2  0.4389      0.410 0.000 0.528 0.000 0.024 0.000 0.448
#> GSM1022365     2  0.4403      0.377 0.000 0.508 0.000 0.024 0.000 0.468
#> GSM1022366     2  0.4381      0.423 0.000 0.536 0.000 0.024 0.000 0.440
#> GSM1022374     5  0.3441      0.775 0.000 0.004 0.000 0.024 0.784 0.188
#> GSM1022375     5  0.3534      0.768 0.000 0.004 0.000 0.024 0.772 0.200
#> GSM1022376     5  0.3274      0.790 0.000 0.004 0.000 0.024 0.804 0.168
#> GSM1022371     2  0.2531      0.654 0.000 0.856 0.000 0.012 0.000 0.132
#> GSM1022372     2  0.2664      0.653 0.000 0.848 0.000 0.016 0.000 0.136
#> GSM1022373     2  0.2531      0.654 0.000 0.856 0.000 0.012 0.000 0.132
#> GSM1022377     4  0.4015      0.891 0.012 0.372 0.000 0.616 0.000 0.000
#> GSM1022378     4  0.4015      0.891 0.012 0.372 0.000 0.616 0.000 0.000
#> GSM1022379     4  0.4174      0.909 0.016 0.352 0.004 0.628 0.000 0.000
#> GSM1022380     4  0.4174      0.909 0.016 0.352 0.004 0.628 0.000 0.000
#> GSM1022385     3  0.0713      0.888 0.000 0.000 0.972 0.000 0.000 0.028
#> GSM1022386     3  0.0865      0.884 0.000 0.000 0.964 0.000 0.000 0.036
#> GSM1022387     3  0.1007      0.877 0.000 0.000 0.956 0.000 0.000 0.044
#> GSM1022388     3  0.0865      0.884 0.000 0.000 0.964 0.000 0.000 0.036
#> GSM1022381     4  0.4170      0.910 0.020 0.328 0.004 0.648 0.000 0.000
#> GSM1022382     4  0.4170      0.910 0.020 0.328 0.004 0.648 0.000 0.000
#> GSM1022383     4  0.4211      0.900 0.020 0.312 0.008 0.660 0.000 0.000
#> GSM1022384     4  0.4313      0.892 0.020 0.304 0.008 0.664 0.000 0.004
#> GSM1022393     5  0.0405      0.861 0.000 0.000 0.000 0.008 0.988 0.004
#> GSM1022394     5  0.0508      0.860 0.000 0.000 0.000 0.012 0.984 0.004
#> GSM1022395     5  0.0260      0.862 0.000 0.000 0.000 0.000 0.992 0.008
#> GSM1022396     5  0.0405      0.861 0.000 0.000 0.000 0.008 0.988 0.004
#> GSM1022389     2  0.5758     -0.549 0.016 0.484 0.000 0.412 0.076 0.012
#> GSM1022390     2  0.6482     -0.535 0.020 0.432 0.000 0.416 0.080 0.052
#> GSM1022391     2  0.5474     -0.578 0.020 0.488 0.000 0.436 0.044 0.012
#> GSM1022392     4  0.6427      0.482 0.020 0.400 0.000 0.452 0.080 0.048
#> GSM1022397     3  0.0748      0.898 0.016 0.000 0.976 0.004 0.000 0.004
#> GSM1022398     3  0.0748      0.898 0.016 0.000 0.976 0.004 0.000 0.004
#> GSM1022399     3  0.0748      0.898 0.016 0.000 0.976 0.004 0.000 0.004
#> GSM1022400     3  0.0862      0.895 0.016 0.000 0.972 0.004 0.000 0.008
#> GSM1022401     5  0.0260      0.862 0.000 0.000 0.000 0.000 0.992 0.008
#> GSM1022402     5  0.0520      0.862 0.000 0.000 0.000 0.008 0.984 0.008
#> GSM1022403     5  0.0146      0.862 0.000 0.000 0.000 0.004 0.996 0.000
#> GSM1022404     5  0.0146      0.862 0.000 0.000 0.000 0.004 0.996 0.000

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-MAD-NMF-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-MAD-NMF-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-MAD-NMF-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-MAD-NMF-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-MAD-NMF-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-MAD-NMF-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-MAD-NMF-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-MAD-NMF-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-MAD-NMF-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-MAD-NMF-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-MAD-NMF-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-MAD-NMF-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-MAD-NMF-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-MAD-NMF-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-MAD-NMF-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-MAD-NMF-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-MAD-NMF-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-MAD-NMF-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-MAD-NMF-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-MAD-NMF-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk MAD-NMF-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-MAD-NMF-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-MAD-NMF-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-MAD-NMF-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-MAD-NMF-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-MAD-NMF-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk MAD-NMF-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>          n protocol(p) cell.type(p) k
#> MAD:NMF 80    1.22e-07     6.13e-05 2
#> MAD:NMF 73    5.52e-12     1.39e-07 3
#> MAD:NMF 78    6.04e-11     8.24e-17 4
#> MAD:NMF 74    4.45e-13     3.24e-15 5
#> MAD:NMF 71    1.25e-23     6.35e-14 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


ATC:hclust*

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["ATC", "hclust"]
# you can also extract it by
# res = res_list["ATC:hclust"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'hclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk ATC-hclust-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk ATC-hclust-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.624           0.914       0.957         0.4835 0.509   0.509
#> 3 3 0.926           0.929       0.969         0.3148 0.867   0.739
#> 4 4 0.973           0.902       0.965         0.0869 0.932   0.818
#> 5 5 0.864           0.893       0.870         0.0991 0.905   0.692
#> 6 6 0.912           0.873       0.915         0.0616 0.965   0.839

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 6
#> attr(,"optional")
#> [1] 3 4

There is also optional best \(k\) = 3 4 that is worth to check.

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1022325     2   0.000      0.950 0.000 1.000
#> GSM1022326     2   0.000      0.950 0.000 1.000
#> GSM1022327     2   0.000      0.950 0.000 1.000
#> GSM1022331     2   0.795      0.705 0.240 0.760
#> GSM1022332     2   0.795      0.705 0.240 0.760
#> GSM1022333     2   0.795      0.705 0.240 0.760
#> GSM1022328     2   0.000      0.950 0.000 1.000
#> GSM1022329     2   0.000      0.950 0.000 1.000
#> GSM1022330     2   0.000      0.950 0.000 1.000
#> GSM1022337     2   0.795      0.705 0.240 0.760
#> GSM1022338     2   0.795      0.705 0.240 0.760
#> GSM1022339     2   0.795      0.705 0.240 0.760
#> GSM1022334     2   0.000      0.950 0.000 1.000
#> GSM1022335     2   0.000      0.950 0.000 1.000
#> GSM1022336     2   0.000      0.950 0.000 1.000
#> GSM1022340     1   0.000      0.951 1.000 0.000
#> GSM1022341     1   0.000      0.951 1.000 0.000
#> GSM1022342     1   0.000      0.951 1.000 0.000
#> GSM1022343     1   0.000      0.951 1.000 0.000
#> GSM1022347     1   0.000      0.951 1.000 0.000
#> GSM1022348     1   0.000      0.951 1.000 0.000
#> GSM1022349     1   0.000      0.951 1.000 0.000
#> GSM1022350     1   0.000      0.951 1.000 0.000
#> GSM1022344     1   0.000      0.951 1.000 0.000
#> GSM1022345     1   0.000      0.951 1.000 0.000
#> GSM1022346     1   0.000      0.951 1.000 0.000
#> GSM1022355     1   0.000      0.951 1.000 0.000
#> GSM1022356     1   0.000      0.951 1.000 0.000
#> GSM1022357     1   0.000      0.951 1.000 0.000
#> GSM1022358     1   0.000      0.951 1.000 0.000
#> GSM1022351     1   0.000      0.951 1.000 0.000
#> GSM1022352     1   0.000      0.951 1.000 0.000
#> GSM1022353     1   0.000      0.951 1.000 0.000
#> GSM1022354     1   0.000      0.951 1.000 0.000
#> GSM1022359     2   0.000      0.950 0.000 1.000
#> GSM1022360     2   0.000      0.950 0.000 1.000
#> GSM1022361     2   0.000      0.950 0.000 1.000
#> GSM1022362     2   0.000      0.950 0.000 1.000
#> GSM1022367     2   0.000      0.950 0.000 1.000
#> GSM1022368     2   0.000      0.950 0.000 1.000
#> GSM1022369     2   0.000      0.950 0.000 1.000
#> GSM1022370     2   0.000      0.950 0.000 1.000
#> GSM1022363     2   0.000      0.950 0.000 1.000
#> GSM1022364     2   0.000      0.950 0.000 1.000
#> GSM1022365     2   0.000      0.950 0.000 1.000
#> GSM1022366     2   0.000      0.950 0.000 1.000
#> GSM1022374     2   0.000      0.950 0.000 1.000
#> GSM1022375     2   0.000      0.950 0.000 1.000
#> GSM1022376     2   0.000      0.950 0.000 1.000
#> GSM1022371     2   0.000      0.950 0.000 1.000
#> GSM1022372     2   0.000      0.950 0.000 1.000
#> GSM1022373     2   0.000      0.950 0.000 1.000
#> GSM1022377     1   0.653      0.833 0.832 0.168
#> GSM1022378     1   0.653      0.833 0.832 0.168
#> GSM1022379     1   0.653      0.833 0.832 0.168
#> GSM1022380     1   0.653      0.833 0.832 0.168
#> GSM1022385     1   0.000      0.951 1.000 0.000
#> GSM1022386     1   0.000      0.951 1.000 0.000
#> GSM1022387     1   0.000      0.951 1.000 0.000
#> GSM1022388     1   0.000      0.951 1.000 0.000
#> GSM1022381     1   0.653      0.833 0.832 0.168
#> GSM1022382     1   0.653      0.833 0.832 0.168
#> GSM1022383     1   0.653      0.833 0.832 0.168
#> GSM1022384     1   0.653      0.833 0.832 0.168
#> GSM1022393     1   0.000      0.951 1.000 0.000
#> GSM1022394     1   0.000      0.951 1.000 0.000
#> GSM1022395     1   0.000      0.951 1.000 0.000
#> GSM1022396     1   0.000      0.951 1.000 0.000
#> GSM1022389     1   0.653      0.833 0.832 0.168
#> GSM1022390     1   0.653      0.833 0.832 0.168
#> GSM1022391     1   0.653      0.833 0.832 0.168
#> GSM1022392     1   0.653      0.833 0.832 0.168
#> GSM1022397     1   0.000      0.951 1.000 0.000
#> GSM1022398     1   0.000      0.951 1.000 0.000
#> GSM1022399     1   0.000      0.951 1.000 0.000
#> GSM1022400     1   0.000      0.951 1.000 0.000
#> GSM1022401     1   0.000      0.951 1.000 0.000
#> GSM1022402     1   0.000      0.951 1.000 0.000
#> GSM1022403     1   0.000      0.951 1.000 0.000
#> GSM1022404     1   0.000      0.951 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette p1    p2    p3
#> GSM1022325     2   0.000      0.918  0 1.000 0.000
#> GSM1022326     2   0.000      0.918  0 1.000 0.000
#> GSM1022327     2   0.000      0.918  0 1.000 0.000
#> GSM1022331     2   0.615      0.418  0 0.592 0.408
#> GSM1022332     2   0.615      0.418  0 0.592 0.408
#> GSM1022333     2   0.615      0.418  0 0.592 0.408
#> GSM1022328     2   0.000      0.918  0 1.000 0.000
#> GSM1022329     2   0.000      0.918  0 1.000 0.000
#> GSM1022330     2   0.000      0.918  0 1.000 0.000
#> GSM1022337     2   0.615      0.418  0 0.592 0.408
#> GSM1022338     2   0.615      0.418  0 0.592 0.408
#> GSM1022339     2   0.615      0.418  0 0.592 0.408
#> GSM1022334     2   0.000      0.918  0 1.000 0.000
#> GSM1022335     2   0.000      0.918  0 1.000 0.000
#> GSM1022336     2   0.000      0.918  0 1.000 0.000
#> GSM1022340     1   0.000      1.000  1 0.000 0.000
#> GSM1022341     1   0.000      1.000  1 0.000 0.000
#> GSM1022342     1   0.000      1.000  1 0.000 0.000
#> GSM1022343     1   0.000      1.000  1 0.000 0.000
#> GSM1022347     1   0.000      1.000  1 0.000 0.000
#> GSM1022348     1   0.000      1.000  1 0.000 0.000
#> GSM1022349     1   0.000      1.000  1 0.000 0.000
#> GSM1022350     1   0.000      1.000  1 0.000 0.000
#> GSM1022344     1   0.000      1.000  1 0.000 0.000
#> GSM1022345     1   0.000      1.000  1 0.000 0.000
#> GSM1022346     1   0.000      1.000  1 0.000 0.000
#> GSM1022355     1   0.000      1.000  1 0.000 0.000
#> GSM1022356     1   0.000      1.000  1 0.000 0.000
#> GSM1022357     1   0.000      1.000  1 0.000 0.000
#> GSM1022358     1   0.000      1.000  1 0.000 0.000
#> GSM1022351     1   0.000      1.000  1 0.000 0.000
#> GSM1022352     1   0.000      1.000  1 0.000 0.000
#> GSM1022353     1   0.000      1.000  1 0.000 0.000
#> GSM1022354     1   0.000      1.000  1 0.000 0.000
#> GSM1022359     2   0.000      0.918  0 1.000 0.000
#> GSM1022360     2   0.000      0.918  0 1.000 0.000
#> GSM1022361     2   0.000      0.918  0 1.000 0.000
#> GSM1022362     2   0.000      0.918  0 1.000 0.000
#> GSM1022367     2   0.000      0.918  0 1.000 0.000
#> GSM1022368     2   0.000      0.918  0 1.000 0.000
#> GSM1022369     2   0.000      0.918  0 1.000 0.000
#> GSM1022370     2   0.000      0.918  0 1.000 0.000
#> GSM1022363     2   0.000      0.918  0 1.000 0.000
#> GSM1022364     2   0.000      0.918  0 1.000 0.000
#> GSM1022365     2   0.000      0.918  0 1.000 0.000
#> GSM1022366     2   0.000      0.918  0 1.000 0.000
#> GSM1022374     2   0.000      0.918  0 1.000 0.000
#> GSM1022375     2   0.000      0.918  0 1.000 0.000
#> GSM1022376     2   0.000      0.918  0 1.000 0.000
#> GSM1022371     2   0.000      0.918  0 1.000 0.000
#> GSM1022372     2   0.000      0.918  0 1.000 0.000
#> GSM1022373     2   0.000      0.918  0 1.000 0.000
#> GSM1022377     3   0.000      1.000  0 0.000 1.000
#> GSM1022378     3   0.000      1.000  0 0.000 1.000
#> GSM1022379     3   0.000      1.000  0 0.000 1.000
#> GSM1022380     3   0.000      1.000  0 0.000 1.000
#> GSM1022385     1   0.000      1.000  1 0.000 0.000
#> GSM1022386     1   0.000      1.000  1 0.000 0.000
#> GSM1022387     1   0.000      1.000  1 0.000 0.000
#> GSM1022388     1   0.000      1.000  1 0.000 0.000
#> GSM1022381     3   0.000      1.000  0 0.000 1.000
#> GSM1022382     3   0.000      1.000  0 0.000 1.000
#> GSM1022383     3   0.000      1.000  0 0.000 1.000
#> GSM1022384     3   0.000      1.000  0 0.000 1.000
#> GSM1022393     1   0.000      1.000  1 0.000 0.000
#> GSM1022394     1   0.000      1.000  1 0.000 0.000
#> GSM1022395     1   0.000      1.000  1 0.000 0.000
#> GSM1022396     1   0.000      1.000  1 0.000 0.000
#> GSM1022389     3   0.000      1.000  0 0.000 1.000
#> GSM1022390     3   0.000      1.000  0 0.000 1.000
#> GSM1022391     3   0.000      1.000  0 0.000 1.000
#> GSM1022392     3   0.000      1.000  0 0.000 1.000
#> GSM1022397     1   0.000      1.000  1 0.000 0.000
#> GSM1022398     1   0.000      1.000  1 0.000 0.000
#> GSM1022399     1   0.000      1.000  1 0.000 0.000
#> GSM1022400     1   0.000      1.000  1 0.000 0.000
#> GSM1022401     1   0.000      1.000  1 0.000 0.000
#> GSM1022402     1   0.000      1.000  1 0.000 0.000
#> GSM1022403     1   0.000      1.000  1 0.000 0.000
#> GSM1022404     1   0.000      1.000  1 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette p1    p2    p3 p4
#> GSM1022325     2   0.000      0.912  0 1.000 0.000  0
#> GSM1022326     2   0.000      0.912  0 1.000 0.000  0
#> GSM1022327     2   0.000      0.912  0 1.000 0.000  0
#> GSM1022331     3   0.000      0.802  0 0.000 1.000  0
#> GSM1022332     3   0.000      0.802  0 0.000 1.000  0
#> GSM1022333     3   0.000      0.802  0 0.000 1.000  0
#> GSM1022328     2   0.000      0.912  0 1.000 0.000  0
#> GSM1022329     2   0.000      0.912  0 1.000 0.000  0
#> GSM1022330     2   0.000      0.912  0 1.000 0.000  0
#> GSM1022337     3   0.000      0.802  0 0.000 1.000  0
#> GSM1022338     3   0.000      0.802  0 0.000 1.000  0
#> GSM1022339     3   0.000      0.802  0 0.000 1.000  0
#> GSM1022334     2   0.000      0.912  0 1.000 0.000  0
#> GSM1022335     2   0.000      0.912  0 1.000 0.000  0
#> GSM1022336     2   0.000      0.912  0 1.000 0.000  0
#> GSM1022340     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022341     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022342     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022343     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022347     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022348     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022349     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022350     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022344     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022345     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022346     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022355     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022356     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022357     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022358     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022351     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022352     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022353     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022354     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022359     2   0.000      0.912  0 1.000 0.000  0
#> GSM1022360     2   0.000      0.912  0 1.000 0.000  0
#> GSM1022361     2   0.000      0.912  0 1.000 0.000  0
#> GSM1022362     2   0.000      0.912  0 1.000 0.000  0
#> GSM1022367     2   0.484      0.238  0 0.604 0.396  0
#> GSM1022368     2   0.484      0.238  0 0.604 0.396  0
#> GSM1022369     2   0.484      0.238  0 0.604 0.396  0
#> GSM1022370     2   0.484      0.238  0 0.604 0.396  0
#> GSM1022363     2   0.000      0.912  0 1.000 0.000  0
#> GSM1022364     2   0.000      0.912  0 1.000 0.000  0
#> GSM1022365     2   0.000      0.912  0 1.000 0.000  0
#> GSM1022366     2   0.000      0.912  0 1.000 0.000  0
#> GSM1022374     3   0.488      0.386  0 0.408 0.592  0
#> GSM1022375     3   0.488      0.386  0 0.408 0.592  0
#> GSM1022376     3   0.488      0.386  0 0.408 0.592  0
#> GSM1022371     2   0.000      0.912  0 1.000 0.000  0
#> GSM1022372     2   0.000      0.912  0 1.000 0.000  0
#> GSM1022373     2   0.000      0.912  0 1.000 0.000  0
#> GSM1022377     4   0.000      1.000  0 0.000 0.000  1
#> GSM1022378     4   0.000      1.000  0 0.000 0.000  1
#> GSM1022379     4   0.000      1.000  0 0.000 0.000  1
#> GSM1022380     4   0.000      1.000  0 0.000 0.000  1
#> GSM1022385     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022386     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022387     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022388     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022381     4   0.000      1.000  0 0.000 0.000  1
#> GSM1022382     4   0.000      1.000  0 0.000 0.000  1
#> GSM1022383     4   0.000      1.000  0 0.000 0.000  1
#> GSM1022384     4   0.000      1.000  0 0.000 0.000  1
#> GSM1022393     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022394     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022395     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022396     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022389     4   0.000      1.000  0 0.000 0.000  1
#> GSM1022390     4   0.000      1.000  0 0.000 0.000  1
#> GSM1022391     4   0.000      1.000  0 0.000 0.000  1
#> GSM1022392     4   0.000      1.000  0 0.000 0.000  1
#> GSM1022397     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022398     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022399     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022400     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022401     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022402     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022403     1   0.000      1.000  1 0.000 0.000  0
#> GSM1022404     1   0.000      1.000  1 0.000 0.000  0

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3 p4    p5
#> GSM1022325     2   0.000      0.913 0.000 1.000 0.000  0 0.000
#> GSM1022326     2   0.000      0.913 0.000 1.000 0.000  0 0.000
#> GSM1022327     2   0.000      0.913 0.000 1.000 0.000  0 0.000
#> GSM1022331     5   0.382      0.678 0.000 0.000 0.304  0 0.696
#> GSM1022332     5   0.382      0.678 0.000 0.000 0.304  0 0.696
#> GSM1022333     5   0.382      0.678 0.000 0.000 0.304  0 0.696
#> GSM1022328     2   0.000      0.913 0.000 1.000 0.000  0 0.000
#> GSM1022329     2   0.000      0.913 0.000 1.000 0.000  0 0.000
#> GSM1022330     2   0.000      0.913 0.000 1.000 0.000  0 0.000
#> GSM1022337     5   0.000      0.711 0.000 0.000 0.000  0 1.000
#> GSM1022338     5   0.000      0.711 0.000 0.000 0.000  0 1.000
#> GSM1022339     5   0.000      0.711 0.000 0.000 0.000  0 1.000
#> GSM1022334     2   0.000      0.913 0.000 1.000 0.000  0 0.000
#> GSM1022335     2   0.000      0.913 0.000 1.000 0.000  0 0.000
#> GSM1022336     2   0.000      0.913 0.000 1.000 0.000  0 0.000
#> GSM1022340     1   0.029      0.990 0.992 0.000 0.008  0 0.000
#> GSM1022341     1   0.029      0.990 0.992 0.000 0.008  0 0.000
#> GSM1022342     1   0.029      0.990 0.992 0.000 0.008  0 0.000
#> GSM1022343     1   0.029      0.990 0.992 0.000 0.008  0 0.000
#> GSM1022347     3   0.382      1.000 0.304 0.000 0.696  0 0.000
#> GSM1022348     3   0.382      1.000 0.304 0.000 0.696  0 0.000
#> GSM1022349     3   0.382      1.000 0.304 0.000 0.696  0 0.000
#> GSM1022350     3   0.382      1.000 0.304 0.000 0.696  0 0.000
#> GSM1022344     3   0.382      1.000 0.304 0.000 0.696  0 0.000
#> GSM1022345     3   0.382      1.000 0.304 0.000 0.696  0 0.000
#> GSM1022346     3   0.382      1.000 0.304 0.000 0.696  0 0.000
#> GSM1022355     1   0.000      0.998 1.000 0.000 0.000  0 0.000
#> GSM1022356     1   0.000      0.998 1.000 0.000 0.000  0 0.000
#> GSM1022357     1   0.000      0.998 1.000 0.000 0.000  0 0.000
#> GSM1022358     1   0.000      0.998 1.000 0.000 0.000  0 0.000
#> GSM1022351     1   0.000      0.998 1.000 0.000 0.000  0 0.000
#> GSM1022352     1   0.000      0.998 1.000 0.000 0.000  0 0.000
#> GSM1022353     1   0.000      0.998 1.000 0.000 0.000  0 0.000
#> GSM1022354     1   0.000      0.998 1.000 0.000 0.000  0 0.000
#> GSM1022359     2   0.000      0.913 0.000 1.000 0.000  0 0.000
#> GSM1022360     2   0.000      0.913 0.000 1.000 0.000  0 0.000
#> GSM1022361     2   0.000      0.913 0.000 1.000 0.000  0 0.000
#> GSM1022362     2   0.000      0.913 0.000 1.000 0.000  0 0.000
#> GSM1022367     2   0.534      0.277 0.000 0.604 0.072  0 0.324
#> GSM1022368     2   0.534      0.277 0.000 0.604 0.072  0 0.324
#> GSM1022369     2   0.534      0.277 0.000 0.604 0.072  0 0.324
#> GSM1022370     2   0.534      0.277 0.000 0.604 0.072  0 0.324
#> GSM1022363     2   0.000      0.913 0.000 1.000 0.000  0 0.000
#> GSM1022364     2   0.000      0.913 0.000 1.000 0.000  0 0.000
#> GSM1022365     2   0.000      0.913 0.000 1.000 0.000  0 0.000
#> GSM1022366     2   0.000      0.913 0.000 1.000 0.000  0 0.000
#> GSM1022374     5   0.420      0.323 0.000 0.408 0.000  0 0.592
#> GSM1022375     5   0.420      0.323 0.000 0.408 0.000  0 0.592
#> GSM1022376     5   0.420      0.323 0.000 0.408 0.000  0 0.592
#> GSM1022371     2   0.000      0.913 0.000 1.000 0.000  0 0.000
#> GSM1022372     2   0.000      0.913 0.000 1.000 0.000  0 0.000
#> GSM1022373     2   0.000      0.913 0.000 1.000 0.000  0 0.000
#> GSM1022377     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022378     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022379     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022380     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022385     3   0.382      1.000 0.304 0.000 0.696  0 0.000
#> GSM1022386     3   0.382      1.000 0.304 0.000 0.696  0 0.000
#> GSM1022387     3   0.382      1.000 0.304 0.000 0.696  0 0.000
#> GSM1022388     3   0.382      1.000 0.304 0.000 0.696  0 0.000
#> GSM1022381     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022382     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022383     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022384     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022393     1   0.000      0.998 1.000 0.000 0.000  0 0.000
#> GSM1022394     1   0.000      0.998 1.000 0.000 0.000  0 0.000
#> GSM1022395     1   0.000      0.998 1.000 0.000 0.000  0 0.000
#> GSM1022396     1   0.000      0.998 1.000 0.000 0.000  0 0.000
#> GSM1022389     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022390     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022391     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022392     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022397     3   0.382      1.000 0.304 0.000 0.696  0 0.000
#> GSM1022398     3   0.382      1.000 0.304 0.000 0.696  0 0.000
#> GSM1022399     3   0.382      1.000 0.304 0.000 0.696  0 0.000
#> GSM1022400     3   0.382      1.000 0.304 0.000 0.696  0 0.000
#> GSM1022401     1   0.000      0.998 1.000 0.000 0.000  0 0.000
#> GSM1022402     1   0.000      0.998 1.000 0.000 0.000  0 0.000
#> GSM1022403     1   0.000      0.998 1.000 0.000 0.000  0 0.000
#> GSM1022404     1   0.000      0.998 1.000 0.000 0.000  0 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3 p4    p5    p6
#> GSM1022325     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022326     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022327     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022331     6   0.377      0.157 0.000 0.000 0.000  0 0.408 0.592
#> GSM1022332     6   0.377      0.157 0.000 0.000 0.000  0 0.408 0.592
#> GSM1022333     6   0.377      0.157 0.000 0.000 0.000  0 0.408 0.592
#> GSM1022328     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022329     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022330     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022337     5   0.000      0.569 0.000 0.000 0.000  0 1.000 0.000
#> GSM1022338     5   0.000      0.569 0.000 0.000 0.000  0 1.000 0.000
#> GSM1022339     5   0.000      0.569 0.000 0.000 0.000  0 1.000 0.000
#> GSM1022334     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022335     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022336     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022340     1   0.026      0.892 0.992 0.000 0.008  0 0.000 0.000
#> GSM1022341     1   0.026      0.892 0.992 0.000 0.008  0 0.000 0.000
#> GSM1022342     1   0.026      0.892 0.992 0.000 0.008  0 0.000 0.000
#> GSM1022343     1   0.026      0.892 0.992 0.000 0.008  0 0.000 0.000
#> GSM1022347     3   0.000      0.998 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022348     3   0.000      0.998 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022349     3   0.000      0.998 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022350     3   0.000      0.998 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022344     3   0.000      0.998 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022345     3   0.000      0.998 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022346     3   0.000      0.998 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022355     1   0.000      0.895 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022356     1   0.000      0.895 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022357     1   0.000      0.895 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022358     1   0.000      0.895 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022351     1   0.000      0.895 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022352     1   0.000      0.895 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022353     1   0.000      0.895 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022354     1   0.000      0.895 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022359     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022360     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022361     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022362     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022367     6   0.503      0.436 0.000 0.460 0.000  0 0.072 0.468
#> GSM1022368     6   0.503      0.436 0.000 0.460 0.000  0 0.072 0.468
#> GSM1022369     6   0.503      0.436 0.000 0.460 0.000  0 0.072 0.468
#> GSM1022370     6   0.503      0.436 0.000 0.460 0.000  0 0.072 0.468
#> GSM1022363     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022364     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022365     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022366     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022374     5   0.525      0.506 0.000 0.264 0.000  0 0.592 0.144
#> GSM1022375     5   0.525      0.506 0.000 0.264 0.000  0 0.592 0.144
#> GSM1022376     5   0.525      0.506 0.000 0.264 0.000  0 0.592 0.144
#> GSM1022371     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022372     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022373     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022377     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022378     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022379     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022380     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022385     3   0.026      0.994 0.000 0.000 0.992  0 0.000 0.008
#> GSM1022386     3   0.026      0.994 0.000 0.000 0.992  0 0.000 0.008
#> GSM1022387     3   0.026      0.994 0.000 0.000 0.992  0 0.000 0.008
#> GSM1022388     3   0.026      0.994 0.000 0.000 0.992  0 0.000 0.008
#> GSM1022381     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022382     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022383     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022384     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022393     1   0.317      0.838 0.744 0.000 0.000  0 0.000 0.256
#> GSM1022394     1   0.317      0.838 0.744 0.000 0.000  0 0.000 0.256
#> GSM1022395     1   0.317      0.838 0.744 0.000 0.000  0 0.000 0.256
#> GSM1022396     1   0.317      0.838 0.744 0.000 0.000  0 0.000 0.256
#> GSM1022389     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022390     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022391     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022392     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022397     3   0.000      0.998 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022398     3   0.000      0.998 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022399     3   0.000      0.998 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022400     3   0.000      0.998 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022401     1   0.317      0.838 0.744 0.000 0.000  0 0.000 0.256
#> GSM1022402     1   0.317      0.838 0.744 0.000 0.000  0 0.000 0.256
#> GSM1022403     1   0.317      0.838 0.744 0.000 0.000  0 0.000 0.256
#> GSM1022404     1   0.317      0.838 0.744 0.000 0.000  0 0.000 0.256

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-hclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-ATC-hclust-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-ATC-hclust-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-ATC-hclust-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-ATC-hclust-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-ATC-hclust-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-ATC-hclust-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-ATC-hclust-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-ATC-hclust-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-ATC-hclust-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-ATC-hclust-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-ATC-hclust-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-ATC-hclust-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-hclust-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-ATC-hclust-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-hclust-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-hclust-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-hclust-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-hclust-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-hclust-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-hclust-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-ATC-hclust-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-hclust-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-hclust-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-hclust-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-hclust-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-hclust-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>             n protocol(p) cell.type(p) k
#> ATC:hclust 80    1.10e-11     4.22e-01 2
#> ATC:hclust 74    3.84e-13     1.93e-05 3
#> ATC:hclust 73    4.00e-13     4.34e-09 4
#> ATC:hclust 73    9.57e-20     9.15e-09 5
#> ATC:hclust 73    9.57e-20     9.15e-09 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


ATC:kmeans**

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["ATC", "kmeans"]
# you can also extract it by
# res = res_list["ATC:kmeans"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk ATC-kmeans-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk ATC-kmeans-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.4913 0.509   0.509
#> 3 3 0.788           0.943       0.912         0.2475 0.867   0.739
#> 4 4 0.803           0.720       0.819         0.1369 0.949   0.864
#> 5 5 0.768           0.673       0.745         0.0720 0.905   0.708
#> 6 6 0.723           0.811       0.796         0.0604 0.903   0.631

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 2

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette p1 p2
#> GSM1022325     2       0          1  0  1
#> GSM1022326     2       0          1  0  1
#> GSM1022327     2       0          1  0  1
#> GSM1022331     2       0          1  0  1
#> GSM1022332     2       0          1  0  1
#> GSM1022333     2       0          1  0  1
#> GSM1022328     2       0          1  0  1
#> GSM1022329     2       0          1  0  1
#> GSM1022330     2       0          1  0  1
#> GSM1022337     2       0          1  0  1
#> GSM1022338     2       0          1  0  1
#> GSM1022339     2       0          1  0  1
#> GSM1022334     2       0          1  0  1
#> GSM1022335     2       0          1  0  1
#> GSM1022336     2       0          1  0  1
#> GSM1022340     1       0          1  1  0
#> GSM1022341     1       0          1  1  0
#> GSM1022342     1       0          1  1  0
#> GSM1022343     1       0          1  1  0
#> GSM1022347     1       0          1  1  0
#> GSM1022348     1       0          1  1  0
#> GSM1022349     1       0          1  1  0
#> GSM1022350     1       0          1  1  0
#> GSM1022344     1       0          1  1  0
#> GSM1022345     1       0          1  1  0
#> GSM1022346     1       0          1  1  0
#> GSM1022355     1       0          1  1  0
#> GSM1022356     1       0          1  1  0
#> GSM1022357     1       0          1  1  0
#> GSM1022358     1       0          1  1  0
#> GSM1022351     1       0          1  1  0
#> GSM1022352     1       0          1  1  0
#> GSM1022353     1       0          1  1  0
#> GSM1022354     1       0          1  1  0
#> GSM1022359     2       0          1  0  1
#> GSM1022360     2       0          1  0  1
#> GSM1022361     2       0          1  0  1
#> GSM1022362     2       0          1  0  1
#> GSM1022367     2       0          1  0  1
#> GSM1022368     2       0          1  0  1
#> GSM1022369     2       0          1  0  1
#> GSM1022370     2       0          1  0  1
#> GSM1022363     2       0          1  0  1
#> GSM1022364     2       0          1  0  1
#> GSM1022365     2       0          1  0  1
#> GSM1022366     2       0          1  0  1
#> GSM1022374     2       0          1  0  1
#> GSM1022375     2       0          1  0  1
#> GSM1022376     2       0          1  0  1
#> GSM1022371     2       0          1  0  1
#> GSM1022372     2       0          1  0  1
#> GSM1022373     2       0          1  0  1
#> GSM1022377     1       0          1  1  0
#> GSM1022378     1       0          1  1  0
#> GSM1022379     1       0          1  1  0
#> GSM1022380     1       0          1  1  0
#> GSM1022385     1       0          1  1  0
#> GSM1022386     1       0          1  1  0
#> GSM1022387     1       0          1  1  0
#> GSM1022388     1       0          1  1  0
#> GSM1022381     1       0          1  1  0
#> GSM1022382     1       0          1  1  0
#> GSM1022383     1       0          1  1  0
#> GSM1022384     1       0          1  1  0
#> GSM1022393     1       0          1  1  0
#> GSM1022394     1       0          1  1  0
#> GSM1022395     1       0          1  1  0
#> GSM1022396     1       0          1  1  0
#> GSM1022389     1       0          1  1  0
#> GSM1022390     1       0          1  1  0
#> GSM1022391     1       0          1  1  0
#> GSM1022392     1       0          1  1  0
#> GSM1022397     1       0          1  1  0
#> GSM1022398     1       0          1  1  0
#> GSM1022399     1       0          1  1  0
#> GSM1022400     1       0          1  1  0
#> GSM1022401     1       0          1  1  0
#> GSM1022402     1       0          1  1  0
#> GSM1022403     1       0          1  1  0
#> GSM1022404     1       0          1  1  0

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1022325     2  0.1289      0.901 0.000 0.968 0.032
#> GSM1022326     2  0.1289      0.901 0.000 0.968 0.032
#> GSM1022327     2  0.1289      0.901 0.000 0.968 0.032
#> GSM1022331     2  0.6204      0.681 0.000 0.576 0.424
#> GSM1022332     2  0.6204      0.681 0.000 0.576 0.424
#> GSM1022333     2  0.6204      0.681 0.000 0.576 0.424
#> GSM1022328     2  0.1289      0.901 0.000 0.968 0.032
#> GSM1022329     2  0.1289      0.901 0.000 0.968 0.032
#> GSM1022330     2  0.1289      0.901 0.000 0.968 0.032
#> GSM1022337     2  0.5431      0.825 0.000 0.716 0.284
#> GSM1022338     2  0.5431      0.825 0.000 0.716 0.284
#> GSM1022339     2  0.5254      0.837 0.000 0.736 0.264
#> GSM1022334     2  0.1289      0.901 0.000 0.968 0.032
#> GSM1022335     2  0.1289      0.901 0.000 0.968 0.032
#> GSM1022336     2  0.1289      0.901 0.000 0.968 0.032
#> GSM1022340     1  0.0000      0.997 1.000 0.000 0.000
#> GSM1022341     1  0.0000      0.997 1.000 0.000 0.000
#> GSM1022342     1  0.0000      0.997 1.000 0.000 0.000
#> GSM1022343     1  0.0000      0.997 1.000 0.000 0.000
#> GSM1022347     1  0.0000      0.997 1.000 0.000 0.000
#> GSM1022348     1  0.0000      0.997 1.000 0.000 0.000
#> GSM1022349     1  0.0000      0.997 1.000 0.000 0.000
#> GSM1022350     1  0.0000      0.997 1.000 0.000 0.000
#> GSM1022344     1  0.0000      0.997 1.000 0.000 0.000
#> GSM1022345     1  0.0000      0.997 1.000 0.000 0.000
#> GSM1022346     1  0.0000      0.997 1.000 0.000 0.000
#> GSM1022355     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022356     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022357     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022358     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022351     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022352     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022353     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022354     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022359     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1022360     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1022361     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1022362     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1022367     2  0.4605      0.855 0.000 0.796 0.204
#> GSM1022368     2  0.4605      0.855 0.000 0.796 0.204
#> GSM1022369     2  0.4605      0.855 0.000 0.796 0.204
#> GSM1022370     2  0.4555      0.856 0.000 0.800 0.200
#> GSM1022363     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1022364     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1022365     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1022366     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1022374     2  0.4555      0.856 0.000 0.800 0.200
#> GSM1022375     2  0.4555      0.856 0.000 0.800 0.200
#> GSM1022376     2  0.4555      0.856 0.000 0.800 0.200
#> GSM1022371     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1022372     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1022373     2  0.0000      0.902 0.000 1.000 0.000
#> GSM1022377     3  0.5291      0.998 0.268 0.000 0.732
#> GSM1022378     3  0.5291      0.998 0.268 0.000 0.732
#> GSM1022379     3  0.5291      0.998 0.268 0.000 0.732
#> GSM1022380     3  0.5291      0.998 0.268 0.000 0.732
#> GSM1022385     1  0.0000      0.997 1.000 0.000 0.000
#> GSM1022386     1  0.0000      0.997 1.000 0.000 0.000
#> GSM1022387     1  0.0000      0.997 1.000 0.000 0.000
#> GSM1022388     1  0.0000      0.997 1.000 0.000 0.000
#> GSM1022381     3  0.5291      0.998 0.268 0.000 0.732
#> GSM1022382     3  0.5291      0.998 0.268 0.000 0.732
#> GSM1022383     3  0.5291      0.998 0.268 0.000 0.732
#> GSM1022384     3  0.5291      0.998 0.268 0.000 0.732
#> GSM1022393     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022394     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022395     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022396     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022389     3  0.5254      0.996 0.264 0.000 0.736
#> GSM1022390     3  0.5254      0.996 0.264 0.000 0.736
#> GSM1022391     3  0.5254      0.996 0.264 0.000 0.736
#> GSM1022392     3  0.5254      0.996 0.264 0.000 0.736
#> GSM1022397     1  0.0000      0.997 1.000 0.000 0.000
#> GSM1022398     1  0.0000      0.997 1.000 0.000 0.000
#> GSM1022399     1  0.0000      0.997 1.000 0.000 0.000
#> GSM1022400     1  0.0000      0.997 1.000 0.000 0.000
#> GSM1022401     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022402     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022403     1  0.0237      0.997 0.996 0.000 0.004
#> GSM1022404     1  0.0237      0.997 0.996 0.000 0.004

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1022325     2  0.1975      0.758 0.000 0.936 0.016 0.048
#> GSM1022326     2  0.1975      0.758 0.000 0.936 0.016 0.048
#> GSM1022327     2  0.1975      0.758 0.000 0.936 0.016 0.048
#> GSM1022331     3  0.6644      0.871 0.000 0.392 0.520 0.088
#> GSM1022332     3  0.6644      0.871 0.000 0.392 0.520 0.088
#> GSM1022333     3  0.6644      0.871 0.000 0.392 0.520 0.088
#> GSM1022328     2  0.1975      0.758 0.000 0.936 0.016 0.048
#> GSM1022329     2  0.1975      0.758 0.000 0.936 0.016 0.048
#> GSM1022330     2  0.1975      0.758 0.000 0.936 0.016 0.048
#> GSM1022337     3  0.5503      0.851 0.000 0.468 0.516 0.016
#> GSM1022338     3  0.5503      0.851 0.000 0.468 0.516 0.016
#> GSM1022339     3  0.5163      0.821 0.000 0.480 0.516 0.004
#> GSM1022334     2  0.1975      0.758 0.000 0.936 0.016 0.048
#> GSM1022335     2  0.1975      0.758 0.000 0.936 0.016 0.048
#> GSM1022336     2  0.1975      0.758 0.000 0.936 0.016 0.048
#> GSM1022340     1  0.3074      0.778 0.848 0.000 0.152 0.000
#> GSM1022341     1  0.3074      0.778 0.848 0.000 0.152 0.000
#> GSM1022342     1  0.3074      0.778 0.848 0.000 0.152 0.000
#> GSM1022343     1  0.2973      0.777 0.856 0.000 0.144 0.000
#> GSM1022347     1  0.0000      0.766 1.000 0.000 0.000 0.000
#> GSM1022348     1  0.0000      0.766 1.000 0.000 0.000 0.000
#> GSM1022349     1  0.0000      0.766 1.000 0.000 0.000 0.000
#> GSM1022350     1  0.0000      0.766 1.000 0.000 0.000 0.000
#> GSM1022344     1  0.0000      0.766 1.000 0.000 0.000 0.000
#> GSM1022345     1  0.0000      0.766 1.000 0.000 0.000 0.000
#> GSM1022346     1  0.0000      0.766 1.000 0.000 0.000 0.000
#> GSM1022355     1  0.4933      0.761 0.568 0.000 0.432 0.000
#> GSM1022356     1  0.4933      0.761 0.568 0.000 0.432 0.000
#> GSM1022357     1  0.4933      0.761 0.568 0.000 0.432 0.000
#> GSM1022358     1  0.4933      0.761 0.568 0.000 0.432 0.000
#> GSM1022351     1  0.4933      0.761 0.568 0.000 0.432 0.000
#> GSM1022352     1  0.4933      0.761 0.568 0.000 0.432 0.000
#> GSM1022353     1  0.4933      0.761 0.568 0.000 0.432 0.000
#> GSM1022354     1  0.4933      0.761 0.568 0.000 0.432 0.000
#> GSM1022359     2  0.0000      0.767 0.000 1.000 0.000 0.000
#> GSM1022360     2  0.0000      0.767 0.000 1.000 0.000 0.000
#> GSM1022361     2  0.0000      0.767 0.000 1.000 0.000 0.000
#> GSM1022362     2  0.0000      0.767 0.000 1.000 0.000 0.000
#> GSM1022367     2  0.5530     -0.229 0.000 0.632 0.336 0.032
#> GSM1022368     2  0.5530     -0.229 0.000 0.632 0.336 0.032
#> GSM1022369     2  0.5530     -0.229 0.000 0.632 0.336 0.032
#> GSM1022370     2  0.5473     -0.172 0.000 0.644 0.324 0.032
#> GSM1022363     2  0.0592      0.761 0.000 0.984 0.000 0.016
#> GSM1022364     2  0.0592      0.761 0.000 0.984 0.000 0.016
#> GSM1022365     2  0.0592      0.761 0.000 0.984 0.000 0.016
#> GSM1022366     2  0.0592      0.761 0.000 0.984 0.000 0.016
#> GSM1022374     2  0.5538     -0.171 0.000 0.644 0.320 0.036
#> GSM1022375     2  0.5538     -0.171 0.000 0.644 0.320 0.036
#> GSM1022376     2  0.5538     -0.171 0.000 0.644 0.320 0.036
#> GSM1022371     2  0.0188      0.766 0.000 0.996 0.000 0.004
#> GSM1022372     2  0.0188      0.766 0.000 0.996 0.000 0.004
#> GSM1022373     2  0.0188      0.766 0.000 0.996 0.000 0.004
#> GSM1022377     4  0.2412      0.986 0.084 0.000 0.008 0.908
#> GSM1022378     4  0.2412      0.986 0.084 0.000 0.008 0.908
#> GSM1022379     4  0.2480      0.987 0.088 0.000 0.008 0.904
#> GSM1022380     4  0.2480      0.987 0.088 0.000 0.008 0.904
#> GSM1022385     1  0.0000      0.766 1.000 0.000 0.000 0.000
#> GSM1022386     1  0.0000      0.766 1.000 0.000 0.000 0.000
#> GSM1022387     1  0.0000      0.766 1.000 0.000 0.000 0.000
#> GSM1022388     1  0.0000      0.766 1.000 0.000 0.000 0.000
#> GSM1022381     4  0.2334      0.988 0.088 0.000 0.004 0.908
#> GSM1022382     4  0.2334      0.988 0.088 0.000 0.004 0.908
#> GSM1022383     4  0.2334      0.988 0.088 0.000 0.004 0.908
#> GSM1022384     4  0.2334      0.988 0.088 0.000 0.004 0.908
#> GSM1022393     1  0.4933      0.761 0.568 0.000 0.432 0.000
#> GSM1022394     1  0.4933      0.761 0.568 0.000 0.432 0.000
#> GSM1022395     1  0.4933      0.761 0.568 0.000 0.432 0.000
#> GSM1022396     1  0.4933      0.761 0.568 0.000 0.432 0.000
#> GSM1022389     4  0.3082      0.980 0.084 0.000 0.032 0.884
#> GSM1022390     4  0.3149      0.981 0.088 0.000 0.032 0.880
#> GSM1022391     4  0.3082      0.980 0.084 0.000 0.032 0.884
#> GSM1022392     4  0.3149      0.981 0.088 0.000 0.032 0.880
#> GSM1022397     1  0.0000      0.766 1.000 0.000 0.000 0.000
#> GSM1022398     1  0.0000      0.766 1.000 0.000 0.000 0.000
#> GSM1022399     1  0.0000      0.766 1.000 0.000 0.000 0.000
#> GSM1022400     1  0.0000      0.766 1.000 0.000 0.000 0.000
#> GSM1022401     1  0.4933      0.761 0.568 0.000 0.432 0.000
#> GSM1022402     1  0.4933      0.761 0.568 0.000 0.432 0.000
#> GSM1022403     1  0.4933      0.761 0.568 0.000 0.432 0.000
#> GSM1022404     1  0.4933      0.761 0.568 0.000 0.432 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1022325     2  0.3565      0.654 0.000 0.800 0.176 0.000 0.024
#> GSM1022326     2  0.3565      0.654 0.000 0.800 0.176 0.000 0.024
#> GSM1022327     2  0.3565      0.654 0.000 0.800 0.176 0.000 0.024
#> GSM1022331     5  0.5561      0.917 0.000 0.204 0.044 0.064 0.688
#> GSM1022332     5  0.5561      0.917 0.000 0.204 0.044 0.064 0.688
#> GSM1022333     5  0.5561      0.917 0.000 0.204 0.044 0.064 0.688
#> GSM1022328     2  0.3565      0.654 0.000 0.800 0.176 0.000 0.024
#> GSM1022329     2  0.3565      0.654 0.000 0.800 0.176 0.000 0.024
#> GSM1022330     2  0.3565      0.654 0.000 0.800 0.176 0.000 0.024
#> GSM1022337     5  0.3756      0.911 0.000 0.248 0.000 0.008 0.744
#> GSM1022338     5  0.3756      0.911 0.000 0.248 0.000 0.008 0.744
#> GSM1022339     5  0.3534      0.897 0.000 0.256 0.000 0.000 0.744
#> GSM1022334     2  0.3565      0.654 0.000 0.800 0.176 0.000 0.024
#> GSM1022335     2  0.3565      0.654 0.000 0.800 0.176 0.000 0.024
#> GSM1022336     2  0.3565      0.654 0.000 0.800 0.176 0.000 0.024
#> GSM1022340     1  0.5616     -0.457 0.552 0.000 0.364 0.000 0.084
#> GSM1022341     1  0.5616     -0.457 0.552 0.000 0.364 0.000 0.084
#> GSM1022342     1  0.5616     -0.457 0.552 0.000 0.364 0.000 0.084
#> GSM1022343     1  0.5616     -0.457 0.552 0.000 0.364 0.000 0.084
#> GSM1022347     3  0.4161      0.951 0.392 0.000 0.608 0.000 0.000
#> GSM1022348     3  0.4161      0.951 0.392 0.000 0.608 0.000 0.000
#> GSM1022349     3  0.4161      0.951 0.392 0.000 0.608 0.000 0.000
#> GSM1022350     3  0.4161      0.951 0.392 0.000 0.608 0.000 0.000
#> GSM1022344     3  0.5151      0.914 0.396 0.000 0.560 0.000 0.044
#> GSM1022345     3  0.5151      0.914 0.396 0.000 0.560 0.000 0.044
#> GSM1022346     3  0.5151      0.914 0.396 0.000 0.560 0.000 0.044
#> GSM1022355     1  0.1121      0.798 0.956 0.000 0.000 0.000 0.044
#> GSM1022356     1  0.1121      0.798 0.956 0.000 0.000 0.000 0.044
#> GSM1022357     1  0.1121      0.798 0.956 0.000 0.000 0.000 0.044
#> GSM1022358     1  0.1121      0.798 0.956 0.000 0.000 0.000 0.044
#> GSM1022351     1  0.1197      0.796 0.952 0.000 0.000 0.000 0.048
#> GSM1022352     1  0.1197      0.796 0.952 0.000 0.000 0.000 0.048
#> GSM1022353     1  0.1197      0.796 0.952 0.000 0.000 0.000 0.048
#> GSM1022354     1  0.1197      0.796 0.952 0.000 0.000 0.000 0.048
#> GSM1022359     2  0.0404      0.682 0.000 0.988 0.000 0.012 0.000
#> GSM1022360     2  0.0404      0.682 0.000 0.988 0.000 0.012 0.000
#> GSM1022361     2  0.0404      0.682 0.000 0.988 0.000 0.012 0.000
#> GSM1022362     2  0.0404      0.682 0.000 0.988 0.000 0.012 0.000
#> GSM1022367     2  0.6976     -0.215 0.000 0.464 0.144 0.036 0.356
#> GSM1022368     2  0.6976     -0.215 0.000 0.464 0.144 0.036 0.356
#> GSM1022369     2  0.6976     -0.215 0.000 0.464 0.144 0.036 0.356
#> GSM1022370     2  0.6976     -0.215 0.000 0.464 0.144 0.036 0.356
#> GSM1022363     2  0.1830      0.661 0.000 0.924 0.068 0.008 0.000
#> GSM1022364     2  0.1830      0.661 0.000 0.924 0.068 0.008 0.000
#> GSM1022365     2  0.1830      0.661 0.000 0.924 0.068 0.008 0.000
#> GSM1022366     2  0.1830      0.661 0.000 0.924 0.068 0.008 0.000
#> GSM1022374     2  0.6681     -0.254 0.000 0.452 0.108 0.032 0.408
#> GSM1022375     2  0.6681     -0.254 0.000 0.452 0.108 0.032 0.408
#> GSM1022376     2  0.6681     -0.254 0.000 0.452 0.108 0.032 0.408
#> GSM1022371     2  0.1082      0.675 0.000 0.964 0.028 0.008 0.000
#> GSM1022372     2  0.1082      0.675 0.000 0.964 0.028 0.008 0.000
#> GSM1022373     2  0.1082      0.675 0.000 0.964 0.028 0.008 0.000
#> GSM1022377     4  0.1990      0.983 0.068 0.000 0.008 0.920 0.004
#> GSM1022378     4  0.1990      0.983 0.068 0.000 0.008 0.920 0.004
#> GSM1022379     4  0.1990      0.983 0.068 0.000 0.008 0.920 0.004
#> GSM1022380     4  0.1990      0.983 0.068 0.000 0.008 0.920 0.004
#> GSM1022385     3  0.5476      0.920 0.388 0.000 0.544 0.000 0.068
#> GSM1022386     3  0.5476      0.920 0.388 0.000 0.544 0.000 0.068
#> GSM1022387     3  0.5476      0.920 0.388 0.000 0.544 0.000 0.068
#> GSM1022388     3  0.5476      0.920 0.388 0.000 0.544 0.000 0.068
#> GSM1022381     4  0.1704      0.984 0.068 0.000 0.000 0.928 0.004
#> GSM1022382     4  0.1704      0.984 0.068 0.000 0.000 0.928 0.004
#> GSM1022383     4  0.1704      0.984 0.068 0.000 0.000 0.928 0.004
#> GSM1022384     4  0.1704      0.984 0.068 0.000 0.000 0.928 0.004
#> GSM1022393     1  0.0963      0.797 0.964 0.000 0.000 0.000 0.036
#> GSM1022394     1  0.0963      0.797 0.964 0.000 0.000 0.000 0.036
#> GSM1022395     1  0.0963      0.797 0.964 0.000 0.000 0.000 0.036
#> GSM1022396     1  0.0963      0.797 0.964 0.000 0.000 0.000 0.036
#> GSM1022389     4  0.2824      0.974 0.068 0.000 0.016 0.888 0.028
#> GSM1022390     4  0.2824      0.974 0.068 0.000 0.016 0.888 0.028
#> GSM1022391     4  0.2824      0.974 0.068 0.000 0.016 0.888 0.028
#> GSM1022392     4  0.2824      0.974 0.068 0.000 0.016 0.888 0.028
#> GSM1022397     3  0.4527      0.952 0.392 0.000 0.596 0.000 0.012
#> GSM1022398     3  0.4527      0.952 0.392 0.000 0.596 0.000 0.012
#> GSM1022399     3  0.4527      0.952 0.392 0.000 0.596 0.000 0.012
#> GSM1022400     3  0.4527      0.952 0.392 0.000 0.596 0.000 0.012
#> GSM1022401     1  0.0963      0.797 0.964 0.000 0.000 0.000 0.036
#> GSM1022402     1  0.0963      0.797 0.964 0.000 0.000 0.000 0.036
#> GSM1022403     1  0.0963      0.797 0.964 0.000 0.000 0.000 0.036
#> GSM1022404     1  0.0963      0.797 0.964 0.000 0.000 0.000 0.036

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4 p5    p6
#> GSM1022325     2  0.3596      0.787 0.004 0.748 0.000 0.000 NA 0.016
#> GSM1022326     2  0.3596      0.787 0.004 0.748 0.000 0.000 NA 0.016
#> GSM1022327     2  0.3483      0.787 0.000 0.748 0.000 0.000 NA 0.016
#> GSM1022331     6  0.6076      0.655 0.052 0.088 0.000 0.028 NA 0.624
#> GSM1022332     6  0.6076      0.655 0.052 0.088 0.000 0.028 NA 0.624
#> GSM1022333     6  0.6076      0.655 0.052 0.088 0.000 0.028 NA 0.624
#> GSM1022328     2  0.3596      0.787 0.004 0.748 0.000 0.000 NA 0.016
#> GSM1022329     2  0.3483      0.787 0.000 0.748 0.000 0.000 NA 0.016
#> GSM1022330     2  0.3596      0.787 0.000 0.748 0.000 0.004 NA 0.016
#> GSM1022337     6  0.5802      0.668 0.068 0.108 0.000 0.004 NA 0.640
#> GSM1022338     6  0.5802      0.668 0.068 0.108 0.000 0.004 NA 0.640
#> GSM1022339     6  0.5705      0.668 0.068 0.112 0.000 0.000 NA 0.640
#> GSM1022334     2  0.3596      0.787 0.000 0.748 0.000 0.004 NA 0.016
#> GSM1022335     2  0.3596      0.787 0.000 0.748 0.000 0.004 NA 0.016
#> GSM1022336     2  0.3596      0.787 0.000 0.748 0.000 0.004 NA 0.016
#> GSM1022340     3  0.5305      0.637 0.120 0.000 0.656 0.000 NA 0.028
#> GSM1022341     3  0.5305      0.637 0.120 0.000 0.656 0.000 NA 0.028
#> GSM1022342     3  0.5305      0.637 0.120 0.000 0.656 0.000 NA 0.028
#> GSM1022343     3  0.5267      0.643 0.116 0.000 0.660 0.000 NA 0.028
#> GSM1022347     3  0.0000      0.881 0.000 0.000 1.000 0.000 NA 0.000
#> GSM1022348     3  0.0000      0.881 0.000 0.000 1.000 0.000 NA 0.000
#> GSM1022349     3  0.0000      0.881 0.000 0.000 1.000 0.000 NA 0.000
#> GSM1022350     3  0.0000      0.881 0.000 0.000 1.000 0.000 NA 0.000
#> GSM1022344     3  0.1967      0.858 0.000 0.000 0.904 0.000 NA 0.012
#> GSM1022345     3  0.1967      0.858 0.000 0.000 0.904 0.000 NA 0.012
#> GSM1022346     3  0.1967      0.858 0.000 0.000 0.904 0.000 NA 0.012
#> GSM1022355     1  0.4946      0.903 0.652 0.000 0.188 0.000 NA 0.000
#> GSM1022356     1  0.4946      0.903 0.652 0.000 0.188 0.000 NA 0.000
#> GSM1022357     1  0.4946      0.903 0.652 0.000 0.188 0.000 NA 0.000
#> GSM1022358     1  0.4946      0.903 0.652 0.000 0.188 0.000 NA 0.000
#> GSM1022351     1  0.5037      0.898 0.640 0.000 0.188 0.000 NA 0.000
#> GSM1022352     1  0.5095      0.894 0.632 0.000 0.188 0.000 NA 0.000
#> GSM1022353     1  0.5095      0.894 0.632 0.000 0.188 0.000 NA 0.000
#> GSM1022354     1  0.5095      0.894 0.632 0.000 0.188 0.000 NA 0.000
#> GSM1022359     2  0.0547      0.800 0.020 0.980 0.000 0.000 NA 0.000
#> GSM1022360     2  0.0547      0.800 0.020 0.980 0.000 0.000 NA 0.000
#> GSM1022361     2  0.0547      0.800 0.020 0.980 0.000 0.000 NA 0.000
#> GSM1022362     2  0.0547      0.800 0.020 0.980 0.000 0.000 NA 0.000
#> GSM1022367     6  0.4782      0.584 0.048 0.380 0.000 0.000 NA 0.568
#> GSM1022368     6  0.4782      0.584 0.048 0.380 0.000 0.000 NA 0.568
#> GSM1022369     6  0.4782      0.584 0.048 0.380 0.000 0.000 NA 0.568
#> GSM1022370     6  0.4799      0.572 0.048 0.388 0.000 0.000 NA 0.560
#> GSM1022363     2  0.2622      0.730 0.016 0.888 0.000 0.004 NA 0.064
#> GSM1022364     2  0.2622      0.730 0.016 0.888 0.000 0.004 NA 0.064
#> GSM1022365     2  0.2622      0.730 0.016 0.888 0.000 0.004 NA 0.064
#> GSM1022366     2  0.2622      0.730 0.016 0.888 0.000 0.004 NA 0.064
#> GSM1022374     6  0.5083      0.611 0.012 0.352 0.000 0.008 NA 0.584
#> GSM1022375     6  0.5083      0.611 0.012 0.352 0.000 0.008 NA 0.584
#> GSM1022376     6  0.5083      0.611 0.012 0.352 0.000 0.008 NA 0.584
#> GSM1022371     2  0.1194      0.791 0.004 0.956 0.000 0.008 NA 0.000
#> GSM1022372     2  0.1194      0.791 0.004 0.956 0.000 0.008 NA 0.000
#> GSM1022373     2  0.1194      0.791 0.004 0.956 0.000 0.008 NA 0.000
#> GSM1022377     4  0.1774      0.942 0.020 0.000 0.024 0.936 NA 0.004
#> GSM1022378     4  0.1774      0.942 0.020 0.000 0.024 0.936 NA 0.004
#> GSM1022379     4  0.1774      0.942 0.020 0.000 0.024 0.936 NA 0.004
#> GSM1022380     4  0.1774      0.942 0.020 0.000 0.024 0.936 NA 0.004
#> GSM1022385     3  0.2433      0.859 0.000 0.000 0.884 0.000 NA 0.044
#> GSM1022386     3  0.2433      0.859 0.000 0.000 0.884 0.000 NA 0.044
#> GSM1022387     3  0.2433      0.859 0.000 0.000 0.884 0.000 NA 0.044
#> GSM1022388     3  0.2433      0.859 0.000 0.000 0.884 0.000 NA 0.044
#> GSM1022381     4  0.1138      0.944 0.004 0.000 0.024 0.960 NA 0.000
#> GSM1022382     4  0.1138      0.944 0.004 0.000 0.024 0.960 NA 0.000
#> GSM1022383     4  0.1138      0.944 0.004 0.000 0.024 0.960 NA 0.000
#> GSM1022384     4  0.1138      0.944 0.004 0.000 0.024 0.960 NA 0.000
#> GSM1022393     1  0.2948      0.905 0.804 0.000 0.188 0.000 NA 0.000
#> GSM1022394     1  0.2948      0.905 0.804 0.000 0.188 0.000 NA 0.000
#> GSM1022395     1  0.2948      0.905 0.804 0.000 0.188 0.000 NA 0.000
#> GSM1022396     1  0.2948      0.905 0.804 0.000 0.188 0.000 NA 0.000
#> GSM1022389     4  0.3455      0.911 0.016 0.000 0.024 0.836 NA 0.020
#> GSM1022390     4  0.3501      0.909 0.016 0.000 0.024 0.832 NA 0.020
#> GSM1022391     4  0.3455      0.911 0.016 0.000 0.024 0.836 NA 0.020
#> GSM1022392     4  0.3501      0.909 0.016 0.000 0.024 0.832 NA 0.020
#> GSM1022397     3  0.0622      0.879 0.000 0.000 0.980 0.000 NA 0.008
#> GSM1022398     3  0.0622      0.879 0.000 0.000 0.980 0.000 NA 0.008
#> GSM1022399     3  0.0622      0.879 0.000 0.000 0.980 0.000 NA 0.008
#> GSM1022400     3  0.0622      0.879 0.000 0.000 0.980 0.000 NA 0.008
#> GSM1022401     1  0.2948      0.905 0.804 0.000 0.188 0.000 NA 0.008
#> GSM1022402     1  0.2948      0.905 0.804 0.000 0.188 0.000 NA 0.008
#> GSM1022403     1  0.2948      0.905 0.804 0.000 0.188 0.000 NA 0.008
#> GSM1022404     1  0.2948      0.905 0.804 0.000 0.188 0.000 NA 0.008

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-kmeans-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-ATC-kmeans-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-ATC-kmeans-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-ATC-kmeans-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-ATC-kmeans-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-ATC-kmeans-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-ATC-kmeans-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-ATC-kmeans-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-ATC-kmeans-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-ATC-kmeans-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-ATC-kmeans-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-ATC-kmeans-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-ATC-kmeans-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-kmeans-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-ATC-kmeans-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-kmeans-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-kmeans-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-kmeans-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-kmeans-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-kmeans-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-kmeans-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-ATC-kmeans-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-kmeans-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-kmeans-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-kmeans-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-kmeans-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-kmeans-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>             n protocol(p) cell.type(p) k
#> ATC:kmeans 80    1.10e-11     4.22e-01 2
#> ATC:kmeans 80    9.12e-15     1.26e-04 3
#> ATC:kmeans 73    4.00e-13     4.34e-09 4
#> ATC:kmeans 69    7.62e-19     1.51e-09 5
#> ATC:kmeans 80    1.08e-20     3.36e-10 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


ATC:skmeans**

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["ATC", "skmeans"]
# you can also extract it by
# res = res_list["ATC:skmeans"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 4.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk ATC-skmeans-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk ATC-skmeans-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.4913 0.509   0.509
#> 3 3 1.000           0.999       0.999         0.2705 0.867   0.739
#> 4 4 0.968           0.974       0.972         0.0855 0.949   0.864
#> 5 5 0.829           0.963       0.938         0.1166 0.904   0.704
#> 6 6 0.940           0.897       0.896         0.0422 0.990   0.956

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 4
#> attr(,"optional")
#> [1] 2 3

There is also optional best \(k\) = 2 3 that is worth to check.

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette p1 p2
#> GSM1022325     2       0          1  0  1
#> GSM1022326     2       0          1  0  1
#> GSM1022327     2       0          1  0  1
#> GSM1022331     2       0          1  0  1
#> GSM1022332     2       0          1  0  1
#> GSM1022333     2       0          1  0  1
#> GSM1022328     2       0          1  0  1
#> GSM1022329     2       0          1  0  1
#> GSM1022330     2       0          1  0  1
#> GSM1022337     2       0          1  0  1
#> GSM1022338     2       0          1  0  1
#> GSM1022339     2       0          1  0  1
#> GSM1022334     2       0          1  0  1
#> GSM1022335     2       0          1  0  1
#> GSM1022336     2       0          1  0  1
#> GSM1022340     1       0          1  1  0
#> GSM1022341     1       0          1  1  0
#> GSM1022342     1       0          1  1  0
#> GSM1022343     1       0          1  1  0
#> GSM1022347     1       0          1  1  0
#> GSM1022348     1       0          1  1  0
#> GSM1022349     1       0          1  1  0
#> GSM1022350     1       0          1  1  0
#> GSM1022344     1       0          1  1  0
#> GSM1022345     1       0          1  1  0
#> GSM1022346     1       0          1  1  0
#> GSM1022355     1       0          1  1  0
#> GSM1022356     1       0          1  1  0
#> GSM1022357     1       0          1  1  0
#> GSM1022358     1       0          1  1  0
#> GSM1022351     1       0          1  1  0
#> GSM1022352     1       0          1  1  0
#> GSM1022353     1       0          1  1  0
#> GSM1022354     1       0          1  1  0
#> GSM1022359     2       0          1  0  1
#> GSM1022360     2       0          1  0  1
#> GSM1022361     2       0          1  0  1
#> GSM1022362     2       0          1  0  1
#> GSM1022367     2       0          1  0  1
#> GSM1022368     2       0          1  0  1
#> GSM1022369     2       0          1  0  1
#> GSM1022370     2       0          1  0  1
#> GSM1022363     2       0          1  0  1
#> GSM1022364     2       0          1  0  1
#> GSM1022365     2       0          1  0  1
#> GSM1022366     2       0          1  0  1
#> GSM1022374     2       0          1  0  1
#> GSM1022375     2       0          1  0  1
#> GSM1022376     2       0          1  0  1
#> GSM1022371     2       0          1  0  1
#> GSM1022372     2       0          1  0  1
#> GSM1022373     2       0          1  0  1
#> GSM1022377     1       0          1  1  0
#> GSM1022378     1       0          1  1  0
#> GSM1022379     1       0          1  1  0
#> GSM1022380     1       0          1  1  0
#> GSM1022385     1       0          1  1  0
#> GSM1022386     1       0          1  1  0
#> GSM1022387     1       0          1  1  0
#> GSM1022388     1       0          1  1  0
#> GSM1022381     1       0          1  1  0
#> GSM1022382     1       0          1  1  0
#> GSM1022383     1       0          1  1  0
#> GSM1022384     1       0          1  1  0
#> GSM1022393     1       0          1  1  0
#> GSM1022394     1       0          1  1  0
#> GSM1022395     1       0          1  1  0
#> GSM1022396     1       0          1  1  0
#> GSM1022389     1       0          1  1  0
#> GSM1022390     1       0          1  1  0
#> GSM1022391     1       0          1  1  0
#> GSM1022392     1       0          1  1  0
#> GSM1022397     1       0          1  1  0
#> GSM1022398     1       0          1  1  0
#> GSM1022399     1       0          1  1  0
#> GSM1022400     1       0          1  1  0
#> GSM1022401     1       0          1  1  0
#> GSM1022402     1       0          1  1  0
#> GSM1022403     1       0          1  1  0
#> GSM1022404     1       0          1  1  0

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1 p2    p3
#> GSM1022325     2  0.0000      1.000 0.000  1 0.000
#> GSM1022326     2  0.0000      1.000 0.000  1 0.000
#> GSM1022327     2  0.0000      1.000 0.000  1 0.000
#> GSM1022331     2  0.0000      1.000 0.000  1 0.000
#> GSM1022332     2  0.0000      1.000 0.000  1 0.000
#> GSM1022333     2  0.0000      1.000 0.000  1 0.000
#> GSM1022328     2  0.0000      1.000 0.000  1 0.000
#> GSM1022329     2  0.0000      1.000 0.000  1 0.000
#> GSM1022330     2  0.0000      1.000 0.000  1 0.000
#> GSM1022337     2  0.0000      1.000 0.000  1 0.000
#> GSM1022338     2  0.0000      1.000 0.000  1 0.000
#> GSM1022339     2  0.0000      1.000 0.000  1 0.000
#> GSM1022334     2  0.0000      1.000 0.000  1 0.000
#> GSM1022335     2  0.0000      1.000 0.000  1 0.000
#> GSM1022336     2  0.0000      1.000 0.000  1 0.000
#> GSM1022340     1  0.0237      0.998 0.996  0 0.004
#> GSM1022341     1  0.0237      0.998 0.996  0 0.004
#> GSM1022342     1  0.0237      0.998 0.996  0 0.004
#> GSM1022343     1  0.0237      0.998 0.996  0 0.004
#> GSM1022347     1  0.0237      0.998 0.996  0 0.004
#> GSM1022348     1  0.0237      0.998 0.996  0 0.004
#> GSM1022349     1  0.0237      0.998 0.996  0 0.004
#> GSM1022350     1  0.0237      0.998 0.996  0 0.004
#> GSM1022344     1  0.0237      0.998 0.996  0 0.004
#> GSM1022345     1  0.0237      0.998 0.996  0 0.004
#> GSM1022346     1  0.0237      0.998 0.996  0 0.004
#> GSM1022355     1  0.0000      0.998 1.000  0 0.000
#> GSM1022356     1  0.0000      0.998 1.000  0 0.000
#> GSM1022357     1  0.0000      0.998 1.000  0 0.000
#> GSM1022358     1  0.0000      0.998 1.000  0 0.000
#> GSM1022351     1  0.0000      0.998 1.000  0 0.000
#> GSM1022352     1  0.0000      0.998 1.000  0 0.000
#> GSM1022353     1  0.0000      0.998 1.000  0 0.000
#> GSM1022354     1  0.0000      0.998 1.000  0 0.000
#> GSM1022359     2  0.0000      1.000 0.000  1 0.000
#> GSM1022360     2  0.0000      1.000 0.000  1 0.000
#> GSM1022361     2  0.0000      1.000 0.000  1 0.000
#> GSM1022362     2  0.0000      1.000 0.000  1 0.000
#> GSM1022367     2  0.0000      1.000 0.000  1 0.000
#> GSM1022368     2  0.0000      1.000 0.000  1 0.000
#> GSM1022369     2  0.0000      1.000 0.000  1 0.000
#> GSM1022370     2  0.0000      1.000 0.000  1 0.000
#> GSM1022363     2  0.0000      1.000 0.000  1 0.000
#> GSM1022364     2  0.0000      1.000 0.000  1 0.000
#> GSM1022365     2  0.0000      1.000 0.000  1 0.000
#> GSM1022366     2  0.0000      1.000 0.000  1 0.000
#> GSM1022374     2  0.0000      1.000 0.000  1 0.000
#> GSM1022375     2  0.0000      1.000 0.000  1 0.000
#> GSM1022376     2  0.0000      1.000 0.000  1 0.000
#> GSM1022371     2  0.0000      1.000 0.000  1 0.000
#> GSM1022372     2  0.0000      1.000 0.000  1 0.000
#> GSM1022373     2  0.0000      1.000 0.000  1 0.000
#> GSM1022377     3  0.0000      0.999 0.000  0 1.000
#> GSM1022378     3  0.0000      0.999 0.000  0 1.000
#> GSM1022379     3  0.0000      0.999 0.000  0 1.000
#> GSM1022380     3  0.0000      0.999 0.000  0 1.000
#> GSM1022385     1  0.0237      0.998 0.996  0 0.004
#> GSM1022386     1  0.0237      0.998 0.996  0 0.004
#> GSM1022387     1  0.0237      0.998 0.996  0 0.004
#> GSM1022388     1  0.0237      0.998 0.996  0 0.004
#> GSM1022381     3  0.0000      0.999 0.000  0 1.000
#> GSM1022382     3  0.0000      0.999 0.000  0 1.000
#> GSM1022383     3  0.0000      0.999 0.000  0 1.000
#> GSM1022384     3  0.0000      0.999 0.000  0 1.000
#> GSM1022393     1  0.0000      0.998 1.000  0 0.000
#> GSM1022394     1  0.0000      0.998 1.000  0 0.000
#> GSM1022395     1  0.0000      0.998 1.000  0 0.000
#> GSM1022396     1  0.0000      0.998 1.000  0 0.000
#> GSM1022389     3  0.0237      0.997 0.004  0 0.996
#> GSM1022390     3  0.0237      0.997 0.004  0 0.996
#> GSM1022391     3  0.0237      0.997 0.004  0 0.996
#> GSM1022392     3  0.0237      0.997 0.004  0 0.996
#> GSM1022397     1  0.0237      0.998 0.996  0 0.004
#> GSM1022398     1  0.0237      0.998 0.996  0 0.004
#> GSM1022399     1  0.0237      0.998 0.996  0 0.004
#> GSM1022400     1  0.0237      0.998 0.996  0 0.004
#> GSM1022401     1  0.0000      0.998 1.000  0 0.000
#> GSM1022402     1  0.0000      0.998 1.000  0 0.000
#> GSM1022403     1  0.0000      0.998 1.000  0 0.000
#> GSM1022404     1  0.0000      0.998 1.000  0 0.000

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1022325     2  0.0000      0.985 0.000 1.000 0.000 0.000
#> GSM1022326     2  0.0000      0.985 0.000 1.000 0.000 0.000
#> GSM1022327     2  0.0000      0.985 0.000 1.000 0.000 0.000
#> GSM1022331     3  0.2281      0.964 0.000 0.096 0.904 0.000
#> GSM1022332     3  0.2281      0.964 0.000 0.096 0.904 0.000
#> GSM1022333     3  0.2281      0.964 0.000 0.096 0.904 0.000
#> GSM1022328     2  0.0000      0.985 0.000 1.000 0.000 0.000
#> GSM1022329     2  0.0000      0.985 0.000 1.000 0.000 0.000
#> GSM1022330     2  0.0000      0.985 0.000 1.000 0.000 0.000
#> GSM1022337     3  0.2921      0.964 0.000 0.140 0.860 0.000
#> GSM1022338     3  0.2921      0.964 0.000 0.140 0.860 0.000
#> GSM1022339     3  0.2921      0.964 0.000 0.140 0.860 0.000
#> GSM1022334     2  0.0000      0.985 0.000 1.000 0.000 0.000
#> GSM1022335     2  0.0000      0.985 0.000 1.000 0.000 0.000
#> GSM1022336     2  0.0000      0.985 0.000 1.000 0.000 0.000
#> GSM1022340     1  0.0000      0.970 1.000 0.000 0.000 0.000
#> GSM1022341     1  0.0000      0.970 1.000 0.000 0.000 0.000
#> GSM1022342     1  0.0000      0.970 1.000 0.000 0.000 0.000
#> GSM1022343     1  0.0000      0.970 1.000 0.000 0.000 0.000
#> GSM1022347     1  0.0000      0.970 1.000 0.000 0.000 0.000
#> GSM1022348     1  0.0000      0.970 1.000 0.000 0.000 0.000
#> GSM1022349     1  0.0000      0.970 1.000 0.000 0.000 0.000
#> GSM1022350     1  0.0000      0.970 1.000 0.000 0.000 0.000
#> GSM1022344     1  0.0000      0.970 1.000 0.000 0.000 0.000
#> GSM1022345     1  0.0000      0.970 1.000 0.000 0.000 0.000
#> GSM1022346     1  0.0000      0.970 1.000 0.000 0.000 0.000
#> GSM1022355     1  0.1792      0.964 0.932 0.000 0.068 0.000
#> GSM1022356     1  0.1792      0.964 0.932 0.000 0.068 0.000
#> GSM1022357     1  0.1792      0.964 0.932 0.000 0.068 0.000
#> GSM1022358     1  0.1792      0.964 0.932 0.000 0.068 0.000
#> GSM1022351     1  0.1792      0.964 0.932 0.000 0.068 0.000
#> GSM1022352     1  0.1792      0.964 0.932 0.000 0.068 0.000
#> GSM1022353     1  0.1792      0.964 0.932 0.000 0.068 0.000
#> GSM1022354     1  0.1792      0.964 0.932 0.000 0.068 0.000
#> GSM1022359     2  0.0000      0.985 0.000 1.000 0.000 0.000
#> GSM1022360     2  0.0000      0.985 0.000 1.000 0.000 0.000
#> GSM1022361     2  0.0000      0.985 0.000 1.000 0.000 0.000
#> GSM1022362     2  0.0000      0.985 0.000 1.000 0.000 0.000
#> GSM1022367     2  0.1389      0.956 0.000 0.952 0.048 0.000
#> GSM1022368     2  0.1389      0.956 0.000 0.952 0.048 0.000
#> GSM1022369     2  0.1389      0.956 0.000 0.952 0.048 0.000
#> GSM1022370     2  0.1389      0.956 0.000 0.952 0.048 0.000
#> GSM1022363     2  0.0000      0.985 0.000 1.000 0.000 0.000
#> GSM1022364     2  0.0000      0.985 0.000 1.000 0.000 0.000
#> GSM1022365     2  0.0000      0.985 0.000 1.000 0.000 0.000
#> GSM1022366     2  0.0000      0.985 0.000 1.000 0.000 0.000
#> GSM1022374     2  0.1389      0.956 0.000 0.952 0.048 0.000
#> GSM1022375     2  0.1389      0.956 0.000 0.952 0.048 0.000
#> GSM1022376     2  0.1389      0.956 0.000 0.952 0.048 0.000
#> GSM1022371     2  0.0000      0.985 0.000 1.000 0.000 0.000
#> GSM1022372     2  0.0000      0.985 0.000 1.000 0.000 0.000
#> GSM1022373     2  0.0000      0.985 0.000 1.000 0.000 0.000
#> GSM1022377     4  0.0000      0.992 0.000 0.000 0.000 1.000
#> GSM1022378     4  0.0000      0.992 0.000 0.000 0.000 1.000
#> GSM1022379     4  0.0000      0.992 0.000 0.000 0.000 1.000
#> GSM1022380     4  0.0000      0.992 0.000 0.000 0.000 1.000
#> GSM1022385     1  0.0000      0.970 1.000 0.000 0.000 0.000
#> GSM1022386     1  0.0000      0.970 1.000 0.000 0.000 0.000
#> GSM1022387     1  0.0000      0.970 1.000 0.000 0.000 0.000
#> GSM1022388     1  0.0000      0.970 1.000 0.000 0.000 0.000
#> GSM1022381     4  0.0000      0.992 0.000 0.000 0.000 1.000
#> GSM1022382     4  0.0000      0.992 0.000 0.000 0.000 1.000
#> GSM1022383     4  0.0000      0.992 0.000 0.000 0.000 1.000
#> GSM1022384     4  0.0000      0.992 0.000 0.000 0.000 1.000
#> GSM1022393     1  0.1792      0.964 0.932 0.000 0.068 0.000
#> GSM1022394     1  0.1792      0.964 0.932 0.000 0.068 0.000
#> GSM1022395     1  0.1792      0.964 0.932 0.000 0.068 0.000
#> GSM1022396     1  0.1792      0.964 0.932 0.000 0.068 0.000
#> GSM1022389     4  0.0921      0.983 0.000 0.000 0.028 0.972
#> GSM1022390     4  0.0921      0.983 0.000 0.000 0.028 0.972
#> GSM1022391     4  0.0921      0.983 0.000 0.000 0.028 0.972
#> GSM1022392     4  0.0921      0.983 0.000 0.000 0.028 0.972
#> GSM1022397     1  0.0000      0.970 1.000 0.000 0.000 0.000
#> GSM1022398     1  0.0000      0.970 1.000 0.000 0.000 0.000
#> GSM1022399     1  0.0000      0.970 1.000 0.000 0.000 0.000
#> GSM1022400     1  0.0000      0.970 1.000 0.000 0.000 0.000
#> GSM1022401     1  0.1792      0.964 0.932 0.000 0.068 0.000
#> GSM1022402     1  0.1792      0.964 0.932 0.000 0.068 0.000
#> GSM1022403     1  0.1792      0.964 0.932 0.000 0.068 0.000
#> GSM1022404     1  0.1792      0.964 0.932 0.000 0.068 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2   p3    p4    p5
#> GSM1022325     2  0.0000      0.969 0.000 1.000 0.00 0.000 0.000
#> GSM1022326     2  0.0000      0.969 0.000 1.000 0.00 0.000 0.000
#> GSM1022327     2  0.0000      0.969 0.000 1.000 0.00 0.000 0.000
#> GSM1022331     5  0.0898      0.937 0.008 0.020 0.00 0.000 0.972
#> GSM1022332     5  0.0898      0.937 0.008 0.020 0.00 0.000 0.972
#> GSM1022333     5  0.0898      0.937 0.008 0.020 0.00 0.000 0.972
#> GSM1022328     2  0.0000      0.969 0.000 1.000 0.00 0.000 0.000
#> GSM1022329     2  0.0000      0.969 0.000 1.000 0.00 0.000 0.000
#> GSM1022330     2  0.0000      0.969 0.000 1.000 0.00 0.000 0.000
#> GSM1022337     5  0.2136      0.937 0.008 0.088 0.00 0.000 0.904
#> GSM1022338     5  0.2136      0.937 0.008 0.088 0.00 0.000 0.904
#> GSM1022339     5  0.2136      0.937 0.008 0.088 0.00 0.000 0.904
#> GSM1022334     2  0.0000      0.969 0.000 1.000 0.00 0.000 0.000
#> GSM1022335     2  0.0000      0.969 0.000 1.000 0.00 0.000 0.000
#> GSM1022336     2  0.0000      0.969 0.000 1.000 0.00 0.000 0.000
#> GSM1022340     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> GSM1022341     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> GSM1022342     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> GSM1022343     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> GSM1022347     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> GSM1022348     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> GSM1022349     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> GSM1022350     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> GSM1022344     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> GSM1022345     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> GSM1022346     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> GSM1022355     1  0.2929      1.000 0.820 0.000 0.18 0.000 0.000
#> GSM1022356     1  0.2929      1.000 0.820 0.000 0.18 0.000 0.000
#> GSM1022357     1  0.2929      1.000 0.820 0.000 0.18 0.000 0.000
#> GSM1022358     1  0.2929      1.000 0.820 0.000 0.18 0.000 0.000
#> GSM1022351     1  0.2929      1.000 0.820 0.000 0.18 0.000 0.000
#> GSM1022352     1  0.2929      1.000 0.820 0.000 0.18 0.000 0.000
#> GSM1022353     1  0.2929      1.000 0.820 0.000 0.18 0.000 0.000
#> GSM1022354     1  0.2929      1.000 0.820 0.000 0.18 0.000 0.000
#> GSM1022359     2  0.0000      0.969 0.000 1.000 0.00 0.000 0.000
#> GSM1022360     2  0.0000      0.969 0.000 1.000 0.00 0.000 0.000
#> GSM1022361     2  0.0000      0.969 0.000 1.000 0.00 0.000 0.000
#> GSM1022362     2  0.0000      0.969 0.000 1.000 0.00 0.000 0.000
#> GSM1022367     2  0.2074      0.904 0.000 0.896 0.00 0.000 0.104
#> GSM1022368     2  0.2074      0.904 0.000 0.896 0.00 0.000 0.104
#> GSM1022369     2  0.2074      0.904 0.000 0.896 0.00 0.000 0.104
#> GSM1022370     2  0.2074      0.904 0.000 0.896 0.00 0.000 0.104
#> GSM1022363     2  0.0000      0.969 0.000 1.000 0.00 0.000 0.000
#> GSM1022364     2  0.0000      0.969 0.000 1.000 0.00 0.000 0.000
#> GSM1022365     2  0.0000      0.969 0.000 1.000 0.00 0.000 0.000
#> GSM1022366     2  0.0000      0.969 0.000 1.000 0.00 0.000 0.000
#> GSM1022374     2  0.2358      0.898 0.008 0.888 0.00 0.000 0.104
#> GSM1022375     2  0.2358      0.898 0.008 0.888 0.00 0.000 0.104
#> GSM1022376     2  0.2358      0.898 0.008 0.888 0.00 0.000 0.104
#> GSM1022371     2  0.0000      0.969 0.000 1.000 0.00 0.000 0.000
#> GSM1022372     2  0.0000      0.969 0.000 1.000 0.00 0.000 0.000
#> GSM1022373     2  0.0000      0.969 0.000 1.000 0.00 0.000 0.000
#> GSM1022377     4  0.0000      0.928 0.000 0.000 0.00 1.000 0.000
#> GSM1022378     4  0.0000      0.928 0.000 0.000 0.00 1.000 0.000
#> GSM1022379     4  0.0000      0.928 0.000 0.000 0.00 1.000 0.000
#> GSM1022380     4  0.0000      0.928 0.000 0.000 0.00 1.000 0.000
#> GSM1022385     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> GSM1022386     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> GSM1022387     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> GSM1022388     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> GSM1022381     4  0.0000      0.928 0.000 0.000 0.00 1.000 0.000
#> GSM1022382     4  0.0000      0.928 0.000 0.000 0.00 1.000 0.000
#> GSM1022383     4  0.0000      0.928 0.000 0.000 0.00 1.000 0.000
#> GSM1022384     4  0.0000      0.928 0.000 0.000 0.00 1.000 0.000
#> GSM1022393     1  0.2929      1.000 0.820 0.000 0.18 0.000 0.000
#> GSM1022394     1  0.2929      1.000 0.820 0.000 0.18 0.000 0.000
#> GSM1022395     1  0.2929      1.000 0.820 0.000 0.18 0.000 0.000
#> GSM1022396     1  0.2929      1.000 0.820 0.000 0.18 0.000 0.000
#> GSM1022389     4  0.3359      0.856 0.164 0.000 0.00 0.816 0.020
#> GSM1022390     4  0.4106      0.788 0.256 0.000 0.00 0.724 0.020
#> GSM1022391     4  0.3359      0.856 0.164 0.000 0.00 0.816 0.020
#> GSM1022392     4  0.4132      0.784 0.260 0.000 0.00 0.720 0.020
#> GSM1022397     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> GSM1022398     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> GSM1022399     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> GSM1022400     3  0.0000      1.000 0.000 0.000 1.00 0.000 0.000
#> GSM1022401     1  0.2929      1.000 0.820 0.000 0.18 0.000 0.000
#> GSM1022402     1  0.2929      1.000 0.820 0.000 0.18 0.000 0.000
#> GSM1022403     1  0.2929      1.000 0.820 0.000 0.18 0.000 0.000
#> GSM1022404     1  0.2929      1.000 0.820 0.000 0.18 0.000 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1022325     2  0.1644      0.857 0.000 0.932 0.000 0.040 0.028 0.000
#> GSM1022326     2  0.1644      0.857 0.000 0.932 0.000 0.040 0.028 0.000
#> GSM1022327     2  0.1644      0.857 0.000 0.932 0.000 0.040 0.028 0.000
#> GSM1022331     5  0.4645      0.780 0.060 0.008 0.000 0.268 0.664 0.000
#> GSM1022332     5  0.4645      0.780 0.060 0.008 0.000 0.268 0.664 0.000
#> GSM1022333     5  0.4645      0.780 0.060 0.008 0.000 0.268 0.664 0.000
#> GSM1022328     2  0.1644      0.857 0.000 0.932 0.000 0.040 0.028 0.000
#> GSM1022329     2  0.1644      0.857 0.000 0.932 0.000 0.040 0.028 0.000
#> GSM1022330     2  0.1644      0.857 0.000 0.932 0.000 0.040 0.028 0.000
#> GSM1022337     5  0.1327      0.786 0.000 0.064 0.000 0.000 0.936 0.000
#> GSM1022338     5  0.1327      0.786 0.000 0.064 0.000 0.000 0.936 0.000
#> GSM1022339     5  0.1327      0.786 0.000 0.064 0.000 0.000 0.936 0.000
#> GSM1022334     2  0.1644      0.857 0.000 0.932 0.000 0.040 0.028 0.000
#> GSM1022335     2  0.1644      0.857 0.000 0.932 0.000 0.040 0.028 0.000
#> GSM1022336     2  0.1644      0.857 0.000 0.932 0.000 0.040 0.028 0.000
#> GSM1022340     3  0.0777      0.977 0.000 0.000 0.972 0.024 0.004 0.000
#> GSM1022341     3  0.0777      0.977 0.000 0.000 0.972 0.024 0.004 0.000
#> GSM1022342     3  0.0777      0.977 0.000 0.000 0.972 0.024 0.004 0.000
#> GSM1022343     3  0.0777      0.977 0.000 0.000 0.972 0.024 0.004 0.000
#> GSM1022347     3  0.0000      0.991 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022348     3  0.0000      0.991 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022349     3  0.0000      0.991 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022350     3  0.0000      0.991 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022344     3  0.0146      0.990 0.000 0.000 0.996 0.004 0.000 0.000
#> GSM1022345     3  0.0146      0.990 0.000 0.000 0.996 0.004 0.000 0.000
#> GSM1022346     3  0.0146      0.990 0.000 0.000 0.996 0.004 0.000 0.000
#> GSM1022355     1  0.3109      0.963 0.848 0.000 0.076 0.068 0.008 0.000
#> GSM1022356     1  0.3109      0.963 0.848 0.000 0.076 0.068 0.008 0.000
#> GSM1022357     1  0.3109      0.963 0.848 0.000 0.076 0.068 0.008 0.000
#> GSM1022358     1  0.3109      0.963 0.848 0.000 0.076 0.068 0.008 0.000
#> GSM1022351     1  0.3109      0.963 0.848 0.000 0.076 0.068 0.008 0.000
#> GSM1022352     1  0.3109      0.963 0.848 0.000 0.076 0.068 0.008 0.000
#> GSM1022353     1  0.3109      0.963 0.848 0.000 0.076 0.068 0.008 0.000
#> GSM1022354     1  0.3109      0.963 0.848 0.000 0.076 0.068 0.008 0.000
#> GSM1022359     2  0.0000      0.868 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022360     2  0.0000      0.868 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022361     2  0.0000      0.868 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022362     2  0.0000      0.868 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022367     2  0.4558      0.648 0.000 0.700 0.000 0.168 0.132 0.000
#> GSM1022368     2  0.4558      0.648 0.000 0.700 0.000 0.168 0.132 0.000
#> GSM1022369     2  0.4558      0.648 0.000 0.700 0.000 0.168 0.132 0.000
#> GSM1022370     2  0.4558      0.648 0.000 0.700 0.000 0.168 0.132 0.000
#> GSM1022363     2  0.0713      0.862 0.000 0.972 0.000 0.028 0.000 0.000
#> GSM1022364     2  0.0713      0.862 0.000 0.972 0.000 0.028 0.000 0.000
#> GSM1022365     2  0.0713      0.862 0.000 0.972 0.000 0.028 0.000 0.000
#> GSM1022366     2  0.0713      0.862 0.000 0.972 0.000 0.028 0.000 0.000
#> GSM1022374     2  0.4630      0.453 0.000 0.580 0.000 0.048 0.372 0.000
#> GSM1022375     2  0.4630      0.453 0.000 0.580 0.000 0.048 0.372 0.000
#> GSM1022376     2  0.4630      0.453 0.000 0.580 0.000 0.048 0.372 0.000
#> GSM1022371     2  0.0000      0.868 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022372     2  0.0000      0.868 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022373     2  0.0000      0.868 0.000 1.000 0.000 0.000 0.000 0.000
#> GSM1022377     4  0.4234      0.987 0.016 0.000 0.000 0.544 0.000 0.440
#> GSM1022378     4  0.4234      0.987 0.016 0.000 0.000 0.544 0.000 0.440
#> GSM1022379     4  0.4234      0.987 0.016 0.000 0.000 0.544 0.000 0.440
#> GSM1022380     4  0.4234      0.987 0.016 0.000 0.000 0.544 0.000 0.440
#> GSM1022385     3  0.0363      0.987 0.000 0.000 0.988 0.012 0.000 0.000
#> GSM1022386     3  0.0363      0.987 0.000 0.000 0.988 0.012 0.000 0.000
#> GSM1022387     3  0.0363      0.987 0.000 0.000 0.988 0.012 0.000 0.000
#> GSM1022388     3  0.0363      0.987 0.000 0.000 0.988 0.012 0.000 0.000
#> GSM1022381     4  0.3828      0.987 0.000 0.000 0.000 0.560 0.000 0.440
#> GSM1022382     4  0.3828      0.987 0.000 0.000 0.000 0.560 0.000 0.440
#> GSM1022383     4  0.3828      0.987 0.000 0.000 0.000 0.560 0.000 0.440
#> GSM1022384     4  0.3828      0.987 0.000 0.000 0.000 0.560 0.000 0.440
#> GSM1022393     1  0.1501      0.963 0.924 0.000 0.076 0.000 0.000 0.000
#> GSM1022394     1  0.1501      0.963 0.924 0.000 0.076 0.000 0.000 0.000
#> GSM1022395     1  0.1501      0.963 0.924 0.000 0.076 0.000 0.000 0.000
#> GSM1022396     1  0.1501      0.963 0.924 0.000 0.076 0.000 0.000 0.000
#> GSM1022389     6  0.0000      0.948 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1022390     6  0.0790      0.950 0.032 0.000 0.000 0.000 0.000 0.968
#> GSM1022391     6  0.0000      0.948 0.000 0.000 0.000 0.000 0.000 1.000
#> GSM1022392     6  0.0790      0.950 0.032 0.000 0.000 0.000 0.000 0.968
#> GSM1022397     3  0.0000      0.991 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022398     3  0.0000      0.991 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022399     3  0.0000      0.991 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022400     3  0.0000      0.991 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022401     1  0.1501      0.963 0.924 0.000 0.076 0.000 0.000 0.000
#> GSM1022402     1  0.1501      0.963 0.924 0.000 0.076 0.000 0.000 0.000
#> GSM1022403     1  0.1501      0.963 0.924 0.000 0.076 0.000 0.000 0.000
#> GSM1022404     1  0.1501      0.963 0.924 0.000 0.076 0.000 0.000 0.000

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-skmeans-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-ATC-skmeans-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-ATC-skmeans-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-ATC-skmeans-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-ATC-skmeans-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-ATC-skmeans-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-ATC-skmeans-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-ATC-skmeans-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-ATC-skmeans-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-ATC-skmeans-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-ATC-skmeans-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-ATC-skmeans-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-ATC-skmeans-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-skmeans-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-ATC-skmeans-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-skmeans-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-skmeans-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-skmeans-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-skmeans-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-skmeans-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-skmeans-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-ATC-skmeans-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-skmeans-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-skmeans-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-skmeans-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-skmeans-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-skmeans-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>              n protocol(p) cell.type(p) k
#> ATC:skmeans 80    1.10e-11     4.22e-01 2
#> ATC:skmeans 80    9.12e-15     1.26e-04 3
#> ATC:skmeans 80    8.27e-16     2.47e-06 4
#> ATC:skmeans 80    1.46e-23     6.83e-06 5
#> ATC:skmeans 77    2.26e-25     3.15e-06 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


ATC:pam**

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["ATC", "pam"]
# you can also extract it by
# res = res_list["ATC:pam"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'pam' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk ATC-pam-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk ATC-pam-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2  1.00           1.000       1.000         0.4913 0.509   0.509
#> 3 3  0.83           0.910       0.940         0.2967 0.853   0.714
#> 4 4  1.00           0.957       0.961         0.1330 0.903   0.738
#> 5 5  1.00           0.963       0.985         0.0861 0.933   0.757
#> 6 6  1.00           0.964       0.985         0.0577 0.957   0.798

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 6
#> attr(,"optional")
#> [1] 2 4 5

There is also optional best \(k\) = 2 4 5 that is worth to check.

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette p1 p2
#> GSM1022325     2       0          1  0  1
#> GSM1022326     2       0          1  0  1
#> GSM1022327     2       0          1  0  1
#> GSM1022331     2       0          1  0  1
#> GSM1022332     2       0          1  0  1
#> GSM1022333     2       0          1  0  1
#> GSM1022328     2       0          1  0  1
#> GSM1022329     2       0          1  0  1
#> GSM1022330     2       0          1  0  1
#> GSM1022337     2       0          1  0  1
#> GSM1022338     2       0          1  0  1
#> GSM1022339     2       0          1  0  1
#> GSM1022334     2       0          1  0  1
#> GSM1022335     2       0          1  0  1
#> GSM1022336     2       0          1  0  1
#> GSM1022340     1       0          1  1  0
#> GSM1022341     1       0          1  1  0
#> GSM1022342     1       0          1  1  0
#> GSM1022343     1       0          1  1  0
#> GSM1022347     1       0          1  1  0
#> GSM1022348     1       0          1  1  0
#> GSM1022349     1       0          1  1  0
#> GSM1022350     1       0          1  1  0
#> GSM1022344     1       0          1  1  0
#> GSM1022345     1       0          1  1  0
#> GSM1022346     1       0          1  1  0
#> GSM1022355     1       0          1  1  0
#> GSM1022356     1       0          1  1  0
#> GSM1022357     1       0          1  1  0
#> GSM1022358     1       0          1  1  0
#> GSM1022351     1       0          1  1  0
#> GSM1022352     1       0          1  1  0
#> GSM1022353     1       0          1  1  0
#> GSM1022354     1       0          1  1  0
#> GSM1022359     2       0          1  0  1
#> GSM1022360     2       0          1  0  1
#> GSM1022361     2       0          1  0  1
#> GSM1022362     2       0          1  0  1
#> GSM1022367     2       0          1  0  1
#> GSM1022368     2       0          1  0  1
#> GSM1022369     2       0          1  0  1
#> GSM1022370     2       0          1  0  1
#> GSM1022363     2       0          1  0  1
#> GSM1022364     2       0          1  0  1
#> GSM1022365     2       0          1  0  1
#> GSM1022366     2       0          1  0  1
#> GSM1022374     2       0          1  0  1
#> GSM1022375     2       0          1  0  1
#> GSM1022376     2       0          1  0  1
#> GSM1022371     2       0          1  0  1
#> GSM1022372     2       0          1  0  1
#> GSM1022373     2       0          1  0  1
#> GSM1022377     1       0          1  1  0
#> GSM1022378     1       0          1  1  0
#> GSM1022379     1       0          1  1  0
#> GSM1022380     1       0          1  1  0
#> GSM1022385     1       0          1  1  0
#> GSM1022386     1       0          1  1  0
#> GSM1022387     1       0          1  1  0
#> GSM1022388     1       0          1  1  0
#> GSM1022381     1       0          1  1  0
#> GSM1022382     1       0          1  1  0
#> GSM1022383     1       0          1  1  0
#> GSM1022384     1       0          1  1  0
#> GSM1022393     1       0          1  1  0
#> GSM1022394     1       0          1  1  0
#> GSM1022395     1       0          1  1  0
#> GSM1022396     1       0          1  1  0
#> GSM1022389     1       0          1  1  0
#> GSM1022390     1       0          1  1  0
#> GSM1022391     1       0          1  1  0
#> GSM1022392     1       0          1  1  0
#> GSM1022397     1       0          1  1  0
#> GSM1022398     1       0          1  1  0
#> GSM1022399     1       0          1  1  0
#> GSM1022400     1       0          1  1  0
#> GSM1022401     1       0          1  1  0
#> GSM1022402     1       0          1  1  0
#> GSM1022403     1       0          1  1  0
#> GSM1022404     1       0          1  1  0

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette   p1    p2    p3
#> GSM1022325     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022326     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022327     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022331     2   0.455      0.747 0.00 0.800 0.200
#> GSM1022332     3   0.617      0.233 0.00 0.412 0.588
#> GSM1022333     2   0.263      0.904 0.00 0.916 0.084
#> GSM1022328     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022329     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022330     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022337     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022338     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022339     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022334     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022335     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022336     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022340     1   0.502      0.836 0.76 0.000 0.240
#> GSM1022341     1   0.000      0.861 1.00 0.000 0.000
#> GSM1022342     1   0.000      0.861 1.00 0.000 0.000
#> GSM1022343     1   0.000      0.861 1.00 0.000 0.000
#> GSM1022347     1   0.000      0.861 1.00 0.000 0.000
#> GSM1022348     1   0.000      0.861 1.00 0.000 0.000
#> GSM1022349     1   0.000      0.861 1.00 0.000 0.000
#> GSM1022350     1   0.000      0.861 1.00 0.000 0.000
#> GSM1022344     1   0.000      0.861 1.00 0.000 0.000
#> GSM1022345     1   0.000      0.861 1.00 0.000 0.000
#> GSM1022346     1   0.000      0.861 1.00 0.000 0.000
#> GSM1022355     1   0.502      0.836 0.76 0.000 0.240
#> GSM1022356     1   0.502      0.836 0.76 0.000 0.240
#> GSM1022357     1   0.502      0.836 0.76 0.000 0.240
#> GSM1022358     1   0.502      0.836 0.76 0.000 0.240
#> GSM1022351     1   0.502      0.836 0.76 0.000 0.240
#> GSM1022352     1   0.502      0.836 0.76 0.000 0.240
#> GSM1022353     1   0.502      0.836 0.76 0.000 0.240
#> GSM1022354     1   0.502      0.836 0.76 0.000 0.240
#> GSM1022359     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022360     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022361     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022362     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022367     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022368     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022369     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022370     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022363     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022364     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022365     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022366     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022374     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022375     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022376     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022371     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022372     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022373     2   0.000      0.991 0.00 1.000 0.000
#> GSM1022377     3   0.000      0.956 0.00 0.000 1.000
#> GSM1022378     3   0.000      0.956 0.00 0.000 1.000
#> GSM1022379     3   0.000      0.956 0.00 0.000 1.000
#> GSM1022380     3   0.000      0.956 0.00 0.000 1.000
#> GSM1022385     1   0.000      0.861 1.00 0.000 0.000
#> GSM1022386     1   0.000      0.861 1.00 0.000 0.000
#> GSM1022387     1   0.000      0.861 1.00 0.000 0.000
#> GSM1022388     1   0.000      0.861 1.00 0.000 0.000
#> GSM1022381     3   0.000      0.956 0.00 0.000 1.000
#> GSM1022382     3   0.000      0.956 0.00 0.000 1.000
#> GSM1022383     3   0.000      0.956 0.00 0.000 1.000
#> GSM1022384     3   0.000      0.956 0.00 0.000 1.000
#> GSM1022393     1   0.502      0.836 0.76 0.000 0.240
#> GSM1022394     1   0.502      0.836 0.76 0.000 0.240
#> GSM1022395     1   0.502      0.836 0.76 0.000 0.240
#> GSM1022396     1   0.502      0.836 0.76 0.000 0.240
#> GSM1022389     3   0.000      0.956 0.00 0.000 1.000
#> GSM1022390     3   0.000      0.956 0.00 0.000 1.000
#> GSM1022391     3   0.000      0.956 0.00 0.000 1.000
#> GSM1022392     3   0.000      0.956 0.00 0.000 1.000
#> GSM1022397     1   0.000      0.861 1.00 0.000 0.000
#> GSM1022398     1   0.000      0.861 1.00 0.000 0.000
#> GSM1022399     1   0.000      0.861 1.00 0.000 0.000
#> GSM1022400     1   0.000      0.861 1.00 0.000 0.000
#> GSM1022401     1   0.502      0.836 0.76 0.000 0.240
#> GSM1022402     1   0.502      0.836 0.76 0.000 0.240
#> GSM1022403     1   0.502      0.836 0.76 0.000 0.240
#> GSM1022404     1   0.502      0.836 0.76 0.000 0.240

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1022325     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022326     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022327     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022331     2   0.517      0.743 0.092 0.756 0.000 0.152
#> GSM1022332     4   0.670      0.181 0.092 0.396 0.000 0.512
#> GSM1022333     2   0.389      0.862 0.092 0.844 0.000 0.064
#> GSM1022328     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022329     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022330     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022337     2   0.222      0.923 0.092 0.908 0.000 0.000
#> GSM1022338     2   0.222      0.923 0.092 0.908 0.000 0.000
#> GSM1022339     2   0.222      0.923 0.092 0.908 0.000 0.000
#> GSM1022334     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022335     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022336     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022340     1   0.471      0.581 0.640 0.000 0.360 0.000
#> GSM1022341     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM1022342     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM1022343     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM1022347     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM1022348     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM1022349     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM1022350     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM1022344     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM1022345     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM1022346     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM1022355     1   0.222      0.981 0.908 0.000 0.092 0.000
#> GSM1022356     1   0.222      0.981 0.908 0.000 0.092 0.000
#> GSM1022357     1   0.222      0.981 0.908 0.000 0.092 0.000
#> GSM1022358     1   0.222      0.981 0.908 0.000 0.092 0.000
#> GSM1022351     1   0.222      0.981 0.908 0.000 0.092 0.000
#> GSM1022352     1   0.222      0.981 0.908 0.000 0.092 0.000
#> GSM1022353     1   0.222      0.981 0.908 0.000 0.092 0.000
#> GSM1022354     1   0.222      0.981 0.908 0.000 0.092 0.000
#> GSM1022359     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022360     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022361     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022362     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022367     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022368     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022369     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022370     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022363     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022364     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022365     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022366     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022374     2   0.130      0.954 0.044 0.956 0.000 0.000
#> GSM1022375     2   0.130      0.954 0.044 0.956 0.000 0.000
#> GSM1022376     2   0.172      0.942 0.064 0.936 0.000 0.000
#> GSM1022371     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022372     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022373     2   0.000      0.976 0.000 1.000 0.000 0.000
#> GSM1022377     4   0.000      0.954 0.000 0.000 0.000 1.000
#> GSM1022378     4   0.000      0.954 0.000 0.000 0.000 1.000
#> GSM1022379     4   0.000      0.954 0.000 0.000 0.000 1.000
#> GSM1022380     4   0.000      0.954 0.000 0.000 0.000 1.000
#> GSM1022385     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM1022386     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM1022387     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM1022388     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM1022381     4   0.000      0.954 0.000 0.000 0.000 1.000
#> GSM1022382     4   0.000      0.954 0.000 0.000 0.000 1.000
#> GSM1022383     4   0.000      0.954 0.000 0.000 0.000 1.000
#> GSM1022384     4   0.000      0.954 0.000 0.000 0.000 1.000
#> GSM1022393     1   0.222      0.981 0.908 0.000 0.092 0.000
#> GSM1022394     1   0.222      0.981 0.908 0.000 0.092 0.000
#> GSM1022395     1   0.222      0.981 0.908 0.000 0.092 0.000
#> GSM1022396     1   0.222      0.981 0.908 0.000 0.092 0.000
#> GSM1022389     4   0.000      0.954 0.000 0.000 0.000 1.000
#> GSM1022390     4   0.000      0.954 0.000 0.000 0.000 1.000
#> GSM1022391     4   0.000      0.954 0.000 0.000 0.000 1.000
#> GSM1022392     4   0.000      0.954 0.000 0.000 0.000 1.000
#> GSM1022397     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM1022398     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM1022399     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM1022400     3   0.000      1.000 0.000 0.000 1.000 0.000
#> GSM1022401     1   0.222      0.981 0.908 0.000 0.092 0.000
#> GSM1022402     1   0.222      0.981 0.908 0.000 0.092 0.000
#> GSM1022403     1   0.222      0.981 0.908 0.000 0.092 0.000
#> GSM1022404     1   0.222      0.981 0.908 0.000 0.092 0.000

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3 p4    p5
#> GSM1022325     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022326     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022327     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022331     5   0.000      0.855 0.000 0.000 0.000  0 1.000
#> GSM1022332     5   0.000      0.855 0.000 0.000 0.000  0 1.000
#> GSM1022333     5   0.000      0.855 0.000 0.000 0.000  0 1.000
#> GSM1022328     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022329     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022330     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022337     5   0.000      0.855 0.000 0.000 0.000  0 1.000
#> GSM1022338     5   0.000      0.855 0.000 0.000 0.000  0 1.000
#> GSM1022339     5   0.000      0.855 0.000 0.000 0.000  0 1.000
#> GSM1022334     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022335     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022336     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022340     1   0.382      0.563 0.696 0.000 0.304  0 0.000
#> GSM1022341     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> GSM1022342     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> GSM1022343     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> GSM1022347     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> GSM1022348     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> GSM1022349     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> GSM1022350     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> GSM1022344     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> GSM1022345     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> GSM1022346     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> GSM1022355     1   0.000      0.977 1.000 0.000 0.000  0 0.000
#> GSM1022356     1   0.000      0.977 1.000 0.000 0.000  0 0.000
#> GSM1022357     1   0.000      0.977 1.000 0.000 0.000  0 0.000
#> GSM1022358     1   0.000      0.977 1.000 0.000 0.000  0 0.000
#> GSM1022351     1   0.000      0.977 1.000 0.000 0.000  0 0.000
#> GSM1022352     1   0.000      0.977 1.000 0.000 0.000  0 0.000
#> GSM1022353     1   0.000      0.977 1.000 0.000 0.000  0 0.000
#> GSM1022354     1   0.000      0.977 1.000 0.000 0.000  0 0.000
#> GSM1022359     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022360     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022361     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022362     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022367     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022368     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022369     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022370     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022363     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022364     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022365     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022366     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022374     5   0.417      0.456 0.000 0.396 0.000  0 0.604
#> GSM1022375     5   0.417      0.456 0.000 0.396 0.000  0 0.604
#> GSM1022376     5   0.218      0.796 0.000 0.112 0.000  0 0.888
#> GSM1022371     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022372     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022373     2   0.000      1.000 0.000 1.000 0.000  0 0.000
#> GSM1022377     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022378     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022379     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022380     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022385     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> GSM1022386     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> GSM1022387     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> GSM1022388     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> GSM1022381     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022382     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022383     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022384     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022393     1   0.000      0.977 1.000 0.000 0.000  0 0.000
#> GSM1022394     1   0.000      0.977 1.000 0.000 0.000  0 0.000
#> GSM1022395     1   0.000      0.977 1.000 0.000 0.000  0 0.000
#> GSM1022396     1   0.000      0.977 1.000 0.000 0.000  0 0.000
#> GSM1022389     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022390     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022391     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022392     4   0.000      1.000 0.000 0.000 0.000  1 0.000
#> GSM1022397     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> GSM1022398     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> GSM1022399     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> GSM1022400     3   0.000      1.000 0.000 0.000 1.000  0 0.000
#> GSM1022401     1   0.000      0.977 1.000 0.000 0.000  0 0.000
#> GSM1022402     1   0.000      0.977 1.000 0.000 0.000  0 0.000
#> GSM1022403     1   0.000      0.977 1.000 0.000 0.000  0 0.000
#> GSM1022404     1   0.000      0.977 1.000 0.000 0.000  0 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3 p4    p5    p6
#> GSM1022325     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022326     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022327     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022331     5   0.000      0.866 0.000 0.000 0.000  0 1.000 0.000
#> GSM1022332     5   0.000      0.866 0.000 0.000 0.000  0 1.000 0.000
#> GSM1022333     5   0.000      0.866 0.000 0.000 0.000  0 1.000 0.000
#> GSM1022328     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022329     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022330     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022337     5   0.000      0.866 0.000 0.000 0.000  0 1.000 0.000
#> GSM1022338     5   0.000      0.866 0.000 0.000 0.000  0 1.000 0.000
#> GSM1022339     5   0.000      0.866 0.000 0.000 0.000  0 1.000 0.000
#> GSM1022334     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022335     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022336     2   0.000      1.000 0.000 1.000 0.000  0 0.000 0.000
#> GSM1022340     1   0.343      0.563 0.696 0.000 0.304  0 0.000 0.000
#> GSM1022341     3   0.000      1.000 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022342     3   0.000      1.000 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022343     3   0.000      1.000 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022347     3   0.000      1.000 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022348     3   0.000      1.000 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022349     3   0.000      1.000 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022350     3   0.000      1.000 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022344     3   0.000      1.000 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022345     3   0.000      1.000 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022346     3   0.000      1.000 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022355     1   0.000      0.977 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022356     1   0.000      0.977 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022357     1   0.000      0.977 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022358     1   0.000      0.977 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022351     1   0.000      0.977 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022352     1   0.000      0.977 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022353     1   0.000      0.977 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022354     1   0.000      0.977 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022359     6   0.000      1.000 0.000 0.000 0.000  0 0.000 1.000
#> GSM1022360     6   0.000      1.000 0.000 0.000 0.000  0 0.000 1.000
#> GSM1022361     6   0.000      1.000 0.000 0.000 0.000  0 0.000 1.000
#> GSM1022362     6   0.000      1.000 0.000 0.000 0.000  0 0.000 1.000
#> GSM1022367     6   0.000      1.000 0.000 0.000 0.000  0 0.000 1.000
#> GSM1022368     6   0.000      1.000 0.000 0.000 0.000  0 0.000 1.000
#> GSM1022369     6   0.000      1.000 0.000 0.000 0.000  0 0.000 1.000
#> GSM1022370     6   0.000      1.000 0.000 0.000 0.000  0 0.000 1.000
#> GSM1022363     6   0.000      1.000 0.000 0.000 0.000  0 0.000 1.000
#> GSM1022364     6   0.000      1.000 0.000 0.000 0.000  0 0.000 1.000
#> GSM1022365     6   0.000      1.000 0.000 0.000 0.000  0 0.000 1.000
#> GSM1022366     6   0.000      1.000 0.000 0.000 0.000  0 0.000 1.000
#> GSM1022374     5   0.398      0.459 0.000 0.008 0.000  0 0.600 0.392
#> GSM1022375     5   0.376      0.446 0.000 0.000 0.000  0 0.600 0.400
#> GSM1022376     5   0.222      0.810 0.000 0.012 0.000  0 0.884 0.104
#> GSM1022371     6   0.000      1.000 0.000 0.000 0.000  0 0.000 1.000
#> GSM1022372     6   0.000      1.000 0.000 0.000 0.000  0 0.000 1.000
#> GSM1022373     6   0.000      1.000 0.000 0.000 0.000  0 0.000 1.000
#> GSM1022377     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022378     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022379     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022380     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022385     3   0.000      1.000 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022386     3   0.000      1.000 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022387     3   0.000      1.000 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022388     3   0.000      1.000 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022381     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022382     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022383     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022384     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022393     1   0.000      0.977 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022394     1   0.000      0.977 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022395     1   0.000      0.977 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022396     1   0.000      0.977 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022389     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022390     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022391     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022392     4   0.000      1.000 0.000 0.000 0.000  1 0.000 0.000
#> GSM1022397     3   0.000      1.000 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022398     3   0.000      1.000 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022399     3   0.000      1.000 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022400     3   0.000      1.000 0.000 0.000 1.000  0 0.000 0.000
#> GSM1022401     1   0.000      0.977 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022402     1   0.000      0.977 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022403     1   0.000      0.977 1.000 0.000 0.000  0 0.000 0.000
#> GSM1022404     1   0.000      0.977 1.000 0.000 0.000  0 0.000 0.000

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-pam-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-ATC-pam-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-ATC-pam-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-ATC-pam-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-ATC-pam-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-ATC-pam-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-ATC-pam-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-ATC-pam-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-ATC-pam-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-ATC-pam-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-ATC-pam-get-signatures-1

get_signatures(res, k = 3)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

plot of chunk tab-ATC-pam-get-signatures-2

get_signatures(res, k = 4)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

plot of chunk tab-ATC-pam-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-pam-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-ATC-pam-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-pam-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-pam-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-pam-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-pam-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-pam-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-pam-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-ATC-pam-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-pam-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-pam-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-pam-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-pam-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-pam-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>          n protocol(p) cell.type(p) k
#> ATC:pam 80    1.10e-11     4.22e-01 2
#> ATC:pam 79    1.71e-14     1.03e-04 3
#> ATC:pam 79    5.15e-21     3.63e-04 4
#> ATC:pam 78    1.86e-20     7.15e-07 5
#> ATC:pam 78    1.97e-26     1.09e-06 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


ATC:mclust**

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["ATC", "mclust"]
# you can also extract it by
# res = res_list["ATC:mclust"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'mclust' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 6.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk ATC-mclust-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk ATC-mclust-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.519           0.874       0.868         0.4347 0.509   0.509
#> 3 3 0.789           0.834       0.887         0.4804 0.835   0.685
#> 4 4 0.881           0.905       0.951         0.0936 0.902   0.749
#> 5 5 0.938           0.955       0.974         0.1363 0.867   0.584
#> 6 6 0.958           0.956       0.945         0.0236 0.987   0.933

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 6
#> attr(,"optional")
#> [1] 5

There is also optional best \(k\) = 5 that is worth to check.

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette   p1   p2
#> GSM1022325     2   0.000      1.000 0.00 1.00
#> GSM1022326     2   0.000      1.000 0.00 1.00
#> GSM1022327     2   0.000      1.000 0.00 1.00
#> GSM1022331     2   0.000      1.000 0.00 1.00
#> GSM1022332     2   0.000      1.000 0.00 1.00
#> GSM1022333     2   0.000      1.000 0.00 1.00
#> GSM1022328     2   0.000      1.000 0.00 1.00
#> GSM1022329     2   0.000      1.000 0.00 1.00
#> GSM1022330     2   0.000      1.000 0.00 1.00
#> GSM1022337     2   0.000      1.000 0.00 1.00
#> GSM1022338     2   0.000      1.000 0.00 1.00
#> GSM1022339     2   0.000      1.000 0.00 1.00
#> GSM1022334     2   0.000      1.000 0.00 1.00
#> GSM1022335     2   0.000      1.000 0.00 1.00
#> GSM1022336     2   0.000      1.000 0.00 1.00
#> GSM1022340     1   0.925      0.821 0.66 0.34
#> GSM1022341     1   0.925      0.821 0.66 0.34
#> GSM1022342     1   0.925      0.821 0.66 0.34
#> GSM1022343     1   0.925      0.821 0.66 0.34
#> GSM1022347     1   0.925      0.821 0.66 0.34
#> GSM1022348     1   0.925      0.821 0.66 0.34
#> GSM1022349     1   0.925      0.821 0.66 0.34
#> GSM1022350     1   0.925      0.821 0.66 0.34
#> GSM1022344     1   0.925      0.821 0.66 0.34
#> GSM1022345     1   0.925      0.821 0.66 0.34
#> GSM1022346     1   0.925      0.821 0.66 0.34
#> GSM1022355     1   0.000      0.716 1.00 0.00
#> GSM1022356     1   0.000      0.716 1.00 0.00
#> GSM1022357     1   0.000      0.716 1.00 0.00
#> GSM1022358     1   0.000      0.716 1.00 0.00
#> GSM1022351     1   0.000      0.716 1.00 0.00
#> GSM1022352     1   0.000      0.716 1.00 0.00
#> GSM1022353     1   0.000      0.716 1.00 0.00
#> GSM1022354     1   0.000      0.716 1.00 0.00
#> GSM1022359     2   0.000      1.000 0.00 1.00
#> GSM1022360     2   0.000      1.000 0.00 1.00
#> GSM1022361     2   0.000      1.000 0.00 1.00
#> GSM1022362     2   0.000      1.000 0.00 1.00
#> GSM1022367     2   0.000      1.000 0.00 1.00
#> GSM1022368     2   0.000      1.000 0.00 1.00
#> GSM1022369     2   0.000      1.000 0.00 1.00
#> GSM1022370     2   0.000      1.000 0.00 1.00
#> GSM1022363     2   0.000      1.000 0.00 1.00
#> GSM1022364     2   0.000      1.000 0.00 1.00
#> GSM1022365     2   0.000      1.000 0.00 1.00
#> GSM1022366     2   0.000      1.000 0.00 1.00
#> GSM1022374     2   0.000      1.000 0.00 1.00
#> GSM1022375     2   0.000      1.000 0.00 1.00
#> GSM1022376     2   0.000      1.000 0.00 1.00
#> GSM1022371     2   0.000      1.000 0.00 1.00
#> GSM1022372     2   0.000      1.000 0.00 1.00
#> GSM1022373     2   0.000      1.000 0.00 1.00
#> GSM1022377     1   0.925      0.821 0.66 0.34
#> GSM1022378     1   0.925      0.821 0.66 0.34
#> GSM1022379     1   0.925      0.821 0.66 0.34
#> GSM1022380     1   0.925      0.821 0.66 0.34
#> GSM1022385     1   0.925      0.821 0.66 0.34
#> GSM1022386     1   0.925      0.821 0.66 0.34
#> GSM1022387     1   0.925      0.821 0.66 0.34
#> GSM1022388     1   0.925      0.821 0.66 0.34
#> GSM1022381     1   0.925      0.821 0.66 0.34
#> GSM1022382     1   0.925      0.821 0.66 0.34
#> GSM1022383     1   0.925      0.821 0.66 0.34
#> GSM1022384     1   0.925      0.821 0.66 0.34
#> GSM1022393     1   0.000      0.716 1.00 0.00
#> GSM1022394     1   0.000      0.716 1.00 0.00
#> GSM1022395     1   0.000      0.716 1.00 0.00
#> GSM1022396     1   0.000      0.716 1.00 0.00
#> GSM1022389     1   0.925      0.821 0.66 0.34
#> GSM1022390     1   0.925      0.821 0.66 0.34
#> GSM1022391     1   0.925      0.821 0.66 0.34
#> GSM1022392     1   0.925      0.821 0.66 0.34
#> GSM1022397     1   0.925      0.821 0.66 0.34
#> GSM1022398     1   0.925      0.821 0.66 0.34
#> GSM1022399     1   0.925      0.821 0.66 0.34
#> GSM1022400     1   0.925      0.821 0.66 0.34
#> GSM1022401     1   0.000      0.716 1.00 0.00
#> GSM1022402     1   0.000      0.716 1.00 0.00
#> GSM1022403     1   0.000      0.716 1.00 0.00
#> GSM1022404     1   0.000      0.716 1.00 0.00

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1022325     2  0.0000      0.997 0.000 1.000 0.000
#> GSM1022326     2  0.0000      0.997 0.000 1.000 0.000
#> GSM1022327     2  0.0000      0.997 0.000 1.000 0.000
#> GSM1022331     2  0.0424      0.993 0.000 0.992 0.008
#> GSM1022332     2  0.0424      0.993 0.000 0.992 0.008
#> GSM1022333     2  0.0424      0.993 0.000 0.992 0.008
#> GSM1022328     2  0.0000      0.997 0.000 1.000 0.000
#> GSM1022329     2  0.0000      0.997 0.000 1.000 0.000
#> GSM1022330     2  0.0000      0.997 0.000 1.000 0.000
#> GSM1022337     3  0.2537      0.762 0.000 0.080 0.920
#> GSM1022338     3  0.2537      0.762 0.000 0.080 0.920
#> GSM1022339     3  0.2537      0.762 0.000 0.080 0.920
#> GSM1022334     2  0.0000      0.997 0.000 1.000 0.000
#> GSM1022335     2  0.0000      0.997 0.000 1.000 0.000
#> GSM1022336     2  0.0000      0.997 0.000 1.000 0.000
#> GSM1022340     1  0.0000      0.806 1.000 0.000 0.000
#> GSM1022341     1  0.0000      0.806 1.000 0.000 0.000
#> GSM1022342     1  0.0000      0.806 1.000 0.000 0.000
#> GSM1022343     1  0.0000      0.806 1.000 0.000 0.000
#> GSM1022347     1  0.0747      0.808 0.984 0.000 0.016
#> GSM1022348     1  0.0747      0.808 0.984 0.000 0.016
#> GSM1022349     1  0.0747      0.808 0.984 0.000 0.016
#> GSM1022350     1  0.0747      0.808 0.984 0.000 0.016
#> GSM1022344     1  0.0000      0.806 1.000 0.000 0.000
#> GSM1022345     1  0.0892      0.809 0.980 0.000 0.020
#> GSM1022346     1  0.0892      0.809 0.980 0.000 0.020
#> GSM1022355     1  0.5016      0.776 0.760 0.000 0.240
#> GSM1022356     1  0.5016      0.776 0.760 0.000 0.240
#> GSM1022357     1  0.5016      0.776 0.760 0.000 0.240
#> GSM1022358     1  0.5016      0.776 0.760 0.000 0.240
#> GSM1022351     1  0.5016      0.776 0.760 0.000 0.240
#> GSM1022352     1  0.5016      0.776 0.760 0.000 0.240
#> GSM1022353     1  0.5016      0.776 0.760 0.000 0.240
#> GSM1022354     1  0.5016      0.776 0.760 0.000 0.240
#> GSM1022359     2  0.0000      0.997 0.000 1.000 0.000
#> GSM1022360     2  0.0000      0.997 0.000 1.000 0.000
#> GSM1022361     2  0.0000      0.997 0.000 1.000 0.000
#> GSM1022362     2  0.0000      0.997 0.000 1.000 0.000
#> GSM1022367     2  0.0424      0.993 0.000 0.992 0.008
#> GSM1022368     2  0.0424      0.993 0.000 0.992 0.008
#> GSM1022369     2  0.0424      0.993 0.000 0.992 0.008
#> GSM1022370     2  0.0424      0.993 0.000 0.992 0.008
#> GSM1022363     2  0.0000      0.997 0.000 1.000 0.000
#> GSM1022364     2  0.0000      0.997 0.000 1.000 0.000
#> GSM1022365     2  0.0000      0.997 0.000 1.000 0.000
#> GSM1022366     2  0.0000      0.997 0.000 1.000 0.000
#> GSM1022374     3  0.2537      0.762 0.000 0.080 0.920
#> GSM1022375     3  0.2537      0.762 0.000 0.080 0.920
#> GSM1022376     3  0.2537      0.762 0.000 0.080 0.920
#> GSM1022371     2  0.0000      0.997 0.000 1.000 0.000
#> GSM1022372     2  0.0000      0.997 0.000 1.000 0.000
#> GSM1022373     2  0.0000      0.997 0.000 1.000 0.000
#> GSM1022377     3  0.5178      0.815 0.256 0.000 0.744
#> GSM1022378     3  0.5178      0.815 0.256 0.000 0.744
#> GSM1022379     3  0.5178      0.815 0.256 0.000 0.744
#> GSM1022380     3  0.5178      0.815 0.256 0.000 0.744
#> GSM1022385     1  0.1031      0.804 0.976 0.000 0.024
#> GSM1022386     1  0.1031      0.804 0.976 0.000 0.024
#> GSM1022387     1  0.1031      0.804 0.976 0.000 0.024
#> GSM1022388     1  0.1031      0.804 0.976 0.000 0.024
#> GSM1022381     3  0.5178      0.815 0.256 0.000 0.744
#> GSM1022382     3  0.5178      0.815 0.256 0.000 0.744
#> GSM1022383     3  0.5178      0.815 0.256 0.000 0.744
#> GSM1022384     3  0.5178      0.815 0.256 0.000 0.744
#> GSM1022393     1  0.5016      0.776 0.760 0.000 0.240
#> GSM1022394     1  0.5016      0.776 0.760 0.000 0.240
#> GSM1022395     1  0.5016      0.776 0.760 0.000 0.240
#> GSM1022396     1  0.5016      0.776 0.760 0.000 0.240
#> GSM1022389     1  0.5835      0.237 0.660 0.000 0.340
#> GSM1022390     1  0.5760      0.273 0.672 0.000 0.328
#> GSM1022391     1  0.5835      0.237 0.660 0.000 0.340
#> GSM1022392     1  0.5760      0.273 0.672 0.000 0.328
#> GSM1022397     1  0.0747      0.808 0.984 0.000 0.016
#> GSM1022398     1  0.0747      0.808 0.984 0.000 0.016
#> GSM1022399     1  0.0747      0.808 0.984 0.000 0.016
#> GSM1022400     1  0.0747      0.808 0.984 0.000 0.016
#> GSM1022401     1  0.5016      0.776 0.760 0.000 0.240
#> GSM1022402     1  0.5016      0.776 0.760 0.000 0.240
#> GSM1022403     1  0.5016      0.776 0.760 0.000 0.240
#> GSM1022404     1  0.5016      0.776 0.760 0.000 0.240

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3 p4
#> GSM1022325     2   0.000      0.916 0.000 1.000 0.000  0
#> GSM1022326     2   0.000      0.916 0.000 1.000 0.000  0
#> GSM1022327     2   0.000      0.916 0.000 1.000 0.000  0
#> GSM1022331     3   0.247      0.881 0.000 0.108 0.892  0
#> GSM1022332     3   0.247      0.881 0.000 0.108 0.892  0
#> GSM1022333     3   0.247      0.881 0.000 0.108 0.892  0
#> GSM1022328     2   0.000      0.916 0.000 1.000 0.000  0
#> GSM1022329     2   0.000      0.916 0.000 1.000 0.000  0
#> GSM1022330     2   0.000      0.916 0.000 1.000 0.000  0
#> GSM1022337     3   0.000      0.943 0.000 0.000 1.000  0
#> GSM1022338     3   0.000      0.943 0.000 0.000 1.000  0
#> GSM1022339     3   0.000      0.943 0.000 0.000 1.000  0
#> GSM1022334     2   0.000      0.916 0.000 1.000 0.000  0
#> GSM1022335     2   0.000      0.916 0.000 1.000 0.000  0
#> GSM1022336     2   0.000      0.916 0.000 1.000 0.000  0
#> GSM1022340     1   0.121      0.945 0.960 0.000 0.040  0
#> GSM1022341     1   0.121      0.945 0.960 0.000 0.040  0
#> GSM1022342     1   0.121      0.945 0.960 0.000 0.040  0
#> GSM1022343     1   0.121      0.945 0.960 0.000 0.040  0
#> GSM1022347     1   0.302      0.902 0.852 0.000 0.148  0
#> GSM1022348     1   0.302      0.902 0.852 0.000 0.148  0
#> GSM1022349     1   0.302      0.902 0.852 0.000 0.148  0
#> GSM1022350     1   0.302      0.902 0.852 0.000 0.148  0
#> GSM1022344     1   0.121      0.945 0.960 0.000 0.040  0
#> GSM1022345     1   0.121      0.945 0.960 0.000 0.040  0
#> GSM1022346     1   0.121      0.945 0.960 0.000 0.040  0
#> GSM1022355     1   0.000      0.946 1.000 0.000 0.000  0
#> GSM1022356     1   0.000      0.946 1.000 0.000 0.000  0
#> GSM1022357     1   0.000      0.946 1.000 0.000 0.000  0
#> GSM1022358     1   0.000      0.946 1.000 0.000 0.000  0
#> GSM1022351     1   0.000      0.946 1.000 0.000 0.000  0
#> GSM1022352     1   0.000      0.946 1.000 0.000 0.000  0
#> GSM1022353     1   0.000      0.946 1.000 0.000 0.000  0
#> GSM1022354     1   0.000      0.946 1.000 0.000 0.000  0
#> GSM1022359     2   0.000      0.916 0.000 1.000 0.000  0
#> GSM1022360     2   0.000      0.916 0.000 1.000 0.000  0
#> GSM1022361     2   0.000      0.916 0.000 1.000 0.000  0
#> GSM1022362     2   0.000      0.916 0.000 1.000 0.000  0
#> GSM1022367     2   0.493      0.280 0.000 0.568 0.432  0
#> GSM1022368     2   0.493      0.280 0.000 0.568 0.432  0
#> GSM1022369     2   0.493      0.280 0.000 0.568 0.432  0
#> GSM1022370     2   0.493      0.280 0.000 0.568 0.432  0
#> GSM1022363     2   0.000      0.916 0.000 1.000 0.000  0
#> GSM1022364     2   0.000      0.916 0.000 1.000 0.000  0
#> GSM1022365     2   0.000      0.916 0.000 1.000 0.000  0
#> GSM1022366     2   0.000      0.916 0.000 1.000 0.000  0
#> GSM1022374     3   0.000      0.943 0.000 0.000 1.000  0
#> GSM1022375     3   0.000      0.943 0.000 0.000 1.000  0
#> GSM1022376     3   0.000      0.943 0.000 0.000 1.000  0
#> GSM1022371     2   0.000      0.916 0.000 1.000 0.000  0
#> GSM1022372     2   0.000      0.916 0.000 1.000 0.000  0
#> GSM1022373     2   0.000      0.916 0.000 1.000 0.000  0
#> GSM1022377     4   0.000      1.000 0.000 0.000 0.000  1
#> GSM1022378     4   0.000      1.000 0.000 0.000 0.000  1
#> GSM1022379     4   0.000      1.000 0.000 0.000 0.000  1
#> GSM1022380     4   0.000      1.000 0.000 0.000 0.000  1
#> GSM1022385     1   0.297      0.904 0.856 0.000 0.144  0
#> GSM1022386     1   0.228      0.928 0.904 0.000 0.096  0
#> GSM1022387     1   0.228      0.928 0.904 0.000 0.096  0
#> GSM1022388     1   0.228      0.928 0.904 0.000 0.096  0
#> GSM1022381     4   0.000      1.000 0.000 0.000 0.000  1
#> GSM1022382     4   0.000      1.000 0.000 0.000 0.000  1
#> GSM1022383     4   0.000      1.000 0.000 0.000 0.000  1
#> GSM1022384     4   0.000      1.000 0.000 0.000 0.000  1
#> GSM1022393     1   0.000      0.946 1.000 0.000 0.000  0
#> GSM1022394     1   0.000      0.946 1.000 0.000 0.000  0
#> GSM1022395     1   0.000      0.946 1.000 0.000 0.000  0
#> GSM1022396     1   0.000      0.946 1.000 0.000 0.000  0
#> GSM1022389     4   0.000      1.000 0.000 0.000 0.000  1
#> GSM1022390     4   0.000      1.000 0.000 0.000 0.000  1
#> GSM1022391     4   0.000      1.000 0.000 0.000 0.000  1
#> GSM1022392     4   0.000      1.000 0.000 0.000 0.000  1
#> GSM1022397     1   0.302      0.902 0.852 0.000 0.148  0
#> GSM1022398     1   0.302      0.902 0.852 0.000 0.148  0
#> GSM1022399     1   0.302      0.902 0.852 0.000 0.148  0
#> GSM1022400     1   0.302      0.902 0.852 0.000 0.148  0
#> GSM1022401     1   0.000      0.946 1.000 0.000 0.000  0
#> GSM1022402     1   0.000      0.946 1.000 0.000 0.000  0
#> GSM1022403     1   0.000      0.946 1.000 0.000 0.000  0
#> GSM1022404     1   0.000      0.946 1.000 0.000 0.000  0

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1 p2    p3 p4 p5
#> GSM1022325     2  0.0000      1.000 0.000  1 0.000  0  0
#> GSM1022326     2  0.0000      1.000 0.000  1 0.000  0  0
#> GSM1022327     2  0.0000      1.000 0.000  1 0.000  0  0
#> GSM1022331     5  0.0000      1.000 0.000  0 0.000  0  1
#> GSM1022332     5  0.0000      1.000 0.000  0 0.000  0  1
#> GSM1022333     5  0.0000      1.000 0.000  0 0.000  0  1
#> GSM1022328     2  0.0000      1.000 0.000  1 0.000  0  0
#> GSM1022329     2  0.0000      1.000 0.000  1 0.000  0  0
#> GSM1022330     2  0.0000      1.000 0.000  1 0.000  0  0
#> GSM1022337     5  0.0000      1.000 0.000  0 0.000  0  1
#> GSM1022338     5  0.0000      1.000 0.000  0 0.000  0  1
#> GSM1022339     5  0.0000      1.000 0.000  0 0.000  0  1
#> GSM1022334     2  0.0000      1.000 0.000  1 0.000  0  0
#> GSM1022335     2  0.0000      1.000 0.000  1 0.000  0  0
#> GSM1022336     2  0.0000      1.000 0.000  1 0.000  0  0
#> GSM1022340     3  0.3752      0.723 0.292  0 0.708  0  0
#> GSM1022341     3  0.3752      0.723 0.292  0 0.708  0  0
#> GSM1022342     3  0.3752      0.723 0.292  0 0.708  0  0
#> GSM1022343     3  0.3752      0.723 0.292  0 0.708  0  0
#> GSM1022347     3  0.0000      0.872 0.000  0 1.000  0  0
#> GSM1022348     3  0.0000      0.872 0.000  0 1.000  0  0
#> GSM1022349     3  0.0000      0.872 0.000  0 1.000  0  0
#> GSM1022350     3  0.0000      0.872 0.000  0 1.000  0  0
#> GSM1022344     3  0.3752      0.723 0.292  0 0.708  0  0
#> GSM1022345     3  0.3752      0.723 0.292  0 0.708  0  0
#> GSM1022346     3  0.3752      0.723 0.292  0 0.708  0  0
#> GSM1022355     1  0.0000      0.996 1.000  0 0.000  0  0
#> GSM1022356     1  0.0000      0.996 1.000  0 0.000  0  0
#> GSM1022357     1  0.0000      0.996 1.000  0 0.000  0  0
#> GSM1022358     1  0.0000      0.996 1.000  0 0.000  0  0
#> GSM1022351     1  0.0000      0.996 1.000  0 0.000  0  0
#> GSM1022352     1  0.0703      0.972 0.976  0 0.024  0  0
#> GSM1022353     1  0.0794      0.968 0.972  0 0.028  0  0
#> GSM1022354     1  0.0000      0.996 1.000  0 0.000  0  0
#> GSM1022359     2  0.0000      1.000 0.000  1 0.000  0  0
#> GSM1022360     2  0.0000      1.000 0.000  1 0.000  0  0
#> GSM1022361     2  0.0000      1.000 0.000  1 0.000  0  0
#> GSM1022362     2  0.0000      1.000 0.000  1 0.000  0  0
#> GSM1022367     5  0.0000      1.000 0.000  0 0.000  0  1
#> GSM1022368     5  0.0000      1.000 0.000  0 0.000  0  1
#> GSM1022369     5  0.0000      1.000 0.000  0 0.000  0  1
#> GSM1022370     5  0.0000      1.000 0.000  0 0.000  0  1
#> GSM1022363     2  0.0000      1.000 0.000  1 0.000  0  0
#> GSM1022364     2  0.0000      1.000 0.000  1 0.000  0  0
#> GSM1022365     2  0.0000      1.000 0.000  1 0.000  0  0
#> GSM1022366     2  0.0000      1.000 0.000  1 0.000  0  0
#> GSM1022374     5  0.0000      1.000 0.000  0 0.000  0  1
#> GSM1022375     5  0.0000      1.000 0.000  0 0.000  0  1
#> GSM1022376     5  0.0000      1.000 0.000  0 0.000  0  1
#> GSM1022371     2  0.0000      1.000 0.000  1 0.000  0  0
#> GSM1022372     2  0.0000      1.000 0.000  1 0.000  0  0
#> GSM1022373     2  0.0000      1.000 0.000  1 0.000  0  0
#> GSM1022377     4  0.0000      1.000 0.000  0 0.000  1  0
#> GSM1022378     4  0.0000      1.000 0.000  0 0.000  1  0
#> GSM1022379     4  0.0000      1.000 0.000  0 0.000  1  0
#> GSM1022380     4  0.0000      1.000 0.000  0 0.000  1  0
#> GSM1022385     3  0.0000      0.872 0.000  0 1.000  0  0
#> GSM1022386     3  0.0000      0.872 0.000  0 1.000  0  0
#> GSM1022387     3  0.0000      0.872 0.000  0 1.000  0  0
#> GSM1022388     3  0.0000      0.872 0.000  0 1.000  0  0
#> GSM1022381     4  0.0000      1.000 0.000  0 0.000  1  0
#> GSM1022382     4  0.0000      1.000 0.000  0 0.000  1  0
#> GSM1022383     4  0.0000      1.000 0.000  0 0.000  1  0
#> GSM1022384     4  0.0000      1.000 0.000  0 0.000  1  0
#> GSM1022393     1  0.0000      0.996 1.000  0 0.000  0  0
#> GSM1022394     1  0.0000      0.996 1.000  0 0.000  0  0
#> GSM1022395     1  0.0000      0.996 1.000  0 0.000  0  0
#> GSM1022396     1  0.0000      0.996 1.000  0 0.000  0  0
#> GSM1022389     4  0.0000      1.000 0.000  0 0.000  1  0
#> GSM1022390     4  0.0000      1.000 0.000  0 0.000  1  0
#> GSM1022391     4  0.0000      1.000 0.000  0 0.000  1  0
#> GSM1022392     4  0.0000      1.000 0.000  0 0.000  1  0
#> GSM1022397     3  0.0000      0.872 0.000  0 1.000  0  0
#> GSM1022398     3  0.0000      0.872 0.000  0 1.000  0  0
#> GSM1022399     3  0.0000      0.872 0.000  0 1.000  0  0
#> GSM1022400     3  0.0000      0.872 0.000  0 1.000  0  0
#> GSM1022401     1  0.0000      0.996 1.000  0 0.000  0  0
#> GSM1022402     1  0.0000      0.996 1.000  0 0.000  0  0
#> GSM1022403     1  0.0000      0.996 1.000  0 0.000  0  0
#> GSM1022404     1  0.0000      0.996 1.000  0 0.000  0  0

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1 p2    p3   p4    p5    p6
#> GSM1022325     2  0.0000      1.000 0.000  1 0.000 0.00 0.000 0.000
#> GSM1022326     2  0.0000      1.000 0.000  1 0.000 0.00 0.000 0.000
#> GSM1022327     2  0.0000      1.000 0.000  1 0.000 0.00 0.000 0.000
#> GSM1022331     6  0.0000      1.000 0.000  0 0.000 0.00 0.000 1.000
#> GSM1022332     6  0.0000      1.000 0.000  0 0.000 0.00 0.000 1.000
#> GSM1022333     6  0.0000      1.000 0.000  0 0.000 0.00 0.000 1.000
#> GSM1022328     2  0.0000      1.000 0.000  1 0.000 0.00 0.000 0.000
#> GSM1022329     2  0.0000      1.000 0.000  1 0.000 0.00 0.000 0.000
#> GSM1022330     2  0.0000      1.000 0.000  1 0.000 0.00 0.000 0.000
#> GSM1022337     5  0.3390      1.000 0.000  0 0.000 0.00 0.704 0.296
#> GSM1022338     5  0.3390      1.000 0.000  0 0.000 0.00 0.704 0.296
#> GSM1022339     5  0.3390      1.000 0.000  0 0.000 0.00 0.704 0.296
#> GSM1022334     2  0.0000      1.000 0.000  1 0.000 0.00 0.000 0.000
#> GSM1022335     2  0.0000      1.000 0.000  1 0.000 0.00 0.000 0.000
#> GSM1022336     2  0.0000      1.000 0.000  1 0.000 0.00 0.000 0.000
#> GSM1022340     3  0.4738      0.752 0.084  0 0.640 0.00 0.276 0.000
#> GSM1022341     3  0.4738      0.752 0.084  0 0.640 0.00 0.276 0.000
#> GSM1022342     3  0.4738      0.752 0.084  0 0.640 0.00 0.276 0.000
#> GSM1022343     3  0.4738      0.752 0.084  0 0.640 0.00 0.276 0.000
#> GSM1022347     3  0.0000      0.865 0.000  0 1.000 0.00 0.000 0.000
#> GSM1022348     3  0.0000      0.865 0.000  0 1.000 0.00 0.000 0.000
#> GSM1022349     3  0.0000      0.865 0.000  0 1.000 0.00 0.000 0.000
#> GSM1022350     3  0.0000      0.865 0.000  0 1.000 0.00 0.000 0.000
#> GSM1022344     3  0.4738      0.752 0.084  0 0.640 0.00 0.276 0.000
#> GSM1022345     3  0.4738      0.752 0.084  0 0.640 0.00 0.276 0.000
#> GSM1022346     3  0.4738      0.752 0.084  0 0.640 0.00 0.276 0.000
#> GSM1022355     1  0.0000      0.998 1.000  0 0.000 0.00 0.000 0.000
#> GSM1022356     1  0.0000      0.998 1.000  0 0.000 0.00 0.000 0.000
#> GSM1022357     1  0.0000      0.998 1.000  0 0.000 0.00 0.000 0.000
#> GSM1022358     1  0.0000      0.998 1.000  0 0.000 0.00 0.000 0.000
#> GSM1022351     1  0.0000      0.998 1.000  0 0.000 0.00 0.000 0.000
#> GSM1022352     1  0.0000      0.998 1.000  0 0.000 0.00 0.000 0.000
#> GSM1022353     1  0.0000      0.998 1.000  0 0.000 0.00 0.000 0.000
#> GSM1022354     1  0.0000      0.998 1.000  0 0.000 0.00 0.000 0.000
#> GSM1022359     2  0.0000      1.000 0.000  1 0.000 0.00 0.000 0.000
#> GSM1022360     2  0.0000      1.000 0.000  1 0.000 0.00 0.000 0.000
#> GSM1022361     2  0.0000      1.000 0.000  1 0.000 0.00 0.000 0.000
#> GSM1022362     2  0.0000      1.000 0.000  1 0.000 0.00 0.000 0.000
#> GSM1022367     6  0.0000      1.000 0.000  0 0.000 0.00 0.000 1.000
#> GSM1022368     6  0.0000      1.000 0.000  0 0.000 0.00 0.000 1.000
#> GSM1022369     6  0.0000      1.000 0.000  0 0.000 0.00 0.000 1.000
#> GSM1022370     6  0.0000      1.000 0.000  0 0.000 0.00 0.000 1.000
#> GSM1022363     2  0.0000      1.000 0.000  1 0.000 0.00 0.000 0.000
#> GSM1022364     2  0.0000      1.000 0.000  1 0.000 0.00 0.000 0.000
#> GSM1022365     2  0.0000      1.000 0.000  1 0.000 0.00 0.000 0.000
#> GSM1022366     2  0.0000      1.000 0.000  1 0.000 0.00 0.000 0.000
#> GSM1022374     5  0.3390      1.000 0.000  0 0.000 0.00 0.704 0.296
#> GSM1022375     5  0.3390      1.000 0.000  0 0.000 0.00 0.704 0.296
#> GSM1022376     5  0.3390      1.000 0.000  0 0.000 0.00 0.704 0.296
#> GSM1022371     2  0.0000      1.000 0.000  1 0.000 0.00 0.000 0.000
#> GSM1022372     2  0.0000      1.000 0.000  1 0.000 0.00 0.000 0.000
#> GSM1022373     2  0.0000      1.000 0.000  1 0.000 0.00 0.000 0.000
#> GSM1022377     4  0.0000      0.994 0.000  0 0.000 1.00 0.000 0.000
#> GSM1022378     4  0.0000      0.994 0.000  0 0.000 1.00 0.000 0.000
#> GSM1022379     4  0.0000      0.994 0.000  0 0.000 1.00 0.000 0.000
#> GSM1022380     4  0.0000      0.994 0.000  0 0.000 1.00 0.000 0.000
#> GSM1022385     3  0.0000      0.865 0.000  0 1.000 0.00 0.000 0.000
#> GSM1022386     3  0.0000      0.865 0.000  0 1.000 0.00 0.000 0.000
#> GSM1022387     3  0.0000      0.865 0.000  0 1.000 0.00 0.000 0.000
#> GSM1022388     3  0.0000      0.865 0.000  0 1.000 0.00 0.000 0.000
#> GSM1022381     4  0.0000      0.994 0.000  0 0.000 1.00 0.000 0.000
#> GSM1022382     4  0.0000      0.994 0.000  0 0.000 1.00 0.000 0.000
#> GSM1022383     4  0.0000      0.994 0.000  0 0.000 1.00 0.000 0.000
#> GSM1022384     4  0.0000      0.994 0.000  0 0.000 1.00 0.000 0.000
#> GSM1022393     1  0.0000      0.998 1.000  0 0.000 0.00 0.000 0.000
#> GSM1022394     1  0.0000      0.998 1.000  0 0.000 0.00 0.000 0.000
#> GSM1022395     1  0.0000      0.998 1.000  0 0.000 0.00 0.000 0.000
#> GSM1022396     1  0.0000      0.998 1.000  0 0.000 0.00 0.000 0.000
#> GSM1022389     4  0.0547      0.988 0.000  0 0.000 0.98 0.020 0.000
#> GSM1022390     4  0.0547      0.988 0.000  0 0.000 0.98 0.020 0.000
#> GSM1022391     4  0.0547      0.988 0.000  0 0.000 0.98 0.020 0.000
#> GSM1022392     4  0.0547      0.988 0.000  0 0.000 0.98 0.020 0.000
#> GSM1022397     3  0.0000      0.865 0.000  0 1.000 0.00 0.000 0.000
#> GSM1022398     3  0.0000      0.865 0.000  0 1.000 0.00 0.000 0.000
#> GSM1022399     3  0.0000      0.865 0.000  0 1.000 0.00 0.000 0.000
#> GSM1022400     3  0.0000      0.865 0.000  0 1.000 0.00 0.000 0.000
#> GSM1022401     1  0.0777      0.971 0.972  0 0.004 0.00 0.024 0.000
#> GSM1022402     1  0.0000      0.998 1.000  0 0.000 0.00 0.000 0.000
#> GSM1022403     1  0.0000      0.998 1.000  0 0.000 0.00 0.000 0.000
#> GSM1022404     1  0.0000      0.998 1.000  0 0.000 0.00 0.000 0.000

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-mclust-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-ATC-mclust-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-ATC-mclust-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-ATC-mclust-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-ATC-mclust-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-ATC-mclust-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-ATC-mclust-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-ATC-mclust-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-ATC-mclust-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-ATC-mclust-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-ATC-mclust-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-ATC-mclust-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-ATC-mclust-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-mclust-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-ATC-mclust-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-mclust-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-mclust-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-mclust-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-mclust-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-mclust-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-mclust-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-ATC-mclust-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-mclust-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-mclust-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-mclust-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-mclust-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-mclust-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>             n protocol(p) cell.type(p) k
#> ATC:mclust 80    1.10e-11     4.22e-01 2
#> ATC:mclust 76    1.17e-12     3.47e-03 3
#> ATC:mclust 76    3.99e-13     8.00e-10 4
#> ATC:mclust 80    1.08e-20     3.36e-10 5
#> ATC:mclust 80    2.52e-23     1.29e-09 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.


ATC:NMF**

The object with results only for a single top-value method and a single partition method can be extracted as:

res = res_list["ATC", "NMF"]
# you can also extract it by
# res = res_list["ATC:NMF"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 31589 rows and 80 columns.
#>   Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'NMF' method.
#>   Performed in total 1250 partitions by row resampling.
#>   Best k for subgroups seems to be 2.
#> 
#> Following methods can be applied to this 'ConsensusPartition' object:
#>  [1] "cola_report"             "collect_classes"         "collect_plots"          
#>  [4] "collect_stats"           "colnames"                "compare_signatures"     
#>  [7] "consensus_heatmap"       "dimension_reduction"     "functional_enrichment"  
#> [10] "get_anno_col"            "get_anno"                "get_classes"            
#> [13] "get_consensus"           "get_matrix"              "get_membership"         
#> [16] "get_param"               "get_signatures"          "get_stats"              
#> [19] "is_best_k"               "is_stable_k"             "membership_heatmap"     
#> [22] "ncol"                    "nrow"                    "plot_ecdf"              
#> [25] "rownames"                "select_partition_number" "show"                   
#> [28] "suggest_best_k"          "test_to_known_factors"

collect_plots() function collects all the plots made from res for all k (number of partitions) into one single page to provide an easy and fast comparison between different k.

collect_plots(res)

plot of chunk ATC-NMF-collect-plots

The plots are:

All the plots in panels can be made by individual functions and they are plotted later in this section.

select_partition_number() produces several plots showing different statistics for choosing “optimized” k. There are following statistics:

The detailed explanations of these statistics can be found in the cola vignette.

Generally speaking, lower PAC score, higher mean silhouette score or higher concordance corresponds to better partition. Rand index and Jaccard index measure how similar the current partition is compared to partition with k-1. If they are too similar, we won't accept k is better than k-1.

select_partition_number(res)

plot of chunk ATC-NMF-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           0.994       0.997         0.4921 0.509   0.509
#> 3 3 0.736           0.888       0.875         0.2478 0.867   0.739
#> 4 4 0.793           0.833       0.884         0.1693 0.862   0.647
#> 5 5 0.660           0.615       0.767         0.0671 0.916   0.724
#> 6 6 0.655           0.558       0.664         0.0362 0.896   0.618

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 2

Following shows the table of the partitions (You need to click the show/hide code output link to see it). The membership matrix (columns with name p*) is inferred by clue::cl_consensus() function with the SE method. Basically the value in the membership matrix represents the probability to belong to a certain group. The finall class label for an item is determined with the group with highest probability it belongs to.

In get_classes() function, the entropy is calculated from the membership matrix and the silhouette score is calculated from the consensus matrix.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>            class entropy silhouette    p1    p2
#> GSM1022325     2  0.0000      1.000 0.000 1.000
#> GSM1022326     2  0.0000      1.000 0.000 1.000
#> GSM1022327     2  0.0000      1.000 0.000 1.000
#> GSM1022331     2  0.0000      1.000 0.000 1.000
#> GSM1022332     2  0.0672      0.992 0.008 0.992
#> GSM1022333     2  0.0000      1.000 0.000 1.000
#> GSM1022328     2  0.0000      1.000 0.000 1.000
#> GSM1022329     2  0.0000      1.000 0.000 1.000
#> GSM1022330     2  0.0000      1.000 0.000 1.000
#> GSM1022337     2  0.0000      1.000 0.000 1.000
#> GSM1022338     2  0.0000      1.000 0.000 1.000
#> GSM1022339     2  0.0000      1.000 0.000 1.000
#> GSM1022334     2  0.0000      1.000 0.000 1.000
#> GSM1022335     2  0.0000      1.000 0.000 1.000
#> GSM1022336     2  0.0000      1.000 0.000 1.000
#> GSM1022340     1  0.0000      0.995 1.000 0.000
#> GSM1022341     1  0.0000      0.995 1.000 0.000
#> GSM1022342     1  0.0000      0.995 1.000 0.000
#> GSM1022343     1  0.0000      0.995 1.000 0.000
#> GSM1022347     1  0.0000      0.995 1.000 0.000
#> GSM1022348     1  0.0000      0.995 1.000 0.000
#> GSM1022349     1  0.0000      0.995 1.000 0.000
#> GSM1022350     1  0.0000      0.995 1.000 0.000
#> GSM1022344     1  0.0000      0.995 1.000 0.000
#> GSM1022345     1  0.0000      0.995 1.000 0.000
#> GSM1022346     1  0.0000      0.995 1.000 0.000
#> GSM1022355     1  0.0000      0.995 1.000 0.000
#> GSM1022356     1  0.0000      0.995 1.000 0.000
#> GSM1022357     1  0.0000      0.995 1.000 0.000
#> GSM1022358     1  0.0000      0.995 1.000 0.000
#> GSM1022351     1  0.0000      0.995 1.000 0.000
#> GSM1022352     1  0.0000      0.995 1.000 0.000
#> GSM1022353     1  0.0000      0.995 1.000 0.000
#> GSM1022354     1  0.0000      0.995 1.000 0.000
#> GSM1022359     2  0.0000      1.000 0.000 1.000
#> GSM1022360     2  0.0000      1.000 0.000 1.000
#> GSM1022361     2  0.0000      1.000 0.000 1.000
#> GSM1022362     2  0.0000      1.000 0.000 1.000
#> GSM1022367     2  0.0000      1.000 0.000 1.000
#> GSM1022368     2  0.0000      1.000 0.000 1.000
#> GSM1022369     2  0.0000      1.000 0.000 1.000
#> GSM1022370     2  0.0000      1.000 0.000 1.000
#> GSM1022363     2  0.0000      1.000 0.000 1.000
#> GSM1022364     2  0.0000      1.000 0.000 1.000
#> GSM1022365     2  0.0000      1.000 0.000 1.000
#> GSM1022366     2  0.0000      1.000 0.000 1.000
#> GSM1022374     2  0.0000      1.000 0.000 1.000
#> GSM1022375     2  0.0000      1.000 0.000 1.000
#> GSM1022376     2  0.0000      1.000 0.000 1.000
#> GSM1022371     2  0.0000      1.000 0.000 1.000
#> GSM1022372     2  0.0000      1.000 0.000 1.000
#> GSM1022373     2  0.0000      1.000 0.000 1.000
#> GSM1022377     1  0.5178      0.872 0.884 0.116
#> GSM1022378     1  0.4431      0.900 0.908 0.092
#> GSM1022379     1  0.0000      0.995 1.000 0.000
#> GSM1022380     1  0.0000      0.995 1.000 0.000
#> GSM1022385     1  0.0000      0.995 1.000 0.000
#> GSM1022386     1  0.0000      0.995 1.000 0.000
#> GSM1022387     1  0.0000      0.995 1.000 0.000
#> GSM1022388     1  0.0000      0.995 1.000 0.000
#> GSM1022381     1  0.0000      0.995 1.000 0.000
#> GSM1022382     1  0.0000      0.995 1.000 0.000
#> GSM1022383     1  0.0000      0.995 1.000 0.000
#> GSM1022384     1  0.0000      0.995 1.000 0.000
#> GSM1022393     1  0.0000      0.995 1.000 0.000
#> GSM1022394     1  0.0000      0.995 1.000 0.000
#> GSM1022395     1  0.0000      0.995 1.000 0.000
#> GSM1022396     1  0.0000      0.995 1.000 0.000
#> GSM1022389     1  0.0376      0.992 0.996 0.004
#> GSM1022390     1  0.0000      0.995 1.000 0.000
#> GSM1022391     1  0.0000      0.995 1.000 0.000
#> GSM1022392     1  0.0000      0.995 1.000 0.000
#> GSM1022397     1  0.0000      0.995 1.000 0.000
#> GSM1022398     1  0.0000      0.995 1.000 0.000
#> GSM1022399     1  0.0000      0.995 1.000 0.000
#> GSM1022400     1  0.0000      0.995 1.000 0.000
#> GSM1022401     1  0.0000      0.995 1.000 0.000
#> GSM1022402     1  0.0000      0.995 1.000 0.000
#> GSM1022403     1  0.0000      0.995 1.000 0.000
#> GSM1022404     1  0.0000      0.995 1.000 0.000

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>            class entropy silhouette    p1    p2    p3
#> GSM1022325     2  0.0592      0.940 0.000 0.988 0.012
#> GSM1022326     2  0.0592      0.940 0.000 0.988 0.012
#> GSM1022327     2  0.0424      0.942 0.000 0.992 0.008
#> GSM1022331     2  0.8278      0.654 0.132 0.620 0.248
#> GSM1022332     2  0.9383      0.487 0.236 0.512 0.252
#> GSM1022333     2  0.7782      0.694 0.100 0.652 0.248
#> GSM1022328     2  0.0000      0.944 0.000 1.000 0.000
#> GSM1022329     2  0.0000      0.944 0.000 1.000 0.000
#> GSM1022330     2  0.0237      0.943 0.000 0.996 0.004
#> GSM1022337     2  0.1529      0.930 0.000 0.960 0.040
#> GSM1022338     2  0.1529      0.930 0.000 0.960 0.040
#> GSM1022339     2  0.0592      0.941 0.000 0.988 0.012
#> GSM1022334     2  0.0892      0.935 0.000 0.980 0.020
#> GSM1022335     2  0.0592      0.940 0.000 0.988 0.012
#> GSM1022336     2  0.0592      0.940 0.000 0.988 0.012
#> GSM1022340     1  0.1753      0.887 0.952 0.000 0.048
#> GSM1022341     1  0.1411      0.888 0.964 0.000 0.036
#> GSM1022342     1  0.1529      0.888 0.960 0.000 0.040
#> GSM1022343     1  0.1411      0.888 0.964 0.000 0.036
#> GSM1022347     1  0.0424      0.875 0.992 0.000 0.008
#> GSM1022348     1  0.0892      0.864 0.980 0.000 0.020
#> GSM1022349     1  0.0424      0.875 0.992 0.000 0.008
#> GSM1022350     1  0.0592      0.872 0.988 0.000 0.012
#> GSM1022344     1  0.1031      0.887 0.976 0.000 0.024
#> GSM1022345     1  0.1289      0.888 0.968 0.000 0.032
#> GSM1022346     1  0.1031      0.887 0.976 0.000 0.024
#> GSM1022355     1  0.4062      0.834 0.836 0.000 0.164
#> GSM1022356     1  0.4702      0.775 0.788 0.000 0.212
#> GSM1022357     1  0.3192      0.870 0.888 0.000 0.112
#> GSM1022358     1  0.4399      0.810 0.812 0.000 0.188
#> GSM1022351     1  0.4062      0.834 0.836 0.000 0.164
#> GSM1022352     1  0.3116      0.872 0.892 0.000 0.108
#> GSM1022353     1  0.3116      0.872 0.892 0.000 0.108
#> GSM1022354     1  0.3116      0.872 0.892 0.000 0.108
#> GSM1022359     2  0.0000      0.944 0.000 1.000 0.000
#> GSM1022360     2  0.0000      0.944 0.000 1.000 0.000
#> GSM1022361     2  0.0000      0.944 0.000 1.000 0.000
#> GSM1022362     2  0.0000      0.944 0.000 1.000 0.000
#> GSM1022367     2  0.4002      0.860 0.000 0.840 0.160
#> GSM1022368     2  0.4796      0.816 0.000 0.780 0.220
#> GSM1022369     2  0.5058      0.798 0.000 0.756 0.244
#> GSM1022370     2  0.2711      0.904 0.000 0.912 0.088
#> GSM1022363     2  0.0000      0.944 0.000 1.000 0.000
#> GSM1022364     2  0.0000      0.944 0.000 1.000 0.000
#> GSM1022365     2  0.0000      0.944 0.000 1.000 0.000
#> GSM1022366     2  0.0000      0.944 0.000 1.000 0.000
#> GSM1022374     2  0.0592      0.942 0.000 0.988 0.012
#> GSM1022375     2  0.0592      0.942 0.000 0.988 0.012
#> GSM1022376     2  0.0424      0.942 0.000 0.992 0.008
#> GSM1022371     2  0.0000      0.944 0.000 1.000 0.000
#> GSM1022372     2  0.0000      0.944 0.000 1.000 0.000
#> GSM1022373     2  0.0000      0.944 0.000 1.000 0.000
#> GSM1022377     3  0.6511      0.882 0.180 0.072 0.748
#> GSM1022378     3  0.6398      0.901 0.192 0.060 0.748
#> GSM1022379     3  0.5138      0.970 0.252 0.000 0.748
#> GSM1022380     3  0.5138      0.970 0.252 0.000 0.748
#> GSM1022385     1  0.0000      0.880 1.000 0.000 0.000
#> GSM1022386     1  0.0237      0.878 0.996 0.000 0.004
#> GSM1022387     1  0.0237      0.878 0.996 0.000 0.004
#> GSM1022388     1  0.0237      0.878 0.996 0.000 0.004
#> GSM1022381     3  0.5138      0.970 0.252 0.000 0.748
#> GSM1022382     3  0.5138      0.970 0.252 0.000 0.748
#> GSM1022383     3  0.5138      0.970 0.252 0.000 0.748
#> GSM1022384     3  0.5138      0.970 0.252 0.000 0.748
#> GSM1022393     1  0.5138      0.700 0.748 0.000 0.252
#> GSM1022394     1  0.4399      0.809 0.812 0.000 0.188
#> GSM1022395     1  0.4062      0.835 0.836 0.000 0.164
#> GSM1022396     1  0.4452      0.804 0.808 0.000 0.192
#> GSM1022389     3  0.5774      0.954 0.232 0.020 0.748
#> GSM1022390     3  0.5138      0.970 0.252 0.000 0.748
#> GSM1022391     3  0.5578      0.962 0.240 0.012 0.748
#> GSM1022392     3  0.5138      0.970 0.252 0.000 0.748
#> GSM1022397     1  0.0237      0.878 0.996 0.000 0.004
#> GSM1022398     1  0.0237      0.878 0.996 0.000 0.004
#> GSM1022399     1  0.0237      0.878 0.996 0.000 0.004
#> GSM1022400     1  0.0237      0.878 0.996 0.000 0.004
#> GSM1022401     1  0.3116      0.873 0.892 0.000 0.108
#> GSM1022402     1  0.4750      0.769 0.784 0.000 0.216
#> GSM1022403     1  0.4399      0.810 0.812 0.000 0.188
#> GSM1022404     1  0.3816      0.847 0.852 0.000 0.148

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>            class entropy silhouette    p1    p2    p3    p4
#> GSM1022325     2  0.3123     0.8462 0.000 0.844 0.000 0.156
#> GSM1022326     2  0.3074     0.8501 0.000 0.848 0.000 0.152
#> GSM1022327     2  0.1716     0.9240 0.000 0.936 0.000 0.064
#> GSM1022331     3  0.5394     0.5189 0.000 0.228 0.712 0.060
#> GSM1022332     3  0.4696     0.6209 0.004 0.136 0.796 0.064
#> GSM1022333     3  0.6265    -0.0369 0.000 0.444 0.500 0.056
#> GSM1022328     2  0.0469     0.9492 0.000 0.988 0.000 0.012
#> GSM1022329     2  0.1022     0.9421 0.000 0.968 0.000 0.032
#> GSM1022330     2  0.1022     0.9421 0.000 0.968 0.000 0.032
#> GSM1022337     2  0.2757     0.9253 0.020 0.912 0.016 0.052
#> GSM1022338     2  0.2757     0.9253 0.020 0.912 0.016 0.052
#> GSM1022339     2  0.2586     0.9293 0.020 0.920 0.016 0.044
#> GSM1022334     2  0.3486     0.8073 0.000 0.812 0.000 0.188
#> GSM1022335     2  0.2814     0.8700 0.000 0.868 0.000 0.132
#> GSM1022336     2  0.2149     0.9070 0.000 0.912 0.000 0.088
#> GSM1022340     1  0.5253     0.3599 0.624 0.000 0.360 0.016
#> GSM1022341     1  0.5130     0.4259 0.652 0.000 0.332 0.016
#> GSM1022342     1  0.5408     0.2171 0.576 0.000 0.408 0.016
#> GSM1022343     1  0.5444     0.1604 0.560 0.000 0.424 0.016
#> GSM1022347     3  0.2647     0.8258 0.120 0.000 0.880 0.000
#> GSM1022348     3  0.2589     0.8255 0.116 0.000 0.884 0.000
#> GSM1022349     3  0.2647     0.8258 0.120 0.000 0.880 0.000
#> GSM1022350     3  0.2589     0.8255 0.116 0.000 0.884 0.000
#> GSM1022344     3  0.4546     0.6695 0.256 0.000 0.732 0.012
#> GSM1022345     3  0.5383     0.2012 0.452 0.000 0.536 0.012
#> GSM1022346     3  0.5279     0.3671 0.400 0.000 0.588 0.012
#> GSM1022355     1  0.0336     0.8827 0.992 0.000 0.008 0.000
#> GSM1022356     1  0.0804     0.8671 0.980 0.000 0.008 0.012
#> GSM1022357     1  0.0592     0.8806 0.984 0.000 0.016 0.000
#> GSM1022358     1  0.0336     0.8827 0.992 0.000 0.008 0.000
#> GSM1022351     1  0.0524     0.8822 0.988 0.000 0.008 0.004
#> GSM1022352     1  0.1256     0.8704 0.964 0.000 0.028 0.008
#> GSM1022353     1  0.1388     0.8676 0.960 0.000 0.028 0.012
#> GSM1022354     1  0.0779     0.8792 0.980 0.000 0.016 0.004
#> GSM1022359     2  0.0336     0.9499 0.000 0.992 0.000 0.008
#> GSM1022360     2  0.0336     0.9499 0.000 0.992 0.000 0.008
#> GSM1022361     2  0.0336     0.9499 0.000 0.992 0.000 0.008
#> GSM1022362     2  0.0336     0.9499 0.000 0.992 0.000 0.008
#> GSM1022367     2  0.1929     0.9368 0.000 0.940 0.024 0.036
#> GSM1022368     2  0.2411     0.9278 0.000 0.920 0.040 0.040
#> GSM1022369     2  0.2500     0.9256 0.000 0.916 0.044 0.040
#> GSM1022370     2  0.1706     0.9398 0.000 0.948 0.016 0.036
#> GSM1022363     2  0.0188     0.9498 0.000 0.996 0.000 0.004
#> GSM1022364     2  0.0188     0.9498 0.000 0.996 0.000 0.004
#> GSM1022365     2  0.0188     0.9498 0.000 0.996 0.000 0.004
#> GSM1022366     2  0.0188     0.9498 0.000 0.996 0.000 0.004
#> GSM1022374     2  0.1590     0.9428 0.008 0.956 0.008 0.028
#> GSM1022375     2  0.1690     0.9419 0.008 0.952 0.008 0.032
#> GSM1022376     2  0.1721     0.9419 0.012 0.952 0.008 0.028
#> GSM1022371     2  0.0188     0.9500 0.000 0.996 0.000 0.004
#> GSM1022372     2  0.0336     0.9499 0.000 0.992 0.000 0.008
#> GSM1022373     2  0.0188     0.9500 0.000 0.996 0.000 0.004
#> GSM1022377     4  0.3257     0.9618 0.068 0.012 0.032 0.888
#> GSM1022378     4  0.3201     0.9658 0.072 0.008 0.032 0.888
#> GSM1022379     4  0.3150     0.9681 0.072 0.004 0.036 0.888
#> GSM1022380     4  0.3056     0.9692 0.072 0.000 0.040 0.888
#> GSM1022385     3  0.3443     0.8118 0.136 0.000 0.848 0.016
#> GSM1022386     3  0.2737     0.8209 0.104 0.000 0.888 0.008
#> GSM1022387     3  0.2048     0.7992 0.064 0.000 0.928 0.008
#> GSM1022388     3  0.2342     0.8089 0.080 0.000 0.912 0.008
#> GSM1022381     4  0.3056     0.9692 0.072 0.000 0.040 0.888
#> GSM1022382     4  0.3056     0.9692 0.072 0.000 0.040 0.888
#> GSM1022383     4  0.3056     0.9692 0.072 0.000 0.040 0.888
#> GSM1022384     4  0.3128     0.9670 0.076 0.000 0.040 0.884
#> GSM1022393     1  0.0779     0.8685 0.980 0.000 0.004 0.016
#> GSM1022394     1  0.0524     0.8822 0.988 0.000 0.008 0.004
#> GSM1022395     1  0.0336     0.8772 0.992 0.000 0.000 0.008
#> GSM1022396     1  0.0376     0.8816 0.992 0.000 0.004 0.004
#> GSM1022389     4  0.2998     0.9570 0.080 0.004 0.024 0.892
#> GSM1022390     4  0.4267     0.8658 0.188 0.000 0.024 0.788
#> GSM1022391     4  0.2998     0.9632 0.080 0.004 0.024 0.892
#> GSM1022392     4  0.4104     0.8935 0.164 0.000 0.028 0.808
#> GSM1022397     3  0.2704     0.8246 0.124 0.000 0.876 0.000
#> GSM1022398     3  0.2973     0.8123 0.144 0.000 0.856 0.000
#> GSM1022399     3  0.2760     0.8227 0.128 0.000 0.872 0.000
#> GSM1022400     3  0.2647     0.8258 0.120 0.000 0.880 0.000
#> GSM1022401     1  0.0657     0.8827 0.984 0.000 0.012 0.004
#> GSM1022402     1  0.0592     0.8714 0.984 0.000 0.000 0.016
#> GSM1022403     1  0.0376     0.8812 0.992 0.000 0.004 0.004
#> GSM1022404     1  0.0376     0.8816 0.992 0.000 0.004 0.004

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>            class entropy silhouette    p1    p2    p3    p4    p5
#> GSM1022325     2  0.4521     0.6492 0.000 0.748 0.000 0.088 0.164
#> GSM1022326     2  0.4277     0.6620 0.000 0.768 0.000 0.076 0.156
#> GSM1022327     2  0.4096     0.6724 0.000 0.784 0.000 0.072 0.144
#> GSM1022331     5  0.5605     0.6656 0.000 0.192 0.168 0.000 0.640
#> GSM1022332     5  0.5336     0.6467 0.000 0.100 0.252 0.000 0.648
#> GSM1022333     5  0.5452     0.5043 0.000 0.292 0.092 0.000 0.616
#> GSM1022328     2  0.3339     0.6986 0.000 0.840 0.000 0.048 0.112
#> GSM1022329     2  0.3803     0.6829 0.000 0.804 0.000 0.056 0.140
#> GSM1022330     2  0.3911     0.6786 0.000 0.796 0.000 0.060 0.144
#> GSM1022337     2  0.6576     0.2491 0.340 0.468 0.004 0.000 0.188
#> GSM1022338     2  0.6604     0.2480 0.332 0.468 0.004 0.000 0.196
#> GSM1022339     2  0.6418     0.2564 0.344 0.472 0.000 0.000 0.184
#> GSM1022334     2  0.4521     0.6483 0.000 0.748 0.000 0.088 0.164
#> GSM1022335     2  0.4412     0.6547 0.000 0.756 0.000 0.080 0.164
#> GSM1022336     2  0.4317     0.6607 0.000 0.764 0.000 0.076 0.160
#> GSM1022340     3  0.2362     0.6562 0.084 0.000 0.900 0.008 0.008
#> GSM1022341     3  0.2548     0.6305 0.116 0.000 0.876 0.004 0.004
#> GSM1022342     3  0.2408     0.6531 0.096 0.000 0.892 0.008 0.004
#> GSM1022343     3  0.2408     0.6562 0.096 0.000 0.892 0.008 0.004
#> GSM1022347     3  0.2707     0.6465 0.000 0.000 0.860 0.008 0.132
#> GSM1022348     3  0.2818     0.6472 0.004 0.000 0.860 0.008 0.128
#> GSM1022349     3  0.2233     0.6670 0.000 0.000 0.892 0.004 0.104
#> GSM1022350     3  0.3022     0.6380 0.004 0.000 0.848 0.012 0.136
#> GSM1022344     3  0.2069     0.6822 0.052 0.000 0.924 0.012 0.012
#> GSM1022345     3  0.2166     0.6694 0.072 0.000 0.912 0.012 0.004
#> GSM1022346     3  0.1901     0.6782 0.056 0.000 0.928 0.012 0.004
#> GSM1022355     1  0.4341     0.6702 0.592 0.000 0.404 0.004 0.000
#> GSM1022356     1  0.4101     0.7735 0.664 0.000 0.332 0.004 0.000
#> GSM1022357     1  0.4450     0.4559 0.508 0.000 0.488 0.004 0.000
#> GSM1022358     1  0.4151     0.7609 0.652 0.000 0.344 0.004 0.000
#> GSM1022351     3  0.4434    -0.3715 0.460 0.000 0.536 0.004 0.000
#> GSM1022352     3  0.4192    -0.1381 0.404 0.000 0.596 0.000 0.000
#> GSM1022353     3  0.4201    -0.1534 0.408 0.000 0.592 0.000 0.000
#> GSM1022354     3  0.4219    -0.1857 0.416 0.000 0.584 0.000 0.000
#> GSM1022359     2  0.0000     0.7428 0.000 1.000 0.000 0.000 0.000
#> GSM1022360     2  0.0000     0.7428 0.000 1.000 0.000 0.000 0.000
#> GSM1022361     2  0.0000     0.7428 0.000 1.000 0.000 0.000 0.000
#> GSM1022362     2  0.0000     0.7428 0.000 1.000 0.000 0.000 0.000
#> GSM1022367     2  0.3534     0.5853 0.000 0.744 0.000 0.000 0.256
#> GSM1022368     2  0.3966     0.4717 0.000 0.664 0.000 0.000 0.336
#> GSM1022369     2  0.4060     0.4274 0.000 0.640 0.000 0.000 0.360
#> GSM1022370     2  0.3039     0.6486 0.000 0.808 0.000 0.000 0.192
#> GSM1022363     2  0.1410     0.7290 0.000 0.940 0.000 0.000 0.060
#> GSM1022364     2  0.1638     0.7310 0.000 0.932 0.000 0.004 0.064
#> GSM1022365     2  0.1478     0.7298 0.000 0.936 0.000 0.000 0.064
#> GSM1022366     2  0.1430     0.7348 0.000 0.944 0.000 0.004 0.052
#> GSM1022374     2  0.5295     0.5287 0.200 0.672 0.000 0.000 0.128
#> GSM1022375     2  0.5210     0.5448 0.184 0.684 0.000 0.000 0.132
#> GSM1022376     2  0.5854     0.4386 0.252 0.596 0.000 0.000 0.152
#> GSM1022371     2  0.0451     0.7419 0.000 0.988 0.000 0.004 0.008
#> GSM1022372     2  0.0451     0.7419 0.000 0.988 0.000 0.004 0.008
#> GSM1022373     2  0.0324     0.7424 0.000 0.992 0.000 0.004 0.004
#> GSM1022377     4  0.1571     0.8918 0.000 0.000 0.004 0.936 0.060
#> GSM1022378     4  0.1041     0.9024 0.000 0.000 0.004 0.964 0.032
#> GSM1022379     4  0.0324     0.9074 0.000 0.000 0.004 0.992 0.004
#> GSM1022380     4  0.0451     0.9073 0.000 0.000 0.004 0.988 0.008
#> GSM1022385     3  0.4535     0.5894 0.008 0.000 0.760 0.072 0.160
#> GSM1022386     3  0.5756     0.2245 0.000 0.000 0.576 0.112 0.312
#> GSM1022387     5  0.6207     0.0557 0.000 0.000 0.400 0.140 0.460
#> GSM1022388     3  0.6150    -0.1564 0.000 0.000 0.464 0.132 0.404
#> GSM1022381     4  0.1267     0.9055 0.012 0.000 0.004 0.960 0.024
#> GSM1022382     4  0.1153     0.9049 0.008 0.000 0.004 0.964 0.024
#> GSM1022383     4  0.1243     0.9032 0.008 0.000 0.004 0.960 0.028
#> GSM1022384     4  0.1243     0.9032 0.008 0.000 0.004 0.960 0.028
#> GSM1022393     1  0.2052     0.7040 0.912 0.000 0.080 0.004 0.004
#> GSM1022394     1  0.3969     0.7926 0.692 0.000 0.304 0.004 0.000
#> GSM1022395     1  0.3280     0.7793 0.808 0.000 0.184 0.004 0.004
#> GSM1022396     1  0.3766     0.8014 0.728 0.000 0.268 0.004 0.000
#> GSM1022389     4  0.4166     0.8142 0.056 0.000 0.008 0.788 0.148
#> GSM1022390     4  0.4609     0.7790 0.172 0.000 0.016 0.756 0.056
#> GSM1022391     4  0.3595     0.8443 0.048 0.000 0.004 0.828 0.120
#> GSM1022392     4  0.3959     0.8116 0.140 0.000 0.028 0.808 0.024
#> GSM1022397     3  0.2612     0.6549 0.000 0.000 0.868 0.008 0.124
#> GSM1022398     3  0.2331     0.6890 0.016 0.000 0.908 0.008 0.068
#> GSM1022399     3  0.2439     0.6594 0.000 0.000 0.876 0.004 0.120
#> GSM1022400     3  0.2886     0.6280 0.000 0.000 0.844 0.008 0.148
#> GSM1022401     1  0.4260     0.7821 0.680 0.000 0.308 0.004 0.008
#> GSM1022402     1  0.2047     0.6381 0.928 0.000 0.040 0.012 0.020
#> GSM1022403     1  0.3107     0.7314 0.852 0.000 0.124 0.016 0.008
#> GSM1022404     1  0.3700     0.7984 0.752 0.000 0.240 0.008 0.000

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>            class entropy silhouette    p1    p2    p3    p4    p5    p6
#> GSM1022325     2  0.2794      0.647 0.016 0.888 0.000 0.028 0.040 0.028
#> GSM1022326     2  0.2688      0.650 0.012 0.892 0.000 0.020 0.036 0.040
#> GSM1022327     2  0.1514      0.688 0.004 0.944 0.000 0.012 0.036 0.004
#> GSM1022331     6  0.7162      0.357 0.012 0.072 0.268 0.000 0.208 0.440
#> GSM1022332     6  0.6699      0.347 0.004 0.036 0.356 0.000 0.204 0.400
#> GSM1022333     6  0.7464      0.330 0.020 0.088 0.248 0.000 0.224 0.420
#> GSM1022328     2  0.1562      0.706 0.000 0.940 0.000 0.004 0.032 0.024
#> GSM1022329     2  0.1218      0.693 0.004 0.956 0.000 0.012 0.028 0.000
#> GSM1022330     2  0.1553      0.689 0.004 0.944 0.000 0.012 0.032 0.008
#> GSM1022337     5  0.3141      0.549 0.020 0.140 0.000 0.000 0.828 0.012
#> GSM1022338     5  0.3056      0.550 0.016 0.140 0.000 0.000 0.832 0.012
#> GSM1022339     5  0.3002      0.544 0.020 0.136 0.000 0.000 0.836 0.008
#> GSM1022334     2  0.3063      0.629 0.012 0.872 0.000 0.032 0.044 0.040
#> GSM1022335     2  0.2722      0.647 0.008 0.888 0.000 0.020 0.036 0.048
#> GSM1022336     2  0.2515      0.656 0.008 0.900 0.000 0.020 0.032 0.040
#> GSM1022340     3  0.4352      0.438 0.324 0.000 0.644 0.000 0.012 0.020
#> GSM1022341     3  0.4015      0.431 0.328 0.000 0.656 0.000 0.008 0.008
#> GSM1022342     3  0.4187      0.434 0.324 0.000 0.652 0.000 0.012 0.012
#> GSM1022343     3  0.4000      0.439 0.324 0.000 0.660 0.000 0.008 0.008
#> GSM1022347     3  0.0260      0.670 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM1022348     3  0.0551      0.663 0.008 0.000 0.984 0.000 0.004 0.004
#> GSM1022349     3  0.0260      0.670 0.008 0.000 0.992 0.000 0.000 0.000
#> GSM1022350     3  0.1067      0.652 0.024 0.000 0.964 0.004 0.004 0.004
#> GSM1022344     3  0.3883      0.520 0.256 0.000 0.720 0.004 0.016 0.004
#> GSM1022345     3  0.4258      0.443 0.316 0.000 0.656 0.004 0.020 0.004
#> GSM1022346     3  0.4058      0.462 0.308 0.000 0.672 0.004 0.012 0.004
#> GSM1022355     1  0.3695      0.640 0.712 0.000 0.272 0.000 0.016 0.000
#> GSM1022356     1  0.3539      0.662 0.756 0.000 0.220 0.000 0.024 0.000
#> GSM1022357     1  0.3894      0.587 0.664 0.000 0.324 0.000 0.008 0.004
#> GSM1022358     1  0.3483      0.657 0.748 0.000 0.236 0.000 0.016 0.000
#> GSM1022351     1  0.3925      0.575 0.656 0.000 0.332 0.000 0.008 0.004
#> GSM1022352     1  0.4502      0.427 0.568 0.000 0.404 0.000 0.016 0.012
#> GSM1022353     1  0.4510      0.419 0.564 0.000 0.408 0.000 0.016 0.012
#> GSM1022354     1  0.4264      0.490 0.604 0.000 0.376 0.000 0.012 0.008
#> GSM1022359     2  0.3620      0.738 0.000 0.772 0.000 0.000 0.044 0.184
#> GSM1022360     2  0.3620      0.738 0.000 0.772 0.000 0.000 0.044 0.184
#> GSM1022361     2  0.3555      0.739 0.000 0.776 0.000 0.000 0.040 0.184
#> GSM1022362     2  0.3555      0.739 0.000 0.776 0.000 0.000 0.040 0.184
#> GSM1022367     2  0.5445      0.246 0.000 0.464 0.000 0.000 0.120 0.416
#> GSM1022368     6  0.5507     -0.290 0.000 0.424 0.000 0.000 0.128 0.448
#> GSM1022369     6  0.5555     -0.187 0.000 0.380 0.000 0.000 0.140 0.480
#> GSM1022370     2  0.5409      0.413 0.000 0.524 0.000 0.000 0.128 0.348
#> GSM1022363     2  0.4291      0.679 0.000 0.680 0.000 0.000 0.052 0.268
#> GSM1022364     2  0.4274      0.680 0.000 0.676 0.000 0.000 0.048 0.276
#> GSM1022365     2  0.4294      0.670 0.000 0.672 0.000 0.000 0.048 0.280
#> GSM1022366     2  0.4254      0.688 0.000 0.680 0.000 0.000 0.048 0.272
#> GSM1022374     5  0.6091      0.349 0.012 0.340 0.000 0.000 0.460 0.188
#> GSM1022375     5  0.6260      0.223 0.012 0.356 0.000 0.000 0.408 0.224
#> GSM1022376     5  0.5300      0.476 0.012 0.300 0.000 0.000 0.592 0.096
#> GSM1022371     2  0.3806      0.735 0.000 0.752 0.000 0.000 0.048 0.200
#> GSM1022372     2  0.4033      0.724 0.000 0.724 0.000 0.000 0.052 0.224
#> GSM1022373     2  0.3618      0.738 0.000 0.768 0.000 0.000 0.040 0.192
#> GSM1022377     4  0.2107      0.844 0.016 0.052 0.000 0.916 0.008 0.008
#> GSM1022378     4  0.1692      0.852 0.020 0.024 0.000 0.940 0.008 0.008
#> GSM1022379     4  0.0551      0.857 0.008 0.004 0.000 0.984 0.004 0.000
#> GSM1022380     4  0.0551      0.857 0.008 0.004 0.000 0.984 0.004 0.000
#> GSM1022385     3  0.5895      0.454 0.036 0.000 0.640 0.184 0.024 0.116
#> GSM1022386     3  0.6366      0.194 0.020 0.000 0.504 0.216 0.008 0.252
#> GSM1022387     6  0.6715     -0.040 0.020 0.000 0.328 0.268 0.008 0.376
#> GSM1022388     3  0.6674     -0.055 0.020 0.000 0.392 0.248 0.008 0.332
#> GSM1022381     4  0.0622      0.857 0.000 0.000 0.000 0.980 0.008 0.012
#> GSM1022382     4  0.0508      0.857 0.000 0.000 0.000 0.984 0.004 0.012
#> GSM1022383     4  0.0508      0.857 0.000 0.000 0.000 0.984 0.004 0.012
#> GSM1022384     4  0.0363      0.857 0.000 0.000 0.000 0.988 0.000 0.012
#> GSM1022393     1  0.5595      0.334 0.504 0.000 0.080 0.004 0.396 0.016
#> GSM1022394     1  0.5225      0.666 0.628 0.000 0.248 0.012 0.112 0.000
#> GSM1022395     1  0.5882      0.576 0.520 0.000 0.168 0.012 0.300 0.000
#> GSM1022396     1  0.5852      0.648 0.548 0.000 0.212 0.012 0.228 0.000
#> GSM1022389     4  0.5512      0.715 0.052 0.188 0.000 0.680 0.040 0.040
#> GSM1022390     4  0.6221      0.612 0.252 0.116 0.000 0.576 0.032 0.024
#> GSM1022391     4  0.4603      0.749 0.016 0.168 0.000 0.744 0.032 0.040
#> GSM1022392     4  0.5971      0.656 0.220 0.108 0.000 0.616 0.036 0.020
#> GSM1022397     3  0.0363      0.670 0.012 0.000 0.988 0.000 0.000 0.000
#> GSM1022398     3  0.1010      0.665 0.036 0.000 0.960 0.000 0.000 0.004
#> GSM1022399     3  0.0458      0.670 0.016 0.000 0.984 0.000 0.000 0.000
#> GSM1022400     3  0.0000      0.668 0.000 0.000 1.000 0.000 0.000 0.000
#> GSM1022401     1  0.6082      0.646 0.512 0.000 0.248 0.016 0.224 0.000
#> GSM1022402     5  0.5042     -0.195 0.456 0.000 0.016 0.020 0.496 0.012
#> GSM1022403     1  0.6104      0.453 0.488 0.000 0.124 0.020 0.360 0.008
#> GSM1022404     1  0.5948      0.642 0.540 0.000 0.204 0.016 0.240 0.000

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-ATC-NMF-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-ATC-NMF-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-ATC-NMF-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-ATC-NMF-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-ATC-NMF-consensus-heatmap-5

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-ATC-NMF-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-ATC-NMF-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-ATC-NMF-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-ATC-NMF-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-ATC-NMF-membership-heatmap-5

As soon as we have had the classes for columns, we can look for signatures which are significantly different between classes which can be candidate marks for certain classes. Following are the heatmaps for signatures.

Signature heatmaps where rows are scaled:

get_signatures(res, k = 2)

plot of chunk tab-ATC-NMF-get-signatures-1

get_signatures(res, k = 3)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

plot of chunk tab-ATC-NMF-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-ATC-NMF-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-ATC-NMF-get-signatures-4

get_signatures(res, k = 6)
#> Error in mat[ceiling(1:nr/h_ratio), ceiling(1:nc/w_ratio), drop = FALSE]: subscript out of bounds

plot of chunk tab-ATC-NMF-get-signatures-5

Signature heatmaps where rows are not scaled:

get_signatures(res, k = 2, scale_rows = FALSE)

plot of chunk tab-ATC-NMF-get-signatures-no-scale-1

get_signatures(res, k = 3, scale_rows = FALSE)

plot of chunk tab-ATC-NMF-get-signatures-no-scale-2

get_signatures(res, k = 4, scale_rows = FALSE)

plot of chunk tab-ATC-NMF-get-signatures-no-scale-3

get_signatures(res, k = 5, scale_rows = FALSE)

plot of chunk tab-ATC-NMF-get-signatures-no-scale-4

get_signatures(res, k = 6, scale_rows = FALSE)

plot of chunk tab-ATC-NMF-get-signatures-no-scale-5

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk ATC-NMF-signature_compare

get_signature() returns a data frame invisibly. TO get the list of signatures, the function call should be assigned to a variable explicitly. In following code, if plot argument is set to FALSE, no heatmap is plotted while only the differential analysis is performed.

# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)

An example of the output of tb is:

#>   which_row         fdr    mean_1    mean_2 scaled_mean_1 scaled_mean_2 km
#> 1        38 0.042760348  8.373488  9.131774    -0.5533452     0.5164555  1
#> 2        40 0.018707592  7.106213  8.469186    -0.6173731     0.5762149  1
#> 3        55 0.019134737 10.221463 11.207825    -0.6159697     0.5749050  1
#> 4        59 0.006059896  5.921854  7.869574    -0.6899429     0.6439467  1
#> 5        60 0.018055526  8.928898 10.211722    -0.6204761     0.5791110  1
#> 6        98 0.009384629 15.714769 14.887706     0.6635654    -0.6193277  2
...

The columns in tb are:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. km: Row groups if k-means clustering is applied to rows.

UMAP plot which shows how samples are separated.

dimension_reduction(res, k = 2, method = "UMAP")

plot of chunk tab-ATC-NMF-dimension-reduction-1

dimension_reduction(res, k = 3, method = "UMAP")

plot of chunk tab-ATC-NMF-dimension-reduction-2

dimension_reduction(res, k = 4, method = "UMAP")

plot of chunk tab-ATC-NMF-dimension-reduction-3

dimension_reduction(res, k = 5, method = "UMAP")

plot of chunk tab-ATC-NMF-dimension-reduction-4

dimension_reduction(res, k = 6, method = "UMAP")

plot of chunk tab-ATC-NMF-dimension-reduction-5

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk ATC-NMF-collect-classes

Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.

test_to_known_factors(res)
#>          n protocol(p) cell.type(p) k
#> ATC:NMF 80    1.10e-11     4.22e-01 2
#> ATC:NMF 79    1.71e-14     1.03e-04 3
#> ATC:NMF 73    8.77e-19     1.04e-06 4
#> ATC:NMF 66    1.34e-18     3.00e-07 5
#> ATC:NMF 54    3.20e-15     2.10e-09 6

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.

Session info

sessionInfo()
#> R version 3.6.0 (2019-04-26)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: CentOS Linux 7 (Core)
#> 
#> Matrix products: default
#> BLAS:   /usr/lib64/libblas.so.3.4.2
#> LAPACK: /usr/lib64/liblapack.so.3.4.2
#> 
#> locale:
#>  [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C               LC_TIME=en_GB.UTF-8       
#>  [4] LC_COLLATE=en_GB.UTF-8     LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8   
#>  [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
#> [10] LC_TELEPHONE=C             LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] grid      stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] genefilter_1.66.0    ComplexHeatmap_2.3.1 markdown_1.1         knitr_1.26          
#> [5] GetoptLong_0.1.7     cola_1.3.2          
#> 
#> loaded via a namespace (and not attached):
#>  [1] circlize_0.4.8       shape_1.4.4          xfun_0.11            slam_0.1-46         
#>  [5] lattice_0.20-38      splines_3.6.0        colorspace_1.4-1     vctrs_0.2.0         
#>  [9] stats4_3.6.0         blob_1.2.0           XML_3.98-1.20        survival_2.44-1.1   
#> [13] rlang_0.4.2          pillar_1.4.2         DBI_1.0.0            BiocGenerics_0.30.0 
#> [17] bit64_0.9-7          RColorBrewer_1.1-2   matrixStats_0.55.0   stringr_1.4.0       
#> [21] GlobalOptions_0.1.1  evaluate_0.14        memoise_1.1.0        Biobase_2.44.0      
#> [25] IRanges_2.18.3       parallel_3.6.0       AnnotationDbi_1.46.1 highr_0.8           
#> [29] Rcpp_1.0.3           xtable_1.8-4         backports_1.1.5      S4Vectors_0.22.1    
#> [33] annotate_1.62.0      skmeans_0.2-11       bit_1.1-14           microbenchmark_1.4-7
#> [37] brew_1.0-6           impute_1.58.0        rjson_0.2.20         png_0.1-7           
#> [41] digest_0.6.23        stringi_1.4.3        polyclip_1.10-0      clue_0.3-57         
#> [45] tools_3.6.0          bitops_1.0-6         magrittr_1.5         eulerr_6.0.0        
#> [49] RCurl_1.95-4.12      RSQLite_2.1.4        tibble_2.1.3         cluster_2.1.0       
#> [53] crayon_1.3.4         pkgconfig_2.0.3      zeallot_0.1.0        Matrix_1.2-17       
#> [57] xml2_1.2.2           httr_1.4.1           R6_2.4.1             mclust_5.4.5        
#> [61] compiler_3.6.0