Subset a ConsensusPartitionList object

# S3 method for ConsensusPartitionList
[(x, i, j, drop = TRUE)

Arguments

x

A ConsensusPartitionList-class object.

i

Index for top-value methods, character or nummeric.

j

Index for partitioning methods, character or nummeric.

drop

Whether drop class

Details

For a specific combination of top-value method and partitioning method, you can also subset by e.g. x['SD:hclust'].

Author

Zuguang Gu <z.gu@dkfz.de>

Examples

data(golub_cola)
golub_cola[c("SD", "MAD"), c("hclust", "kmeans")]
#> A 'ConsensusPartitionList' object with 4 methods.
#>   On a matrix with 4116 rows and 72 columns.
#>   Top rows are extracted by 'SD, MAD' methods.
#>   Subgroups are detected by 'hclust, kmeans' method.
#>   Number of partitions are tried for k = 2, 3, 4, 5, 6.
#>   Performed in total 1000 partitions by row resampling.
#> 
#> Following methods can be applied to this 'ConsensusPartitionList' object:
#>  [1] "cola_report"           "collect_classes"       "collect_plots"        
#>  [4] "collect_stats"         "colnames"              "functional_enrichment"
#>  [7] "get_anno"              "get_anno_col"          "get_classes"          
#> [10] "get_matrix"            "get_membership"        "get_stats"            
#> [13] "is_best_k"             "is_stable_k"           "ncol"                 
#> [16] "nrow"                  "rownames"              "show"                 
#> [19] "suggest_best_k"        "test_to_known_factors" "top_rows_heatmap"     
#> [22] "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", "MAD")], c("hclust", "kmeans")]
golub_cola["SD", "kmeans"] # a ConsensusPartition object
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 4116 rows and 72 columns.
#>   Top rows (328) are extracted by 'SD' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 250 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"        
#>  [3] "collect_plots"           "collect_stats"          
#>  [5] "colnames"                "compare_partitions"     
#>  [7] "compare_signatures"      "consensus_heatmap"      
#>  [9] "dimension_reduction"     "functional_enrichment"  
#> [11] "get_anno"                "get_anno_col"           
#> [13] "get_classes"             "get_consensus"          
#> [15] "get_matrix"              "get_membership"         
#> [17] "get_param"               "get_signatures"         
#> [19] "get_stats"               "is_best_k"              
#> [21] "is_stable_k"             "membership_heatmap"     
#> [23] "ncol"                    "nrow"                   
#> [25] "plot_ecdf"               "predict_classes"        
#> [27] "rownames"                "select_partition_number"
#> [29] "show"                    "suggest_best_k"         
#> [31] "test_to_known_factors"   "top_rows_heatmap"       
golub_cola["SD:kmeans"] # a ConsensusPartition object
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 4116 rows and 72 columns.
#>   Top rows (328) are extracted by 'SD' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 250 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"        
#>  [3] "collect_plots"           "collect_stats"          
#>  [5] "colnames"                "compare_partitions"     
#>  [7] "compare_signatures"      "consensus_heatmap"      
#>  [9] "dimension_reduction"     "functional_enrichment"  
#> [11] "get_anno"                "get_anno_col"           
#> [13] "get_classes"             "get_consensus"          
#> [15] "get_matrix"              "get_membership"         
#> [17] "get_param"               "get_signatures"         
#> [19] "get_stats"               "is_best_k"              
#> [21] "is_stable_k"             "membership_heatmap"     
#> [23] "ncol"                    "nrow"                   
#> [25] "plot_ecdf"               "predict_classes"        
#> [27] "rownames"                "select_partition_number"
#> [29] "show"                    "suggest_best_k"         
#> [31] "test_to_known_factors"   "top_rows_heatmap"       
golub_cola[["SD:kmeans"]] # a ConsensusPartition object
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6.
#>   On a matrix with 4116 rows and 72 columns.
#>   Top rows (328) are extracted by 'SD' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 250 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"        
#>  [3] "collect_plots"           "collect_stats"          
#>  [5] "colnames"                "compare_partitions"     
#>  [7] "compare_signatures"      "consensus_heatmap"      
#>  [9] "dimension_reduction"     "functional_enrichment"  
#> [11] "get_anno"                "get_anno_col"           
#> [13] "get_classes"             "get_consensus"          
#> [15] "get_matrix"              "get_membership"         
#> [17] "get_param"               "get_signatures"         
#> [19] "get_stats"               "is_best_k"              
#> [21] "is_stable_k"             "membership_heatmap"     
#> [23] "ncol"                    "nrow"                   
#> [25] "plot_ecdf"               "predict_classes"        
#> [27] "rownames"                "select_partition_number"
#> [29] "show"                    "suggest_best_k"         
#> [31] "test_to_known_factors"   "top_rows_heatmap"       
golub_cola["SD", "kmeans", drop = FALSE] # still a ConsensusPartitionList object
#> A 'ConsensusPartitionList' object with 1 methods.
#>   On a matrix with 4116 rows and 72 columns.
#>   Top rows are extracted by 'SD' methods.
#>   Subgroups are detected by 'kmeans' method.
#>   Number of partitions are tried for k = 2, 3, 4, 5, 6.
#>   Performed in total 250 partitions by row resampling.
#> 
#> Following methods can be applied to this 'ConsensusPartitionList' object:
#>  [1] "cola_report"           "collect_classes"       "collect_plots"        
#>  [4] "collect_stats"         "colnames"              "functional_enrichment"
#>  [7] "get_anno"              "get_anno_col"          "get_classes"          
#> [10] "get_matrix"            "get_membership"        "get_stats"            
#> [13] "is_best_k"             "is_stable_k"           "ncol"                 
#> [16] "nrow"                  "rownames"              "show"                 
#> [19] "suggest_best_k"        "test_to_known_factors" "top_rows_heatmap"     
#> [22] "top_rows_overlap"     
#> 
#> You can get result for a single method by, e.g. object["SD", "kmeans"] or object["SD:kmeans"]
golub_cola["SD:kmeans", drop = FALSE] # still a ConsensusPartitionList object
#> A 'ConsensusPartitionList' object with 1 methods.
#>   On a matrix with 4116 rows and 72 columns.
#>   Top rows are extracted by 'SD' methods.
#>   Subgroups are detected by 'kmeans' method.
#>   Number of partitions are tried for k = 2, 3, 4, 5, 6.
#>   Performed in total 250 partitions by row resampling.
#> 
#> Following methods can be applied to this 'ConsensusPartitionList' object:
#>  [1] "cola_report"           "collect_classes"       "collect_plots"        
#>  [4] "collect_stats"         "colnames"              "functional_enrichment"
#>  [7] "get_anno"              "get_anno_col"          "get_classes"          
#> [10] "get_matrix"            "get_membership"        "get_stats"            
#> [13] "is_best_k"             "is_stable_k"           "ncol"                 
#> [16] "nrow"                  "rownames"              "show"                 
#> [19] "suggest_best_k"        "test_to_known_factors" "top_rows_heatmap"     
#> [22] "top_rows_overlap"     
#> 
#> You can get result for a single method by, e.g. object["SD", "kmeans"] or object["SD:kmeans"]
golub_cola["SD", ]
#> A 'ConsensusPartitionList' object with 5 methods.
#>   On a matrix with 4116 rows and 72 columns.
#>   Top rows are extracted by 'SD' methods.
#>   Subgroups are detected by 'hclust, kmeans, skmeans, pam, mclust' method.
#>   Number of partitions are tried for k = 2, 3, 4, 5, 6.
#>   Performed in total 1250 partitions by row resampling.
#> 
#> Following methods can be applied to this 'ConsensusPartitionList' object:
#>  [1] "cola_report"           "collect_classes"       "collect_plots"        
#>  [4] "collect_stats"         "colnames"              "functional_enrichment"
#>  [7] "get_anno"              "get_anno_col"          "get_classes"          
#> [10] "get_matrix"            "get_membership"        "get_stats"            
#> [13] "is_best_k"             "is_stable_k"           "ncol"                 
#> [16] "nrow"                  "rownames"              "show"                 
#> [19] "suggest_best_k"        "test_to_known_factors" "top_rows_heatmap"     
#> [22] "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["SD"], c("hclust", "kmeans")]
golub_cola[, "hclust"]
#> A 'ConsensusPartitionList' object with 4 methods.
#>   On a matrix with 4116 rows and 72 columns.
#>   Top rows are extracted by 'SD, CV, MAD, ATC' methods.
#>   Subgroups are detected by 'hclust' method.
#>   Number of partitions are tried for k = 2, 3, 4, 5, 6.
#>   Performed in total 1000 partitions by row resampling.
#> 
#> Following methods can be applied to this 'ConsensusPartitionList' object:
#>  [1] "cola_report"           "collect_classes"       "collect_plots"        
#>  [4] "collect_stats"         "colnames"              "functional_enrichment"
#>  [7] "get_anno"              "get_anno_col"          "get_classes"          
#> [10] "get_matrix"            "get_membership"        "get_stats"            
#> [13] "is_best_k"             "is_stable_k"           "ncol"                 
#> [16] "nrow"                  "rownames"              "show"                 
#> [19] "suggest_best_k"        "test_to_known_factors" "top_rows_heatmap"     
#> [22] "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")], "hclust"]
golub_cola[1:2, 1:2]
#> A 'ConsensusPartitionList' object with 4 methods.
#>   On a matrix with 4116 rows and 72 columns.
#>   Top rows are extracted by 'SD, CV' methods.
#>   Subgroups are detected by 'hclust, kmeans' method.
#>   Number of partitions are tried for k = 2, 3, 4, 5, 6.
#>   Performed in total 1000 partitions by row resampling.
#> 
#> Following methods can be applied to this 'ConsensusPartitionList' object:
#>  [1] "cola_report"           "collect_classes"       "collect_plots"        
#>  [4] "collect_stats"         "colnames"              "functional_enrichment"
#>  [7] "get_anno"              "get_anno_col"          "get_classes"          
#> [10] "get_matrix"            "get_membership"        "get_stats"            
#> [13] "is_best_k"             "is_stable_k"           "ncol"                 
#> [16] "nrow"                  "rownames"              "show"                 
#> [19] "suggest_best_k"        "test_to_known_factors" "top_rows_heatmap"     
#> [22] "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")]