# Predict cancer subtypes using NCC or machine learning methods based on TCGA data

#### Dadong Zhang

#### 2024-03-22

# OncoSubtype

Provide functionality for cancer subtyping using existing published methods or machine learning based on TCGA data.

Currently support mRNA subtyping for LUSC, LUAD, HNSC, STAD, and BLCA using nearest centroids method or machine-learning-based method by training TCGA data.

## Installation

You can install the latest released version by

    install.packages("OncoSubtype")

## Example

This is a basic example for predicting the subtypes for LUSC.

### Predict (Lung Squamous Cell Carcinoma) LUSC mRNA Expression Subtypes using wilkerson method

    library(OncoSubtype)
    library(tidyverse)
    set.seed(2121)
    data <- get_median_centered(example_fpkm)
    data <- assays(data)$centered
    rownames(data) <- rowData(example_fpkm)$external_gene_name
    # use default wilkerson's nearest centroids method
    output1 <- centroids_subtype(data, disease = 'LUSC')
    table(output1$subtypes)

### Using random forest model by training TCGA LUSC data

    output2 <- ml_subtype(data, disease = 'LUSC', method = 'rf')
    table(output1$subtypes)
    confusionMatrix(output1, output2)

### Check the consistance between two methods

    confusionMatrix(output1, output2)

### Plotheat map

    PlotHeat(object = output2, set = 'both', fontsize = 10,
              show_rownames = FALSE, show_colnames = FALSE)