<!--
%\VignetteEngine{knitr}
%\VignetteIndexEntry{1. A Quick Start of Using cola Package}
-->

A Quick Start of Using cola Package
=============================================================

**Author**: Zuguang Gu ( z.gu@dkfz.de )

**Date**: `r Sys.Date()`

**Package version**: `r installed.packages()["cola", "Version"]`

-------------------------------------------------------------

```{r, echo = FALSE, message = FALSE}
library(markdown)

library(knitr)
knitr::opts_chunk$set(
    error = FALSE,
    tidy  = FALSE,
    message = FALSE,
    fig.align = "center")

options(width = 100)
library(cola)
```

Assume your matrix is stored in an object called `mat`, to perform consensus partitioning,
you only need to run following code:

```{r, eval = FALSE}
# code only for demonstration
mat = adjust_matrix(mat)  # optional
rl = run_all_consensus_partition_methods(mat, mc.cores = ...)
cola_report(rl, output_dir = ..., mc.cores = ...)
```

In above code, there are three steps:

1. Adjust the matrix. In this step, rows with too many `NA`s are removed. Rows with very low variance
are removed. `NA` values are imputed if there are not too many in each row. Outliers are adjusted in each
row. This step is optional.
2. Run consensus partitioning with multiple methods. The default partition methods are `hclust`,
`kmeans`, `skmeans::skmeans`, `cluster::pam` and `Mclust::mclust`. The default methods to
extract top n rows are `sd`, `cv`, `MAD` and `ATC`.
3. Generate a detailed HTML report for the complete analysis.


To perform hierarchical partitioning, run following code:

```{r, eval = FALSE}
# code only for demonstration
rh = hierarchical_partition(mat, mc.cores = ...)
cola_report(rh, output_dir = ..., mc.cores = ...)
```

For the hierarchical partition, you can only select one partition method and one top-value method.
The default partition method is `kmeans` and the default top-value method is `MAD`.

There are examples on real datasets for cola analysis that can be found at https://jokergoo.github.io/cola_examples/.
