consensus_partition {cola} | R Documentation

## Consensus partition

### Description

Consensus partition

### Usage

    consensus_partition(data,
        top_value_method = "ATC",
        top_n = seq(min(1000, round(nrow(data)*0.1)),
        min(5000, round(nrow(data)*0.5)),
        length.out = 5),
        partition_method = "skmeans",
        max_k = 6,
        sample_by = "row",
        p_sampling = 0.8,
        partition_repeat = 50,
        partition_param = list(),
        anno = NULL,
        anno_col = NULL,
        scale_rows = NULL,
        verbose = TRUE,
        mc.cores = 1,
        .env = NULL)

### Arguments

`data` | A numeric matrix where subgroups are found by columns.
`top_value_method` | A single top-value method. Available methods are in `all_top_value_methods`. Use `register_top_value_methods` to add a new top-value method.
`top_n` | Number of rows with top values. The value can be a vector with length > 1. When n > 5000, the function only randomly sample 5000 rows from top n rows. If `top_n` is a vector, paritition will be applied to every values in `top_n` and consensus partition is summarized from all partitions.
`partition_method` | A single partition method. Available methods are in `all_partition_methods`. Use `register_partition_methods` to add a new partition method.
`max_k` | Maximal number of partitions to try. The function will try `2:max_k` partitions.
`sample_by` | Should randomly sample the matrix by rows or by columns?
`p_sampling` | Proportion of the submatrix which contains the top n rows to sample.
`partition_repeat` | Number of repeats for the random sampling.
`partition_param` | Parameters for the partition method which are passed to `...` in a registered partition method. See `register_partition_methods` for detail.
`anno` | A data frame with known annotation of samples. The annotations will be plotted in heatmaps and the correlation to predicted subgroups will be tested.
`anno_col` | A list of colors (color is defined as a named vector) for the annotations. If `anno` is a data frame, `anno_col` should be a named list where names correspond to the column names in `anno`.
`scale_rows` | Whether to scale rows. If it is `TRUE`, scaling method defined in `register_partition_methods` is used.
`verbose` | Whether print messages.
`mc.cores` | Multiple cores to use.
`.env` | An environment, internally used.

### Details

The function performs analysis in following steps:

- calculate scores for rows by top-value method,

- for each top_n value, take top n rows,

- randomly sample `p_sampling` rows from the top_n-row matrix and perform partitioning for `partition_repeats` times,

- collect partitions from all partitions and calculate consensus partitions.

### Value

A `ConsensusPartition-class` object. Simply type object in the interactive R session to see which functions can be applied on it.

### Author(s)

Zuguang Gu <z.gu@dkfz.de>

### See Also

`run_all_consensus_partition_methods` runs consensus partition with multiple top-value methods and multiple partition methods. `hierarchical_partition` runs consensus partition hierarchically.

### Examples

    set.seed(123)
    m = cbind(rbind(matrix(rnorm(20*20, mean = 1,   sd = 0.5), nr = 20),
                    matrix(rnorm(20*20, mean = 0,   sd = 0.5), nr = 20),
                    matrix(rnorm(20*20, mean = 0,   sd = 0.5), nr = 20)),
              rbind(matrix(rnorm(20*20, mean = 0,   sd = 0.5), nr = 20),
                    matrix(rnorm(20*20, mean = 1,   sd = 0.5), nr = 20),
                    matrix(rnorm(20*20, mean = 0,   sd = 0.5), nr = 20)),
              rbind(matrix(rnorm(20*20, mean = 0.5, sd = 0.5), nr = 20),
                    matrix(rnorm(20*20, mean = 0.5, sd = 0.5), nr = 20),
                    matrix(rnorm(20*20, mean = 1,   sd = 0.5), nr = 20))
             ) + matrix(rnorm(60*60, sd = 0.5), nr = 60)
    cp = consensus_partition(m, partition_repeat = 10, top_n = c(10, 20, 50))
    cp

[Package cola version 1.0.1 Index]